Skip to content

Commit cf12c2f

Browse files
committed
IGNITE-14794 (minor) Cleanup.
1 parent 7a07c92 commit cf12c2f

2 files changed

Lines changed: 16 additions & 135 deletions

File tree

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public class SnapshotRestoreProcess {
137137
* Future to be completed when the cache restore process is complete. By default, this is a stub.
138138
* When the process is started the future is recreated on the initiator node and passed to the user.
139139
*/
140-
private volatile ClusterSnapshotFuture fut = new ClusterSnapshotFuture();
140+
private volatile ClusterSnapshotFuture fut;
141141

142142
/** Current snapshot restore operation context (will be {@code null} when the operation is not running). */
143143
private volatile SnapshotRestoreContext opCtx;
@@ -349,7 +349,7 @@ public IgniteFuture<Void> start(String snpName, @Nullable Collection<String> cac
349349

350350
ClusterSnapshotFuture fut0 = fut;
351351

352-
return fut0.isDone() ? null : fut0.name;
352+
return fut0 != null ? fut0.name : null;
353353
}
354354

355355
/**
@@ -413,6 +413,15 @@ public Set<UUID> cacheStartRequiredAliveNodes(IgniteUuid reqId) {
413413
return new HashSet<>(opCtx0.nodes());
414414
}
415415

416+
/**
417+
* Finish local cache group restore process.
418+
*
419+
* @param reqId Request ID.
420+
*/
421+
private void finishProcess(UUID reqId) {
422+
finishProcess(reqId, null);
423+
}
424+
416425
/**
417426
* Finish local cache group restore process.
418427
*
@@ -436,7 +445,9 @@ else if (log.isInfoEnabled())
436445
synchronized (this) {
437446
ClusterSnapshotFuture fut0 = fut;
438447

439-
if (!fut0.isDone() && reqId.equals(fut0.rqId)) {
448+
if (fut0 != null && reqId.equals(fut0.rqId)) {
449+
fut = null;
450+
440451
ctx.pools().getSystemExecutorService().submit(() -> {
441452
fut0.endTime = U.currentTimeMillis();
442453

@@ -475,7 +486,7 @@ public IgniteFuture<Boolean> cancel(IgniteCheckedException reason, String snpNam
475486
synchronized (this) {
476487
opCtx0 = opCtx;
477488

478-
if (!fut.isDone() && fut.name.equals(snpName)) {
489+
if (fut != null && fut.name.equals(snpName)) {
479490
fut0 = fut;
480491

481492
fut0.interruptEx = reason;
@@ -587,7 +598,7 @@ private IgniteInternalFuture<SnapshotRestoreOperationResponse> prepare(SnapshotO
587598

588599
ClusterSnapshotFuture fut0 = fut;
589600

590-
if (!fut0.isDone() && fut0.interruptEx != null)
601+
if (fut0 != null && fut0.interruptEx != null)
591602
opCtx0.errHnd.accept(fut0.interruptEx);
592603
}
593604

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreStatusDetails.java

Lines changed: 0 additions & 130 deletions
This file was deleted.

0 commit comments

Comments
 (0)