Vladsz83 commented on code in PR #12702:
URL: https://github.com/apache/ignite/pull/12702#discussion_r2786435854


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java:
##########
@@ -1202,22 +1202,23 @@ public <M extends Serializable> void 
storeSnapshotMeta(M meta, File smf) {
      */
     private IgniteInternalFuture<Void> completeHandlersAsyncIfNeeded(
         SnapshotOperation snpOp,
-        Collection<SnapshotOperationResponse> res
+        Map<UUID, SnapshotOperationResponse> res

Review Comment:
   Let's fix `{@link SnapshotHandler#complete(String, Collection)}` . There is 
a map now.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java:
##########
@@ -1202,22 +1202,23 @@ public <M extends Serializable> void 
storeSnapshotMeta(M meta, File smf) {
      */
     private IgniteInternalFuture<Void> completeHandlersAsyncIfNeeded(
         SnapshotOperation snpOp,
-        Collection<SnapshotOperationResponse> res
+        Map<UUID, SnapshotOperationResponse> res
     ) {
         if (snpOp.error() != null)
             return new GridFinishedFuture<>();
 
         SnapshotOperationRequest req = snpOp.request();
 
-        Map<String, List<SnapshotHandlerResult<?>>> clusterHndResults = new 
HashMap<>();
+        Map<String, Map<UUID, SnapshotHandlerResult<?>>> clusterHndResults = 
new HashMap<>();
 
-        for (SnapshotOperationResponse snpRes : res) {
-            if (snpRes == null || snpRes.handlerResults() == null)
-                continue;
+        res.forEach((nodeId, r) -> {

Review Comment:
   Suggestion: `(nodeId, r)` -> `(nodeId, snpRes)`



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java:
##########
@@ -1202,22 +1202,23 @@ public <M extends Serializable> void 
storeSnapshotMeta(M meta, File smf) {
      */
     private IgniteInternalFuture<Void> completeHandlersAsyncIfNeeded(
         SnapshotOperation snpOp,
-        Collection<SnapshotOperationResponse> res
+        Map<UUID, SnapshotOperationResponse> res
     ) {
         if (snpOp.error() != null)
             return new GridFinishedFuture<>();
 
         SnapshotOperationRequest req = snpOp.request();
 
-        Map<String, List<SnapshotHandlerResult<?>>> clusterHndResults = new 
HashMap<>();
+        Map<String, Map<UUID, SnapshotHandlerResult<?>>> clusterHndResults = 
new HashMap<>();
 
-        for (SnapshotOperationResponse snpRes : res) {
-            if (snpRes == null || snpRes.handlerResults() == null)
-                continue;
+        res.forEach((nodeId, r) -> {
+            if (r == null || r.handlerResults() == null)
+                return;

Review Comment:
   It was `continue` before, not `return`.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotPartitionsVerifyHandler.java:
##########
@@ -439,13 +440,18 @@ private PartitionHashRecord 
calculateDumpedPartitionHash(Dump dump, String folde
     }
 
     /** {@inheritDoc} */
-    @Override public void complete(String name,
-        Collection<SnapshotHandlerResult<Map<PartitionKey, 
PartitionHashRecord>>> results) throws IgniteCheckedException {
+    @Override public void complete(
+        String name,
+        Map<UUID, SnapshotHandlerResult<Map<PartitionKey, 
PartitionHashRecord>>> results
+    ) throws IgniteCheckedException {
         IdleVerifyResult.Builder bldr = IdleVerifyResult.builder();
 
-        for (SnapshotHandlerResult<Map<PartitionKey, PartitionHashRecord>> res 
: results) {
+        for (Map.Entry<UUID, SnapshotHandlerResult<Map<PartitionKey, 
PartitionHashRecord>>> e : results.entrySet()) {
+            UUID nodeId = e.getKey();
+            SnapshotHandlerResult<Map<PartitionKey, PartitionHashRecord>> res 
= e.getValue();
+
             if (res.error() != null) {
-                bldr.addException(res.node(), res.error());
+                bldr.addException(cctx.discovery().node(nodeId), res.error());

Review Comment:
   What if node is already gone?



-- 
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