diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java index 917ac650e28c1..17c871b09707f 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java @@ -74,7 +74,6 @@ import static java.sql.Statement.RETURN_GENERATED_KEYS; import static org.apache.ignite.cache.query.SqlFieldsQuery.DFLT_LAZY; import static org.apache.ignite.configuration.ClientConnectorConfiguration.DFLT_PORT; -import static org.apache.ignite.internal.processors.odbc.SqlStateCode.TRANSACTION_STATE_EXCEPTION; import static org.apache.ignite.testframework.GridTestUtils.assertThrows; import static org.apache.ignite.testframework.GridTestUtils.assertThrowsAnyCause; import static org.apache.ignite.testframework.GridTestUtils.getFieldValue; @@ -1290,50 +1289,6 @@ public void testRollback() throws Exception { } } - /** - * @throws Exception if failed. - */ - @Test - public void testBeginFails() throws Exception { - try (Connection conn = DriverManager.getConnection(urlWithPartitionAwarenessProp)) { - conn.createStatement().execute("BEGIN"); - - fail("Exception is expected"); - } - catch (SQLException e) { - assertEquals(TRANSACTION_STATE_EXCEPTION, e.getSQLState()); - } - } - - /** - * @throws Exception if failed. - */ - @Test - public void testCommitIgnored() throws Exception { - try (Connection conn = DriverManager.getConnection(urlWithPartitionAwarenessProp)) { - conn.setAutoCommit(false); - conn.createStatement().execute("COMMIT"); - - conn.commit(); - } - // assert no exception - } - - /** - * @throws Exception if failed. - */ - @Test - public void testRollbackIgnored() throws Exception { - try (Connection conn = DriverManager.getConnection(urlWithPartitionAwarenessProp)) { - conn.setAutoCommit(false); - - conn.createStatement().execute("ROLLBACK"); - - conn.rollback(); - } - // assert no exception - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/inline/InlineIndexTree.java b/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/inline/InlineIndexTree.java index 928284a174c1b..79e863c9dd4b5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/inline/InlineIndexTree.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/inline/InlineIndexTree.java @@ -154,7 +154,7 @@ public InlineIndexTree( this.idxRowCache = idxRowCache; - mvccEnabled = grpCtx.mvccEnabled(); + mvccEnabled = false; if (!initNew) { // Init from metastore. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java index 64f5d9bbdd605..99bed931a2895 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java @@ -287,13 +287,6 @@ public CacheGroupContext( topValidators = Collections.unmodifiableCollection(topologyValidators(ccfg, ctx.kernalContext().plugins())); } - /** - * @return Mvcc flag. - */ - public boolean mvccEnabled() { - return mvccEnabled; - } - /** * @return {@code True} if this is cache group for one of system caches. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java index d88788bdccd69..81a9787f9e8d5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java @@ -51,7 +51,6 @@ import org.apache.ignite.internal.util.lang.GridIterator; import org.apache.ignite.internal.util.lang.IgniteInClosure2X; import org.apache.ignite.internal.util.lang.IgnitePredicateX; -import org.apache.ignite.lang.IgniteBiTuple; import org.jetbrains.annotations.Nullable; /** @@ -198,17 +197,6 @@ public void invoke(GridCacheContext cctx, KeyCacheObject key, GridDhtLocalPartit @Nullable public CacheDataRow mvccRead(GridCacheContext cctx, KeyCacheObject key, MvccSnapshot mvccSnapshot) throws IgniteCheckedException; - /** - * For testing only. - * - * @param cctx Cache context. - * @param key Key. - * @return All stored versions for given key. - * @throws IgniteCheckedException If failed. - */ - public List> mvccAllVersions(GridCacheContext cctx, KeyCacheObject key) - throws IgniteCheckedException; - /** * Returns iterator over the all row versions for the given key. * @@ -983,17 +971,6 @@ GridCursor mvccAllVersionsCursor(GridCacheContext cctx, KeyCacheOb public CacheDataRow mvccFind(GridCacheContext cctx, KeyCacheObject key, MvccSnapshot snapshot) throws IgniteCheckedException; - /** - * For testing only. - * - * @param cctx Cache context. - * @param key Key. - * @return All stored versions for given key. - * @throws IgniteCheckedException If failed. - */ - List> mvccFindAllVersions(GridCacheContext cctx, KeyCacheObject key) - throws IgniteCheckedException; - /** * @return Data cursor. * @throws IgniteCheckedException If failed. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java index e785cf50c906d..1100e06ab0944 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java @@ -19,7 +19,6 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -46,7 +45,6 @@ import org.apache.ignite.internal.pagemem.FullPageId; import org.apache.ignite.internal.pagemem.PageMemory; import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager; -import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageMvccMarkUpdatedRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageMvccUpdateNewTxStateHintRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageMvccUpdateTxStateHintRecord; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; @@ -89,7 +87,6 @@ import org.apache.ignite.internal.processors.cache.tree.mvcc.data.MvccUpdateResult; import org.apache.ignite.internal.processors.cache.tree.mvcc.data.ResultType; import org.apache.ignite.internal.processors.cache.tree.mvcc.search.MvccDataPageClosure; -import org.apache.ignite.internal.processors.cache.tree.mvcc.search.MvccFirstRowTreeClosure; import org.apache.ignite.internal.processors.cache.tree.mvcc.search.MvccLinkAwareSearchRow; import org.apache.ignite.internal.processors.cache.tree.mvcc.search.MvccMaxSearchRow; import org.apache.ignite.internal.processors.cache.tree.mvcc.search.MvccMinSearchRow; @@ -118,24 +115,18 @@ import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.lang.IgnitePredicate; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import static java.lang.Boolean.TRUE; import static org.apache.ignite.internal.pagemem.PageIdAllocator.FLAG_IDX; import static org.apache.ignite.internal.pagemem.PageIdAllocator.INDEX_PARTITION; import static org.apache.ignite.internal.processors.cache.GridCacheUtils.TTL_ETERNAL; import static org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.OWNING; import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.INITIAL_VERSION; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.MVCC_COUNTER_NA; import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.MVCC_CRD_COUNTER_NA; import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.MVCC_HINTS_BIT_OFF; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.MVCC_KEY_ABSENT_BEFORE_OFF; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.MVCC_OP_COUNTER_MASK; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.MVCC_OP_COUNTER_NA; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.compare; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.compareNewVersion; import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.isVisible; import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.mvccVersionIsValid; import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.state; @@ -643,15 +634,6 @@ private Iterator cacheData(boolean primary, boolean backup, Affi return row; } - /** {@inheritDoc} */ - @Override public List> mvccAllVersions(GridCacheContext cctx, KeyCacheObject key) - throws IgniteCheckedException { - CacheDataStore dataStore = dataStore(cctx, key); - - return dataStore != null ? dataStore.mvccFindAllVersions(cctx, key) : - Collections.emptyList(); - } - /** {@inheritDoc} */ @Override public GridCursor mvccAllVersionsCursor(GridCacheContext cctx, KeyCacheObject key, Object x) throws IgniteCheckedException { @@ -1467,9 +1449,9 @@ public CacheDataStoreImpl( this.busyLock = busyLock; this.log = log; - PartitionUpdateCounter delegate = grp.mvccEnabled() ? new PartitionUpdateCounterMvccImpl(grp) : - !grp.persistenceEnabled() || grp.hasAtomicCaches() ? new PartitionUpdateCounterVolatileImpl(grp) : - new PartitionUpdateCounterTrackingImpl(grp); + PartitionUpdateCounter delegate = !grp.persistenceEnabled() || grp.hasAtomicCaches() ? + new PartitionUpdateCounterVolatileImpl(grp) : + new PartitionUpdateCounterTrackingImpl(grp); pCntr = grp.shared().logger(PartitionUpdateCounterDebugWrapper.class).isDebugEnabled() ? new PartitionUpdateCounterDebugWrapper(partId, delegate) : new PartitionUpdateCounterErrorWrapper(partId, delegate); @@ -1547,18 +1529,7 @@ void decrementSize(int cacheId) { * @return {@code True} if there are no items in the store. */ @Override public boolean isEmpty() { - try { - /* - * TODO https://issues.apache.org/jira/browse/IGNITE-10082 - * Using of counters is cheaper than tree operations. Return size checking after the ticked is resolved. - */ - return grp.mvccEnabled() ? dataTree.isEmpty() : storageSize.sum() == 0; - } - catch (IgniteCheckedException e) { - U.error(grp.shared().logger(IgniteCacheOffheapManagerImpl.class), "Failed to perform operation.", e); - - return false; - } + return storageSize.sum() == 0; } /** {@inheritDoc} */ @@ -1662,7 +1633,7 @@ void decrementSize(int cacheId) { */ private boolean canUpdateOldRow(GridCacheContext cctx, @Nullable CacheDataRow oldRow, DataRow dataRow) throws IgniteCheckedException { - if (oldRow == null || cctx.queries().enabled() || grp.mvccEnabled()) + if (oldRow == null || cctx.queries().enabled()) return false; if (oldRow.expireTime() != dataRow.expireTime()) @@ -2468,14 +2439,7 @@ private int cleanup0(GridCacheContext cctx, @Nullable List> mvccFindAllVersions( - GridCacheContext cctx, - KeyCacheObject key - ) throws IgniteCheckedException { - assert grp.mvccEnabled(); - - // Note: this method is intended for testing only. - - key.valueBytes(cctx.cacheObjectContext()); - - int cacheId = grp.sharedGroup() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID; - - GridCursor cur = dataTree.find( - new MvccMaxSearchRow(cacheId, key), - new MvccMinSearchRow(cacheId, key) - ); - - List> res = new ArrayList<>(); - - long crd = MVCC_CRD_COUNTER_NA; - long cntr = MVCC_COUNTER_NA; - int opCntr = MVCC_OP_COUNTER_NA; - - while (cur.next()) { - CacheDataRow row = cur.get(); - - if (compareNewVersion(row, crd, cntr, opCntr) != 0) // deleted row - res.add(F.t(null, row.newMvccVersion())); - - res.add(F.t(row.value(), row.mvccVersion())); - - crd = row.mvccCoordinatorVersion(); - cntr = row.mvccCounter(); - opCntr = row.mvccOperationCounter(); - } - - return res; - } - /** {@inheritDoc} */ @Override public GridCursor mvccAllVersionsCursor( GridCacheContext cctx, KeyCacheObject key, Object x @@ -2880,17 +2790,7 @@ private void afterRowFound(@Nullable CacheDataRow row, KeyCacheObject key) throw @Override public GridCursor cursor(MvccSnapshot mvccSnapshot) throws IgniteCheckedException { - GridCursor cursor; - if (mvccSnapshot != null) { - assert grp.mvccEnabled(); - - cursor = dataTree.find(null, null, - new MvccFirstVisibleRowTreeClosure(grp.singleCacheContext(), mvccSnapshot), null); - } - else - cursor = dataTree.find(null, null); - - return cursor; + return dataTree.find(null, null); } /** {@inheritDoc} */ @@ -2933,19 +2833,7 @@ private void afterRowFound(@Nullable CacheDataRow row, KeyCacheObject key) throw upperRow = upper != null ? new SearchRow(CU.UNDEFINED_CACHE_ID, upper) : null; } - GridCursor cursor; - - if (snapshot != null) { - assert grp.mvccEnabled(); - - GridCacheContext cctx = grp.sharedGroup() ? grp.shared().cacheContext(cacheId) : grp.singleCacheContext(); - - cursor = dataTree.find(lowerRow, upperRow, new MvccFirstVisibleRowTreeClosure(cctx, snapshot), x); - } - else - cursor = dataTree.find(lowerRow, upperRow, x); - - return cursor; + return dataTree.find(lowerRow, upperRow, x); } /** {@inheritDoc} */ @@ -3266,43 +3154,16 @@ public boolean found() { * Mvcc remove handler. */ private static final class MvccMarkUpdatedHandler extends PageHandler { - /** */ - private final CacheGroupContext grp; - /** */ private MvccMarkUpdatedHandler(CacheGroupContext grp) { - this.grp = grp; } /** {@inheritDoc} */ @Override public Boolean run(int cacheId, long pageId, long page, long pageAddr, PageIO io, Boolean walPlc, MvccUpdateDataRow updateDataRow, int itemId, IoStatisticsHolder statHolder) throws IgniteCheckedException { - assert grp.mvccEnabled(); - - PageMemory pageMem = grp.dataRegion().pageMemory(); - IgniteWriteAheadLogManager wal = grp.shared().wal(); - - DataPageIO iox = (DataPageIO)io; - - int off = iox.getPayloadOffset(pageAddr, itemId, - pageMem.realPageSize(grp.groupId()), MVCC_INFO_SIZE); + assert false; // ex mvcc code. - long newCrd = iox.newMvccCoordinator(pageAddr, off); - long newCntr = iox.newMvccCounter(pageAddr, off); - int newOpCntr = iox.rawNewMvccOperationCounter(pageAddr, off); - - assert newCrd == MVCC_CRD_COUNTER_NA || state(grp, newCrd, newCntr, newOpCntr) == TxState.ABORTED; - - int keyAbsentBeforeFlag = updateDataRow.isKeyAbsentBefore() ? (1 << MVCC_KEY_ABSENT_BEFORE_OFF) : 0; - - iox.updateNewVersion(pageAddr, off, updateDataRow.mvccCoordinatorVersion(), updateDataRow.mvccCounter(), - updateDataRow.mvccOperationCounter() | keyAbsentBeforeFlag, TxState.NA); - - if (isWalDeltaRecordNeeded(pageMem, cacheId, pageId, page, wal, walPlc)) - wal.log(new DataPageMvccMarkUpdatedRecord(cacheId, pageId, itemId, - updateDataRow.mvccCoordinatorVersion(), updateDataRow.mvccCounter(), updateDataRow.mvccOperationCounter())); - - return TRUE; + return false; } } @@ -3374,81 +3235,16 @@ private MvccUpdateTxStateHintHandler(CacheGroupContext grp) { * Applies changes to the row. */ private static final class MvccApplyChangesHandler extends PageHandler { - /** */ - private final CacheGroupContext grp; - /** */ private MvccApplyChangesHandler(CacheGroupContext grp) { - this.grp = grp; } /** {@inheritDoc} */ @Override public Boolean run(int cacheId, long pageId, long page, long pageAddr, PageIO io, Boolean walPlc, MvccDataRow newRow, int itemId, IoStatisticsHolder statHolder) throws IgniteCheckedException { - assert grp.mvccEnabled(); + assert false; // ex mvcc code. - DataPageIO iox = (DataPageIO)io; - - PageMemory pageMem = grp.dataRegion().pageMemory(); - IgniteWriteAheadLogManager wal = grp.shared().wal(); - - int off = iox.getPayloadOffset(pageAddr, itemId, - pageMem.realPageSize(grp.groupId()), MVCC_INFO_SIZE); - - long crd = iox.mvccCoordinator(pageAddr, off); - long cntr = iox.mvccCounter(pageAddr, off); - int opCntrAndHint = iox.rawMvccOperationCounter(pageAddr, off); - int opCntr = opCntrAndHint & MVCC_OP_COUNTER_MASK; - byte txState = (byte)(opCntrAndHint >>> MVCC_HINTS_BIT_OFF); - - long newCrd = iox.newMvccCoordinator(pageAddr, off); - long newCntr = iox.newMvccCounter(pageAddr, off); - int newOpCntrAndHint = iox.rawNewMvccOperationCounter(pageAddr, off); - int newOpCntr = newOpCntrAndHint & MVCC_OP_COUNTER_MASK; - byte newTxState = (byte)(newOpCntrAndHint >>> MVCC_HINTS_BIT_OFF); - - assert crd == newRow.mvccCoordinatorVersion(); - assert cntr == newRow.mvccCounter(); - assert opCntr == newRow.mvccOperationCounter(); - - assert newRow.mvccTxState() != TxState.NA : newRow.mvccTxState(); - - if (txState != newRow.mvccTxState() && newRow.mvccTxState() != TxState.NA) { - assert txState == TxState.NA : txState; - - iox.rawMvccOperationCounter(pageAddr, off, opCntr | (newRow.mvccTxState() << MVCC_HINTS_BIT_OFF)); - - if (isWalDeltaRecordNeeded(pageMem, cacheId, pageId, page, wal, walPlc)) - wal.log(new DataPageMvccUpdateTxStateHintRecord(cacheId, pageId, itemId, newRow.mvccTxState())); - } - - if (compare(newCrd, - newCntr, - newOpCntr, - newRow.newMvccCoordinatorVersion(), - newRow.newMvccCounter(), - newRow.newMvccOperationCounter()) != 0) { - - assert newRow.newMvccTxState() == TxState.NA || newRow.newMvccCoordinatorVersion() != MVCC_CRD_COUNTER_NA; - - iox.updateNewVersion(pageAddr, off, newRow.newMvccCoordinatorVersion(), newRow.newMvccCounter(), - newRow.newMvccOperationCounter(), newRow.newMvccTxState()); - - if (isWalDeltaRecordNeeded(pageMem, cacheId, pageId, page, wal, walPlc)) - wal.log(new DataPageMvccMarkUpdatedRecord(cacheId, pageId, itemId, - newRow.newMvccCoordinatorVersion(), newRow.newMvccCounter(), - newRow.newMvccOperationCounter() | (newRow.newMvccTxState() << MVCC_HINTS_BIT_OFF))); - } - else if (newTxState != newRow.newMvccTxState() && newRow.newMvccTxState() != TxState.NA) { - assert newTxState == TxState.NA : newTxState; - - iox.rawNewMvccOperationCounter(pageAddr, off, newOpCntr | (newRow.newMvccTxState() << MVCC_HINTS_BIT_OFF)); - - if (isWalDeltaRecordNeeded(pageMem, cacheId, pageId, page, wal, walPlc)) - wal.log(new DataPageMvccUpdateNewTxStateHintRecord(cacheId, pageId, itemId, newRow.newMvccTxState())); - } - - return TRUE; + return false; } } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java index 4b80722218556..fd68fec7f8150 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java @@ -637,13 +637,9 @@ else if (supplyMsg.error() != null) ); try { - if (grp.mvccEnabled()) - mvccPreloadEntries(topVer, node, p, infosWrap); - else { - preloadEntries(topVer, part, infosWrap); + preloadEntries(topVer, part, infosWrap); - rebalanceFut.onReceivedKeys(p, e.getValue().infos().size(), node); - } + rebalanceFut.onReceivedKeys(p, e.getValue().infos().size(), node); } catch (GridDhtInvalidPartitionException ignored) { if (log.isDebugEnabled()) @@ -896,7 +892,6 @@ private void preloadEntries( * @throws IgniteInterruptedCheckedException If interrupted. */ private boolean preloadEntry(CacheDataRow row, AffinityTopologyVersion topVer) throws IgniteCheckedException { - assert !grp.mvccEnabled(); assert ctx.database().checkpointLockIsHeldByThread(); GridCacheContext cctx = grp.sharedGroup() ? ctx.cacheContext(row.cacheId()) : grp.singleCacheContext(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java index 0cdcb8a61f757..9c21b3b1096b7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java @@ -38,15 +38,10 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.cache.CacheGroupContext; import org.apache.ignite.internal.processors.cache.GridCacheEntryInfo; -import org.apache.ignite.internal.processors.cache.GridCacheMvccEntryInfo; import org.apache.ignite.internal.processors.cache.IgniteRebalanceIterator; import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition; import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState; 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.MvccUtils; -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.persistence.CacheDataRow; import org.apache.ignite.internal.util.tostring.GridToStringExclude; import org.apache.ignite.internal.util.typedef.F; @@ -324,17 +319,8 @@ public void handleDemandMessage(int topicId, UUID nodeId, GridDhtPartitionDemand long batchesCnt = 0; - CacheDataRow prevRow = null; - while (iter.hasNext()) { - CacheDataRow row = iter.peek(); - - // Prevent mvcc entry history splitting into separate batches. - boolean canFlushHistory = !grp.mvccEnabled() || - prevRow != null && ((grp.sharedGroup() && row.cacheId() != prevRow.cacheId()) || - !row.key().equals(prevRow.key())); - - if (canFlushHistory && supplyMsg.messageSize() >= msgMaxSize) { + if (supplyMsg.messageSize() >= msgMaxSize) { if (++batchesCnt >= maxBatchesCnt) { saveSupplyContext(contextId, iter, @@ -357,9 +343,7 @@ public void handleDemandMessage(int topicId, UUID nodeId, GridDhtPartitionDemand } } - row = iter.next(); - - prevRow = row; + CacheDataRow row = iter.next(); int part = row.partition(); @@ -542,29 +526,10 @@ else if (iter.isPartitionMissing(p)) { * @return Entry info. */ private GridCacheEntryInfo extractEntryInfo(CacheDataRow row) { - GridCacheEntryInfo info = grp.mvccEnabled() ? - new GridCacheMvccEntryInfo() : new GridCacheEntryInfo(); + GridCacheEntryInfo info = new GridCacheEntryInfo(); info.key(row.key()); info.cacheId(row.cacheId()); - - if (grp.mvccEnabled()) { - assert row.mvccCoordinatorVersion() != MvccUtils.MVCC_CRD_COUNTER_NA; - - // Rows from rebalance iterator have actual states already. - if (row.mvccTxState() != TxState.COMMITTED) - return null; - - ((MvccVersionAware)info).mvccVersion(row); - ((GridCacheMvccEntryInfo)info).mvccTxState(TxState.COMMITTED); - - if (row.newMvccCoordinatorVersion() != MvccUtils.MVCC_CRD_COUNTER_NA && - row.newMvccTxState() == TxState.COMMITTED) { - ((MvccUpdateVersionAware)info).newMvccVersion(row); - ((GridCacheMvccEntryInfo)info).newMvccTxState(TxState.COMMITTED); - } - } - info.value(row.value()); info.version(row.version()); info.expireTime(row.expireTime()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java index eaf90a3612726..81687c2415059 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java @@ -1643,13 +1643,8 @@ private void distributedExchange() throws IgniteCheckedException { boolean skipWaitOnLocalJoin = localJoinExchange() && cctx.exchange().latch().canSkipJoiningNodes(initialVersion()); - if (context().exchangeFreeSwitch() && isBaselineNodeFailed()) { - // Currently MVCC does not support operations on partially switched cluster. - if (cctx.kernalContext().coordinators().mvccEnabled()) - waitPartitionRelease(EXCHANGE_FREE_LATCH_ID, true, false); - else - waitPartitionRelease(null, false, false); - } + if (context().exchangeFreeSwitch() && isBaselineNodeFailed()) + waitPartitionRelease(null, false, false); else if (!skipWaitOnLocalJoin) { // Skip partition release if node has locally joined (it doesn't have any updates to be finished). boolean distributed = true; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java index 9823d03885ab8..a22f7a764d3cd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java @@ -446,10 +446,6 @@ public void tryFinishEviction(GridDhtLocalPartition part) { /** {@inheritDoc} */ @Override public boolean needForceKeys() { - // Do not use force key request with enabled MVCC. - if (grp.mvccEnabled()) - return false; - if (grp.rebalanceEnabled()) { IgniteInternalFuture rebalanceFut = rebalanceFuture(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java index 818cf7eef0e45..a39212117ae21 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionTopologyImpl.java @@ -2894,9 +2894,7 @@ private void removeNode(UUID nodeId) { long gapStart = gaps.get(j * 2); long gapStop = gaps.get(j * 2 + 1); - if (part.group().persistenceEnabled() && - part.group().walEnabled() && - !part.group().mvccEnabled()) { + if (part.group().persistenceEnabled() && part.group().walEnabled()) { // Rollback record tracks applied out-of-order updates while finalizeUpdateCounters // return gaps (missing updates). The code below transforms gaps to updates. RollbackRecord rec = new RollbackRecord(part.group().groupId(), part.id(), diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionsStateValidator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionsStateValidator.java index d1dd063aa268d..8dafc6d67d5ed 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionsStateValidator.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionsStateValidator.java @@ -26,7 +26,6 @@ import java.util.Set; import java.util.TreeMap; import java.util.UUID; - import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.events.DiscoveryEvent; @@ -99,10 +98,8 @@ public void validatePartitionCountersAndSizes( ignoringNodes.add(id); } - if (!cctx.cache().cacheGroup(top.groupId()).mvccEnabled()) { // TODO: Remove "if" clause in IGNITE-9451. - // Validate cache sizes. - resSize = validatePartitionsSizes(top, messages, ignoringNodes); - } + // Validate cache sizes. + resSize = validatePartitionsSizes(top, messages, ignoringNodes); AffinityTopologyVersion topVer = fut.context().events().topologyVersion(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessor.java index f41d61579e0cd..010d86b7adba7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessor.java @@ -194,12 +194,6 @@ public interface MvccProcessor extends GridProcessor { */ void ackTxRollback(MvccVersion updateVer); - /** - * @return {@code True} if at least one cache with - * {@code CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT} mode is registered. - */ - boolean mvccEnabled(); - /** * Pre-processes cache configuration before start. * 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 b192559d215e9..6ebcca49ed262 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 @@ -57,7 +57,6 @@ import org.apache.ignite.internal.managers.eventstorage.DiscoveryEventListener; import org.apache.ignite.internal.processors.GridProcessorAdapter; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; -import org.apache.ignite.internal.processors.cache.CacheGroupContext; import org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch; import org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest; import org.apache.ignite.internal.processors.cache.GridCacheContext; @@ -267,11 +266,6 @@ public MvccProcessorImpl(GridKernalContext ctx) { ctx.discovery().setCustomEventListener(DynamicCacheChangeBatch.class, customLsnr); } - /** {@inheritDoc} */ - @Override public boolean mvccEnabled() { - return mvccEnabled; - } - /** {@inheritDoc} */ @Override public void preProcessCacheConfiguration(CacheConfiguration ccfg) { if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) { @@ -1183,12 +1177,8 @@ void stopVacuumWorkers() { cleanupQueue = null; } - if (workers == null) { - if (log.isDebugEnabled() && mvccEnabled()) - log.debug("Attempting to stop inactive vacuum."); - + if (workers == null) return; - } assert queue != null; @@ -1289,25 +1279,6 @@ else if (snapshot.cleanupVersion() <= MVCC_COUNTER_NA) } }; - for (CacheGroupContext grp : ctx.cache().cacheGroups()) { - if (grp.mvccEnabled()) { - grp.topology().readLock(); - - try { - for (GridDhtLocalPartition part : grp.topology().localPartitions()) { - VacuumTask task = new VacuumTask(snapshot, part); - - cleanupQueue.offer(task); - - res0.add(task); - } - } - finally { - grp.topology().readUnlock(); - } - } - } - res0.markInitialized(); res0.listen(() -> { 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 29ca654c5d26a..c9e75da265427 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 @@ -742,14 +742,6 @@ private static GridNearTxLocal txStart(GridKernalContext ctx, @Nullable GridCach return tx; } - /** - * @param ctx Grid kernal context. - * @return Whether MVCC is enabled or not. - */ - public static boolean mvccEnabled(GridKernalContext ctx) { - return ctx.coordinators().mvccEnabled(); - } - /** * Initialises MVCC filter and returns MVCC query tracker if needed. * @param cctx Cache context. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java index 43d69a62dbe2f..af8f92fb8a858 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java @@ -20,7 +20,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -1058,9 +1057,6 @@ private Metas getOrAllocateCacheMetas() throws IgniteCheckedException { if (partCntrs == null || partCntrs.isEmpty()) return null; - if (grp.mvccEnabled()) // TODO IGNITE-7384 - return super.historicalIterator(partCntrs, missing); - GridCacheDatabaseSharedManager database = (GridCacheDatabaseSharedManager)grp.shared().database(); Map partsCounters = new HashMap<>(); @@ -1215,7 +1211,7 @@ public void findAndCleanupLostIndexesForStoppedCache(int cacheId) throws IgniteC grp.dataRegion().pageMemory(), globalRemoveId(), reuseListForIndex(name), - grp.mvccEnabled() + false ); indexStorage.dropIndex(name); @@ -2714,17 +2710,6 @@ private void checkGapsLinkAndPartMetaStorage(PagePartitionMetaIOV3 io, long page return null; } - /** {@inheritDoc} */ - @Override public List> mvccFindAllVersions(GridCacheContext cctx, KeyCacheObject key) - throws IgniteCheckedException { - CacheDataStore delegate = init0(true); - - if (delegate != null) - return delegate.mvccFindAllVersions(cctx, key); - - return Collections.emptyList(); - } - /** {@inheritDoc} */ @Override public GridCursor mvccAllVersionsCursor(GridCacheContext cctx, KeyCacheObject key, Object x) throws IgniteCheckedException { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java index e60dc5dcc37d8..f644c72e04ae7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java @@ -2288,7 +2288,7 @@ public void applyPartitionsUpdatesCounters( if (updated && rollback) { CacheGroupContext grpCtx = part.group(); - if (grpCtx.persistenceEnabled() && grpCtx.walEnabled() && !grpCtx.mvccEnabled()) { + if (grpCtx.persistenceEnabled() && grpCtx.walEnabled()) { RollbackRecord rec = new RollbackRecord(grpCtx.groupId(), part.id(), start, delta); 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 113f582c24c4f..63f2c6bca14e1 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,11 +316,6 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter { return entry != null ? entry.get(0) : null; } - /** MVCC Enabled */ - public boolean mvccEnabled() { - return false; - } - /** {@inheritDoc} */ @Override public boolean useMvccCaching(int cacheId) { assert cacheCtx == null || cacheCtx.cacheId() == cacheId; 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 cd1483f93d902..324e47525a5ca 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 @@ -90,7 +90,6 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal; import org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator; -import org.apache.ignite.internal.processors.cache.mvcc.msg.MvccRecoveryFinishedMessage; import org.apache.ignite.internal.processors.cache.mvcc.txlog.TxState; import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer; import org.apache.ignite.internal.processors.cache.transactions.TxDeadlockDetection.TxDeadlockFuture; @@ -137,7 +136,6 @@ import static org.apache.ignite.events.EventType.EVT_NODE_JOINED; import static org.apache.ignite.events.EventType.EVT_NODE_LEFT; import static org.apache.ignite.events.EventType.EVT_TX_STARTED; -import static org.apache.ignite.internal.GridTopic.TOPIC_CACHE_COORDINATOR; import static org.apache.ignite.internal.GridTopic.TOPIC_TX; import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL; import static org.apache.ignite.internal.processors.cache.GridCacheOperation.READ; @@ -3224,10 +3222,6 @@ private TxRecoveryInitRunnable(ClusterNode node, MvccCoordinator mvccCrd) { log.debug("Processing node failed event [locNodeId=" + cctx.localNodeId() + ", failedNodeId=" + evtNodeId + ']'); - // Null means that recovery voting is not needed. - GridCompoundFuture allTxFinFut = isMvccRecoveryMessageRequired() - ? new GridCompoundFuture<>() : null; - for (final IgniteInternalTx tx : activeTransactions()) { if ((tx.near() && !tx.local() && tx.originatingNodeId().equals(evtNodeId)) || (tx.storeWriteThrough() && tx.masterNodeIds().contains(evtNodeId))) { @@ -3257,11 +3251,6 @@ else if (tx.state() == MARKED_ROLLBACK || tx.setRollbackOnly()) tx.rollbackAsync(); } } - - // Await only mvcc transactions initiated by failed client node. - if (allTxFinFut != null && tx.eventNodeId().equals(evtNodeId) - && tx.mvccSnapshot() != null) - allTxFinFut.add(tx.finishFuture()); } } @@ -3271,57 +3260,12 @@ else if (tx.state() == MARKED_ROLLBACK || tx.setRollbackOnly()) if (log.isInfoEnabled() && preparedTxCnt.get() > 0) doneFut.listen(this::finishAndRecordTimings); - - if (allTxFinFut == null) - return; - - allTxFinFut.markInitialized(); - - // Send vote to mvcc coordinator when all recovering transactions have finished. - allTxFinFut.listen(() -> { - // If mvcc coordinator issued snapshot for recovering transaction has failed during recovery, - // then there is no need to send messages to new coordinator. - try { - cctx.kernalContext().io().sendToGridTopic( - mvccCrd.nodeId(), - TOPIC_CACHE_COORDINATOR, - new MvccRecoveryFinishedMessage(evtNodeId), - SYSTEM_POOL); - } - catch (ClusterTopologyCheckedException e) { - if (log.isInfoEnabled()) - log.info("Mvcc coordinator issued snapshots for recovering transactions " + - "has left the cluster (will ignore) [locNodeId=" + cctx.localNodeId() + - ", failedNodeId=" + evtNodeId + - ", mvccCrdNodeId=" + mvccCrd.nodeId() + ']'); - } - catch (IgniteCheckedException e) { - log.warning("Failed to notify mvcc coordinator that all recovering transactions were " + - "finished [locNodeId=" + cctx.localNodeId() + - ", failedNodeId=" + evtNodeId + - ", mvccCrdNodeId=" + mvccCrd.nodeId() + ']', e); - } - }); } finally { cctx.kernalContext().gateway().readUnlock(); } } - /** - * Determines need to send a recovery message or not. - * - * @return True if message required, false otherwise. - */ - private boolean isMvccRecoveryMessageRequired() { - ClusterNode mvccCrdNode = null; - - if (mvccCrd != null && mvccCrd.nodeId() != null) - mvccCrdNode = cctx.node(mvccCrd.nodeId()); - - return node.isClient() && mvccCrdNode != null && cctx.kernalContext().coordinators().mvccEnabled(); - } - /** * @param tx Tx. * @param failedNode Failed node. 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 da8a8dcb8242e..d29da192ca1ab 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,11 +130,6 @@ public abstract class IgniteTxRemoteStateAdapter implements IgniteTxRemoteState assert false; } - /** MVCC Enabled */ - public boolean mvccEnabled() { - return mvccEnabled; - } - /** {@inheritDoc} */ @Override public boolean useMvccCaching(int cacheId) { return mvccCachingCacheIds.contains(cacheId); 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 68422a5aaf0f1..310193a8cc7e5 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,11 +482,6 @@ public synchronized Collection allEntriesCopy() { return writeView != null && writeView.size() == 1 ? F.firstValue(writeView) : null; } - /** MVCC Enabled */ - public boolean mvccEnabled() { - return Boolean.TRUE == mvccEnabled; - } - /** {@inheritDoc} */ @Override public boolean useMvccCaching(int cacheId) { return mvccCachingCacheIds.contains(cacheId); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java index 65887df7fc857..9e0029cc9ffa1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java @@ -24,7 +24,6 @@ import org.apache.ignite.internal.processors.cache.CacheGroupContext; import org.apache.ignite.internal.processors.cache.GridCacheSharedContext; import org.apache.ignite.internal.processors.cache.KeyCacheObject; -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.CacheDataRowAdapter; import org.apache.ignite.internal.processors.cache.persistence.CacheSearchRow; @@ -38,11 +37,6 @@ import org.apache.ignite.internal.processors.cache.persistence.tree.io.IOVersions; import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO; import org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseList; -import org.apache.ignite.internal.processors.cache.tree.mvcc.data.MvccCacheIdAwareDataInnerIO; -import org.apache.ignite.internal.processors.cache.tree.mvcc.data.MvccCacheIdAwareDataLeafIO; -import org.apache.ignite.internal.processors.cache.tree.mvcc.data.MvccDataInnerIO; -import org.apache.ignite.internal.processors.cache.tree.mvcc.data.MvccDataLeafIO; -import org.apache.ignite.internal.processors.cache.tree.mvcc.data.MvccDataRow; import org.apache.ignite.internal.processors.cache.tree.mvcc.search.MvccDataPageClosure; import org.apache.ignite.internal.util.GridUnsafe; import org.apache.ignite.internal.util.lang.GridCursor; @@ -53,7 +47,6 @@ import static java.lang.Boolean.TRUE; 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.internal.processors.cache.persistence.tree.io.PageIO.T_DATA; import static org.apache.ignite.internal.util.GridArrays.clearTail; @@ -187,7 +180,6 @@ private GridCursor scanDataPages(CacheDataRowAdapter.RowData rowDa GridCacheSharedContext shared = grp.shared(); GridCacheDatabaseSharedManager db = (GridCacheDatabaseSharedManager)shared.database(); PageStore pageStore = db.getPageStore(grpId, partId); - boolean mvccEnabled = grp.mvccEnabled(); int pageSize = pageSize(); long startPageId = ((PageMemoryEx)pageMem).partitionMetaPageId(grp.groupId(), partId); @@ -267,7 +259,7 @@ private boolean readNextDataPage() throws IgniteCheckedException { for (int i = 0; i < rowsCnt; i++) { if (c == null || c.applyMvcc(io, pageAddr, i, pageSize)) { - DataRow row = mvccEnabled ? new MvccDataRow() : new DataRow(); + DataRow row = new DataRow(); row.initFromDataPage( io, @@ -323,9 +315,6 @@ private static CacheDataRowAdapter.RowData asRowData(Object flags) { * @return Tree inner IO. */ private static IOVersions innerIO(CacheGroupContext grp) { - if (grp.mvccEnabled()) - return grp.sharedGroup() ? MvccCacheIdAwareDataInnerIO.VERSIONS : MvccDataInnerIO.VERSIONS; - return grp.sharedGroup() ? CacheIdAwareDataInnerIO.VERSIONS : DataInnerIO.VERSIONS; } @@ -334,9 +323,6 @@ private static IOVersions innerIO(CacheGroupConte * @return Tree leaf IO. */ private static IOVersions leafIO(CacheGroupContext grp) { - if (grp.mvccEnabled()) - return grp.sharedGroup() ? MvccCacheIdAwareDataLeafIO.VERSIONS : MvccDataLeafIO.VERSIONS; - return grp.sharedGroup() ? CacheIdAwareDataLeafIO.VERSIONS : DataLeafIO.VERSIONS; } @@ -350,9 +336,6 @@ public CacheDataRowStore rowStore() { /** {@inheritDoc} */ @Override protected int compare(BPlusIO iox, long pageAddr, int idx, CacheSearchRow row) throws IgniteCheckedException { - assert !grp.mvccEnabled() || row.mvccCoordinatorVersion() != MvccUtils.MVCC_CRD_COUNTER_NA - || (row.getClass() == SearchRow.class && row.key() == null) : row; - RowLinkIO io = (RowLinkIO)iox; int cmp; @@ -390,16 +373,7 @@ public CacheDataRowStore rowStore() { cmp = compareKeys(row.key(), link); - if (cmp != 0 || !grp.mvccEnabled()) - return cmp; - - long crd = io.getMvccCoordinatorVersion(pageAddr, idx); - long cntr = io.getMvccCounter(pageAddr, idx); - int opCntr = io.getMvccOperationCounter(pageAddr, idx); - - assert MvccUtils.mvccVersionIsValid(crd, cntr, opCntr); - - return -MvccUtils.compare(crd, cntr, opCntr, row); // descending order + return cmp; } /** {@inheritDoc} */ @@ -413,15 +387,7 @@ public CacheDataRowStore rowStore() { CacheDataRowAdapter.RowData x = asRowData(flags); - if (grp.mvccEnabled()) { - long mvccCrdVer = rowIo.getMvccCoordinatorVersion(pageAddr, idx); - long mvccCntr = rowIo.getMvccCounter(pageAddr, idx); - int mvccOpCntr = rowIo.getMvccOperationCounter(pageAddr, idx); - - return rowStore.mvccRow(cacheId, hash, link, x, mvccCrdVer, mvccCntr, mvccOpCntr); - } - else - return rowStore.dataRow(cacheId, hash, link, x); + return rowStore.dataRow(cacheId, hash, link, x); } /** {@inheritDoc} */ @@ -456,9 +422,6 @@ private int compareKeys(KeyCacheObject key, final long link) throws IgniteChecke if (data.nextLink() == 0) { long addr = pageAddr + data.offset(); - if (grp.mvccEnabled()) - addr += MVCC_INFO_SIZE; // Skip MVCC info. - if (grp.storeCacheIdInDataPage()) addr += 4; // Skip cache id. @@ -504,8 +467,7 @@ private int compareKeys(KeyCacheObject key, final long link) throws IgniteChecke releasePage(pageId, page); } - // TODO GG-11768. - CacheDataRowAdapter other = grp.mvccEnabled() ? new MvccDataRow(link) : new CacheDataRowAdapter(link); + CacheDataRowAdapter other = new CacheDataRowAdapter(link); other.initFromLink(grp, CacheDataRowAdapter.RowData.KEY_ONLY); byte[] bytes1 = other.key().valueBytes(grp.cacheObjectContext()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingRow.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingRow.java index 4116ae0b21957..1a6a1837c1bff 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingRow.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/PendingRow.java @@ -21,7 +21,6 @@ import org.apache.ignite.internal.processors.cache.CacheGroupContext; import org.apache.ignite.internal.processors.cache.KeyCacheObject; import org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter; -import org.apache.ignite.internal.processors.cache.tree.mvcc.data.MvccDataRow; import org.apache.ignite.internal.util.typedef.internal.S; /** @@ -69,7 +68,7 @@ public PendingRow(int cacheId, long expireTime, long link) { * @throws IgniteCheckedException If failed. */ PendingRow initKey(CacheGroupContext grp) throws IgniteCheckedException { - CacheDataRowAdapter rowData = grp.mvccEnabled() ? new MvccDataRow(link) : new CacheDataRowAdapter(link); + CacheDataRowAdapter rowData = new CacheDataRowAdapter(link); rowData.initFromLink(grp, CacheDataRowAdapter.RowData.KEY_ONLY); key = rowData.key(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java index f0be798624cb0..5c5034b7f9bf8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java @@ -32,7 +32,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import javax.cache.configuration.Factory; -import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteLogger; import org.apache.ignite.cache.query.BulkLoadContextCursor; import org.apache.ignite.cache.query.FieldsQueryCursor; @@ -53,7 +52,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.QueryCursorImpl; import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils; import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; import org.apache.ignite.internal.processors.cache.query.QueryCursorEx; import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx; @@ -71,7 +69,6 @@ import org.apache.ignite.internal.processors.query.SqlClientContext; import org.apache.ignite.internal.sql.optimizer.affinity.PartitionResult; import org.apache.ignite.internal.util.GridSpinBusyLock; -import org.apache.ignite.internal.util.future.GridFutureAdapter; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.S; @@ -240,25 +237,12 @@ public JdbcRequestHandler( } /** {@inheritDoc} */ - @Override public ClientListenerResponse handle(ClientListenerRequest req0) { - assert req0 != null; + @Override public ClientListenerResponse handle(ClientListenerRequest req) { + assert req != null; - assert req0 instanceof JdbcRequest; + assert req instanceof JdbcRequest; - JdbcRequest req = (JdbcRequest)req0; - - if (!MvccUtils.mvccEnabled(connCtx.kernalContext())) - return doHandle(req); - else { - GridFutureAdapter fut = worker.process(req); - - try { - return fut.get(); - } - catch (IgniteCheckedException e) { - return exceptionToResult(e); - } - } + return doHandle((JdbcRequest)req); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java index 5415395ff7cf1..eb84a170c6222 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java @@ -28,8 +28,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import javax.cache.configuration.Factory; - -import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteException; import org.apache.ignite.IgniteLogger; import org.apache.ignite.cache.query.FieldsQueryCursor; @@ -38,7 +36,6 @@ import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.apache.ignite.internal.binary.BinaryWriterExImpl; import org.apache.ignite.internal.binary.GridBinaryMarshaller; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils; import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx; import org.apache.ignite.internal.processors.odbc.ClientListenerProtocolVersion; @@ -57,7 +54,6 @@ import org.apache.ignite.internal.processors.query.QueryUtils; import org.apache.ignite.internal.processors.query.SqlClientContext; import org.apache.ignite.internal.util.GridSpinBusyLock; -import org.apache.ignite.internal.util.future.GridFutureAdapter; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.U; @@ -191,25 +187,12 @@ public OdbcRequestHandler( } /** {@inheritDoc} */ - @Override public ClientListenerResponse handle(ClientListenerRequest req0) { - assert req0 != null; - - assert req0 instanceof OdbcRequest; + @Override public ClientListenerResponse handle(ClientListenerRequest req) { + assert req != null; - OdbcRequest req = (OdbcRequest)req0; - - if (!MvccUtils.mvccEnabled(ctx)) - return doHandle(req); - else { - GridFutureAdapter fut = worker.process(req); + assert req instanceof OdbcRequest; - try { - return fut.get(); - } - catch (IgniteCheckedException e) { - return exceptionToResult(e); - } - } + return doHandle((OdbcRequest)req); } /** diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridExchangeFreeSwitchTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridExchangeFreeSwitchTest.java index dedd7b402b79e..efaadd7c98bf8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridExchangeFreeSwitchTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridExchangeFreeSwitchTest.java @@ -45,7 +45,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage; -import org.apache.ignite.internal.processors.cache.mvcc.MvccProcessor; import org.apache.ignite.internal.util.future.GridFinishedFuture; import org.apache.ignite.internal.util.typedef.G; import org.apache.ignite.lang.IgniteBiInClosure; @@ -367,21 +366,9 @@ private void testNoTransactionsWaitAtNodeLeft(int backups, PartitionLossPolicy l Random r = new Random(); - Ignite candidate; - MvccProcessor proc; + int nodeToStop = r.nextInt(nodes); - int nodeToStop; - - do { - nodeToStop = r.nextInt(nodes); - candidate = grid(nodeToStop); - - proc = ((IgniteEx)candidate).context().coordinators(); - } - // MVCC coordinator fail always breaks transactions, excluding. - while (proc.mvccEnabled() && proc.currentCoordinator().local()); - - Ignite failed = candidate; + Ignite failed = grid(nodeToStop); int multiplicator = 3; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTracker.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTracker.java index 9bd4f0eaae165..dcd44136b7fa4 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTracker.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTracker.java @@ -52,7 +52,6 @@ import org.apache.ignite.internal.processors.cache.CacheGroupContext; import org.apache.ignite.internal.processors.cache.GridCacheProcessor; import org.apache.ignite.internal.processors.cache.GridCacheSharedContext; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils; import org.apache.ignite.internal.processors.cache.mvcc.txlog.TxLog; import org.apache.ignite.internal.processors.cache.persistence.DataRegion; import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl; @@ -65,7 +64,6 @@ import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO; import org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager; import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer; -import org.apache.ignite.internal.processors.cache.tree.AbstractDataLeafIO; import org.apache.ignite.internal.util.GridUnsafe; import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.internal.util.typedef.internal.U; @@ -75,8 +73,6 @@ import org.apache.ignite.spi.encryption.EncryptionSpi; import org.mockito.Mockito; -import static org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO.T_CACHE_ID_DATA_REF_MVCC_LEAF; -import static org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO.T_DATA_REF_MVCC_LEAF; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -542,9 +538,6 @@ private long pageStoreAllocatedPages() { long totalAllocated = pageStoreMgr.pagesAllocated(MetaStorage.METASTORAGE_CACHE_ID); - if (MvccUtils.mvccEnabled(gridCtx)) - totalAllocated += pageStoreMgr.pagesAllocated(TxLog.TX_LOG_CACHE_ID); - for (CacheGroupContext ctx : gridCtx.cache().cacheGroups()) totalAllocated += pageStoreMgr.pagesAllocated(ctx.groupId()); @@ -685,20 +678,6 @@ private boolean comparePages(FullPageId fullPageId, DirectMemoryPage expPage, lo PageIO pageIo = PageIO.getPageIO(actualPageAddr); - if (pageIo.getType() == T_DATA_REF_MVCC_LEAF || pageIo.getType() == T_CACHE_ID_DATA_REF_MVCC_LEAF) { - assert cacheProc.cacheGroup(fullPageId.groupId()).mvccEnabled(); - - AbstractDataLeafIO io = (AbstractDataLeafIO)pageIo; - - int cnt = io.getMaxCount(actualPageAddr, pageSize); - - // Reset lock info as there is no sense to log it into WAL. - for (int i = 0; i < cnt; i++) { - io.setMvccLockCoordinatorVersion(expPageAddr, i, io.getMvccLockCoordinatorVersion(actualPageAddr, i)); - io.setMvccLockCounter(expPageAddr, i, io.getMvccLockCounter(actualPageAddr, i)); - } - } - // Compare only meaningful data. if (pageIo instanceof CompactablePageIO) { tmpBuf1.clear(); 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 e38942543304b..17d6c40126ea6 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 @@ -43,11 +43,9 @@ import org.apache.ignite.internal.processors.bulkload.BulkLoadProcessor; import org.apache.ignite.internal.processors.bulkload.BulkLoadStreamerWriter; import org.apache.ignite.internal.processors.cache.GridCacheContext; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal; import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor; import org.apache.ignite.internal.processors.query.IgniteSQLException; -import org.apache.ignite.internal.processors.query.NestedTxMode; import org.apache.ignite.internal.processors.query.QueryEntityEx; import org.apache.ignite.internal.processors.query.QueryField; import org.apache.ignite.internal.processors.query.QueryUtils; @@ -90,12 +88,8 @@ import org.h2.table.Column; import org.h2.value.DataType; import org.h2.value.Value; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.mvccEnabled; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.tx; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.txStart; import static org.apache.ignite.internal.processors.query.QueryUtils.convert; import static org.apache.ignite.internal.processors.query.QueryUtils.isDdlOnSchemaSupported; import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlQueryParser.PARAM_WRAP_VALUE; @@ -193,8 +187,6 @@ public FieldsQueryCursor> runNativeCommand(String sql, SqlCommand cmdNat return processBulkLoadCommand((SqlBulkLoadCommand)cmdNative, qryId); else if (cmdNative instanceof SqlSetStreamingCommand) processSetStreamingCommand((SqlSetStreamingCommand)cmdNative, cliCtx); - else - processTxCommand(cmdNative, params); return null; } @@ -615,108 +607,6 @@ private static String getTypeClassName(GridSqlColumn col) { } } - /** - * Process transactional command. - * @param cmd Command. - * @param params Parameters. - * @throws IgniteCheckedException if failed. - */ - private void processTxCommand(SqlCommand cmd, QueryParameters params) - throws IgniteCheckedException { - NestedTxMode nestedTxMode = params.nestedTxMode(); - - GridNearTxLocal tx = tx(ctx); - - if (cmd instanceof SqlBeginTransactionCommand) { - if (!mvccEnabled(ctx)) - throw new IgniteSQLException("MVCC must be enabled in order to start transaction.", - IgniteQueryErrorCode.MVCC_DISABLED); - - if (tx != null) { - if (nestedTxMode == null) - nestedTxMode = NestedTxMode.DEFAULT; - - switch (nestedTxMode) { - case COMMIT: - doCommit(tx); - - txStart(ctx, params.timeout()); - - break; - - case IGNORE: - log.warning("Transaction has already been started, ignoring BEGIN command."); - - break; - - case ERROR: - throw new IgniteSQLException("Transaction has already been started.", - IgniteQueryErrorCode.TRANSACTION_EXISTS); - - default: - throw new IgniteSQLException("Unexpected nested transaction handling mode: " + - nestedTxMode.name()); - } - } - else - txStart(ctx, params.timeout()); - } - else if (cmd instanceof SqlCommitTransactionCommand) { - // Do nothing if there's no transaction. - if (tx != null) - doCommit(tx); - } - else { - assert cmd instanceof SqlRollbackTransactionCommand; - - // Do nothing if there's no transaction. - if (tx != null) - doRollback(tx); - } - } - - /** - * Commit and properly close transaction. - * @param tx Transaction. - * @throws IgniteCheckedException if failed. - */ - private void doCommit(@NotNull GridNearTxLocal tx) throws IgniteCheckedException { - try { - tx.commit(); - } - finally { - closeTx(tx); - } - } - - /** - * Rollback and properly close transaction. - * @param tx Transaction. - * @throws IgniteCheckedException if failed. - */ - public void doRollback(@NotNull GridNearTxLocal tx) throws IgniteCheckedException { - try { - tx.rollback(); - } - finally { - closeTx(tx); - } - } - - /** - * Properly close transaction. - * @param tx Transaction. - * @throws IgniteCheckedException if failed. - */ - private void closeTx(@NotNull GridNearTxLocal tx) throws IgniteCheckedException { - try { - tx.close(); - } - finally { - ctx.cache().context().tm().resetContext(); - } - } - /** * Process SET STREAMING command. * diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/GridCacheTwoStepQuery.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/GridCacheTwoStepQuery.java index 842972d6590e5..aad80a1b66d64 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/GridCacheTwoStepQuery.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/GridCacheTwoStepQuery.java @@ -225,13 +225,6 @@ public Set tables() { return tbls; } - /** - * @return Mvcc flag. - */ - public boolean mvccEnabled() { - return mvccEnabled; - } - /** * @return Number of parameters */ 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 681f019b843e3..bbb088cc0917b 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 @@ -159,8 +159,6 @@ import static java.lang.Math.min; import static java.util.Collections.singletonList; import static org.apache.ignite.events.EventType.EVT_SQL_QUERY_EXECUTION; -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; import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.tx; import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.txStart; @@ -411,8 +409,6 @@ private GridQueryFieldsResult executeSelectLocal( boolean inTx, int timeout ) { - assert !select.mvccEnabled() || mvccTracker != null; - String qry; if (select.forUpdate()) @@ -1121,7 +1117,7 @@ private List>> executeDml( Exception failReason = null; try (TraceSurroundings ignored = MTC.support(ctx.tracing().create(SQL_DML_QRY_EXECUTE, MTC.span()))) { - if (!dml.mvccEnabled() && !updateInTxAllowed && ctx.cache().context().tm().inUserTx()) { + if (!updateInTxAllowed && ctx.cache().context().tm().inUserTx()) { throw new IgniteSQLException("DML statements are not allowed inside a transaction over " + "cache(s) with TRANSACTIONAL atomicity mode (change atomicity mode to " + "TRANSACTIONAL_SNAPSHOT or disable this error message with system property " + @@ -1211,28 +1207,6 @@ private List>> executeSelect( boolean inTx = false; - if (select.mvccEnabled()) { - mvccCctx = ctx.cache().context().cacheContext(select.mvccCacheId()); - - if (mvccCctx == null) - throw new IgniteCheckedException("Cache has been stopped concurrently [cacheId=" + - select.mvccCacheId() + ']'); - - boolean autoStartTx = !qryParams.autoCommit() && tx(ctx) == null; - - // Start new user tx in case of autocommit == false. - if (autoStartTx) - txStart(ctx, qryParams.timeout()); - - tx = tx(ctx); - - checkActive(tx); - - inTx = tx != null; - - tracker = MvccUtils.mvccTracker(mvccCctx, tx); - } - int timeout = operationTimeout(qryParams.timeout(), tx); Iterable> iter = executeSelect0( @@ -1345,8 +1319,6 @@ private Iterable> executeSelect0( boolean inTx, int timeout ) { - assert !select.mvccEnabled() || mvccTracker != null; - // Check security. if (ctx.security().enabled()) checkSecurity(select.cacheIds()); @@ -1687,9 +1659,6 @@ private Iterable> executeSelectDistributed( }; } else { - assert !twoStepQry.mvccEnabled() || !F.isEmpty(twoStepQry.cacheIds()); - assert twoStepQry.mvccEnabled() == (mvccTracker != null); - iter = new Iterable>() { @Override public Iterator> iterator() { try (TraceSurroundings ignored = MTC.support(ctx.tracing().create(SQL_ITER_OPEN, MTC.span()))) { @@ -2075,14 +2044,8 @@ private JavaObjectSerializer h2Serializer() { } /** {@inheritDoc} */ - @Override public void onClientDisconnect() throws IgniteCheckedException { - if (!mvccEnabled(ctx)) - return; - - GridNearTxLocal tx = tx(ctx); - - if (tx != null) - cmdProc.doRollback(tx); + @Override public void onClientDisconnect() { + // No-op. } /** {@inheritDoc} */ diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParserResultDml.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParserResultDml.java index 79ebfe2c542e8..9d5626db29632 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParserResultDml.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParserResultDml.java @@ -65,13 +65,6 @@ public GridSqlStatement statement() { return stmt; } - /** - * @return MVCC enabled. - */ - public boolean mvccEnabled() { - return mvccEnabled; - } - /** * @return Streamer table. */ diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParserResultSelect.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParserResultSelect.java index 418dc331e3755..8c6c5ff4d62d9 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParserResultSelect.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParserResultSelect.java @@ -146,13 +146,6 @@ public Integer mvccCacheId() { return mvccCacheId; } - /** - * @return Whether this is a SELECT for MVCC caches. - */ - public boolean mvccEnabled() { - return mvccCacheId != null; - } - /** * @return Whether this is FOR UPDATE query. */ diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java index 125771e865bb3..57736d6580e26 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java @@ -80,7 +80,6 @@ import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2QueryRequest; import org.apache.ignite.internal.processors.tracing.MTC; import org.apache.ignite.internal.processors.tracing.MTC.TraceSurroundings; -import org.apache.ignite.internal.transactions.IgniteTxAlreadyCompletedCheckedException; import org.apache.ignite.internal.util.typedef.C2; import org.apache.ignite.internal.util.typedef.CIX2; import org.apache.ignite.internal.util.typedef.F; @@ -88,7 +87,6 @@ import org.apache.ignite.lang.IgniteBiClosure; import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.transactions.TransactionAlreadyCompletedException; import org.apache.ignite.transactions.TransactionException; import org.h2.command.ddl.CreateTableData; import org.h2.engine.Session; @@ -102,8 +100,6 @@ import static java.util.Collections.singletonList; import static java.util.Collections.singletonMap; import static org.apache.ignite.IgniteSystemProperties.IGNITE_SQL_RETRY_TIMEOUT; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.checkActive; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.tx; import static org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery.EMPTY_PARAMS; import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter.mergeTableIdentifier; import static org.apache.ignite.internal.processors.tracing.SpanTags.ERROR; @@ -359,8 +355,6 @@ public Iterator> query( Boolean dataPageScanEnabled, int pageSize ) { - assert !qry.mvccEnabled() || mvccTracker != null; - if (pageSize <= 0) pageSize = Query.DFLT_PAGE_SIZE; @@ -372,14 +366,6 @@ public Iterator> query( if (parts != null && qry.isReplicatedOnly()) throw new CacheException("Partitions are not supported for replicated caches"); - try { - if (qry.mvccEnabled()) - checkActive(tx(ctx)); - } - catch (IgniteTxAlreadyCompletedCheckedException e) { - throw new TransactionAlreadyCompletedException(e.getMessage(), e); - } - final boolean singlePartMode = parts != null && parts.length == 1; if (F.isEmpty(params)) diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionCommandsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionCommandsSelfTest.java deleted file mode 100644 index 83c213b99dee3..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionCommandsSelfTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.index; - -import java.util.concurrent.Callable; -import org.apache.ignite.internal.processors.query.IgniteSQLException; -import org.apache.ignite.testframework.GridTestUtils; -import org.junit.Test; - -/** - * - */ -public class SqlTransactionCommandsSelfTest extends AbstractSchemaSelfTest { - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - startGrid(commonConfiguration(0)); - - super.execute(grid(0), "CREATE TABLE INTS(k int primary key, v int) WITH \"wrap_value=false,cache_name=ints," + - "atomicity=transactional\""); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testBeginWithMvccDisabled() throws Exception { - GridTestUtils.assertThrows(null, new Callable() { - @Override public Object call() throws Exception { - execute(grid(0), "BEGIN"); - - return null; - } - }, IgniteSQLException.class, "MVCC must be enabled in order to start transaction."); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testCommitWithMvccDisabled() throws Exception { - execute(grid(0), "COMMIT"); - // assert no exception - } - - /** - * @throws Exception if failed. - */ - @Test - public void testRollbackWithMvccDisabled() throws Exception { - execute(grid(0), "ROLLBACK"); - // assert no exception - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite3.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite3.java index 4805bf92d01b3..219ecc25cf3a6 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite3.java +++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite3.java @@ -95,7 +95,6 @@ import org.apache.ignite.internal.processors.cache.index.OptimizedMarshallerIndexNameTest; import org.apache.ignite.internal.processors.cache.index.PojoIndexLocalQueryTest; import org.apache.ignite.internal.processors.cache.index.SqlPartitionEvictionTest; -import org.apache.ignite.internal.processors.cache.index.SqlTransactionCommandsSelfTest; import org.apache.ignite.internal.processors.cache.metric.SqlViewExporterSpiTest; import org.apache.ignite.internal.processors.cache.query.IgniteCacheQueryCacheDestroySelfTest; import org.apache.ignite.internal.processors.cache.query.ScanQueryConcurrentSqlUpdatesTest; @@ -267,8 +266,6 @@ GridIndexRebuildTest.class, CheckIndexesInlineSizeOnNodeJoinMultiJvmTest.class, - SqlTransactionCommandsSelfTest.class, - IgniteSqlDefaultValueTest.class, IgniteDecimalSelfTest.class, IgniteSQLColumnConstraintsTest.class,