public class MvccUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static MvccVersion |
INITIAL_VERSION
A special version visible by everyone
|
static long |
MVCC_COUNTER_NA |
static long |
MVCC_CRD_COUNTER_NA |
static long |
MVCC_CRD_START_CNTR |
static int |
MVCC_HINTS_BIT_OFF |
static int |
MVCC_HINTS_MASK
Mask for tx hints. (2 highest bits)
|
static long |
MVCC_INITIAL_CNTR |
static int |
MVCC_INVISIBLE |
static int |
MVCC_KEY_ABSENT_BEFORE_MASK
Mask for KeyAbsent flag.
|
static int |
MVCC_KEY_ABSENT_BEFORE_OFF |
static MvccSnapshot |
MVCC_MAX_SNAPSHOT
A special snapshot for which all committed versions are visible
|
static int |
MVCC_OP_COUNTER_MASK
Mask for operation counter bits.
|
static int |
MVCC_OP_COUNTER_NA |
static int |
MVCC_READ_OP_CNTR
Used as 'read' snapshot op counter.
|
static long |
MVCC_START_CNTR |
static int |
MVCC_START_OP_CNTR |
static int |
MVCC_VISIBLE |
static int |
MVCC_VISIBLE_REMOVED |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
belongToSameTx(MvccVersion v1,
MvccVersion v2) |
static GridNearTxLocal |
checkActive(GridNearTxLocal tx)
Checks transaction state.
|
static int |
compare(long mvccCrdLeft,
long mvccCntrLeft,
int mvccOpCntrLeft,
long mvccCrdRight,
long mvccCntrRight,
int mvccOpCntrRight)
Compares to pairs of coordinator/counter versions.
|
static int |
compare(long mvccCrdLeft,
long mvccCntrLeft,
int mvccOpCntrLeft,
MvccVersionAware other)
Compares to pairs of coordinator/counter versions.
|
static int |
compare(long mvccCrdLeft,
long mvccCntrLeft,
long mvccCrdRight,
long mvccCntrRight)
Compares to pairs of coordinator/counter versions.
|
static int |
compare(MvccVersionAware row,
long mvccCrdRight,
long mvccCntrRight)
Compares to pairs of MVCC versions.
|
static int |
compare(MvccVersionAware row,
MvccVersion ver)
Compares row version (xid_min) with the given version.
|
static int |
compare(MvccVersion mvccVerLeft,
long mvccCrdRight,
long mvccCntrRight)
Compares to pairs of MVCC versions.
|
static int |
compare(MvccVersion mvccVerLeft,
long mvccCrdRight,
long mvccCntrRight,
int mvccOpCntrRight)
Compares to pairs of MVCC versions.
|
static int |
compareIgnoreOpCounter(MvccVersion left,
MvccVersion right)
Compares left version (xid_min) with the given version ignoring operation counter.
|
static int |
compareNewVersion(MvccUpdateVersionAware row,
long mvccCrd,
long mvccCntr)
Compares new row version (xid_max) with the given counter and coordinator versions.
|
static int |
compareNewVersion(MvccUpdateVersionAware row,
long mvccCrd,
long mvccCntr,
int opCntr)
Compares new row version (xid_max) with the given counter and coordinator versions.
|
static int |
compareNewVersion(MvccUpdateVersionAware row,
MvccVersion ver)
Compares new row version (xid_max) with the given version.
|
static MvccVersion |
getNewVersion(GridCacheContext cctx,
long link)
Returns new version of row (xid_max) if any.
|
static int |
getVisibleState(GridCacheContext cctx,
long link,
MvccSnapshot snapshot)
Checks if a row's new version is visible for the given snapshot.
|
static boolean |
hasNewVersion(MvccUpdateVersionAware row)
Checks if a row has not empty new version (xid_max).
|
static boolean |
isActive(GridCacheContext cctx,
long mvccCrd,
long mvccCntr,
MvccSnapshot snapshot) |
static boolean |
isVisible(GridCacheContext cctx,
MvccSnapshot snapshot,
DataPageIO dataIo,
long pageAddr,
int itemId,
int pageSize) |
static boolean |
isVisible(GridCacheContext cctx,
MvccSnapshot snapshot,
long mvccCrd,
long mvccCntr,
int opCntr)
Checks if version is visible from the given snapshot.
|
static boolean |
isVisible(GridCacheContext cctx,
MvccSnapshot snapshot,
long mvccCrd,
long mvccCntr,
int opCntrWithHints,
boolean useTxLog)
Checks if version is visible from the given snapshot.
|
static boolean |
isVisible(GridCacheContext cctx,
MvccSnapshot snapshot,
long crd,
long cntr,
int opCntr,
long link)
Checks visibility of the given row versions from the given snapshot.
|
static boolean |
mvccEnabled(GridKernalContext ctx) |
static @NotNull MvccQueryTracker |
mvccTracker(GridCacheContext cctx,
boolean autoStartTx)
Initialises MVCC filter and returns MVCC query tracker if needed.
|
static @NotNull MvccQueryTracker |
mvccTracker(GridCacheContext cctx,
GridNearTxLocal tx)
Initialises MVCC filter and returns MVCC query tracker if needed.
|
static boolean |
mvccVersionIsValid(long crdVer,
long cntr) |
static boolean |
mvccVersionIsValid(long crdVer,
long cntr,
int opCntr) |
static ClusterTopologyServerNotFoundException |
noCoordinatorError() |
static MvccSnapshot |
requestSnapshot(@NotNull GridNearTxLocal tx) |
static byte |
state(CacheGroupContext grp,
long mvccCrd,
long mvccCntr,
int mvccOpCntr) |
static byte |
state(GridCacheContext cctx,
long mvccCrd,
long mvccCntr,
int mvccOpCntr) |
static byte |
state(MvccProcessor proc,
long mvccCrd,
long mvccCntr,
int mvccOpCntr) |
static void |
throwAtomicityModesMismatchException(CacheConfiguration ccfg1,
CacheConfiguration ccfg2)
Throws atomicity modes compatibility validation exception.
|
static @Nullable GridNearTxLocal |
tx(GridKernalContext ctx) |
static @Nullable GridNearTxLocal |
tx(GridKernalContext ctx,
@Nullable GridCacheVersion txId) |
static GridNearTxLocal |
txStart(GridCacheContext cctx,
long timeout) |
static GridNearTxLocal |
txStart(GridKernalContext ctx,
long timeout) |
static IgniteTxUnexpectedStateCheckedException |
unexpectedStateException(CacheGroupContext grp,
byte state,
long crd,
long cntr,
int opCntr) |
static IgniteTxUnexpectedStateCheckedException |
unexpectedStateException(GridCacheContext cctx,
byte state,
long crd,
long cntr,
int opCntr,
MvccSnapshot snapshot) |
static void |
verifyMvccOperationSupport(GridCacheContext<?,?> cctx,
String opType)
Throw an
UnsupportedOperationException if this cache is transactional and MVCC is enabled with
appropriate message about corresponding operation type. |
public static final int MVCC_KEY_ABSENT_BEFORE_OFF
public static final int MVCC_HINTS_BIT_OFF
public static final int MVCC_KEY_ABSENT_BEFORE_MASK
public static final int MVCC_HINTS_MASK
public static final int MVCC_OP_COUNTER_MASK
public static final long MVCC_CRD_COUNTER_NA
public static final long MVCC_CRD_START_CNTR
public static final long MVCC_COUNTER_NA
public static final long MVCC_INITIAL_CNTR
public static final long MVCC_START_CNTR
public static final int MVCC_OP_COUNTER_NA
public static final int MVCC_START_OP_CNTR
public static final int MVCC_READ_OP_CNTR
public static final int MVCC_INVISIBLE
public static final int MVCC_VISIBLE_REMOVED
public static final int MVCC_VISIBLE
public static final MvccVersion INITIAL_VERSION
public static final MvccSnapshot MVCC_MAX_SNAPSHOT
public static boolean isActive(GridCacheContext cctx, long mvccCrd, long mvccCntr, MvccSnapshot snapshot) throws IgniteCheckedException
cctx - Cache context.mvccCrd - Mvcc coordinator version.mvccCntr - Mvcc counter.snapshot - Snapshot.True if transaction is active.IgniteCheckedException - If failed.TxStatepublic static byte state(GridCacheContext cctx, long mvccCrd, long mvccCntr, int mvccOpCntr)
cctx - Cache context.mvccCrd - Mvcc coordinator version.mvccCntr - Mvcc counter.mvccOpCntr - Mvcc operation counter.TxStatepublic static byte state(CacheGroupContext grp, long mvccCrd, long mvccCntr, int mvccOpCntr)
grp - Cache group context.mvccCrd - Mvcc coordinator version.mvccCntr - Mvcc counter.mvccOpCntr - Mvcc operation counter.TxStatepublic static byte state(MvccProcessor proc, long mvccCrd, long mvccCntr, int mvccOpCntr)
proc - Mvcc processor.mvccCrd - Mvcc coordinator version.mvccCntr - Mvcc counter.TxStatepublic static boolean isVisible(GridCacheContext cctx, MvccSnapshot snapshot, long mvccCrd, long mvccCntr, int opCntr) throws IgniteCheckedException
cctx - Cache context.snapshot - Snapshot.mvccCrd - Mvcc coordinator.mvccCntr - Mvcc counter.opCntr - Operation counter.True if visible.IgniteCheckedException - If failed.public static boolean isVisible(GridCacheContext cctx, MvccSnapshot snapshot, long mvccCrd, long mvccCntr, int opCntrWithHints, boolean useTxLog) throws IgniteCheckedException
cctx - Cache context.snapshot - Snapshot.mvccCrd - Mvcc coordinator.mvccCntr - Mvcc counter.opCntrWithHints - Operation counter.useTxLog - True if TxLog should be used.True if visible.IgniteCheckedException - If failed.public static IgniteTxUnexpectedStateCheckedException unexpectedStateException(CacheGroupContext grp, byte state, long crd, long cntr, int opCntr)
grp - Cache group context.state - State.crd - Mvcc coordinator counter.cntr - Mvcc counter.opCntr - Mvcc operation counter.public static IgniteTxUnexpectedStateCheckedException unexpectedStateException(GridCacheContext cctx, byte state, long crd, long cntr, int opCntr, MvccSnapshot snapshot)
cctx - Cache context.state - State.crd - Mvcc coordinator counter.cntr - Mvcc counter.opCntr - Mvcc operation counter.snapshot - Mvcc snapshotpublic static boolean isVisible(GridCacheContext cctx, MvccSnapshot snapshot, long crd, long cntr, int opCntr, long link) throws IgniteCheckedException
cctx - Context.snapshot - Snapshot.crd - Mvcc coordinator counter.cntr - Mvcc counter.opCntr - Mvcc operation counter.link - Link to data row (new version is located there).IgniteCheckedException - If failed.public static boolean hasNewVersion(MvccUpdateVersionAware row)
row - Row.True if row has a new version.public static int getVisibleState(GridCacheContext cctx, long link, MvccSnapshot snapshot) throws IgniteCheckedException
cctx - Cache context.link - Link to the row.snapshot - Mvcc snapshot.True if row is visible for the given snapshot.IgniteCheckedException - If failed.public static MvccVersion getNewVersion(GridCacheContext cctx, long link) throws IgniteCheckedException
cctx - Cache context.link - Link to the row.MvccVersion if row has xid_max, or null if doesn't.IgniteCheckedException - If failed.public static int compare(MvccVersionAware row, MvccVersion ver)
row - Row.ver - Version.Comparable.public static int compare(MvccVersion mvccVerLeft, long mvccCrdRight, long mvccCntrRight)
Comparable.mvccVerLeft - First MVCC version.mvccCrdRight - Second coordinator version.mvccCntrRight - Second counter.Comparable.public static int compare(MvccVersionAware row, long mvccCrdRight, long mvccCntrRight)
Comparable.row - First MVCC version.mvccCrdRight - Second coordinator version.mvccCntrRight - Second counter.Comparable.public static int compare(MvccVersion mvccVerLeft, long mvccCrdRight, long mvccCntrRight, int mvccOpCntrRight)
Comparable.mvccVerLeft - First MVCC version.mvccCrdRight - Second coordinator version.mvccCntrRight - Second counter.mvccOpCntrRight - Second operation counter.Comparable.public static int compare(long mvccCrdLeft,
long mvccCntrLeft,
int mvccOpCntrLeft,
MvccVersionAware other)
Comparable.mvccCrdLeft - First coordinator version.mvccCntrLeft - First counter version.mvccOpCntrLeft - First operation counter.other - The object to compare with.Comparable.public static int compare(long mvccCrdLeft,
long mvccCntrLeft,
long mvccCrdRight,
long mvccCntrRight)
Comparable.mvccCrdLeft - First coordinator version.mvccCntrLeft - First counter version.mvccCrdRight - Second coordinator version.mvccCntrRight - Second counter version.Comparable.public static int compare(long mvccCrdLeft,
long mvccCntrLeft,
int mvccOpCntrLeft,
long mvccCrdRight,
long mvccCntrRight,
int mvccOpCntrRight)
Comparable.mvccCrdLeft - First coordinator version.mvccCntrLeft - First counter version.mvccOpCntrLeft - First operation counter.mvccCrdRight - Second coordinator version.mvccCntrRight - Second counter version.mvccOpCntrRight - Second operation counter.Comparable.public static int compareIgnoreOpCounter(MvccVersion left, MvccVersion right)
left - Version.right - Version.Comparable.public static int compareNewVersion(MvccUpdateVersionAware row, long mvccCrd, long mvccCntr)
row - Row.mvccCrd - Mvcc coordinator.mvccCntr - Mvcc counter.Comparable.public static int compareNewVersion(MvccUpdateVersionAware row, long mvccCrd, long mvccCntr, int opCntr)
row - Row.mvccCrd - Mvcc coordinator.mvccCntr - Mvcc counter.opCntr - Mvcc operation counter.Comparable.public static int compareNewVersion(MvccUpdateVersionAware row, MvccVersion ver)
row - Row.ver - Version.Comparable.public static boolean mvccVersionIsValid(long crdVer,
long cntr,
int opCntr)
crdVer - Mvcc coordinator version.cntr - Counter.opCntr - Operation counter.true.public static boolean mvccVersionIsValid(long crdVer,
long cntr)
crdVer - Mvcc coordinator version.cntr - Counter.True if version is valid.public static ClusterTopologyServerNotFoundException noCoordinatorError()
public static boolean isVisible(GridCacheContext cctx, MvccSnapshot snapshot, DataPageIO dataIo, long pageAddr, int itemId, int pageSize) throws IgniteCheckedException
cctx - Cache context.snapshot - Mvcc snapshot.dataIo - Data page IO.pageAddr - Page address.itemId - Item Id.pageSize - Page size.true If the row is visible.IgniteCheckedException - If failed.public static void verifyMvccOperationSupport(GridCacheContext<?,?> cctx, String opType)
UnsupportedOperationException if this cache is transactional and MVCC is enabled with
appropriate message about corresponding operation type.cctx - Cache context.opType - operation type to mention in error message.public static GridNearTxLocal checkActive(GridNearTxLocal tx) throws IgniteTxAlreadyCompletedCheckedException
tx - Transaction.IgniteTxAlreadyCompletedCheckedException@Nullable public static @Nullable GridNearTxLocal tx(GridKernalContext ctx)
ctx - Grid kernal context.null if none started.TransactionUnsupportedConcurrencyException - If transaction mode is not supported when MVCC is enabled.TransactionMixedModeException - If started transaction spans non MVCC caches.@Nullable public static @Nullable GridNearTxLocal tx(GridKernalContext ctx, @Nullable @Nullable GridCacheVersion txId)
ctx - Grid kernal context.txId - Transaction ID.null if none started.TransactionUnsupportedConcurrencyException - If transaction mode is not supported when MVCC is enabled.TransactionMixedModeException - If started transaction spans non MVCC caches.public static GridNearTxLocal txStart(GridKernalContext ctx, long timeout)
ctx - Grid kernal context.timeout - Transaction timeout.public static GridNearTxLocal txStart(GridCacheContext cctx, long timeout)
cctx - Cache context.timeout - Transaction timeout.public static boolean mvccEnabled(GridKernalContext ctx)
ctx - Grid kernal context.@NotNull public static @NotNull MvccQueryTracker mvccTracker(GridCacheContext cctx, boolean autoStartTx) throws IgniteCheckedException
cctx - Cache context.autoStartTx - Start transaction flag.IgniteCheckedException - If failed.@NotNull public static @NotNull MvccQueryTracker mvccTracker(GridCacheContext cctx, GridNearTxLocal tx) throws IgniteCheckedException
cctx - Cache context.tx - Transaction.IgniteCheckedException - If failed.public static MvccSnapshot requestSnapshot(@NotNull @NotNull GridNearTxLocal tx) throws IgniteCheckedException
tx - Transaction.IgniteCheckedException - If failed.public static void throwAtomicityModesMismatchException(CacheConfiguration ccfg1, CacheConfiguration ccfg2)
ccfg1 - Config 1.ccfg2 - Config 2.public static boolean belongToSameTx(MvccVersion v1, MvccVersion v2)
v1 - First MVCC version.v2 - Second MVCC version.True if compared versions belongs to the same transaction.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.11.1 Release Date : December 20 2021