From 6f77083e7649cef17e72d99a2fe6e54b4556aced Mon Sep 17 00:00:00 2001 From: Anton Vinogradov Date: Tue, 19 Sep 2023 14:57:21 +0300 Subject: [PATCH] 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.