A transaction is an access operation in the Record Store by another component, such as the CAS Server API or Forge. Transactions provide a means to keep one operation isolated from another operation and allow each to operate independently.
In other words, one transaction can read while another is
writing. Each
transaction is either a
READ_WRITE
transaction or a
READ
transaction:
READ
transactions support only Read operations. A Read operation on uncommitted data is not supported. There may be any number ofREAD
transactions running simultaneously. Examples of Read operations are Forge reading a record generation for a baseline update or an administrator using the Record Store Command-line utility with the-c
flag to get the count (number of records) in a Record Store instance.READ_WRITE
transactions support both Read and Write operations. There may be only oneREAD_WRITE
transactions running at any time. An example of a Write operation is a crawler running a full crawl and writing the output to a Record Store instance. Just like in aREAD
transaction, a Read operation on uncommitted data in aREAD_WRITE
transaction is not supported.
Each transaction is assigned a transaction ID. When a transaction
begins, the Record Store service logs an INFO message with the transaction type
and ID, as in this example of Forge performing a
READ
transaction (with an ID of 2) for a baseline
update:
Started transaction 2 of type READ
An example of a Write transaction message would be the following:
Started transaction 3 of type READ_WRITE
Each transaction has a status, which is one of the following:
ACTIVE
– The transaction is currently active. For example, the transaction is in the middle of a Write operation.COMMITTED
– The transaction has successfully finished. An INFO message of “Committed transaction” is logged to indicate this status.COMMIT_FAILED
– A commit transaction failed. The only operation allowed on the transaction is a rollback.ROLLED_BACK
– The transaction has been successfully rolled back. No further operations are allowed on the transaction.
The rules for transactions are as follows: