From 09a47d761f7591fd33b6797fe3d5615dcfc4a279 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Mon, 18 Sep 2023 21:37:09 +0300 Subject: [PATCH 01/27] WIP --- .../query/calcite/exec/ddl/DdlCommandHandler.java | 5 ----- .../query/index/sorted/inline/InlineIndexImpl.java | 4 +--- .../cache/GatewayProtectedCacheProxy.java | 5 ----- .../internal/processors/cache/GridCacheContext.java | 5 ++++- .../cache/distributed/dht/GridDhtGetFuture.java | 2 -- .../distributed/dht/GridDhtGetSingleFuture.java | 2 -- .../distributed/dht/GridPartitionedGetFuture.java | 6 ++---- .../dht/GridPartitionedSingleGetFuture.java | 4 +--- .../dht/preloader/GridDhtForceKeysFuture.java | 2 -- .../query/GridCacheDistributedQueryManager.java | 4 ---- .../cache/query/GridCacheQueryManager.java | 2 -- .../continuous/CacheContinuousQueryHandler.java | 13 +------------ .../processors/query/h2/IgniteH2Indexing.java | 2 +- .../processors/query/h2/database/H2PkHashIndex.java | 2 -- .../processors/query/h2/database/H2TreeIndex.java | 2 -- 15 files changed, 10 insertions(+), 50 deletions(-) diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ddl/DdlCommandHandler.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ddl/DdlCommandHandler.java index 3a6b00c8fa1ed..e7c268d8918d0 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ddl/DdlCommandHandler.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ddl/DdlCommandHandler.java @@ -277,11 +277,6 @@ private void handle0(AlterTableDropCommand cmd) throws IgniteCheckedException { assert cctx != null; - if (cctx.mvccEnabled()) { - throw new IgniteSQLException("Cannot drop column(s) with enabled MVCC. " + - "Operation is unsupported at the moment.", IgniteQueryErrorCode.UNSUPPORTED_OPERATION); - } - if (QueryUtils.isSqlType(typeDesc.valueClass())) { throw new SchemaOperationException("Cannot drop column(s) because table was created " + "with WRAP_VALUE=false option."); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/inline/InlineIndexImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/inline/InlineIndexImpl.java index fd374b150d226..d57c76d9cc08c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/inline/InlineIndexImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/inline/InlineIndexImpl.java @@ -222,7 +222,7 @@ public InlineIndexImpl(GridCacheContext cctx, SortedIndexDefinition def, I /** */ private boolean isSingleRowLookup(IndexRow lower, IndexRow upper) throws IgniteCheckedException { - return !cctx.mvccEnabled() && def.primary() && lower != null && isFullSchemaSearch(lower) && checkRowsTheSame(lower, upper); + return def.primary() && lower != null && isFullSchemaSearch(lower) && checkRowsTheSame(lower, upper); } /** @@ -475,8 +475,6 @@ private InlineTreeFilterClosure filterClosure(IndexQueryContext qryCtx) { MvccSnapshot v = qryCtx.mvccSnapshot(); - assert !cctx.mvccEnabled() || v != null; - if (cacheFilter == null && v == null && qryCtx.rowFilter() == null) return null; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java index 09cec58727e19..e1250247573f4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java @@ -239,11 +239,6 @@ public void setCacheManager(org.apache.ignite.cache.CacheManager cacheMgr) { CacheOperationGate opGate = onEnter(); try { - if (context().mvccEnabled()) { - throw new UnsupportedOperationException( - "The TRANSACTIONAL_SNAPSHOT mode is incompatible with the read-repair feature."); - } - if (context().isNear()) throw new UnsupportedOperationException("Read-repair is incompatible with near caches."); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java index fb48c74a14109..2176d8414b594 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java @@ -114,6 +114,7 @@ import org.apache.ignite.plugin.security.SecurityException; import org.apache.ignite.plugin.security.SecurityPermission; import org.jetbrains.annotations.Nullable; + import static org.apache.ignite.IgniteSystemProperties.IGNITE_DISABLE_TRIGGERING_CACHE_INTERCEPTOR_ON_CONFLICT; import static org.apache.ignite.IgniteSystemProperties.IGNITE_READ_LOAD_BALANCING; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; @@ -2123,7 +2124,9 @@ public boolean readNoEntry(@Nullable IgniteCacheExpiryPolicy expiryPlc, boolean * @return {@code True} if mvcc is enabled for cache. */ public boolean mvccEnabled() { - return grp.mvccEnabled(); + assert !grp.mvccEnabled(); + + return false; } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java index 2f09a2866d8ad..76e8191aa7d31 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java @@ -185,8 +185,6 @@ void init() { // TODO get rid of force keys request https://issues.apache.org/jira/browse/IGNITE-10251 GridDhtFuture fut = cctx.group().preloader().request(cctx, keys.keySet(), topVer); - assert !cctx.mvccEnabled() || fut == null; // Should not happen with MVCC enabled. - if (fut != null) { if (!F.isEmpty(fut.invalidPartitions())) { if (retries == null) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java index b26ab9178ace2..61ea59cca5f90 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java @@ -206,8 +206,6 @@ public GridCacheVersion version() { private void map() { // TODO Get rid of force keys request https://issues.apache.org/jira/browse/IGNITE-10251. if (cctx.group().preloader().needForceKeys()) { - assert !cctx.mvccEnabled(); - GridDhtFuture fut = cctx.group().preloader().request( cctx, Collections.singleton(key), diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java index 0105abc103bb9..ffefe41937b56 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java @@ -113,7 +113,7 @@ public GridPartitionedGetFuture( recovery ); - assert (mvccSnapshot == null) == !cctx.mvccEnabled(); + assert mvccSnapshot == null; this.mvccSnapshot = mvccSnapshot; this.txLbl = txLbl; @@ -422,9 +422,7 @@ private boolean tryLocalGet( Map locVals ) { // Local get cannot be used with MVCC as local node can contain some visible version which is not latest. - boolean fastLocGet = !cctx.mvccEnabled() && - (!forcePrimary || affNodes.get(0).isLocal()) && - cctx.reserveForFastLocalGet(part, topVer); + boolean fastLocGet = (!forcePrimary || affNodes.get(0).isLocal()) && cctx.reserveForFastLocalGet(part, topVer); if (fastLocGet) { try { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java index 1fb2636695fb9..9fc935f170954 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java @@ -428,9 +428,7 @@ private boolean tryLocalGet( List affNodes ) { // Local get cannot be used with MVCC as local node can contain some visible version which is not latest. - boolean fastLocGet = !cctx.mvccEnabled() && - (!forcePrimary || affNodes.get(0).isLocal()) && - cctx.reserveForFastLocalGet(part, topVer); + boolean fastLocGet = (!forcePrimary || affNodes.get(0).isLocal()) && cctx.reserveForFastLocalGet(part, topVer); if (fastLocGet) { try { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java index 2af2e7fd5d9ed..474c4d9b87129 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java @@ -235,8 +235,6 @@ private boolean map(Iterable keys, Collection exc) boolean ret = false; if (mappings != null) { - assert !cctx.mvccEnabled(); // Should not happen when MVCC enabled. - ClusterNode loc = cctx.localNode(); int curTopVer = topCntr.get(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java index 95a842c79cfac..a54135394ad5c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java @@ -179,9 +179,6 @@ protected void removeQueryFuture(long reqId) { * @param req Query request. */ @Override public void processQueryRequest(UUID sndId, GridCacheQueryRequest req) { - assert req.mvccSnapshot() != null || !cctx.mvccEnabled() || req.cancel() || - (req.type() == null && !req.fields()) : req; // Last assertion means next page request. - if (req.cancel()) { cancelIds.add(new CancelMessageId(req.id(), sndId)); @@ -548,7 +545,6 @@ private CacheQueryFuture queryDistributed(GridCacheQueryBean qry, final Colle @Override public GridCloseableIterator scanQueryDistributed(final GridCacheQueryAdapter qry, Collection nodes) throws IgniteCheckedException { assert qry.type() == GridCacheQueryType.SCAN : qry; - assert qry.mvccSnapshot() != null || !cctx.mvccEnabled(); boolean performanceStatsEnabled = cctx.kernalContext().performanceStatistics().enabled(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java index a139361a2a9fe..64d6b9a5aa42c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java @@ -806,8 +806,6 @@ private GridCloseableIterator> sharedCacheSetIterator(GridCa private GridCloseableIterator scanIterator(final GridCacheQueryAdapter qry, IgniteClosure transformer, boolean locNode) throws IgniteCheckedException { - assert !cctx.mvccEnabled() || qry.mvccSnapshot() != null; - final IgniteBiPredicate keyValFilter = qry.scanFilter(); final InternalScanFilter intFilter = keyValFilter != null ? new InternalScanFilter<>(keyValFilter) : null; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java index 2a506e1e89557..af50b088f7797 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java @@ -685,18 +685,7 @@ private boolean needNotify(boolean skipEvt, assert !skipEvt || evt == null; assert skipEvt || part == -1 && cntr == -1; // part == -1 && cntr == -1 means skip counter. - if (!cctx.mvccEnabled()) - return true; - - assert locInitUpdCntrs != null; - - cntr = skipEvt ? cntr : evt.getPartitionUpdateCounter(); - part = skipEvt ? part : evt.partitionId(); - - T2 initCntr = locInitUpdCntrs.get(part); - - // Do not notify listener if entry was updated before the query is started. - return initCntr == null || cntr >= initCntr.get2(); + return true; } }; diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java index 37559cc4758fd..f33f12c73287e 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java @@ -2293,7 +2293,7 @@ private List>> executeUpdateDistributed( GridCacheContext cctx = plan.cacheContext(); // For MVCC case, let's enlist batch elements one by one. - if (plan.hasRows() && plan.mode() == UpdateMode.INSERT && !cctx.mvccEnabled()) { + if (plan.hasRows() && plan.mode() == UpdateMode.INSERT) { CacheOperationContext opCtx = DmlUtils.setKeepBinaryContext(cctx); try { diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java index 74025aded0e1b..63ac318fd841f 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java @@ -109,8 +109,6 @@ public H2PkHashIndex( seg = qctx.segment(); } - assert !cctx.mvccEnabled() || mvccSnapshot != null; - KeyCacheObject lowerObj = lower != null ? cctx.toCacheKeyObject(lower.getValue(0).getObject()) : null; KeyCacheObject upperObj = upper != null ? cctx.toCacheKeyObject(upper.getValue(0).getObject()) : null; diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java index f49acd2c96c12..832fb3e01fdba 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java @@ -224,8 +224,6 @@ public H2TreeIndex(InlineIndexImpl queryIndex, GridH2Table tbl, IndexColumn[] co /** */ private IndexQueryContext idxQryContext(QueryContext qctx) { - assert qctx != null || !cctx.mvccEnabled(); - if (qctx == null) return null; From 6fa2b621c2e30231a256006d88f6fecab0ce93ca Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 13:03:49 +0300 Subject: [PATCH 02/27] WIP --- .../cache/ValidateIndexesClosure.java | 45 +------------------ 1 file changed, 2 insertions(+), 43 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/management/cache/ValidateIndexesClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/management/cache/ValidateIndexesClosure.java index 4bc27a679affc..1e26da8e4ce35 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/management/cache/ValidateIndexesClosure.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/management/cache/ValidateIndexesClosure.java @@ -53,9 +53,6 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject; import org.apache.ignite.internal.processors.cache.PartitionUpdateCounter; import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition; -import org.apache.ignite.internal.processors.cache.mvcc.MvccQueryTracker; -import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils; import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow; import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager; import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore; @@ -535,24 +532,7 @@ private Map processPartition( partRes = new ValidateIndexesPartitionResult(); - boolean hasMvcc = grpCtx.caches().stream().anyMatch(GridCacheContext::mvccEnabled); - - if (hasMvcc) { - for (GridCacheContext context : grpCtx.caches()) { - IndexQueryContext qryCtx = mvccQueryContext(context); - - GridIterator iterator = grpCtx.offheap().cachePartitionIterator( - context.cacheId(), - part.id(), - qryCtx.mvccSnapshot(), - null - ); - - processPartIterator(grpCtx, partRes, qryCtx, iterator); - } - } - else - processPartIterator(grpCtx, partRes, null, grpCtx.offheap().partitionIterator(part.id())); + processPartIterator(grpCtx, partRes, null, grpCtx.offheap().partitionIterator(part.id())); PartitionUpdateCounter updateCntrAfter = part.dataStore().partUpdateCounter(); @@ -702,27 +682,6 @@ else if (current++ % checkThrough > 0) } } - /** - * Get QueryContext for MVCC snapshot. - * - * @param cctx Cache context. - * @return QueryContext for MVCC snapshot. - * @throws IgniteCheckedException If failed. - */ - private IndexQueryContext mvccQueryContext(GridCacheContext cctx) throws IgniteCheckedException { - boolean mvccEnabled = cctx.mvccEnabled(); - - if (mvccEnabled) { - MvccQueryTracker tracker = MvccUtils.mvccTracker(cctx, true); - - MvccSnapshot mvccSnapshot = tracker.snapshot(); - - return new IndexQueryContext(cacheName -> null, null, mvccSnapshot); - } - - return null; - } - /** * */ @@ -791,7 +750,7 @@ private Map processIndex( GridCursor cursor = null; try { - cursor = idx.find(null, null, true, true, mvccQueryContext(cacheCtxWithIdx.get1())); + cursor = idx.find(null, null, true, true, null); if (cursor == null) throw new IgniteCheckedException("Can't iterate through index: " + idx); From 83f2e89c87e64b5a2c00ca1f8be326101d852ffc Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 13:14:22 +0300 Subject: [PATCH 03/27] WIP --- .../internal/management/cdc/CdcCacheDataResendTask.java | 3 --- .../ignite/internal/managers/indexing/IndexesRebuildTask.java | 4 +--- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/management/cdc/CdcCacheDataResendTask.java b/modules/core/src/main/java/org/apache/ignite/internal/management/cdc/CdcCacheDataResendTask.java index b14c872170bee..ab81ce8229c97 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/management/cdc/CdcCacheDataResendTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/management/cdc/CdcCacheDataResendTask.java @@ -142,9 +142,6 @@ protected CdcCacheDataResendJob(CdcResendCommandArg arg, AffinityTopologyVersion ", dataRegionName=" + cache.context().dataRegion().config().getName() + ']'); } - if (cache.context().mvccEnabled()) - throw new UnsupportedOperationException("The TRANSACTIONAL_SNAPSHOT mode is not supported."); - caches.add(cache); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/indexing/IndexesRebuildTask.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/indexing/IndexesRebuildTask.java index 847fcce196b48..cc6d4f6fe427b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/indexing/IndexesRebuildTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/indexing/IndexesRebuildTask.java @@ -71,10 +71,8 @@ public class IndexesRebuildTask { boolean recreate = pageStore == null || !pageStore.hasIndexStore(cctx.groupId()); if (recreate) { - boolean mvccEnabled = cctx.mvccEnabled(); - // If there are no index store, rebuild all indexes. - clo = row -> cctx.queries().store(row, null, mvccEnabled); + clo = row -> cctx.queries().store(row, null, false); } else { Collection toRebuild = cctx.kernalContext().indexProcessor().treeIndexes(cctx.name(), !force); From dc1302263b0c9ade43c87e6a8dd9aca3a721f68f Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 13:22:21 +0300 Subject: [PATCH 04/27] WIP --- .../ignite/internal/processors/cache/GridCacheAdapter.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index 5aab76e79129f..b77ae3ffd7644 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -767,16 +767,11 @@ public void onKernalStop() { IgniteCacheOffheapManager offheapMgr = ctx.isNear() ? ctx.near().dht().context().offheap() : ctx.offheap(); - MvccSnapshot mvccSnapshot = ctx.mvccEnabled() ? MvccUtils.MVCC_MAX_SNAPSHOT : null; - its.add(offheapMgr.cacheEntriesIterator(ctx, modes.primary, modes.backup, topVer, ctx.keepBinary(), - mvccSnapshot, null)); + null, null)); } } else if (modes.heap) { - if (ctx.mvccEnabled()) - return F.emptyIterator(); - if (modes.near && ctx.isNear()) its.add(ctx.near().nearEntries().iterator()); From c51945a0f8fe9a280633bcfe9c4e7c05523ec1d5 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 13:38:16 +0300 Subject: [PATCH 05/27] WIP --- .../processors/cache/GridCacheAdapter.java | 32 ++++++++----------- .../processors/cache/GridCacheContext.java | 3 +- .../processors/cache/GridCacheMapEntry.java | 12 ++----- 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index b77ae3ffd7644..6ad0c9cda4ef0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -176,7 +176,6 @@ import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE; /** @@ -871,9 +870,7 @@ else if (modes.heap) { ctx.shared().database().checkpointReadLock(); try { - cacheVal = ctx.mvccEnabled() - ? e.mvccPeek(modes.heap && !modes.offheap) - : e.peek(modes.heap, modes.offheap, topVer, null); + cacheVal = e.peek(modes.heap, modes.offheap, topVer, null); } catch (GridCacheEntryRemovedException ignore) { if (log.isDebugEnabled()) @@ -1943,8 +1940,8 @@ protected final IgniteInternalFuture> getAllAsync0( tx = checkCurrentTx(); } - if (ctx.mvccEnabled() || tx == null || tx.implicit()) { - assert (mvccSnapshot == null) == !ctx.mvccEnabled(); + if (tx == null || tx.implicit()) { + assert mvccSnapshot == null; Map misses = null; @@ -2299,10 +2296,7 @@ else if (storeEnabled) /** */ protected GridNearTxLocal checkCurrentTx() { - if (!ctx.mvccEnabled()) - return ctx.tm().threadLocalTx(ctx); - - return MvccUtils.tx(ctx.kernalContext(), null); + return ctx.tm().threadLocalTx(ctx); } /** @@ -4240,11 +4234,11 @@ public void awaitLastFut() { true, op.single(), ctx.systemTx() ? ctx : null, - ctx.mvccEnabled() ? PESSIMISTIC : OPTIMISTIC, - ctx.mvccEnabled() ? REPEATABLE_READ : READ_COMMITTED, + OPTIMISTIC, + READ_COMMITTED, tCfg.getDefaultTxTimeout(), !ctx.skipStore(), - ctx.mvccEnabled(), + false, 0, null ); @@ -4358,11 +4352,11 @@ private IgniteInternalFuture asyncOp(final AsyncOp op) { true, op.single(), ctx.systemTx() ? ctx : null, - ctx.mvccEnabled() ? PESSIMISTIC : OPTIMISTIC, - ctx.mvccEnabled() ? REPEATABLE_READ : READ_COMMITTED, + OPTIMISTIC, + READ_COMMITTED, txCfg.getDefaultTxTimeout(), !skipStore, - ctx.mvccEnabled(), + false, 0, null); @@ -5387,11 +5381,11 @@ public void execute(boolean retry) { true, op.single(), ctx.systemTx() ? ctx : null, - ctx.mvccEnabled() ? PESSIMISTIC : OPTIMISTIC, - ctx.mvccEnabled() ? REPEATABLE_READ : READ_COMMITTED, + OPTIMISTIC, + READ_COMMITTED, CU.transactionConfiguration(ctx, ctx.kernalContext().config()).getDefaultTxTimeout(), opCtx == null || !opCtx.skipStore(), - ctx.mvccEnabled(), + false, 0, null); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java index 2176d8414b594..912a329f595cd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java @@ -2116,8 +2116,7 @@ public void releaseForFastLocalGet(int part, AffinityTopologyVersion topVer) { * @return {@code True} if it is possible to directly read offheap instead of using {@link GridCacheEntryEx#innerGet}. */ public boolean readNoEntry(@Nullable IgniteCacheExpiryPolicy expiryPlc, boolean readers) { - return mvccEnabled() - || (!config().isOnheapCacheEnabled() && !readers && expiryPlc == null && config().getPlatformCacheConfiguration() == null); + return !config().isOnheapCacheEnabled() && !readers && expiryPlc == null && config().getPlatformCacheConfiguration() == null; } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java index 70b4c5870e48d..d537690e1008b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java @@ -445,7 +445,7 @@ protected GridDhtLocalPartition localPartition() { /** {@inheritDoc} */ @Nullable @Override public List allVersionsInfo() throws IgniteCheckedException { - assert cctx.mvccEnabled(); + assert false; // assert mvcc enabled lockEntry(); @@ -1028,10 +1028,7 @@ private EntryGetResult entryGetResult(CacheObject val, GridCacheVersion ver, boo deletedUnlocked(false); } else { - if (cctx.mvccEnabled()) - cctx.offheap().mvccRemoveAll(this); - else - removeValue(); + removeValue(); if (cctx.deferredDelete() && !isInternal() && !detached() && !deletedUnlocked()) deletedUnlocked(true); @@ -2342,10 +2339,7 @@ protected void clearReader(UUID nodeId) throws GridCacheEntryRemovedException { ", val=" + val + ']'); } - if (cctx.mvccEnabled()) - cctx.offheap().mvccRemoveAll(this); - else - removeValue(); + removeValue(); } finally { unlockEntry(); From 12f8158e8506fff1dd4205963f840c2222f6dbf8 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 13:58:34 +0300 Subject: [PATCH 06/27] WIP --- .../processors/cache/GridCacheMapEntry.java | 89 ++++--------------- 1 file changed, 17 insertions(+), 72 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java index d537690e1008b..ffdb06ba8a64e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java @@ -2864,10 +2864,7 @@ private boolean checkExpired() throws IgniteCheckedException { long delta = expireTime - U.currentTimeMillis(); if (delta <= 0) { - if (cctx.mvccEnabled()) - cctx.offheap().mvccRemoveAll(this); - else - removeValue(); + removeValue(); return true; } @@ -3042,45 +3039,12 @@ else if (val == null) } } - if (cctx.mvccEnabled()) { - assert !preload; - - cctx.offheap().mvccInitialValue(this, val, ver, expTime, mvccVer, newMvccVer); - } - else - storeValue(val, expTime, ver, null, row); + storeValue(val, expTime, ver, null, row); } } - else { - if (cctx.mvccEnabled()) { - // cannot identify whether the entry is exist on the fly - unswap(false); - - if (update = p.apply(null)) { - // If entry is already unswapped and we are modifying it, we must run deletion callbacks for old value. - long oldExpTime = expireTimeUnlocked(); - long delta = (oldExpTime == 0 ? 0 : oldExpTime - U.currentTimeMillis()); - - if (delta < 0) { - if (onExpired(this.val, null)) { - if (cctx.deferredDelete()) { - deferred = true; - oldVer = this.ver; - } - else if (val == null) - obsolete = true; - } - } + else + update = storeValue(val, expTime, ver, p, row); - assert !preload; - - cctx.offheap().mvccInitialValue(this, val, ver, expTime, mvccVer, newMvccVer); - } - } - else - // Optimization to access storage only once. - update = storeValue(val, expTime, ver, p, row); - } if (update) { update(val, expTime, ttl, ver, true); @@ -3102,34 +3066,18 @@ else if (deletedUnlocked()) updateCntr = nextPartitionCounter(topVer, true, true, null); if (walEnabled) { - if (cctx.mvccEnabled()) { - cctx.group().wal().log(new MvccDataRecord(new MvccDataEntry( - cctx.cacheId(), - key, - val, - val == null ? DELETE : GridCacheOperation.CREATE, - null, - ver, - expireTime, - partition(), - updateCntr, - mvccVer == null ? MvccUtils.INITIAL_VERSION : mvccVer - ))); - } - else { - cctx.group().wal().log(new DataRecord(new DataEntry( - cctx.cacheId(), - key, - val, - val == null ? DELETE : GridCacheOperation.CREATE, - null, - ver, - expireTime, - partition(), - updateCntr, - DataEntry.flags(primary, preload, fromStore) - ))); - } + cctx.group().wal().log(new DataRecord(new DataEntry( + cctx.cacheId(), + key, + val, + val == null ? DELETE : GridCacheOperation.CREATE, + null, + ver, + expireTime, + partition(), + updateCntr, + DataEntry.flags(primary, preload, fromStore) + ))); } drReplicate(drType, val, ver, topVer); @@ -3748,10 +3696,7 @@ private boolean onExpired(CacheObject expiredVal, GridCacheVersion obsoleteVer) if (log.isTraceEnabled()) log.trace("onExpired clear [key=" + key + ", entry=" + System.identityHashCode(this) + ']'); - if (cctx.mvccEnabled()) - cctx.offheap().mvccRemoveAll(this); - else - removeValue(); + removeValue(); if (cctx.events().isRecordable(EVT_CACHE_OBJECT_EXPIRED)) { cctx.events().addEvent(partition(), From 9ad63d92766448059400b511a565e0ca5cfae866 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 14:09:08 +0300 Subject: [PATCH 07/27] WIP --- .../processors/cache/GridCacheProcessor.java | 2 -- .../processors/cache/GridCacheUtils.java | 3 ++- .../distributed/dht/GridDhtCacheAdapter.java | 26 +++++-------------- .../distributed/dht/GridDhtCacheEntry.java | 5 +--- .../distributed/dht/GridDhtGetFuture.java | 12 --------- .../dht/GridDhtGetSingleFuture.java | 12 --------- .../distributed/dht/GridDhtLockFuture.java | 10 +++---- .../dht/GridDhtTxPrepareFuture.java | 10 +++---- 8 files changed, 17 insertions(+), 63 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java index 61696306fe782..4618afce95b6c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java @@ -2262,7 +2262,6 @@ private void onCacheStarted(GridCacheContext cacheCtx) throws IgniteCheckedExcep ", mode=" + cfg.getCacheMode() + ", atomicity=" + cfg.getAtomicityMode() + ", backups=" + cfg.getBackups() + - ", mvcc=" + cacheCtx.mvccEnabled() + (expPlcInfo != null ? ", " + expPlcInfo : "") + ']'); } @@ -2345,7 +2344,6 @@ private void onCacheStarted(GridCacheContext cacheCtx) throws IgniteCheckedExcep ", mode=" + cfg.getCacheMode() + ", atomicity=" + cfg.getAtomicityMode() + ", backups=" + cfg.getBackups() + - ", mvcc=" + cacheCtx.mvccEnabled() + (expPlcInfo != null ? ", " + expPlcInfo : "") + ']'); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java index f8c27c2f18ce6..c1680aa89ab60 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java @@ -115,6 +115,7 @@ import org.apache.ignite.transactions.TransactionRollbackException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import static java.util.Objects.nonNull; import static org.apache.ignite.IgniteSystemProperties.IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -1807,7 +1808,7 @@ public static void initializeConfigDefaults(IgniteLogger log, CacheConfiguration boolean readThrough, boolean skipVals ) { - if (cctx.mvccEnabled() || !readThrough || skipVals || + if (!readThrough || skipVals || (key != null && !cctx.affinity().backupsByKey(key, topVer).contains(cctx.localNode()))) return null; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java index a785bb6bc80a0..fa845e53454fb 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java @@ -233,30 +233,16 @@ private void processForceKeysRequest0(ClusterNode node, GridDhtForceKeysRequest entry.unswap(); - if (ctx.mvccEnabled()) { - List infos = entry.allVersionsInfo(); + GridCacheEntryInfo info = entry.info(); - if (infos == null) { - assert entry.obsolete() : entry; + if (info == null) { + assert entry.obsolete() : entry; - continue; - } - - for (int i = 0; i < infos.size(); i++) - res.addInfo(infos.get(i)); + continue; } - else { - GridCacheEntryInfo info = entry.info(); - - if (info == null) { - assert entry.obsolete() : entry; - continue; - } - - if (!info.isNew()) - res.addInfo(info); - } + if (!info.isNew()) + res.addInfo(info); entry.touch(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java index f66602d68de92..05de436568e24 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java @@ -672,10 +672,7 @@ public boolean clearInternal( ']'); } - if (cctx.mvccEnabled()) - cctx.offheap().mvccRemoveAll(this); - else - removeValue(); + removeValue(); // Give to GC. update(null, 0L, 0L, ver, true); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java index 76e8191aa7d31..97e025ebdf20b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java @@ -311,18 +311,6 @@ private boolean map(KeyCacheObject key, boolean forceKeys) { try { int keyPart = cctx.affinity().partition(key); - if (cctx.mvccEnabled()) { - boolean noOwners = cctx.topology().owners(keyPart, topVer).isEmpty(); - - // Force key request is disabled for MVCC. So if there are no partition owners for the given key - // (we have a not strict partition loss policy if we've got here) we need to set flag forceKeys to true - // to avoid useless remapping to other non-owning partitions. For non-mvcc caches the force key request - // is also useless in the such situations, so the same flow is here: allegedly we've made a force key - // request with no results and therefore forceKeys flag may be set to true here. - if (noOwners) - forceKeys = true; - } - GridDhtLocalPartition part = topVer.topologyVersion() > 0 ? cache().topology().localPartition(keyPart, topVer, true) : cache().topology().localPartition(keyPart); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java index 61ea59cca5f90..28062800b9606 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java @@ -281,18 +281,6 @@ private boolean map(KeyCacheObject key, boolean forceKeys) { try { int keyPart = cctx.affinity().partition(key); - if (cctx.mvccEnabled()) { - boolean noOwners = cctx.topology().owners(keyPart, topVer).isEmpty(); - - // Force key request is disabled for MVCC. So if there are no partition owners for the given key - // (we have a not strict partition loss policy if we've got here) we need to set flag forceKeys to true - // to avoid useless remapping to other non-owning partitions. For non-mvcc caches the force key request - // is also useless in the such situations, so the same flow is here: allegedly we've made a force key - // request with no results and therefore forceKeys flag may be set to true here. - if (noOwners) - forceKeys = true; - } - GridDhtLocalPartition part = topVer.topologyVersion() > 0 ? cache().topology().localPartition(keyPart, topVer, true) : cache().topology().localPartition(keyPart); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java index 95a32f2a3149f..d937006ce13bd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java @@ -55,8 +55,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture; import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtInvalidPartitionException; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUpdateVersionAware; -import org.apache.ignite.internal.processors.cache.mvcc.MvccVersionAware; import org.apache.ignite.internal.processors.cache.mvcc.txlog.TxState; import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry; @@ -1351,10 +1349,10 @@ void onResult(GridDhtLockResponse res) { try { if (entry.initialValue(info.value(), info.version(), - cctx.mvccEnabled() ? ((MvccVersionAware)info).mvccVersion() : null, - cctx.mvccEnabled() ? ((MvccUpdateVersionAware)info).newMvccVersion() : null, - cctx.mvccEnabled() ? ((MvccVersionAware)entry).mvccTxState() : TxState.NA, - cctx.mvccEnabled() ? ((MvccUpdateVersionAware)entry).newMvccTxState() : TxState.NA, + null, + null, + TxState.NA, + TxState.NA, info.ttl(), info.expireTime(), true, diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java index d3ea93089ba5e..6e9fe2e6168a8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java @@ -68,8 +68,6 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareRequest; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse; import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUpdateVersionAware; -import org.apache.ignite.internal.processors.cache.mvcc.MvccVersionAware; import org.apache.ignite.internal.processors.cache.mvcc.txlog.TxState; import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry; @@ -1989,10 +1987,10 @@ void onResult(GridDhtTxPrepareResponse res) { try { if (entry.initialValue(info.value(), info.version(), - cacheCtx.mvccEnabled() ? ((MvccVersionAware)info).mvccVersion() : null, - cacheCtx.mvccEnabled() ? ((MvccUpdateVersionAware)info).newMvccVersion() : null, - cacheCtx.mvccEnabled() ? ((MvccVersionAware)info).mvccTxState() : TxState.NA, - cacheCtx.mvccEnabled() ? ((MvccUpdateVersionAware)info).newMvccTxState() : TxState.NA, + null, + null, + TxState.NA, + TxState.NA, info.ttl(), info.expireTime(), true, From ba486f812a74aeb9808b89d80684b74ec8fb70d2 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 14:27:13 +0300 Subject: [PATCH 08/27] WIP --- .../cache/distributed/dht/GridPartitionedGetFuture.java | 4 +--- .../cache/distributed/dht/GridPartitionedSingleGetFuture.java | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java index ffefe41937b56..0b9c4ade4be3a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java @@ -465,9 +465,7 @@ private boolean localGet(AffinityTopologyVersion topVer, KeyCacheObject key, int if (readNoEntry) { KeyCacheObject key0 = (KeyCacheObject)cctx.cacheObjects().prepareForCache(key, cctx); - CacheDataRow row = cctx.mvccEnabled() ? - cctx.offheap().mvccRead(cctx, key0, mvccSnapshot()) : - cctx.offheap().read(cctx, key0); + CacheDataRow row = cctx.offheap().read(cctx, key0); if (row != null) { long expireTime = row.expireTime(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java index 9fc935f170954..f27d55374e742 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java @@ -190,7 +190,7 @@ public GridPartitionedSingleGetFuture( @Nullable MvccSnapshot mvccSnapshot ) { assert key != null; - assert mvccSnapshot == null || cctx.mvccEnabled(); + assert mvccSnapshot == null; AffinityTopologyVersion lockedTopVer = cctx.shared().lockedTopologyVersion(null); From 92772fd3618693a02e83c28803a32ed5a7b5f02e Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 14:34:40 +0300 Subject: [PATCH 09/27] WIP --- .../dht/colocated/GridDhtColocatedCache.java | 41 ++----------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java index cf301cdf1d875..3c995babf3f5a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java @@ -63,7 +63,6 @@ import org.apache.ignite.internal.processors.cache.distributed.near.consistency.GridNearReadRepairCheckOnlyFuture; import org.apache.ignite.internal.processors.cache.mvcc.MvccQueryTracker; import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils; import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow; import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey; import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx; @@ -201,7 +200,7 @@ public GridDistributedCacheEntry entryExx( final ReadRepairStrategy readRepairStrategy = opCtx != null ? opCtx.readRepairStrategy() : null; // Get operation bypass Tx in Mvcc mode. - if (!ctx.mvccEnabled() && tx != null && !tx.implicit() && !skipTx) { + if (tx != null && !tx.implicit() && !skipTx) { return asyncOp(tx, new AsyncOp() { @Override public IgniteInternalFuture op(GridNearTxLocal tx, AffinityTopologyVersion readyTopVer) { IgniteInternalFuture> fut = tx.getAllAsync(ctx, @@ -238,23 +237,6 @@ public GridDistributedCacheEntry entryExx( MvccSnapshot mvccSnapshot = null; MvccQueryTracker mvccTracker = null; - if (ctx.mvccEnabled()) { - try { - if (tx != null) - mvccSnapshot = MvccUtils.requestSnapshot(tx); - else { - mvccTracker = MvccUtils.mvccTracker(ctx, null); - - mvccSnapshot = mvccTracker.snapshot(); - } - - assert mvccSnapshot != null; - } - catch (IgniteCheckedException ex) { - return new GridFinishedFuture<>(ex); - } - } - AffinityTopologyVersion topVer; if (tx != null) @@ -335,7 +317,7 @@ else if (mvccTracker != null) final CacheOperationContext opCtx = ctx.operationContextPerCall(); - if (!ctx.mvccEnabled() && tx != null && !tx.implicit() && !skipTx) { + if (tx != null && !tx.implicit() && !skipTx) { return asyncOp(tx, new AsyncOp>(keys) { /** {@inheritDoc} */ @Override public IgniteInternalFuture> op(GridNearTxLocal tx, @@ -357,23 +339,6 @@ else if (mvccTracker != null) MvccSnapshot mvccSnapshot = null; MvccQueryTracker mvccTracker = null; - if (ctx.mvccEnabled()) { - try { - if (tx != null) - mvccSnapshot = MvccUtils.requestSnapshot(tx); - else { - mvccTracker = MvccUtils.mvccTracker(ctx, null); - - mvccSnapshot = mvccTracker.snapshot(); - } - - assert mvccSnapshot != null; - } - catch (IgniteCheckedException ex) { - return new GridFinishedFuture<>(ex); - } - } - AffinityTopologyVersion topVer; if (tx != null) @@ -510,7 +475,7 @@ public final IgniteInternalFuture> loadAsync( @Nullable String txLbl, @Nullable MvccSnapshot mvccSnapshot ) { - assert (mvccSnapshot == null) == !ctx.mvccEnabled(); + assert mvccSnapshot == null; if (keys == null || keys.isEmpty()) return new GridFinishedFuture<>(Collections.emptyMap()); From 771c735f19f84daa8a35f016b8eedd645a6bbb95 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 14:35:31 +0300 Subject: [PATCH 10/27] WIP --- .../ignite/internal/processors/cache/GridCacheMapEntry.java | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java index ffdb06ba8a64e..c78b63a14543b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java @@ -3045,7 +3045,6 @@ else if (val == null) else update = storeValue(val, expTime, ver, p, row); - if (update) { update(val, expTime, ttl, ver, true); From 6f77083e7649cef17e72d99a2fe6e54b4556aced Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 14:57:21 +0300 Subject: [PATCH 11/27] WIP --- .../dht/preloader/GridDhtForceKeysFuture.java | 10 +- .../distributed/near/GridNearTxLocal.java | 120 +----------------- 2 files changed, 5 insertions(+), 125 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java index 474c4d9b87129..9a42bb00296f5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java @@ -42,8 +42,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtFuture; import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition; import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionTopology; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUpdateVersionAware; -import org.apache.ignite.internal.processors.cache.mvcc.MvccVersionAware; import org.apache.ignite.internal.processors.cache.mvcc.txlog.TxState; import org.apache.ignite.internal.util.F0; import org.apache.ignite.internal.util.GridLeanSet; @@ -536,10 +534,10 @@ void onResult(GridDhtForceKeysResponse res) { if (entry.initialValue( info.value(), info.version(), - cctx.mvccEnabled() ? ((MvccVersionAware)info).mvccVersion() : null, - cctx.mvccEnabled() ? ((MvccUpdateVersionAware)info).newMvccVersion() : null, - cctx.mvccEnabled() ? ((MvccVersionAware)entry).mvccTxState() : TxState.NA, - cctx.mvccEnabled() ? ((MvccUpdateVersionAware)entry).newMvccTxState() : TxState.NA, + null, + null, + TxState.NA, + TxState.NA, info.ttl(), info.expireTime(), true, diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java index 0d76760d1ede9..9797bd87c1b99 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java @@ -603,10 +603,6 @@ private IgniteInternalFuture putAsync0( ) { assert key != null; - if (cacheCtx.mvccEnabled()) - return mvccPutAllAsync0(cacheCtx, Collections.singletonMap(key, val), - entryProc == null ? null : Collections.singletonMap(key, entryProc), invokeArgs, retval, filter); - try { beforePut(cacheCtx, retval, false); @@ -858,9 +854,6 @@ private IgniteInternalFuture putAllAsync0( @Nullable Map drMap, final boolean retval ) { - if (cacheCtx.mvccEnabled()) - return mvccPutAllAsync0(cacheCtx, map, invokeMap, invokeArgs, retval, null); - try { beforePut(cacheCtx, retval, false); } @@ -1703,9 +1696,6 @@ private IgniteInternalFuture removeAllAsync0( final boolean retval, @Nullable final CacheEntryPredicate filter, boolean singleRmv) { - if (cacheCtx.mvccEnabled()) - return mvccRemoveAllAsync0(cacheCtx, keys, retval, filter); - try { checkUpdatesAllowed(cacheCtx); } @@ -1929,87 +1919,6 @@ private IgniteInternalFuture removeAllAsync0( } } - /** - * Internal method for remove operations in Mvcc mode. - * - * @param cacheCtx Cache context. - * @param keys Keys to remove. - * @param retval Flag indicating whether a value should be returned. - * @param filter Filter. - * @return Future for asynchronous remove. - */ - @SuppressWarnings("unchecked") - private IgniteInternalFuture mvccRemoveAllAsync0( - final GridCacheContext cacheCtx, - @Nullable final Collection keys, - final boolean retval, - @Nullable final CacheEntryPredicate filter - ) { - try { - MvccUtils.requestSnapshot(this); - - beforeRemove(cacheCtx, retval); - } - catch (IgniteCheckedException e) { - return new GridFinishedFuture(e); - } - - if (F.isEmpty(keys)) { - if (implicit()) { - try { - commit(); - } - catch (IgniteCheckedException e) { - return new GridFinishedFuture<>(e); - } - } - - return new GridFinishedFuture<>(new GridCacheReturn(localResult(), true)); - } - - init(); - - Set enlisted = new HashSet<>(keys.size()); - - try { - for (Object key : keys) { - if (isRollbackOnly()) - return new GridFinishedFuture<>(timedOut() ? timeoutException() : rollbackException()); - - if (key == null) { - rollback(); - - throw new NullPointerException("Null key."); - } - - KeyCacheObject cacheKey = cacheCtx.toCacheKeyObject(key); - - enlisted.add(cacheKey); - } - - } - catch (IgniteCheckedException e) { - return new GridFinishedFuture(e); - } - - return updateAsync(cacheCtx, new UpdateSourceIterator() { - - private final Iterator it = enlisted.iterator(); - - @Override public EnlistOperation operation() { - return EnlistOperation.DELETE; - } - - @Override public boolean hasNextX() { - return it.hasNext(); - } - - @Override public KeyCacheObject nextX() { - return it.next(); - } - }, retval, filter, remainingTime()); - } - /** * @param cacheCtx Cache context. * @param cacheIds Involved cache ids. @@ -2208,9 +2117,6 @@ public IgniteInternalFuture> getAllAsync( if (F.isEmpty(keys)) return new GridFinishedFuture<>(Collections.emptyMap()); - if (cacheCtx.mvccEnabled() && !isOperationAllowed(true)) - return txTypeMismatchFinishFuture(); - init(); int keysCnt = keys.size(); @@ -4811,15 +4717,12 @@ private boolean isAll(GridCacheContext cctx, * @throws IgniteCheckedException If failed. */ private void beforePut(GridCacheContext cacheCtx, boolean retval, boolean mvccOp) throws IgniteCheckedException { - assert !mvccOp || cacheCtx.mvccEnabled(); + assert !mvccOp; checkUpdatesAllowed(cacheCtx); cacheCtx.checkSecurity(SecurityPermission.CACHE_PUT); - if (cacheCtx.mvccEnabled() && !isOperationAllowed(mvccOp)) - throw new IgniteCheckedException(TX_TYPE_MISMATCH_ERR_MSG); - if (retval) needReturnValue(true); @@ -4828,27 +4731,6 @@ private void beforePut(GridCacheContext cacheCtx, boolean retval, boolean mvccOp init(); } - /** - * @param cacheCtx Cache context. - * @param retval Return value flag. - * @throws IgniteCheckedException If failed. - */ - private void beforeRemove(GridCacheContext cacheCtx, boolean retval) throws IgniteCheckedException { - assert cacheCtx.mvccEnabled(); - - checkUpdatesAllowed(cacheCtx); - - cacheCtx.checkSecurity(SecurityPermission.CACHE_REMOVE); - - if (cacheCtx.mvccEnabled() && !isOperationAllowed(true)) - throw new IgniteCheckedException(TX_TYPE_MISMATCH_ERR_MSG); - - if (retval) - needReturnValue(true); - - checkValid(); - } - /** * @param cacheCtx Cache context. * @throws IgniteCheckedException If updates are not allowed. From fc85b5141396484c7eb923206273adea4d234d8d Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 14:58:42 +0300 Subject: [PATCH 12/27] WIP --- .../processors/cache/GridCacheMapEntry.java | 73 ------------------- 1 file changed, 73 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java index c78b63a14543b..cf7815a465b74 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java @@ -88,7 +88,6 @@ import org.apache.ignite.internal.util.IgniteTree; import org.apache.ignite.internal.util.future.GridFutureAdapter; import org.apache.ignite.internal.util.lang.GridClosureException; -import org.apache.ignite.internal.util.lang.GridCursor; import org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter; import org.apache.ignite.internal.util.lang.GridTuple; import org.apache.ignite.internal.util.lang.GridTuple3; @@ -125,7 +124,6 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.RENTING; import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.MVCC_MAX_SNAPSHOT; import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.compareIgnoreOpCounter; -import static org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter.RowData.NO_KEY; import static org.apache.ignite.internal.processors.cache.version.GridCacheVersionEx.addConflictVersion; import static org.apache.ignite.internal.processors.dr.GridDrType.DR_NONE; @@ -443,77 +441,6 @@ protected GridDhtLocalPartition localPartition() { return info; } - /** {@inheritDoc} */ - @Nullable @Override public List allVersionsInfo() throws IgniteCheckedException { - assert false; // assert mvcc enabled - - lockEntry(); - - try { - if (obsolete()) - return Collections.emptyList(); - - GridCursor cur = - cctx.offheap().dataStore(localPartition()).mvccAllVersionsCursor(cctx, key, NO_KEY); - - List res = new ArrayList<>(); - - while (cur.next()) { - CacheDataRow row = cur.get(); - - GridCacheMvccEntryInfo info = new GridCacheMvccEntryInfo(); - - info.key(key); - info.value(row.value()); - info.cacheId(cctx.cacheId()); - info.version(row.version()); - info.setNew(false); - info.setDeleted(false); - - byte txState = row.mvccTxState() != TxState.NA ? row.mvccTxState() : - MvccUtils.state(cctx, row.mvccCoordinatorVersion(), row.mvccCounter(), - row.mvccOperationCounter()); - - if (txState == TxState.ABORTED) - continue; - - info.mvccVersion(row.mvccCoordinatorVersion(), row.mvccCounter(), row.mvccOperationCounter()); - info.mvccTxState(txState); - - byte newTxState = row.newMvccTxState() != TxState.NA ? row.newMvccTxState() : - MvccUtils.state(cctx, row.newMvccCoordinatorVersion(), row.newMvccCounter(), - row.newMvccOperationCounter()); - - if (newTxState != TxState.ABORTED) { - info.newMvccVersion(row.newMvccCoordinatorVersion(), - row.newMvccCounter(), - row.newMvccOperationCounter()); - - info.newMvccTxState(newTxState); - } - - long expireTime = row.expireTime(); - - long ttl; - - ttl = expireTime == CU.EXPIRE_TIME_ETERNAL ? CU.TTL_ETERNAL : expireTime - U.currentTimeMillis(); - - if (ttl < 0) - ttl = CU.TTL_MINIMUM; - - info.ttl(ttl); - info.expireTime(expireTime); - - res.add(info); - } - - return res; - } - finally { - unlockEntry(); - } - } - /** {@inheritDoc} */ @Override public final CacheObject unswap() throws IgniteCheckedException, GridCacheEntryRemovedException { return unswap(true); From 50fa824beb72bb7c5a47b58457729c3a4d2bd13f Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 15:04:15 +0300 Subject: [PATCH 13/27] WIP --- .../ignite/internal/processors/cache/GridCacheEntryEx.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java index ba15b79bab17d..d08b379c69248 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java @@ -189,11 +189,6 @@ public interface GridCacheEntryEx { */ @Nullable public GridCacheEntryInfo info(); - /** - * @return Entry info for each MVCC version. - */ - @Nullable public List allVersionsInfo() throws IgniteCheckedException; - /** * Invalidates this entry. * From 747b47ac2cb713b9eb13d470348a1a2aaa404a78 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 15:13:01 +0300 Subject: [PATCH 14/27] WIP --- .../internal/processors/cache/GridCacheTestEntryEx.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java index 2d03c8ff93265..df6d746c0deba 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java @@ -294,12 +294,6 @@ void recheckLock() { return info; } - /** {@inheritDoc} */ - @Nullable @Override public List allVersionsInfo() - throws IgniteCheckedException { - return null; - } - /** {@inheritDoc} */ @Override public boolean valid(AffinityTopologyVersion topVer) { return true; From b99eb1b5ab345936e5f878f978823524ef925f10 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 17:46:05 +0300 Subject: [PATCH 15/27] WIP --- .../cache/GatewayProtectedCacheProxy.java | 3 - .../processors/cache/GridCacheAdapter.java | 40 ------------ .../cache/IgniteCacheProxyImpl.java | 4 -- .../distributed/dht/GridDhtCacheAdapter.java | 4 -- .../cache/mvcc/MvccProcessorImpl.java | 10 +-- .../processors/cache/mvcc/MvccUtils.java | 61 +------------------ 6 files changed, 3 insertions(+), 119 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java index e1250247573f4..dab37b7c532a2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java @@ -51,7 +51,6 @@ import org.apache.ignite.cluster.ClusterGroup; import org.apache.ignite.internal.AsyncSupportAdapter; import org.apache.ignite.internal.GridKernalState; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils; import org.apache.ignite.internal.util.tostring.GridToStringExclude; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.lang.IgniteBiPredicate; @@ -145,8 +144,6 @@ public void setCacheManager(org.apache.ignite.cache.CacheManager cacheMgr) { CacheOperationGate opGate = onEnter(); try { - MvccUtils.verifyMvccOperationSupport(delegate.context(), "withExpiryPolicy"); - return new GatewayProtectedCacheProxy<>(delegate, opCtx.withExpiryPolicy(plc), lock); } finally { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index 6ad0c9cda4ef0..9576bd3397b17 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -102,7 +102,6 @@ import org.apache.ignite.internal.processors.cache.distributed.near.consistency.IgniteConsistencyViolationException; import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo; import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils; import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow; import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey; @@ -1057,9 +1056,6 @@ public List> splitClearLocally(boolean srv, bool @Override public void clearLocally(boolean srv, boolean near, boolean readers) { ctx.checkSecurity(SecurityPermission.CACHE_REMOVE); - //TODO IGNITE-7952 - MvccUtils.verifyMvccOperationSupport(ctx, "Clear"); - List> jobs = splitClearLocally(srv, near, readers); if (!F.isEmpty(jobs)) { @@ -1130,9 +1126,6 @@ public List> splitClearLocally(boolean srv, bool * @throws IgniteCheckedException In case of error. */ private void clear(@Nullable Set keys) throws IgniteCheckedException { - //TODO IGNITE-7952 - MvccUtils.verifyMvccOperationSupport(ctx, "Clear"); - ctx.shared().cache().checkReadOnlyState("clear", ctx.config()); executeClearTask(keys, false).get(); @@ -1144,9 +1137,6 @@ private void clear(@Nullable Set keys) throws IgniteCheckedExceptio * @return Future. */ private IgniteInternalFuture clearAsync(@Nullable final Set keys) { - //TODO IGNITE-7952 - MvccUtils.verifyMvccOperationSupport(ctx, "Clear"); - ctx.shared().cache().checkReadOnlyState("clear", ctx.config()); return executeClearTask(keys, false).chainCompose(fut -> executeClearTask(keys, true)); @@ -1208,9 +1198,6 @@ public void clearLocally(Collection keys, boolean readers) { if (F.isEmpty(keys)) return; - //TODO IGNITE-7952 - MvccUtils.verifyMvccOperationSupport(ctx, "Clear"); - GridCacheVersion obsoleteVer = nextVersion(); for (KeyCacheObject key : keys) { @@ -3475,9 +3462,6 @@ public CacheMetricsImpl metrics0() { if (F.isEmpty(keys)) return true; - //TODO: IGNITE-9324: add explicit locks support. - MvccUtils.verifyMvccOperationSupport(ctx, "Lock"); - IgniteInternalFuture fut = lockAllAsync(keys, timeout); boolean isInterrupted = false; @@ -3519,9 +3503,6 @@ public CacheMetricsImpl metrics0() { @Override public IgniteInternalFuture lockAsync(K key, long timeout) { A.notNull(key, "key"); - //TODO: IGNITE-9324: add explicit locks support. - MvccUtils.verifyMvccOperationSupport(ctx, "Lock"); - return lockAllAsync(Collections.singletonList(key), timeout); } @@ -3622,9 +3603,6 @@ protected void checkJta() throws IgniteCheckedException { /** {@inheritDoc} */ @Override public void localLoadCache(final IgniteBiPredicate p, Object[] args) throws IgniteCheckedException { - //TODO IGNITE-7954 - MvccUtils.verifyMvccOperationSupport(ctx, "Load"); - final boolean replicate = ctx.isDrEnabled(); final AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion(); @@ -3760,9 +3738,6 @@ public IgniteInternalFuture loadAll( for (Object key : keys) A.notNull(key, "key"); - //TODO IGNITE-7954 - MvccUtils.verifyMvccOperationSupport(ctx, "Load"); - CacheOperationContext opCtx = ctx.operationContextPerCall(); ExpiryPolicy plc = opCtx != null ? opCtx.expiry() : null; @@ -3834,9 +3809,6 @@ private void localLoadAndUpdate(final Collection keys) throws Ignit */ public void localLoad(Collection keys, @Nullable ExpiryPolicy plc, final boolean keepBinary) throws IgniteCheckedException { - //TODO IGNITE-7954 - MvccUtils.verifyMvccOperationSupport(ctx, "Load"); - final boolean replicate = ctx.isDrEnabled(); final AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion(); @@ -3907,9 +3879,6 @@ IgniteInternalFuture globalLoadCacheAsync(@Nullable IgniteBiPredicate p assert !F.isEmpty(nodes) : "There are not datanodes fo cache: " + ctx.name(); - //TODO IGNITE-7954 - MvccUtils.verifyMvccOperationSupport(ctx, "Load"); - final boolean keepBinary = opCtx != null && opCtx.isKeepBinary(); IgniteInternalFuture fut = ctx.kernalContext().closure().callAsync( @@ -4624,9 +4593,6 @@ protected Object readResolve() throws ObjectStreamException { private boolean clearLocally0(K key, boolean readers) { ctx.shared().cache().checkReadOnlyState("clear", ctx.config()); - //TODO IGNITE-7952 - MvccUtils.verifyMvccOperationSupport(ctx, "Clear"); - ctx.checkSecurity(SecurityPermission.CACHE_REMOVE); GridCacheVersion obsoleteVer = nextVersion(); @@ -4658,9 +4624,6 @@ private boolean clearLocally0(K key, boolean readers) { @Override public boolean evict(K key) { A.notNull(key, "key"); - //TODO IGNITE-7956 - MvccUtils.verifyMvccOperationSupport(ctx, "Evict"); - return evictx(key, nextVersion(), CU.empty0()); } @@ -4671,9 +4634,6 @@ private boolean clearLocally0(K key, boolean readers) { if (F.isEmpty(keys)) return; - //TODO IGNITE-7956 - MvccUtils.verifyMvccOperationSupport(ctx, "Evict"); - GridCacheVersion obsoleteVer = nextVersion(); try { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java index 8d9f23f9a0009..17628fd4f7106 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java @@ -79,7 +79,6 @@ import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils; import org.apache.ignite.internal.processors.cache.query.CacheQuery; import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture; import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType; @@ -447,9 +446,6 @@ public IgniteCacheProxy gatewayWrapper() { IgniteInternalCache delegate = getDelegateSafe(); GridCacheContext ctx = getContextSafe(); - //TODO: IGNITE-9324: add explicit locks support. - MvccUtils.verifyMvccOperationSupport(ctx, "Lock"); - return new CacheLockImpl<>(ctx.gate(), delegate, ctx.operationContextPerCall(), keys); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java index fa845e53454fb..d700ae7122e86 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java @@ -72,7 +72,6 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetRequest; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetResponse; import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; import org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilter; import org.apache.ignite.internal.processors.security.SecurityUtils; @@ -489,9 +488,6 @@ protected GridDistributedCacheEntry createEntry(KeyCacheObject key) { return; } - //TODO IGNITE-7954 - MvccUtils.verifyMvccOperationSupport(ctx, "Load"); - final AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion(); // Version for all loaded entries. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java index e23607f70658b..b192559d215e9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java @@ -325,15 +325,7 @@ public MvccProcessorImpl(GridKernalContext ctx) { /** {@inheritDoc} */ @Override public void onCacheStop(final GridCacheContext cctx) { - if (cctx.mvccEnabled() && txLog != null) { - assert mvccEnabled && mvccSupported; - - boolean hasMvccCaches = ctx.cache().cacheDescriptors().values().stream() - .anyMatch(c -> c.cacheConfiguration().getAtomicityMode() == TRANSACTIONAL_SNAPSHOT); - - if (!hasMvccCaches) - stopTxLog(); - } + // No-op. } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java index 301cede38a8a8..46b170754dc7d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java @@ -23,7 +23,6 @@ import org.apache.ignite.configuration.TransactionConfiguration; import org.apache.ignite.internal.GridKernalContext; import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException; -import org.apache.ignite.internal.pagemem.PageMemory; import org.apache.ignite.internal.processors.cache.CacheGroupContext; import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal; @@ -42,8 +41,6 @@ import org.jetbrains.annotations.Nullable; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.internal.pagemem.PageIdUtils.itemId; -import static org.apache.ignite.internal.pagemem.PageIdUtils.pageId; import static org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO.MVCC_INFO_SIZE; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; @@ -588,32 +585,9 @@ private static boolean isVisible(GridCacheContext cctx, long link, */ private static R invoke(GridCacheContext cctx, long link, MvccClosure clo, MvccSnapshot snapshot) throws IgniteCheckedException { - assert cctx.mvccEnabled(); + assert false; // !mvcc enabled - PageMemory pageMem = cctx.dataRegion().pageMemory(); - int grpId = cctx.groupId(); - - int pageSize = pageMem.realPageSize(grpId); - - long pageId = pageId(link); - int itemId = itemId(link); - long page = pageMem.acquirePage(grpId, pageId); - - try { - long pageAddr = pageMem.readLock(grpId, pageId, page); - - try { - DataPageIO dataIo = DataPageIO.VERSIONS.forPage(pageAddr); - - return invoke(cctx, dataIo, pageAddr, itemId, pageSize, clo, snapshot); - } - finally { - pageMem.readUnlock(grpId, pageId, page); - } - } - finally { - pageMem.releasePage(grpId, pageId, page); - } + return null; } /** @@ -662,18 +636,6 @@ public static boolean isVisible(GridCacheContext cctx, MvccSnapshot snapshot, Da return invoke(cctx, dataIo, pageAddr, itemId, pageSize, isVisible, snapshot); } - /** - * Throw an {@link UnsupportedOperationException} if this cache is transactional and MVCC is enabled with - * appropriate message about corresponding operation type. - * @param cctx Cache context. - * @param opType operation type to mention in error message. - */ - public static void verifyMvccOperationSupport(GridCacheContext cctx, String opType) { - if (cctx.mvccEnabled()) - throw new UnsupportedOperationException(opType + " operations are not supported on transactional " + - "caches when MVCC is enabled."); - } - /** * Checks transaction state. * @param tx Transaction. @@ -788,25 +750,6 @@ public static boolean mvccEnabled(GridKernalContext ctx) { return ctx.coordinators().mvccEnabled(); } - /** - * Initialises MVCC filter and returns MVCC query tracker if needed. - * @param cctx Cache context. - * @param autoStartTx Start transaction flag. - * @return MVCC query tracker. - * @throws IgniteCheckedException If failed. - */ - @NotNull public static MvccQueryTracker mvccTracker(GridCacheContext cctx, boolean autoStartTx) - throws IgniteCheckedException { - assert cctx != null && cctx.mvccEnabled(); - - GridNearTxLocal tx = tx(cctx.kernalContext()); - - if (tx == null && autoStartTx) - tx = txStart(cctx, 0); - - return mvccTracker(cctx, tx); - } - /** * Initialises MVCC filter and returns MVCC query tracker if needed. * @param cctx Cache context. From 5b68f23f88d2542765aee5f6142e5f73836081a2 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 18:16:16 +0300 Subject: [PATCH 16/27] WIP --- .../cache/query/GridCacheQueryAdapter.java | 17 +------- .../IgniteTxImplicitSingleStateImpl.java | 6 +-- .../IgniteTxRemoteStateAdapter.java | 6 +-- .../cache/transactions/IgniteTxStateImpl.java | 12 +----- .../processors/query/h2/CommandProcessor.java | 4 -- .../internal/processors/query/h2/H2Utils.java | 39 ------------------- .../query/h2/sql/GridSqlQuerySplitter.java | 4 +- 7 files changed, 8 insertions(+), 80 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java index 72c663327fbf9..2c22dec13e61e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java @@ -48,10 +48,8 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter; import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnreservedPartitionException; import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionTopology; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal; import org.apache.ignite.internal.processors.cache.mvcc.MvccQueryTracker; import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils; import org.apache.ignite.internal.processors.query.QueryUtils; import org.apache.ignite.internal.util.GridCloseableIteratorAdapter; import org.apache.ignite.internal.util.GridEmptyCloseableIterator; @@ -70,6 +68,7 @@ import org.apache.ignite.plugin.security.SecurityPermission; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.INDEX; import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SCAN; import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SET; @@ -627,20 +626,6 @@ private CacheQueryFuture execute0(@Nullable IgniteReducer rmtReduce MvccQueryTracker mvccTracker = null; - if (cctx.mvccEnabled() && mvccSnapshot == null) { - GridNearTxLocal tx = cctx.tm().userTx(); - - if (tx != null) - mvccSnapshot = MvccUtils.requestSnapshot(tx); - else { - mvccTracker = MvccUtils.mvccTracker(cctx, null); - - mvccSnapshot = mvccTracker.snapshot(); - } - - assert mvccSnapshot != null; - } - boolean loc = nodes.size() == 1 && F.first(nodes).id().equals(cctx.localNodeId()); GridCloseableIterator it; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java index ba02c928ed204..186ddfdc4034a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java @@ -72,7 +72,7 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter { tx.activeCachesDeploymentEnabled(cacheCtx.deploymentEnabled()); - useMvccCaching = cacheCtx.mvccEnabled() && (cacheCtx.isDrEnabled() || cacheCtx.hasContinuousQueryListeners(tx)); + useMvccCaching = false; } /** {@inheritDoc} */ @@ -318,9 +318,7 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter { /** {@inheritDoc} */ @Override public boolean mvccEnabled() { - GridCacheContext ctx0 = cacheCtx; - - return ctx0 != null && ctx0.mvccEnabled(); + return false; } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java index 675bad5003735..aad1f7da6da75 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java @@ -94,12 +94,8 @@ public abstract class IgniteTxRemoteStateAdapter implements IgniteTxRemoteState mvccEnabled = mvccTx; // Check if we can enlist new cache to transaction. - if (!activeCacheIds.contains(cacheId)) { + if (!activeCacheIds.contains(cacheId)) activeCacheIds.add(cacheId); - - if (cctx.mvccEnabled() && (cctx.hasContinuousQueryListeners(tx) || cctx.isDrEnabled())) - mvccCachingCacheIds.add(cacheId); - } } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java index ba27e787a25ec..a8a6162ce810e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java @@ -222,11 +222,7 @@ public class IgniteTxStateImpl extends IgniteTxLocalStateAdapter { this.recovery = recovery; - if (mvccEnabled != null && mvccEnabled != cacheCtx.mvccEnabled()) - throw new IgniteCheckedException("Failed to enlist new cache to existing transaction " + - "(caches with different mvcc settings can't be enlisted in one transaction)."); - - mvccEnabled = cacheCtx.mvccEnabled(); + mvccEnabled = false; // Check if we can enlist new cache to transaction. if (!activeCacheIds.contains(cacheId)) { @@ -253,13 +249,9 @@ public class IgniteTxStateImpl extends IgniteTxLocalStateAdapter { ", cacheSystem=" + cacheCtx.systemTx() + ", txSystem=" + tx.system() + ']'); } - else { + else activeCacheIds.add(cacheId); - if (cacheCtx.mvccEnabled() && (cacheCtx.hasContinuousQueryListeners(tx) || cacheCtx.isDrEnabled())) - mvccCachingCacheIds.add(cacheId); - } - if (activeCacheIds.size() == 1) tx.activeCachesDeploymentEnabled(cacheCtx.deploymentEnabled()); } diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java index 49278ed2a8930..e38942543304b 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java @@ -404,10 +404,6 @@ else if (cmdH2 instanceof GridSqlAlterTableDropColumn) { assert cctx != null; - if (cctx.mvccEnabled()) - throw new IgniteSQLException("Cannot drop column(s) with enabled MVCC. " + - "Operation is unsupported at the moment.", IgniteQueryErrorCode.UNSUPPORTED_OPERATION); - if (QueryUtils.isSqlType(tbl.rowDescriptor().type().valueClass())) throw new SchemaOperationException("Cannot drop column(s) because table was created " + "with " + PARAM_WRAP_VALUE + "=false option."); diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java index bfc03a5f19064..d6b59b8357d45 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java @@ -52,7 +52,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheContextInfo; import org.apache.ignite.internal.processors.cache.GridCacheSharedContext; import org.apache.ignite.internal.processors.cache.QueryCursorImpl; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils; import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; import org.apache.ignite.internal.processors.odbc.jdbc.JdbcParameterMeta; import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata; @@ -815,44 +814,6 @@ public static List collectCacheIds( return caches0.isEmpty() ? Collections.emptyList() : new ArrayList<>(caches0); } - /** - * Collect MVCC enabled flag. - * - * @param idx Indexing. - * @param cacheIds Cache IDs. - * @return {@code True} if indexing is enabled. - */ - public static boolean collectMvccEnabled(IgniteH2Indexing idx, List cacheIds) { - if (cacheIds.isEmpty()) - return false; - - GridCacheSharedContext sharedCtx = idx.kernalContext().cache().context(); - - GridCacheContext cctx0 = null; - - boolean mvccEnabled = false; - - for (int i = 0; i < cacheIds.size(); i++) { - Integer cacheId = cacheIds.get(i); - - GridCacheContext cctx = sharedCtx.cacheContext(cacheId); - - if (cctx == null) { - throw new IgniteSQLException("Failed to find cache [cacheId=" + cacheId + ']', - IgniteQueryErrorCode.TABLE_NOT_FOUND); - } - - if (i == 0) { - mvccEnabled = cctx.mvccEnabled(); - cctx0 = cctx; - } - else if (cctx.mvccEnabled() != mvccEnabled) - MvccUtils.throwAtomicityModesMismatchException(cctx0.config(), cctx.config()); - } - - return mvccEnabled; - } - /** * Check if query is valid. * diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java index 9dec2c5749173..bfa265d447487 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java @@ -51,6 +51,7 @@ import org.h2.command.Prepared; import org.h2.command.dml.Query; import org.h2.table.Column; + import static org.apache.ignite.internal.processors.query.h2.opt.join.CollocationModel.isCollocated; import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlConst.TRUE; import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlFunctionType.AVG; @@ -317,7 +318,6 @@ private static GridCacheTwoStepQuery split0( } List cacheIds = H2Utils.collectCacheIds(idx, null, splitter.tbls); - boolean mvccEnabled = H2Utils.collectMvccEnabled(idx, cacheIds); boolean replicatedOnly = splitter.mapSqlQrys.stream().noneMatch(GridCacheSqlQuery::isPartitioned); boolean treatReplicatedAsPartitioned = splitter.mapSqlQrys.stream().anyMatch(GridCacheSqlQuery::treatReplicatedAsPartitioned); @@ -336,7 +336,7 @@ private static GridCacheTwoStepQuery split0( replicatedOnly, splitter.extractor.mergeMapQueries(splitter.mapSqlQrys), cacheIds, - mvccEnabled, + false, locSplit, treatReplicatedAsPartitioned ); From 5559c81c7c5a115ace883561aff6b47a8f9664c4 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 18:34:11 +0300 Subject: [PATCH 17/27] WIP --- .../processors/query/h2/IgniteH2Indexing.java | 55 +------------------ 1 file changed, 2 insertions(+), 53 deletions(-) diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java index f33f12c73287e..805dfa5d3bee7 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java @@ -61,7 +61,6 @@ import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor; import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.GridCacheContextInfo; -import org.apache.ignite.internal.processors.cache.KeyCacheObject; import org.apache.ignite.internal.processors.cache.QueryCursorImpl; import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteClusterReadOnlyException; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture; @@ -159,9 +158,7 @@ import static java.lang.Math.max; import static java.lang.Math.min; import static java.util.Collections.singletonList; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_MVCC_TX_SIZE_CACHING_THRESHOLD; import static org.apache.ignite.events.EventType.EVT_SQL_QUERY_EXECUTION; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccCachingManager.TX_SIZE_THRESHOLD; import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.checkActive; import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.mvccEnabled; import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.requestSnapshot; @@ -1413,57 +1410,9 @@ private Iterable> executeSelect0( * @return Query results cursor. */ private Iterable> lockSelectedRows(Iterable> cur, GridCacheContext cctx, int pageSize, long timeout) { - assert cctx != null && cctx.mvccEnabled(); + assert false; // !mvcc enabled. - GridNearTxLocal tx = tx(ctx); - - if (tx == null) - throw new IgniteSQLException("Failed to perform SELECT FOR UPDATE operation: transaction has already finished."); - - Collection> rowsCache = new ArrayList<>(); - - UpdateSourceIterator srcIt = new UpdateSourceIterator() { - private Iterator> it = cur.iterator(); - - @Override public EnlistOperation operation() { - return EnlistOperation.LOCK; - } - - @Override public boolean hasNextX() throws IgniteCheckedException { - return it.hasNext(); - } - - @Override public KeyCacheObject nextX() throws IgniteCheckedException { - List res = it.next(); - - // nextX() can be called from the different threads. - synchronized (rowsCache) { - rowsCache.add(res.subList(0, res.size() - 1)); - - if (rowsCache.size() > TX_SIZE_THRESHOLD) { - throw new IgniteCheckedException("Too many rows are locked by SELECT FOR UPDATE statement. " + - "Consider locking fewer keys or increase the limit by setting a " + - IGNITE_MVCC_TX_SIZE_CACHING_THRESHOLD + " system property. Current value is " + - TX_SIZE_THRESHOLD + " rows."); - } - } - - // The last column is expected to be a _key. - return cctx.toCacheKeyObject(res.get(res.size() - 1)); - } - }; - - IgniteInternalFuture fut = tx.updateAsync(cctx, srcIt, pageSize, - timeout, true); - - try { - fut.get(); - } - catch (IgniteCheckedException e) { - throw U.convertException(e); - } - - return rowsCache; + return null; } /** From c13e561900058bac9adbe92c56f407e2e718f001 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 18:36:17 +0300 Subject: [PATCH 18/27] WIP --- .../processors/query/h2/IgniteH2Indexing.java | 34 ++++++------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java index 805dfa5d3bee7..cc011d23d918f 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java @@ -2370,35 +2370,21 @@ private UpdateResult executeUpdate( GridCacheContext cctx = dml.plan().cacheContext(); - boolean transactional = cctx != null && cctx.mvccEnabled(); - - int maxRetryCnt = transactional ? 1 : DFLT_UPDATE_RERUN_ATTEMPTS; - - for (int i = 0; i < maxRetryCnt; i++) { + for (int i = 0; i < DFLT_UPDATE_RERUN_ATTEMPTS; i++) { CacheOperationContext opCtx = cctx != null ? DmlUtils.setKeepBinaryContext(cctx) : null; UpdateResult r; try { - if (transactional) - r = executeUpdateTransactional( - qryId, - qryDesc, - qryParams, - dml, - loc, - cancel - ); - else - r = executeUpdateNonTransactional( - qryId, - qryDesc, - qryParams, - dml, - loc, - filters, - cancel - ); + r = executeUpdateNonTransactional( + qryId, + qryDesc, + qryParams, + dml, + loc, + filters, + cancel + ); } finally { if (opCtx != null) From fbeeac48363601315cdcde648815b461ad73a2ea Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 18:40:42 +0300 Subject: [PATCH 19/27] WIP --- .../distributed/IgniteCacheFailedUpdateResponseTest.java | 5 ++--- .../internal/processors/query/h2/sql/GridSqlQueryParser.java | 3 --- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java index cc0f4ed07574a..ae4bc957bd64e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java @@ -38,7 +38,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.cache.IgniteCacheProxy; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; @@ -140,7 +139,7 @@ public void testInvokeTx() throws Exception { * @param cache Cache. */ private void testInvoke(final IgniteCache cache) throws Exception { - Class exp = grid("client").transactions().tx() == null || ((IgniteCacheProxy)cache).context().mvccEnabled() + Class exp = grid("client").transactions().tx() == null ? EntryProcessorException.class : NonSerializableException.class; @@ -176,7 +175,7 @@ private void testInvokeAll(final IgniteCache cache) throws Excep assertNotNull(epRes); // In transactions EP will be invoked locally. - Class exp = grid("client").transactions().tx() == null || ((IgniteCacheProxy)cache).context().mvccEnabled() + Class exp = grid("client").transactions().tx() == null ? EntryProcessorException.class : NonSerializableException.class; diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java index 7c84d3bce047b..99765a5395f15 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java @@ -1840,9 +1840,6 @@ public boolean isLocalQuery() { if (cctx == null) return false; - if (cctx.mvccEnabled()) - return false; - if (cctx.isPartitioned()) return false; From 3a4fd59407d0903ce782c6df60656aa3dc30950b Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 18:50:11 +0300 Subject: [PATCH 20/27] WIP --- .../internal/processors/cache/GridCacheContext.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java index 912a329f595cd..6136c24ce7239 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java @@ -2119,15 +2119,6 @@ public boolean readNoEntry(@Nullable IgniteCacheExpiryPolicy expiryPlc, boolean return !config().isOnheapCacheEnabled() && !readers && expiryPlc == null && config().getPlatformCacheConfiguration() == null; } - /** - * @return {@code True} if mvcc is enabled for cache. - */ - public boolean mvccEnabled() { - assert !grp.mvccEnabled(); - - return false; - } - /** * @param part Partition. * @param topVer Topology version. From 981b8d5da0abcf30824677ce34665a12ea2aa812 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 19:32:00 +0300 Subject: [PATCH 21/27] WIP --- .../GridDistributedTxRemoteAdapter.java | 2 +- .../dht/GridDhtTxFinishFuture.java | 6 +- .../dht/GridDhtTxPrepareFuture.java | 8 +-- .../GridNearPessimisticTxPrepareFuture.java | 64 ++++++++----------- .../distributed/near/GridNearTxLocal.java | 9 +-- .../cache/transactions/IgniteTxState.java | 5 -- 6 files changed, 30 insertions(+), 64 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java index 9b0f870cbbb6b..afc98e047cd9e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java @@ -490,7 +490,7 @@ private void commitIfLocked() throws IgniteCheckedException { Set reservedParts = new HashSet<>(); try { - assert !txState.mvccEnabled() || mvccSnapshot != null : "Mvcc is not initialized: " + this; + assert mvccSnapshot == null; Collection entries = near() ? allEntries() : writeEntries(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java index e53eacc2b74c6..387eaeff6cecd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java @@ -261,7 +261,7 @@ public void onResult(UUID nodeId, GridDhtTxFinishResponse res) { if (this.tx.syncMode() != PRIMARY_SYNC) this.tx.sendFinishReply(finishErr); - if (!this.tx.txState().mvccEnabled() && !commit && shouldApplyCountersOnRollbackError(finishErr)) { + if (!commit && shouldApplyCountersOnRollbackError(finishErr)) { TxCounters txCounters = this.tx.txCounters(false); if (txCounters != null) { @@ -319,7 +319,7 @@ public void finish(boolean commit) { MTC.supportContinual(span = cctx.kernalContext().tracing().create(TX_DHT_FINISH, MTC.span()))) { boolean sync; - assert !tx.txState().mvccEnabled() || tx.mvccSnapshot() != null; + assert tx.mvccSnapshot() == null; if (!F.isEmpty(dhtMap) || !F.isEmpty(nearMap)) sync = finish(commit, dhtMap, nearMap); @@ -435,8 +435,6 @@ private boolean finish(boolean commit, if (tx.onePhaseCommit()) return false; - assert !commit || !tx.txState().mvccEnabled() || tx.mvccSnapshot() != null || F.isEmpty(tx.writeEntries()); - boolean sync = tx.syncMode() == FULL_SYNC; if (tx.explicitLock() || tx.queryEnlisted()) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java index 6e9fe2e6168a8..4f8cbc9aabf8f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java @@ -1348,11 +1348,7 @@ private void prepare0() throws IgniteTxRollbackCheckedException { return; if (last) { - if (!tx.txState().mvccEnabled()) { - /** For MVCC counters are assigned on enlisting. */ - /** See usage of {@link TxCounters#incrementUpdateCounter(int, int)} ) */ - tx.calculatePartitionUpdateCounters(); - } + tx.calculatePartitionUpdateCounters(); recheckOnePhaseCommit(); @@ -1392,8 +1388,6 @@ private void recheckOnePhaseCommit() { * */ private void sendPrepareRequests() { - assert !tx.txState().mvccEnabled() || !tx.onePhaseCommit() || tx.mvccSnapshot() != null; - int miniId = 0; assert tx.transactionNodes() != null; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java index 0988ac2ccc5e5..2aa76f9bcbf48 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java @@ -288,7 +288,7 @@ private void prepareLocal(GridNearTxPrepareRequest req, */ @SuppressWarnings("unchecked") private void preparePessimistic() { - assert !tx.implicitSingle() || tx.txState().mvccEnabled(); // Non-mvcc implicit-single tx goes fast commit way. + assert !tx.implicitSingle(); Map mappings = new HashMap<>(); @@ -298,59 +298,45 @@ private void preparePessimistic() { Map> txNodes; - if (tx.txState().mvccEnabled()) { - Collection mvccMappings = tx.implicitSingle() - ? Collections.singleton(tx.mappings().singleMapping()) : tx.mappings().mappings(); + GridDhtTxMapping txMapping = new GridDhtTxMapping(); - txNodes = new HashMap<>(mvccMappings.size()); + for (IgniteTxEntry txEntry : tx.allEntries()) { + txEntry.clearEntryReadVersion(); - for (GridDistributedTxMapping m : mvccMappings) { - mappings.put(m.primary().id(), m); + GridCacheContext cacheCtx = txEntry.context(); - txNodes.put(m.primary().id(), m.backups()); - } - } - else { - GridDhtTxMapping txMapping = new GridDhtTxMapping(); - - for (IgniteTxEntry txEntry : tx.allEntries()) { - txEntry.clearEntryReadVersion(); - - GridCacheContext cacheCtx = txEntry.context(); - - if (cacheCtx.isNear()) - hasNearCache = true; + if (cacheCtx.isNear()) + hasNearCache = true; - List nodes; + List nodes; - GridDhtPartitionTopology top = cacheCtx.topology(); - nodes = top.nodes(cacheCtx.affinity().partition(txEntry.key()), topVer); + GridDhtPartitionTopology top = cacheCtx.topology(); + nodes = top.nodes(cacheCtx.affinity().partition(txEntry.key()), topVer); - if (F.isEmpty(nodes)) { - onDone(new ClusterTopologyServerNotFoundException("Failed to map keys to nodes (partition " + - "is not mapped to any node) [key=" + txEntry.key() + - ", partition=" + cacheCtx.affinity().partition(txEntry.key()) + ", topVer=" + topVer + ']')); + if (F.isEmpty(nodes)) { + onDone(new ClusterTopologyServerNotFoundException("Failed to map keys to nodes (partition " + + "is not mapped to any node) [key=" + txEntry.key() + + ", partition=" + cacheCtx.affinity().partition(txEntry.key()) + ", topVer=" + topVer + ']')); - return; - } - - ClusterNode primary = nodes.get(0); + return; + } - GridDistributedTxMapping nodeMapping = mappings.get(primary.id()); + ClusterNode primary = nodes.get(0); - if (nodeMapping == null) - mappings.put(primary.id(), nodeMapping = new GridDistributedTxMapping(primary)); + GridDistributedTxMapping nodeMapping = mappings.get(primary.id()); - txEntry.nodeId(primary.id()); + if (nodeMapping == null) + mappings.put(primary.id(), nodeMapping = new GridDistributedTxMapping(primary)); - nodeMapping.add(txEntry); + txEntry.nodeId(primary.id()); - txMapping.addMapping(nodes); - } + nodeMapping.add(txEntry); - txNodes = txMapping.transactionNodes(); + txMapping.addMapping(nodes); } + txNodes = txMapping.transactionNodes(); + tx.transactionNodes(txNodes); if (!hasNearCache) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java index 9797bd87c1b99..8c3e954151bde 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java @@ -3233,14 +3233,7 @@ public IgniteTxMappings mappings() { /** {@inheritDoc} */ @Override public boolean queryEnlisted() { - if (!txState.mvccEnabled()) - return false; - else if (qryEnlisted) - return true; - else if (mappings.single()) - return !mappings.empty() && mappings.singleMapping().queryUpdate(); - else - return mappings.mappings().stream().anyMatch(GridDistributedTxMapping::queryUpdate); + return false; } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxState.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxState.java index 6feab42292e92..0a32e96656f30 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxState.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxState.java @@ -190,11 +190,6 @@ public void addActiveCache(GridCacheContext cacheCtx, boolean recovery, IgniteTx */ public boolean empty(); - /** - * @return {@code True} if MVCC mode is enabled for transaction. - */ - public boolean mvccEnabled(); - /** * @param cacheId Cache id. * @return {@code True} if it is need to store in the heap updates made by the current TX for the given cache. From 34b4f0364785346ec6500f5455d3623ea2e3ba63 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 19:36:42 +0300 Subject: [PATCH 22/27] WIP --- .../dht/GridDhtTxAbstractEnlistFuture.java | 2 -- .../near/GridNearTxPrepareFutureAdapter.java | 2 +- .../transactions/IgniteTxLocalAdapter.java | 19 +------------------ .../cache/transactions/IgniteTxManager.java | 8 +------- 4 files changed, 3 insertions(+), 28 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxAbstractEnlistFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxAbstractEnlistFuture.java index 432f2f31cd5e7..4cc5310abc138 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxAbstractEnlistFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxAbstractEnlistFuture.java @@ -337,8 +337,6 @@ else if (tx.updateLockFuture(null, this)) else // Nothing to do for single update. assert tx.txState().cacheIds().contains(cctx.cacheId()) && tx.txState().cacheIds().size() == 1; - tx.markQueryEnlisted(); - this.it = it; } catch (Throwable e) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java index 35d38aafc45c0..24ef5b65fbbaf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java @@ -175,7 +175,7 @@ final void checkOnePhase(GridDhtTxMapping txMapping) { * @param txNodes Primary to backups node map. */ final void checkOnePhase(Map> txNodes) { - if (tx.storeWriteThrough() || tx.txState().mvccEnabled()) // TODO IGNITE-3479 (onePhase + mvcc) + if (tx.storeWriteThrough()) return; if (txNodes.size() == 1) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java index 61245b2993332..d34490e4461bd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java @@ -404,9 +404,6 @@ public void userPrepare(@Nullable Collection entries) throws Igni try { cctx.tm().prepareTx(this, entries); - - if (txState().mvccEnabled()) - calculatePartitionUpdateCounters(); } catch (IgniteCheckedException e) { throw e; @@ -859,7 +856,7 @@ assert ownsLock(txEntry.cached()) : } } - if (!txState.mvccEnabled() && txCounters != null) { + if (txCounters != null) { cctx.tm().txHandler().applyPartitionsUpdatesCounters(txCounters.updateCounters()); for (IgniteTxEntry entry : commitEntries) { @@ -1616,20 +1613,6 @@ public boolean queryEnlisted() { return qryEnlisted; } - /** - * Marks that there are entries, enlisted by query. - */ - public void markQueryEnlisted() { - assert mvccSnapshot != null && txState.mvccEnabled(); - - if (!qryEnlisted) { - qryEnlisted = true; - - if (!cctx.localNode().isClient()) - cctx.coordinators().registerLocalTransaction(mvccSnapshot.coordinatorVersion(), mvccSnapshot.counter()); - } - } - /** * Post-lock closure alias. * diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java index 29b61efb7ebaa..cd1483f93d902 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java @@ -60,7 +60,6 @@ import org.apache.ignite.internal.managers.eventstorage.HighPriorityListener; import org.apache.ignite.internal.managers.systemview.walker.TransactionViewWalker; import org.apache.ignite.internal.pagemem.wal.record.DataEntry; -import org.apache.ignite.internal.pagemem.wal.record.MvccTxRecord; import org.apache.ignite.internal.pagemem.wal.record.TxRecord; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.cache.CacheObjectsReleaseFuture; @@ -2800,12 +2799,7 @@ public void mvccFinish(IgniteTxAdapter tx) { Map> nodes = tx.consistentIdMapper.mapToCompactIds(tx.topVer, tx.txNodes, baselineTop); - TxRecord record; - - if (tx.txState().mvccEnabled()) - record = new MvccTxRecord(tx.state(), tx.nearXidVersion(), tx.writeVersion(), nodes, tx.mvccSnapshot()); - else - record = new TxRecord(tx.state(), tx.nearXidVersion(), tx.writeVersion(), nodes); + TxRecord record = new TxRecord(tx.state(), tx.nearXidVersion(), tx.writeVersion(), nodes); try { return cctx.wal().log(record); From 637e589123cf3c006462d9edce67261dfc198543 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 19:37:48 +0300 Subject: [PATCH 23/27] WIP --- .../cache/transactions/IgniteTxImplicitSingleStateImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java index 186ddfdc4034a..5b27cba418675 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java @@ -317,7 +317,7 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter { } /** {@inheritDoc} */ - @Override public boolean mvccEnabled() { + public boolean mvccEnabled() { return false; } From 7b5d11b2f06ba48d116669f7b3adc386c3a519a3 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 19:38:15 +0300 Subject: [PATCH 24/27] WIP --- .../cache/transactions/IgniteTxRemoteStateAdapter.java | 2 +- .../processors/cache/transactions/IgniteTxStateImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java index aad1f7da6da75..ea327f1a16fa1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java @@ -131,7 +131,7 @@ public abstract class IgniteTxRemoteStateAdapter implements IgniteTxRemoteState } /** {@inheritDoc} */ - @Override public boolean mvccEnabled() { + public boolean mvccEnabled() { return mvccEnabled; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java index a8a6162ce810e..065f204d2848a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java @@ -483,7 +483,7 @@ public synchronized Collection allEntriesCopy() { } /** {@inheritDoc} */ - @Override public boolean mvccEnabled() { + public boolean mvccEnabled() { return Boolean.TRUE == mvccEnabled; } From a7c914fae16d4585d1bf8ddb33cba1387e9c3ec4 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 20:30:19 +0300 Subject: [PATCH 25/27] WIP --- .../ignite/internal/processors/cache/GridCacheAdapter.java | 3 +-- .../cache/distributed/dht/GridPartitionedGetFuture.java | 1 - .../cache/distributed/dht/GridPartitionedSingleGetFuture.java | 1 - .../ignite/internal/processors/cache/mvcc/MvccUtils.java | 2 +- .../ignite/internal/processors/query/h2/IgniteH2Indexing.java | 2 +- 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index 9576bd3397b17..6a54eee097626 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -765,8 +765,7 @@ public void onKernalStop() { IgniteCacheOffheapManager offheapMgr = ctx.isNear() ? ctx.near().dht().context().offheap() : ctx.offheap(); - its.add(offheapMgr.cacheEntriesIterator(ctx, modes.primary, modes.backup, topVer, ctx.keepBinary(), - null, null)); + its.add(offheapMgr.cacheEntriesIterator(ctx, modes.primary, modes.backup, topVer, ctx.keepBinary(), null, null)); } } else if (modes.heap) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java index 0b9c4ade4be3a..a890cd792a85c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java @@ -421,7 +421,6 @@ private boolean tryLocalGet( List affNodes, Map locVals ) { - // Local get cannot be used with MVCC as local node can contain some visible version which is not latest. boolean fastLocGet = (!forcePrimary || affNodes.get(0).isLocal()) && cctx.reserveForFastLocalGet(part, topVer); if (fastLocGet) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java index f27d55374e742..3233a3a93f808 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java @@ -427,7 +427,6 @@ private boolean tryLocalGet( AffinityTopologyVersion topVer, List affNodes ) { - // Local get cannot be used with MVCC as local node can contain some visible version which is not latest. boolean fastLocGet = (!forcePrimary || affNodes.get(0).isLocal()) && cctx.reserveForFastLocalGet(part, topVer); if (fastLocGet) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java index 46b170754dc7d..29ca654c5d26a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java @@ -585,7 +585,7 @@ private static boolean isVisible(GridCacheContext cctx, long link, */ private static R invoke(GridCacheContext cctx, long link, MvccClosure clo, MvccSnapshot snapshot) throws IgniteCheckedException { - assert false; // !mvcc enabled + assert false; // ex mvcc code, should never happen return null; } diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java index cc011d23d918f..681f019b843e3 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java @@ -1410,7 +1410,7 @@ private Iterable> executeSelect0( * @return Query results cursor. */ private Iterable> lockSelectedRows(Iterable> cur, GridCacheContext cctx, int pageSize, long timeout) { - assert false; // !mvcc enabled. + assert false; // ex mvcc code, should never happen return null; } From 9bc34916c999597bc94a7ca7d7507f093a9f9d41 Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 21:01:33 +0300 Subject: [PATCH 26/27] WIP --- .../cache/transactions/IgniteTxImplicitSingleStateImpl.java | 2 +- .../cache/transactions/IgniteTxRemoteStateAdapter.java | 2 +- .../processors/cache/transactions/IgniteTxStateImpl.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java index 5b27cba418675..113f582c24c4f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java @@ -316,7 +316,7 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter { return entry != null ? entry.get(0) : null; } - /** {@inheritDoc} */ + /** MVCC Enabled */ public boolean mvccEnabled() { return false; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java index ea327f1a16fa1..da8a8dcb8242e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java @@ -130,7 +130,7 @@ public abstract class IgniteTxRemoteStateAdapter implements IgniteTxRemoteState assert false; } - /** {@inheritDoc} */ + /** MVCC Enabled */ public boolean mvccEnabled() { return mvccEnabled; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java index 065f204d2848a..68422a5aaf0f1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java @@ -482,7 +482,7 @@ public synchronized Collection allEntriesCopy() { return writeView != null && writeView.size() == 1 ? F.firstValue(writeView) : null; } - /** {@inheritDoc} */ + /** MVCC Enabled */ public boolean mvccEnabled() { return Boolean.TRUE == mvccEnabled; } From 36bc10afa55f6bebc65555883f67c176eaf7a31c Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Wed, 20 Sep 2023 15:48:34 +0300 Subject: [PATCH 27/27] WIP --- .../Cache/CachePartitionedTest.cs | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedTest.cs index c9100b223aaa3..fc777917de831 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedTest.cs @@ -44,39 +44,5 @@ protected override int Backups() { return 1; } - - /// - /// Test MVCC transaction. - /// - [Test] - public void TestMvccTransaction() - { - IIgnite ignite = GetIgnite(0); - - ICache cache = ignite.GetOrCreateCache(new CacheConfiguration - { - Name = "mvcc", - AtomicityMode = CacheAtomicityMode.TransactionalSnapshot - }); - - ITransaction tx = ignite.GetTransactions().TxStart(); - - cache.Put(1, 1); - cache.Put(2, 2); - - tx.Commit(); - - Assert.AreEqual(1, cache.Get(1)); - Assert.AreEqual(2, cache.Get(2)); - - tx = ignite.GetTransactions().TxStart(); - - Assert.AreEqual(1, cache.Get(1)); - Assert.AreEqual(2, cache.Get(2)); - - tx.Commit(); - - ignite.DestroyCache("mvcc"); - } } }