User Tools

Site Tools


documentation:developer:zzz_archive:backend-devel:open-ils_storage_methods_transaction

Transaction Control

The Open-ILS Storage server supports database level transactions that are performed within one OpenSRF Session. This transaction control allows atomic updates of multiple objects to be applied simultaniously without the worry of users getting broken or incomplete data due to timing issues or errors unrelated to their own queries and transactions. In order to support truely atomic transactions the database that backs the Storage server must support tranactions, but if it does not these methods will become a no-op.

Because the Storage server needs to support different types of replication systems (Multi-master, Single-master multi-slave, XA-base distributed transactions, etc.), you should wrap all write calls, such as create, update and delete, in a transaction. This will allow the Driver to detect when it should be directing a query to the master database in a single-master replication scheme.

open-ils.storage.transaction.begin

Starts a database transaction if supported by the current Storage Driver.

  • Returns:
    • Success
      Returns 1 on success
    • Failure
      Throws an exception uppon failure

open-ils.storage.transaction.commit

Commits the current transaction to the database.

  • Returns:
    • Success
      Returns 1 on success
    • Failure
      Throws an exception uppon failure

open-ils.storage.transaction.current

Retrieves the current transaction ID. This is generally Driver dependant.

  • Returns:
    • Success
      Returns the transaction ID for the currently executing transaction
    • Failure
      Returns an empty result on failure

open-ils.storage.transaction.rollback

Rolls back the current database transaction.

  • Returns:
    • Success
      Returns 1 on success
    • Failure
      Throws an exception uppon failure

TODO

  • Add a XA/2PC/distributed transaction manager service
  • Add interface Prepared Transactions
    This will allow cross-session transaction support and non-database participation in transactions.
documentation/developer/zzz_archive/backend-devel/open-ils_storage_methods_transaction.txt · Last modified: 2022/02/10 13:34 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.