Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-19915 Remove obsolete IgniteCacheSnapshotManager #10824

Merged
merged 7 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1343,16 +1343,6 @@ public List<PartitionsExchangeAware> exchangeAwareComponents() {
* @param grps Cache groups for partitions refresh.
*/
public void refreshPartitions(@NotNull Collection<CacheGroupContext> grps) {
// TODO https://issues.apache.org/jira/browse/IGNITE-6857
if (cctx.snapshot().snapshotOperationInProgress()) {
if (log.isDebugEnabled())
log.debug("Schedule resend parititions due to snapshot in progress");

scheduleResendPartitions();

return;
}

if (grps.isEmpty()) {
if (log.isDebugEnabled())
log.debug("Skip partitions refresh, there are no cache groups for partition refresh.");
Expand Down Expand Up @@ -3460,11 +3450,6 @@ else if (task instanceof ForceRebalanceExchangeTask) {
forcedRebFut = ((ForceRebalanceExchangeTask)task).forcedRebalanceFuture();

for (CacheGroupContext grp : assignsSet.descendingSet()) {
boolean disableRebalance = cctx.snapshot().partitionsAreFrozen(grp);

if (disableRebalance)
continue;

RebalanceFuture cur = grp.preloader().prepare(exchId,
exchFut,
cnt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@
import org.apache.ignite.internal.processors.cache.persistence.metastorage.MetastorageLifecycleListener;
import org.apache.ignite.internal.processors.cache.persistence.metastorage.ReadOnlyMetastorage;
import org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteCacheSnapshotManager;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotDiscoveryMessage;
import org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseList;
Expand Down Expand Up @@ -1084,8 +1083,6 @@ private void stopCache(GridCacheAdapter<?, ?> cache, boolean cancel, boolean cal

ctx.kernalContext().continuous().onCacheStop(ctx);

ctx.kernalContext().cache().context().snapshot().onCacheStop(ctx, callDestroy);

ctx.kernalContext().coordinators().onCacheStop(ctx);

ctx.group().stopCache(ctx, clearCache);
Expand Down Expand Up @@ -3071,11 +3068,6 @@ private GridCacheSharedContext createSharedContext(
if (snapshotMgr == null)
snapshotMgr = new IgniteSnapshotManager(ctx);

IgniteCacheSnapshotManager snpMgr = ctx.plugins().createComponent(IgniteCacheSnapshotManager.class);

if (snpMgr == null)
snpMgr = new IgniteCacheSnapshotManager();

CacheObjectTransformerManager transMgr = ctx.plugins().createComponent(CacheObjectTransformerManager.class);

GridCacheIoManager ioMgr = new GridCacheIoManager();
Expand All @@ -3101,7 +3093,6 @@ private GridCacheSharedContext createSharedContext(
walStateMgr,
dbMgr,
snapshotMgr,
snpMgr,
depMgr,
exchMgr,
topMgr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import org.apache.ignite.internal.processors.cache.mvcc.MvccProcessor;
import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteCacheSnapshotManager;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager;
import org.apache.ignite.internal.processors.cache.store.CacheStoreManager;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
Expand Down Expand Up @@ -124,9 +123,6 @@ public class GridCacheSharedContext<K, V> {
/** Database manager. */
private IgniteCacheDatabaseSharedManager dbMgr;

/** Snapshot manager. */
private IgniteCacheSnapshotManager snpMgr;

/** Page store manager. {@code Null} if persistence is not enabled. */
@Nullable private IgnitePageStoreManager pageStoreMgr;

Expand Down Expand Up @@ -209,7 +205,6 @@ public class GridCacheSharedContext<K, V> {
* @param walStateMgr WAL state manager.
* @param depMgr Deployment manager.
* @param dbMgr Database manager.
* @param snpMgr Snapshot manager.
* @param exchMgr Exchange manager.
* @param affMgr Affinity manager.
* @param ioMgr IO manager.
Expand All @@ -230,7 +225,6 @@ public GridCacheSharedContext(
WalStateManager walStateMgr,
IgniteCacheDatabaseSharedManager dbMgr,
IgniteSnapshotManager snapshotMgr,
IgniteCacheSnapshotManager snpMgr,
GridCacheDeploymentManager<K, V> depMgr,
GridCachePartitionExchangeManager<K, V> exchMgr,
CacheAffinitySharedManager<K, V> affMgr,
Expand Down Expand Up @@ -258,7 +252,6 @@ public GridCacheSharedContext(
walStateMgr,
dbMgr,
snapshotMgr,
snpMgr,
depMgr,
exchMgr,
affMgr,
Expand Down Expand Up @@ -301,8 +294,6 @@ public GridCacheSharedContext(

stateAwareMgrs.add(dbMgr);

stateAwareMgrs.add(snpMgr);

stateAwareMgrs.add(snapshotMgr);

for (PluginProvider prv : kernalCtx.plugins().allProviders())
Expand Down Expand Up @@ -441,7 +432,6 @@ void onReconnected(boolean active) throws IgniteCheckedException {
walStateMgr,
dbMgr,
snapshotMgr,
snpMgr,
new GridCacheDeploymentManager<K, V>(),
new GridCachePartitionExchangeManager<K, V>(),
affMgr,
Expand Down Expand Up @@ -493,7 +483,6 @@ private void setManagers(
WalStateManager walStateMgr,
IgniteCacheDatabaseSharedManager dbMgr,
IgniteSnapshotManager snapshotMgr,
IgniteCacheSnapshotManager snpMgr,
GridCacheDeploymentManager<K, V> depMgr,
GridCachePartitionExchangeManager<K, V> exchMgr,
CacheAffinitySharedManager affMgr,
Expand All @@ -518,7 +507,6 @@ private void setManagers(
this.walStateMgr = add(mgrs, walStateMgr);
this.dbMgr = add(mgrs, dbMgr);
this.snapshotMgr = add(mgrs, snapshotMgr);
this.snpMgr = add(mgrs, snpMgr);
this.jtaMgr = add(mgrs, jtaMgr);
this.depMgr = add(mgrs, depMgr);
this.exchMgr = add(mgrs, exchMgr);
Expand Down Expand Up @@ -755,13 +743,6 @@ public IgniteCacheDatabaseSharedManager database() {
return dbMgr;
}

/**
* @return Snapshot manager.
*/
public IgniteCacheSnapshotManager snapshot() {
return snpMgr;
}

/**
* @return Page store manager. {@code Null} if persistence is not enabled.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ private void commitIfLocked() throws IgniteCheckedException {
try {
assert !txState.mvccEnabled() || mvccSnapshot != null : "Mvcc is not initialized: " + this;

Collection<IgniteTxEntry> entries = near() || cctx.snapshot().needTxReadLogging() ? allEntries() : writeEntries();
Collection<IgniteTxEntry> entries = near() ? allEntries() : writeEntries();

// Data entry to write to WAL.
List<DataEntry> dataEntries = null;
Expand Down Expand Up @@ -602,7 +602,7 @@ else if (conflictCtx.isMerge()) {
GridCacheVersion dhtVer = cached.isNear() ? writeVersion() : null;

if (!near() && cacheCtx.group().logDataRecords() &&
op != NOOP && op != RELOAD && (op != READ || cctx.snapshot().needTxReadLogging())) {
op != NOOP && op != RELOAD && op != READ) {
if (dataEntries == null)
dataEntries = new ArrayList<>(entries.size());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,17 +1080,6 @@ else if (msg instanceof WalStateAbstractMessage)
assert false;
}

if (cctx.localNode().isClient()) {
cctx.exchange().exchangerBlockingSectionBegin();

try {
tryToPerformLocalSnapshotOperation();
}
finally {
cctx.exchange().exchangerBlockingSectionEnd();
}
}

for (PartitionsExchangeAware comp : cctx.exchange().exchangeAwareComponents())
comp.onInitAfterTopologyLock(this);

Expand Down Expand Up @@ -1807,30 +1796,6 @@ else if (!skipWaitOnLocalJoin) { // Skip partition release if node has locally j
}
}

/**
* Try to start local snapshot operation if it is needed by discovery event
*/
private void tryToPerformLocalSnapshotOperation() {
try {
long start = System.nanoTime();

IgniteInternalFuture fut = cctx.snapshot().tryStartLocalSnapshotOperation(firstDiscoEvt, exchId.topologyVersion());

if (fut != null) {
fut.get();

long end = System.nanoTime();

if (log.isInfoEnabled())
log.info("Snapshot initialization completed [topVer=" + exchangeId().topologyVersion() +
", time=" + U.nanosToMillis(end - start) + "ms]");
}
}
catch (IgniteException | IgniteCheckedException e) {
U.error(log, "Error while starting snapshot operation", e);
}
}

/**
* Change WAL mode if needed.
*/
Expand Down Expand Up @@ -2515,9 +2480,6 @@ private String exchangeTimingsLogMessage(String header, List<String> timings) {
grpValidRes = m;
}

if (!cctx.localNode().isClient())
tryToPerformLocalSnapshotOperation();

if (err == null)
cctx.coordinators().onExchangeDone(events().discoveryCache());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
import org.apache.ignite.internal.mem.DirectMemoryProvider;
import org.apache.ignite.internal.mem.DirectMemoryRegion;
import org.apache.ignite.internal.metric.IoStatisticsHolderNoOp;
import org.apache.ignite.internal.pagemem.FullPageId;
import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.pagemem.PageUtils;
Expand Down Expand Up @@ -128,7 +127,6 @@
import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageReadWriteManager;
import org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteCacheSnapshotManager;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PagePartitionMetaIO;
import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer;
Expand All @@ -146,7 +144,6 @@
import org.apache.ignite.internal.util.StripedExecutor;
import org.apache.ignite.internal.util.TimeBag;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.lang.GridInClosure3X;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.X;
Expand Down Expand Up @@ -327,9 +324,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
/** This is the earliest WAL pointer that was reserved during preloading. */
private final AtomicReference<WALPointer> reservedForPreloading = new AtomicReference<>();

/** Snapshot manager. */
private IgniteCacheSnapshotManager snapshotMgr;

/**
* MetaStorage instance. Value {@code null} means storage not initialized yet.
* Guarded by {@link GridCacheDatabaseSharedManager#checkpointReadLock()}
Expand Down Expand Up @@ -531,8 +525,6 @@ private DataRegionConfiguration createDefragmentationMappingRegionConfig(long re
@Override protected void start0() throws IgniteCheckedException {
super.start0();

snapshotMgr = cctx.snapshot();

IgnitePageStoreManager store = cctx.pageStore();

assert store instanceof FilePageStoreManager : "Invalid page store manager was created: " + store;
Expand Down Expand Up @@ -570,7 +562,6 @@ private DataRegionConfiguration createDefragmentationMappingRegionConfig(long re
this::cacheGroupContexts,
this::getPageMemoryForCacheGroup,
resolveThrottlingPolicy(),
snapshotMgr,
dataStorageMetricsImpl(),
kernalCtx.longJvmPauseDetector(),
kernalCtx.failure(),
Expand Down Expand Up @@ -816,7 +807,6 @@ private void prepareCacheDefragmentation(List<String> cacheNames) throws IgniteC
() -> regions,
this::getPageMemoryForCacheGroup,
resolveThrottlingPolicy(),
snapshotMgr,
dataStorageMetricsImpl(),
kernalCtx.longJvmPauseDetector(),
kernalCtx.failure(),
Expand Down Expand Up @@ -919,8 +909,6 @@ private void readMetastore() throws IgniteCheckedException {
log.debug("Activate database manager [id=" + cctx.localNodeId() +
" topVer=" + cctx.discovery().topologyVersionEx() + " ]");

snapshotMgr = cctx.snapshot();

checkpointManager.init();

super.onActivate(ctx);
Expand Down Expand Up @@ -1215,22 +1203,6 @@ private long[] calculateFragmentSizes(String regionName, int concLvl, long cache
chpBufSize = cacheSize;
}

GridInClosure3X<Long, FullPageId, PageMemoryEx> changeTracker;

if (trackable)
changeTracker = new GridInClosure3X<Long, FullPageId, PageMemoryEx>() {
@Override public void applyx(
Long page,
FullPageId fullId,
PageMemoryEx pageMem
) throws IgniteCheckedException {
if (trackable)
snapshotMgr.onChangeTrackerPage(page, fullId, pageMem);
}
};
else
changeTracker = null;

PageMemoryImpl pageMem = new PageMemoryImpl(
wrapMetricsPersistentMemoryProvider(memProvider, memMetrics),
calculateFragmentSizes(
Expand All @@ -1245,15 +1217,12 @@ private long[] calculateFragmentSizes(String regionName, int concLvl, long cache
(fullId, pageBuf, tag) -> {
memMetrics.onPageWritten();

// We can write only page from disk into snapshot.
snapshotMgr.beforePageWrite(fullId);

// Write page to disk.
pmPageMgr.write(fullId.groupId(), fullId.pageId(), pageBuf, tag, true);

getCheckpointer().currentProgress().updateEvictedPages(1);
},
changeTracker,
trackable,
this,
memMetrics,
resolveThrottlingPolicy(),
Expand Down Expand Up @@ -1568,8 +1537,6 @@ private String cacheInfo(GridCacheContext cacheCtx) {
if (!gctx.persistenceEnabled())
continue;

snapshotMgr.onCacheGroupStop(gctx, destroy);

PageMemoryEx pageMem = (PageMemoryEx)dataRegion.pageMemory();

Collection<Integer> grpIds = destroyed.computeIfAbsent(pageMem, k -> new HashSet<>());
Expand Down
Loading