Skip to main content

Transactions

Abstract

FairCom JSON NAV includes several actions for creating, committing, undoing, and listing transactions.

This section covers how to create, commit, rollback, and list transactions. A transaction allows multiple actions to be committed or rolled back as a group. FairCom transactions fully support atomicity, durability, and isolation. Atomicity ensures changes made by actions in a transaction are committed or rolled back all-or-nothing. Durability ensures changes made by actions in a transaction are safely persisted in storage after the transaction has been committed. Isolation ensures changes made by actions inside a transaction are invisible outside it. Isolation prevents queries from seeing uncommitted changes, including inserts, updates, and deletes by other transactions.

Action

Description

"createTransaction"

This returns a "transactionId" property that you can add to other actions to put them under control of this transaction. Until you run "commitTransaction", changes made inside the transaction are invisible outside the transaction and are not durably persisted; thus, if the server fails before the transaction commits, all actions in the transaction are automatically rolled back.

"createTransactionSavePoint"

This bookmarks the current point in the transaction process. You can create multiple savepoints and use "revertTransactionToSavepoint" to undo changes made after the savepoint.

"revertTransactionToSavepoint"

This undoes a transaction's changes back to a savepoint previously created by "createTransactionSavepoint" . It keeps the transaction open so you can continue to do more actions under transaction control.

"commitTransaction"

This closes a transaction and makes its changes durable and visible to other transactions. You can include the "transactionSavepointId" property to commit changes in the transaction up to the savepoint. "commitTransaction" always closes a transaction. Once a transaction is closed, you can no longer use its "transactionId".

"rollbackTransaction"

This closes a transaction and discards all changes made under the control of the transaction. Once a transaction is closed, you can no longer use its "transactionId".

"listTransactions"

This returns a list of all active transactions that the logged-in account is authorized to see.