| Modifier and Type | Class and Description |
|---|---|
| public static class | TransactionStore.
A change in a map. |
| public static interface | TransactionStore.
This listener can be registered with the transaction to be notified of every compensating change during transaction rollback. |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final AtomicReference | committingTransactions
This is intended to be the source of ultimate truth about transaction being committed. |
| private final DataType | |
| private boolean | |
| private static final int | |
| private static final long | |
| private static final int | MAX_OPEN_TRANSACTIONS
Hard limit on the number of concurrently opened transactions |
| private int | maxTransactionId
Soft limit on the number of concurrently opened transactions. |
| pack-priv final AtomicReference | openTransactions
This BitSet is used as vacancy indicator for transaction slots in transactions[]. |
| private final MVMap | preparedTransactions
The persisted map of prepared transactions. |
| private static final TransactionStore. | |
| pack-priv final MVStore | store
The store. |
| pack-priv final int | timeoutMillis
Default blocked transaction timeout |
| private final AtomicReferenceArray | transactions
Array holding all open transaction objects. |
| private static final String | |
| private final MVMap | |
| private static final char | |
| public static final String | UNDO_LOG_NAME_PREFIX
The prefix for undo log entries. |
| private static final char | |
| private final MVMap. | |
| pack-priv final MVMap | undoLogs
Undo logs. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | TransactionStore(MVStore
the store store, MetaType<?> the data type for type registry map values metaDataType, DataType<?> default data type for map keys and values dataType, int lock acquisition timeout in milliseconds, 0 means no wait timeoutMillis)Create a new transaction store. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv long | Returns: key for the added recordid of the transaction transactionId, long sequential number of the log record within transaction logId, Record<?, ?> Record(mapId, key, previousValue) to add record)Add an undo log entry. |
| public Transaction | |
| public Transaction | Returns: the transactionto be notified in case of a rollback listener,to wait for a blocking transaction timeoutMillis, int of the owner (Session?) to be reported by getBlockerId ownerId, IsolationLevel of new transaction isolationLevel)Begin a new transaction. |
| pack-priv static long | Returns: the number of key-value pairsthe root references undoLogRootReferences)Calculate the size for undo log entries. |
| public synchronized void | |
| pack-priv RootReference | Returns: the array of root references or null if snapshotting is not possibleGet the root references (snapshots) for undo-log maps. |
| pack-priv void | commit(Transaction
transaction to commit t, boolean if called during initial transaction recovery procedure
therefore undo log is stored under "committed" name already recovery)Commit a transaction. |
| pack-priv MVMap. | |
| public void | endLeftoverTransactions()
Commit all transactions that are in the committed state, and rollback all open transactions. |
| pack-priv void | endTransaction(Transaction
the transaction t, boolean true if transaction has done any updates
(even if they are fully rolled back),
false if it just performed a data access hasChanges)End this transaction. |
| private void | |
| pack-priv Iterator | Returns: the changesthe transaction t, final long the maximum log id maxLogId, final long the minimum log id toLogId)Get the changes of the given transaction, starting from the latest log id back to the given log id. |
| pack-priv static long | Returns: the log idthe operation id operationId)Get the log id for the given operation id. |
| pack-priv <K, V> MVMap | |
| pack-priv int | |
| public List | Returns: the list of transactions (sorted by id)Get the list of unclosed transactions that have pending writes. |
| pack-priv static long | Returns: the operation idthe transaction id transactionId, long the log id logId)Combine the transaction id and the log id to an operation id. |
| pack-priv Transaction | Returns: Transaction object.id for an open transaction transactionId)Get Transaction object for a transaction id. |
| pack-priv static int | Returns: the transaction idthe operation id operationId)Get the transaction id for the given operation id. |
| private static String | Returns: undo log nameof the corresponding transaction transactionId)Generate a string used to name undo log map for a specific transaction. |
| public boolean | |
| public void | |
| public void | init(TransactionStore.
to notify about transaction rollback listenerInitialize the store. |
| private boolean | |
| private void | |
| public < the key type K, the value type V> MVMap | |
| pack-priv < key type K, value type V> MVMap | |
| private static MVMap | |
| pack-priv <K, V> MVMap | |
| private Transaction | registerTransaction(int txId, int status, String name, long logId, int timeoutMillis, int ownerId, IsolationLevel isolationLevel, TransactionStore.
|
| pack-priv void | |
| pack-priv void | |
| pack-priv void | rollbackTo(Transaction
the transaction t, long the last log id maxLogId, long the log id to roll back to toLogId)Rollback to an old savepoint. |
| public void | setMaxTransactionId(int
the maximum id max)Set the maximum transaction id, after which ids are re-used. |
| pack-priv void |
| committingTransactions | back to summary |
|---|---|
| pack-priv final AtomicReference<BitSet> committingTransactions This is intended to be the source of ultimate truth about transaction being committed. Once bit is set, corresponding transaction is logically committed, although it might be plenty of "uncommitted" entries in various maps and undo record are still around. Nevertheless, all of those should be considered by other transactions as committed. | |
| dataType | back to summary |
|---|---|
| private final DataType<?> dataType | |
| init | back to summary |
|---|---|
| private boolean init | |
| LOG_ID_BITS | back to summary |
|---|---|
| private static final int LOG_ID_BITS | |
| LOG_ID_MASK | back to summary |
|---|---|
| private static final long LOG_ID_MASK | |
| MAX_OPEN_TRANSACTIONS | back to summary |
|---|---|
| private static final int MAX_OPEN_TRANSACTIONS Hard limit on the number of concurrently opened transactions | |
| maxTransactionId | back to summary |
|---|---|
| private int maxTransactionId Soft limit on the number of concurrently opened transactions. Not really needed but used by some test. | |
| openTransactions | back to summary |
|---|---|
| pack-priv final AtomicReference<VersionedBitSet> openTransactions This BitSet is used as vacancy indicator for transaction slots in transactions[]. It provides easy way to find first unoccupied slot, and also allows for copy-on-write non-blocking updates. | |
| preparedTransactions | back to summary |
|---|---|
| private final MVMap<Integer, Object[]> preparedTransactions The persisted map of prepared transactions. Key: transactionId, value: [ status, name ]. | |
| ROLLBACK_LISTENER_NONE | back to summary |
|---|---|
| private static final TransactionStore. | |
| store | back to summary |
|---|---|
| pack-priv final MVStore store The store. | |
| timeoutMillis | back to summary |
|---|---|
| pack-priv final int timeoutMillis Default blocked transaction timeout | |
| transactions | back to summary |
|---|---|
| private final AtomicReferenceArray<Transaction> transactions Array holding all open transaction objects. Position in array is "transaction id". VolatileReferenceArray would do the job here, but there is no such thing in Java yet | |
| TYPE_REGISTRY_NAME | back to summary |
|---|---|
| private static final String TYPE_REGISTRY_NAME | |
| typeRegistry | back to summary |
|---|---|
| private final MVMap<String, DataType<?>> typeRegistry | |
| UNDO_LOG_COMMITTED | back to summary |
|---|---|
| private static final char UNDO_LOG_COMMITTED | |
| UNDO_LOG_NAME_PREFIX | back to summary |
|---|---|
| public static final String UNDO_LOG_NAME_PREFIX The prefix for undo log entries. | |
| UNDO_LOG_OPEN | back to summary |
|---|---|
| private static final char UNDO_LOG_OPEN | |
| undoLogBuilder | back to summary |
|---|---|
| private final MVMap. | |
| undoLogs | back to summary |
|---|---|
| pack-priv final MVMap<Long, Record<?, ?>>[] undoLogs Undo logs. If the first entry for a transaction doesn't have a logId of 0, then the transaction is partially committed (which means rollback is not possible). Log entries are written before the data is changed (write-ahead). Key: opId, value: [ mapId, key, oldValue ].
| |
| TransactionStore | back to summary |
|---|---|
| public TransactionStore(MVStore store) Create a new transaction store.
| |
| TransactionStore | back to summary |
|---|---|
| public TransactionStore(MVStore store, DataType<?> dataType) | |
| TransactionStore | back to summary |
|---|---|
| public TransactionStore(MVStore store, MetaType<?> metaDataType, DataType<?> dataType, int timeoutMillis) Create a new transaction store. | |
| addUndoLogRecord | back to summary |
|---|---|
| pack-priv long addUndoLogRecord(int transactionId, long logId, Record<?, ?> record) Add an undo log entry.
| |
| begin | back to summary |
|---|---|
| public Transaction begin() Begin a new transaction.
| |
| begin | back to summary |
|---|---|
| public Transaction begin(TransactionStore. Begin a new transaction.
| |
| calculateUndoLogsTotalSize | back to summary |
|---|---|
| pack-priv static long calculateUndoLogsTotalSize(RootReference<Long, Record<?, ?>>[] undoLogRootReferences) Calculate the size for undo log entries.
| |
| close | back to summary |
|---|---|
| public synchronized void close() Close the transaction store. | |
| collectUndoLogRootReferences | back to summary |
|---|---|
| pack-priv RootReference Get the root references (snapshots) for undo-log maps. Those snapshots can potentially be used to optimize TransactionMap.size().
| |
| commit | back to summary |
|---|---|
| pack-priv void commit(Transaction t, boolean recovery) Commit a transaction.
| |
| createUndoLogBuilder | back to summary |
|---|---|
pack-priv MVMap.
| |
| endLeftoverTransactions | back to summary |
|---|---|
| public void endLeftoverTransactions() Commit all transactions that are in the committed state, and rollback all open transactions. | |
| endTransaction | back to summary |
|---|---|
| pack-priv void endTransaction(Transaction t, boolean hasChanges) End this transaction. Change status to CLOSED and vacate transaction slot. Will try to commit MVStore if autocommitDelay is 0 or if database is idle and amount of unsaved changes is sizable.
| |
| flipCommittingTransactionsBit | back to summary |
|---|---|
| private void flipCommittingTransactionsBit(int transactionId, boolean flag) | |
| getChanges | back to summary |
|---|---|
| pack-priv Iterator Get the changes of the given transaction, starting from the latest log id back to the given log id.
| |
| getLogId | back to summary |
|---|---|
| pack-priv static long getLogId(long operationId) Get the log id for the given operation id.
| |
| getMap | back to summary |
|---|---|
| pack-priv <K, V> MVMap | |
| getMaxTransactionId | back to summary |
|---|---|
| pack-priv int getMaxTransactionId() | |
| getOpenTransactions | back to summary |
|---|---|
| public List Get the list of unclosed transactions that have pending writes.
| |
| getOperationId | back to summary |
|---|---|
| pack-priv static long getOperationId(int transactionId, long logId) Combine the transaction id and the log id to an operation id.
| |
| getTransaction | back to summary |
|---|---|
| pack-priv Transaction getTransaction(int transactionId) Get Transaction object for a transaction id.
| |
| getTransactionId | back to summary |
|---|---|
| pack-priv static int getTransactionId(long operationId) Get the transaction id for the given operation id.
| |
| getUndoLogName | back to summary |
|---|---|
| private static String getUndoLogName(int transactionId) Generate a string used to name undo log map for a specific transaction. This name will contain transaction id.
| |
| hasMap | back to summary |
|---|---|
| public boolean hasMap(String name) Check whether a given map exists.
| |
| init | back to summary |
|---|---|
| public void init() Initialize the store without any RollbackListener.
| |
| init | back to summary |
|---|---|
| public void init(TransactionStore. Initialize the store. This is needed before a transaction can be opened. If the transaction store is corrupt, this method can throw an exception, in which case the store can only be used for reading.
| |
| isUndoEmpty | back to summary |
|---|---|
| private boolean isUndoEmpty() | |
| markUndoLogAsCommitted | back to summary |
|---|---|
| private void markUndoLogAsCommitted(int transactionId) | |
| openMap | back to summary |
|---|---|
| public <K, V> MVMap Open the map with the given name. | |
| openMap | back to summary |
|---|---|
| pack-priv <K, V> MVMap Open the map with the given id.
| |
| openTypeRegistry | back to summary |
|---|---|
| private static MVMap | |
| openVersionedMap | back to summary |
|---|---|
| pack-priv <K, V> MVMap | |
| registerTransaction | back to summary |
|---|---|
| private Transaction registerTransaction(int txId, int status, String name, long logId, int timeoutMillis, int ownerId, IsolationLevel isolationLevel, TransactionStore. | |
| removeMap | back to summary |
|---|---|
| pack-priv void removeMap(TransactionMap<?, ?> map) Remove the given map.
| |
| removeUndoLogRecord | back to summary |
|---|---|
| pack-priv void removeUndoLogRecord(int transactionId) Remove an undo log entry.
| |
| rollbackTo | back to summary |
|---|---|
| pack-priv void rollbackTo(Transaction t, long maxLogId, long toLogId) Rollback to an old savepoint.
| |
| setMaxTransactionId | back to summary |
|---|---|
| public void setMaxTransactionId(int max) Set the maximum transaction id, after which ids are re-used. If the old transaction is still in use when re-using an old id, the new transaction fails.
| |
| storeTransaction | back to summary |
|---|---|
| pack-priv void storeTransaction(Transaction t) Store a transaction.
| |
| Modifier and Type | Field and Description |
|---|---|
| public final Object | key
The key. |
| public final String | mapName
The name of the map where the change occurred. |
| public final Object | value
The value. |
| Access | Constructor and Description |
|---|---|
| public |
| key | back to summary |
|---|---|
| public final Object key The key. | |
| mapName | back to summary |
|---|---|
| public final String mapName The name of the map where the change occurred. | |
| value | back to summary |
|---|---|
| public final Object value The value. | |
| Change | back to summary |
|---|---|
| public Change(String mapName, Object key, Object value) | |
| Modifier and Type | Method and Description |
|---|---|
| public void | onRollback(MVMap<Object, VersionedValue<Object>>
modified map, Object of the modified entry key, VersionedValue<Object> value in the map (null if delete is rolled back) existingValue, VersionedValue<Object> value to be restored (null if add is rolled back) restoredValue)Notified of a single map change (add/update/remove) |
| onRollback | back to summary |
|---|---|
| public void onRollback(MVMap<Object, VersionedValue<Object>> map, Object key, VersionedValue<Object> existingValue, VersionedValue<Object> restoredValue) Notified of a single map change (add/update/remove)
| |
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final DataType | |
| private final MVMap |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public MVMap | create(MVStore
which will own this map store, Map<String, Object> configuration config)Overrides org. Implements org. Create a new map of the given type. |
| protected MVMap | create(Map<String, Object>
config map config)Overrides org. Create map from config. |
| pack-priv static String | |
| private void |
| defaultDataType | back to summary |
|---|---|
| private final DataType<T> defaultDataType | |
| typeRegistry | back to summary |
|---|---|
| private final MVMap<String, DataType<?>> typeRegistry | |
| TxMapBuilder | back to summary |
|---|---|
| pack-priv TxMapBuilder(MVMap<String, DataType<?>> typeRegistry, DataType<?> defaultDataType) | |
| create | back to summary |
|---|---|
| public MVMap Overrides org. Implements org. Doc from org. Create a new map of the given type. | |
| create | back to summary |
|---|---|
| protected MVMap Overrides org. Doc from org. Create map from config. | |
| getDataTypeRegistrationKey | back to summary |
|---|---|
| pack-priv static String getDataTypeRegistrationKey(DataType<?> dataType) | |
| registerDataType | back to summary |
|---|---|
| private void registerDataType(DataType<?> dataType) | |
| Modifier and Type | Field and Description |
|---|---|
| private final String |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected String | asString(String
the map name (or null) name)Overrides org. Get the map metadata as a string. |
| protected MVMap | |
| public String |
| type | back to summary |
|---|---|
| private final String type | |
| TMVMap | back to summary |
|---|---|
| pack-priv TMVMap(Map<String, Object> config, DataType<K> keyType, DataType<V> valueType) | |
| TMVMap | back to summary |
|---|---|
| private TMVMap(MVMap<K, V> source) | |
| asString | back to summary |
|---|---|
| protected String asString(String name) Overrides org. Doc from org. Get the map metadata as a string. | |
| cloneIt | back to summary |
|---|---|
| protected MVMap Overrides org. Doc from org. Clone the current map. | |
| getType | back to summary |
|---|---|
| public String getType() Overrides org. Doc from org. Get the map type. When opening an existing map, the map type must match. | |