Ensuring ACID Semantics
As a relational database, TimesTen is ACID compliant.
-
Atomic: All TimesTen transactions are atomic: Either all database operations in a single transaction occur or none of them occur.
-
Consistent: Any transaction can bring the database from one consistent state to another.
-
Isolated: Transactions can be isolated. TimesTen has two isolation levels: read committed and serializable, which together with row level locking provide multi-user concurrency control.
-
Durable: Once a transaction has been committed, it remains committed.
The following sections detail how TimesTen ensures ACID semantics for transactions:
Transaction Atomicity, Consistency, and Isolation
Locking and transaction logs are used to ensure ACID semantics as a transaction modifies data in a database.
-
Locking: TimesTen acquires locks on data items that the transaction writes and, depending on the transaction isolation level, data items that the transaction reads. See Concurrency Control Through Isolation and Locking.
-
Transaction logging: All TimesTen transactions are atomic. Either all or none of the effects of the transaction are applied to the database. Modifications to the database are recorded in a transaction log. Atomicity is implemented by using the transaction log to undo the effects of a transaction if it is rolled back. Rollback can be caused explicitly by the application or during database recovery because the transaction was not committed at the time of failure. See Transaction Logging.
The following table shows how TimesTen uses locks and transaction logs:
If | Then |
---|---|
Transaction is terminated successfully (committed) |
|
Transaction is rolled back |
|
System fails (data not committed) |
|
Application fails |
|
Transaction Consistency and Durability
TimesTen provides consistency and durability with a combination of checkpointing and transaction logging.
-
A checkpoint operation writes the current in-memory database image to a checkpoint file on the file system.
-
For TimesTen Classic, a successful checkpoint operation makes all transactions that have been committed at the time of the checkpoint operation consistent and durable.
-
In TimesTen Scaleout, the data in your database is distributed across elements. Each element keeps its own checkpoint and transaction log files. As a result, the data stored in each element is independently durable.
Each data instance in a grid manages one element of a database. In the event of a failure, a data instance can automatically recover the data stored in its element from the checkpoint and transaction logs files while the remaining data instances continue to service applications. If the K-safety value is 2 or greater, then a failed element can be recovered from another element in its replica set.
-
-
All transactions are logged to an in-memory transaction log buffer, which is written to the file system either with durable or nondurable transactions. See Durability Options.
Note:
Checkpointing and logging are further described in Checkpoint Operations and Transaction Logging.