Skip to content

Commit

Permalink
IGNITE-21345 TxState and MvccSnapshot removal (#11323)
Browse files Browse the repository at this point in the history
  • Loading branch information
shishkovilja committed Apr 24, 2024
1 parent a2053f1 commit c4d122d
Show file tree
Hide file tree
Showing 55 changed files with 110 additions and 914 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot;
import org.apache.ignite.internal.processors.query.calcite.exec.exp.ExpressionFactory;
import org.apache.ignite.internal.processors.query.calcite.exec.exp.ExpressionFactoryImpl;
import org.apache.ignite.internal.processors.query.calcite.exec.tracker.ExecutionNodeMemoryTracker;
Expand Down Expand Up @@ -196,13 +195,6 @@ public boolean keepBinary() {
return true; // TODO
}

/**
* @return MVCC snapshot.
*/
public MvccSnapshot mvccSnapshot() {
return null; // TODO
}

/**
* @return Handler to access row fields.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ public IndexFirstLastScan(

return new IndexQueryContext(
res.cacheFilter(),
createNotNullRowFilter(idx, true),
res.mvccSnapshot()
createNotNullRowFilter(idx, true)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
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.MvccSnapshot;
import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusIO;
import org.apache.ignite.internal.processors.query.calcite.exec.RowHandler.RowFactory;
Expand Down Expand Up @@ -81,9 +80,6 @@ public class IndexScan<Row> extends AbstractIndexScan<Row, IndexRow> {
/** */
private final int[] parts;

/** */
private final MvccSnapshot mvccSnapshot;

/** */
private volatile List<GridDhtLocalPartition> reserved;

Expand Down Expand Up @@ -152,7 +148,6 @@ protected IndexScan(
factory = ectx.rowHandler().factory(ectx.getTypeFactory(), rowType);
topVer = ectx.topologyVersion();
this.parts = parts;
mvccSnapshot = ectx.mvccSnapshot();
this.requiredColumns = requiredColumns;
this.idxFieldMapping = idxFieldMapping;

Expand Down Expand Up @@ -372,7 +367,7 @@ private synchronized void release() {

BPlusTree.TreeRowClosure<IndexRow, IndexRow> rowFilter = isInlineScan() ? null : createNotExpiredRowFilter();

return new IndexQueryContext(filter, rowFilter, rowFactory, mvccSnapshot);
return new IndexQueryContext(filter, rowFilter, rowFactory);
}

/** */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
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.MvccSnapshot;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.query.calcite.exec.RowHandler.RowFactory;
import org.apache.ignite.internal.processors.query.calcite.schema.CacheTableDescriptor;
Expand Down Expand Up @@ -64,9 +63,6 @@ public class TableScan<Row> implements Iterable<Row>, AutoCloseable {
/** */
private final int[] parts;

/** */
private final MvccSnapshot mvccSnapshot;

/** */
private volatile List<GridDhtLocalPartition> reserved;

Expand All @@ -90,7 +86,6 @@ public TableScan(

factory = this.ectx.rowHandler().factory(this.ectx.getTypeFactory(), rowType);
topVer = ectx.topologyVersion();
mvccSnapshot = ectx.mvccSnapshot();
}

/** {@inheritDoc} */
Expand Down Expand Up @@ -241,7 +236,7 @@ private void advance() throws IgniteCheckedException {
if (part == null)
break;

cur = part.dataStore().cursor(cctx.cacheId(), mvccSnapshot);
cur = part.dataStore().cursor(cctx.cacheId());
}

if (cur.next()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ else if (checkExpired)

try {
for (int i = 0; i < iidx.segmentsCount(); ++i)
cnt += iidx.count(i, new IndexQueryContext(filter, rowFilter, ectx.mvccSnapshot()));
cnt += iidx.count(i, new IndexQueryContext(filter, rowFilter));
}
catch (IgniteCheckedException e) {
throw new IgniteException("Unable to count index records.", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.ignite.internal.cache.query.index.sorted.inline;

import org.apache.ignite.internal.cache.query.index.sorted.IndexRow;
import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot;
import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
import org.apache.ignite.spi.indexing.IndexingQueryFilter;

Expand All @@ -33,36 +32,23 @@ public class IndexQueryContext {
/** Index row factory. */
private final BPlusTree.TreeRowFactory<IndexRow, IndexRow> rowFactory;

/** */
private final MvccSnapshot mvccSnapshot;

/** */
public IndexQueryContext(
IndexingQueryFilter cacheFilter,
BPlusTree.TreeRowClosure<IndexRow, IndexRow> rowFilter,
MvccSnapshot mvccSnapshot
BPlusTree.TreeRowClosure<IndexRow, IndexRow> rowFilter
) {
this(cacheFilter, rowFilter, null, mvccSnapshot);
this(cacheFilter, rowFilter, null);
}

/** */
public IndexQueryContext(
IndexingQueryFilter cacheFilter,
BPlusTree.TreeRowClosure<IndexRow, IndexRow> rowFilter,
BPlusTree.TreeRowFactory<IndexRow, IndexRow> rowFactory,
MvccSnapshot mvccSnapshot
BPlusTree.TreeRowFactory<IndexRow, IndexRow> rowFactory
) {
this.cacheFilter = cacheFilter;
this.rowFilter = rowFilter;
this.rowFactory = rowFactory;
this.mvccSnapshot = mvccSnapshot;
}

/**
* @return Mvcc snapshot.
*/
public MvccSnapshot mvccSnapshot() {
return mvccSnapshot;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private void resendCacheData(IgniteInternalCache<?, ?> cache) throws IgniteCheck
GridCacheContext<?, ?> cctx = cache.context();

GridIterator<CacheDataRow> locRows = cctx.offheap()
.cacheIterator(cctx.cacheId(), true, false, AffinityTopologyVersion.NONE, null, null);
.cacheIterator(cctx.cacheId(), true, false, AffinityTopologyVersion.NONE, null);

long cnt = 0;
Set<Integer> parts = new TreeSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,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.distributed.near.GridNearUnlockRequest;
import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshotWithoutTxs;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.IncrementalSnapshotAwareMessage;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotFilesFailureMessage;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotFilesRequestMessage;
Expand Down Expand Up @@ -316,7 +315,6 @@ public class GridIoMessageFactory implements MessageFactoryProvider {
factory.register((short)133, ClusterMetricsUpdateMessage::new);
factory.register((short)134, ContinuousRoutineStartResultMessage::new);
factory.register((short)135, LatchAckMessage::new);
factory.register((short)150, MvccSnapshotWithoutTxs::new);
factory.register((short)157, PartitionUpdateCountersMessage::new);
factory.register((short)158, GridDhtPartitionSupplyMessageV2::new);
factory.register((short)162, GenerateEncryptionKeyRequest::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,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));
}
}
else if (modes.heap) {
Expand Down Expand Up @@ -2598,7 +2598,7 @@ protected IgniteInternalFuture<V> getAndRemoveAsync0(final K key) {

do {
Iterator<CacheDataRow> it = ctx.offheap().cacheIterator(ctx.cacheId(),
true, true, null, null, null);
true, true, null, null);

while (it.hasNext() && keys.size() < REMOVE_ALL_KEYS_BATCH)
keys.add((K)it.next().key());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockCancelledException;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.mvcc.txlog.TxState;
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;
Expand Down Expand Up @@ -618,50 +617,14 @@ default boolean initialValue(CacheObject val,
GridDrType drType,
boolean fromStore,
boolean primary) throws IgniteCheckedException, GridCacheEntryRemovedException {
return initialValue(val, ver, TxState.NA, TxState.NA,
ttl, expireTime, preload, topVer, drType, fromStore, primary);
return initialValue(val, ver, ttl, expireTime, preload, topVer, drType, fromStore, primary, null);
}

/**
* Sets new value if current version is <tt>0</tt>
*
* @param val New value.
* @param ver Version to use.
* @param mvccTxState Tx state hint for mvcc version.
* @param newMvccTxState Tx state hint for new mvcc version.
* @param ttl Time to live.
* @param expireTime Expiration time.
* @param preload Flag indicating whether entry is being preloaded.
* @param topVer Topology version.
* @param drType DR type.
* @param fromStore {@code True} if value was loaded from store.
* @param primary {@code True} if current node is primary for partition.
* @return {@code True} if initial value was set.
* @throws IgniteCheckedException In case of error.
* @throws GridCacheEntryRemovedException If entry was removed.
*/
default boolean initialValue(CacheObject val,
GridCacheVersion ver,
byte mvccTxState,
byte newMvccTxState,
long ttl,
long expireTime,
boolean preload,
AffinityTopologyVersion topVer,
GridDrType drType,
boolean fromStore,
boolean primary) throws IgniteCheckedException, GridCacheEntryRemovedException {
return initialValue(val, ver, TxState.NA, TxState.NA,
ttl, expireTime, preload, topVer, drType, fromStore, primary, null);
}

/**
* Sets new value if current version is <tt>0</tt>
*
* @param val New value.
* @param ver Version to use.
* @param mvccTxState Tx state hint for mvcc version.
* @param newMvccTxState Tx state hint for new mvcc version.
* @param ttl Time to live.
* @param expireTime Expiration time.
* @param preload Flag indicating whether entry is being preloaded.
Expand All @@ -676,8 +639,6 @@ default boolean initialValue(CacheObject val,
*/
public boolean initialValue(CacheObject val,
GridCacheVersion ver,
byte mvccTxState,
byte newMvccTxState,
long ttl,
long expireTime,
boolean preload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2497,8 +2497,6 @@ private boolean skipInterceptor(@Nullable GridCacheVersion explicitVer) {
@Override public boolean initialValue(
CacheObject val,
GridCacheVersion ver,
byte mvccTxState,
byte newMvccTxState,
long ttl,
long expireTime,
boolean preload,
Expand Down
Loading

0 comments on commit c4d122d

Please sign in to comment.