timoninmaxim commented on code in PR #12386:
URL: https://github.com/apache/ignite/pull/12386#discussion_r2397591810


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IncrementalSnapshotVerificationTask.java:
##########
@@ -55,301 +54,255 @@
 import static 
org.apache.ignite.internal.managers.discovery.ConsistentIdMapper.ALL_NODES;
 
 /** */
-public class IncrementalSnapshotVerificationTask {
+public class IncrementalSnapshotVerificationTask implements 
Supplier<IncrementalSnapshotVerificationTaskResult> {
     /** */
-    private final VerifyIncrementalSnapshotJob job;
+    private final IgniteEx ignite;
 
     /** */
     private final IgniteLogger log;
 
     /** */
-    public IncrementalSnapshotVerificationTask(IgniteEx ignite, IgniteLogger 
log, SnapshotFileTree sft, int incrementalIdx) {
-        job = new VerifyIncrementalSnapshotJob(ignite, log, sft, 
incrementalIdx);
-        this.log = log;
-    }
+    private final SnapshotFileTree sft;
 
     /** */
-    public IdleVerifyResult reduce(Map<ClusterNode, 
IncrementalSnapshotVerificationTaskResult> results) throws IgniteException {
-        IdleVerifyResult.Builder bldr = IdleVerifyResult.builder();
-
-        for (Map.Entry<ClusterNode, IncrementalSnapshotVerificationTaskResult> 
nodeRes: results.entrySet()) {
-            IncrementalSnapshotVerificationTaskResult res = nodeRes.getValue();
+    private final int incIdx;
 
-            if (!F.isEmpty(res.partiallyCommittedTxs()))
-                bldr.addPartiallyCommited(nodeRes.getKey(), 
res.partiallyCommittedTxs());
-
-            bldr.addPartitionHashes(res.partHashRes());
-
-            if (log.isDebugEnabled())
-                log.debug("Handle VerifyIncrementalSnapshotJob result [node=" 
+ nodeRes.getKey() + ", taskRes=" + res + ']');
-
-            bldr.addIncrementalHashRecords(nodeRes.getKey(), res.txHashRes());
-        }
-
-        return bldr.build();
-    }
+    /** */
+    private LongAdder procEntriesCnt;
 
     /** */
-    public IncrementalSnapshotVerificationTaskResult execute() {
-        return job.execute0();
+    public IncrementalSnapshotVerificationTask(IgniteEx ignite, IgniteLogger 
log, SnapshotFileTree sft, int incrementalIdx) {
+        this.ignite = ignite;
+        this.log = log;
+        this.sft = sft;
+        this.incIdx = incrementalIdx;
     }
 
     /** */
-    private static class VerifyIncrementalSnapshotJob {
-        /** */
-        private final IgniteEx ignite;
-
-        /** */
-        private final IgniteLogger log;
-
-        /** */
-        private final SnapshotFileTree sft;
-
-        /** */
-        private final int incIdx;
-
-        /** */
-        private LongAdder procEntriesCnt;
-
-        /**
-         * @param ignite Ignite instance.
-         * @param log Ignite logger.
-         * @param sft Snapshot file tree
-         * @param incIdx Incremental snapshot index.
-         */
-        private VerifyIncrementalSnapshotJob(
-            IgniteEx ignite,
-            IgniteLogger log,
-            SnapshotFileTree sft,
-            int incIdx
-        ) {
-            this.ignite = ignite;
-            this.log = log;
-            this.sft = sft;
-            this.incIdx = incIdx;
-        }
+    @Override public IncrementalSnapshotVerificationTaskResult get() {
+        return execute0();
+    }
 
-        /**
-         * @return Map containing calculated transactions hash for every 
remote node in the cluster.
-         */
-        public IncrementalSnapshotVerificationTaskResult execute0() throws 
IgniteException {
-            try {
-                if (log.isInfoEnabled()) {
-                    log.info("Verify incremental snapshot procedure has been 
initiated " +
-                        "[snpName=" + sft.name() + ", incrementIndex=" + 
incIdx + ", consId=" + sft.consistentId() + ']');
-                }
+    /**
+     * @return Map containing calculated transactions hash for every remote 
node in the cluster.
+     */
+    private IncrementalSnapshotVerificationTaskResult execute0() throws 
IgniteException {

Review Comment:
   You don't need `execute0` method now, let's use `get()`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to