Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Below is the list of components that are required for CC execution. Each component contains a minimal set of required methods. This section may serve as a hint for implementros.

MVStore

Implements methods for accessing multi-version data under txn context. One per data table partition. Contains all primary and secondary indexes.

Code Block
languagejava
// PutsInserts a row. and Thisadds callit updatesin primarythe andindexes. allReturns secondarya indexesrowId afterfor acquiringthe necessaryinserted locksrow.
CompletableFuture<Void>CompletableFuture<RowId> put(Tuple row, UUID txId); 

// RemovesUpdates a row and related index entries. This call updates primary and all secondary indexes after acquiring necessary locks Returns a previous value.
CompletableFuture<Tuple> update(RowId rowId, Tuple newVal, UUID txId);

// Removes a row and related index entries. Returns a removed row.
CompletableFuture<Tuple> remove(TupleRowId keyTuplerowId, UUID txId);

// ExecutesGet thea querytuple inby RW moderowId.
AsyncCursor<Tuple>CompletableFuture<Tuple> queryget(@NullableRowId Query queryrowId, UUID txId);

// Executes the query in RORW mode.
Cursor<Tuple>AsyncCursor<RowId> query(@Nullable Query query, TimestampUUID readTstxId);

// Invokes a closure over Executes the setquery ofin records matching the filter. Returns a number of modified rows.
CompletableFuture<Long> invoke(InvokeClosure closure, @Nullable Filter filter, UUID txIdRO mode.
Cursor<Tuple> query(@Nullable Query query, Timestamp readTs);

// Commits a transaction with a timestamp.
CompletableFuture<Boolean> commit(UUID txId, Timestamp commitTs);

// Aborts a transaction
CompletableFuture<Boolean> abort(UUID txId);

...

The proposed operations should support batches.

...

LockTable

Used to manage locks (easily guessed). It has a volatile state, which is lost on restart. One per table/index. Used by MVStore to acquire/release locks as required by CC protocol.

LockManager LockTable provides the following operations:

  • Lock getOrAddEntry(Object key) // Allocates a new lock entry for a given key
  • void remove
  • CompletableFutute<LockDesc> acquire(UUID txId, byte[] lockName, LockMode mode); // Acquires (or upgrades) a lock and returns a future with a lock description
  • void release(Lock lock); // Release previously acquired lockAttempts to remove lock resources

Lock provides the following operations:

  • Locker acquire(UUID lockerId, LockMode mode) // Lock or upgrade existing lock in/to a mode
  • LockMode downgrade(UUID lockerIdvoid downgrade(Lock lock, LockMode mode) ; // Downgrades Downgrade a lock to a mode
  • void releaseIterator<Lock> locks(UUID txIdid); // Return all locks acquired by a transaction.Release the acquired lock

TxnStateManager

Holds a transaction state. Currently two states are supported: COMMITTED and ABORTED. One per data node. Used by MVStore to resolve write intents and for txn recovery purposes.

...