A transaction is an access operation in the Record Store by
another component. 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. There may be any number of
READ transactions running simultaneously. Examples of
Read operations are Integrator ETL 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 one
READ_WRITE transaction 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.
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 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:
- Once a transaction has been
committed or rolled back, additional operations that try to access the
transaction will fail.
- Once a Read operation has
ended, additional operations that try to access the read cursor will fail.
- Only one operation per
transaction can run at a time.
- If a transaction is rolled
back, then it cancels operations in progress.