Apache Ignite C++
Classes | Enumerations
ignite::transactions Namespace Reference

Ignite Transaction API. More...

Classes

class  Transaction
 Ignite cache transaction. More...
 
class  TransactionMetrics
 Transaction metrics, shared across all caches. More...
 
class  Transactions
 Transactions facade. More...
 

Enumerations

enum  TransactionConcurrency { IGNITE_TX_CONCURRENCY_OPTIMISTIC = 0, IGNITE_TX_CONCURRENCY_PESSIMISTIC = 1 }
 Transaction concurrency control model. More...
 
enum  TransactionIsolation { IGNITE_TX_ISOLATION_READ_COMMITTED = 0, IGNITE_TX_ISOLATION_REPEATABLE_READ = 1, IGNITE_TX_ISOLATION_SERIALIZABLE = 2 }
 Defines different cache transaction isolation levels. More...
 
enum  TransactionState {
  IGNITE_TX_STATE_ACTIVE, IGNITE_TX_STATE_PREPARING, IGNITE_TX_STATE_PREPARED, IGNITE_TX_STATE_MARKED_ROLLBACK,
  IGNITE_TX_STATE_COMMITTING, IGNITE_TX_STATE_COMMITTED, IGNITE_TX_STATE_ROLLING_BACK, IGNITE_TX_STATE_ROLLED_BACK,
  IGNITE_TX_STATE_UNKNOWN
}
 Cache transaction state. More...
 

Detailed Description

Ignite Transaction API.

Enumeration Type Documentation

Transaction concurrency control model.

Enumerator
IGNITE_TX_CONCURRENCY_OPTIMISTIC 

Optimistic concurrency model.

In this mode all cache operations are not distributed to other nodes until Transaction::Commit() is called. In this mode one 'PREPARE' message will be sent to participating cache nodes to start acquiring per-transaction locks, and once all nodes reply 'OK', a one-way 'COMMIT' message is sent without waiting for reply.

Note that in this mode, optimistic failures are only possible in conjunction with IGNITE_TX_ISOLATION_SERIALIZABLE isolation level. In all other cases, optimistic transactions will never fail optimistically and will always be identically ordered on all participating grid nodes.

IGNITE_TX_CONCURRENCY_PESSIMISTIC 

Pessimistic concurrency model.

In this mode a lock is acquired on all cache operations with exception of read operations in IGNITE_TX_ISOLATION_READ_COMMITTED mode. All optional filters passed into cache operations will be evaluated after successful lock acquisition. Whenever Transaction::Commit() is called, a single one-way 'COMMIT' message is sent to participating cache nodes without waiting for reply. Note that there is no reason for distributed 'PREPARE' step, as all locks have been already acquired.

Defines different cache transaction isolation levels.

Enumerator
IGNITE_TX_ISOLATION_READ_COMMITTED 

Read committed isolation level.

This isolation level means that always a committed value will be provided for read operations. With this isolation level values are always read from cache global memory or persistent store every time a value is accessed. In other words, if the same key is accessed more than once within the same transaction, it may have different value every time since global cache memory may be updated concurrently by other threads.

IGNITE_TX_ISOLATION_REPEATABLE_READ 

Repeatable read isolation level.

This isolation level means that if a value was read once within transaction, then all consecutive reads will provide the same in-transaction value. With this isolation level accessed values are stored within in-transaction memory, so consecutive access to the same key within the same transaction will always return the value that was previously read or updated within this transaction. If concurrency is IGNITE_TX_CONCURRENCY_PESSIMISTIC, then a lock on the key will be acquired prior to accessing the value.

IGNITE_TX_ISOLATION_SERIALIZABLE 

Serializable isolation level.

This isolation level means that all transactions occur in a completely isolated fashion, as if all transactions in the system had executed serially, one after the other. Read access with this level happens the same way as with IGNITE_TX_ISOLATION_REPEATABLE_READ level. However, in IGNITE_TX_CONCURRENCY_OPTIMISTIC mode, if some transactions cannot be serially isolated from each other, then one winner will be picked and the other transactions in conflict will result in IgniteError being thrown.

Cache transaction state.

Enumerator
IGNITE_TX_STATE_ACTIVE 

Transaction started.

IGNITE_TX_STATE_PREPARING 

Transaction validating.

IGNITE_TX_STATE_PREPARED 

Transaction validation succeeded.

IGNITE_TX_STATE_MARKED_ROLLBACK 

Transaction is marked for rollback.

IGNITE_TX_STATE_COMMITTING 

Transaction commit started (validating finished).

IGNITE_TX_STATE_COMMITTED 

Transaction commit succeeded.

IGNITE_TX_STATE_ROLLING_BACK 

Transaction rollback started (validation failed).

IGNITE_TX_STATE_ROLLED_BACK 

Transaction rollback succeeded.

IGNITE_TX_STATE_UNKNOWN 

Transaction rollback failed or is otherwise unknown state.