Vladsz83 commented on code in PR #11391:
URL: https://github.com/apache/ignite/pull/11391#discussion_r1673804042
##########
modules/core/src/main/java/org/apache/ignite/internal/management/cache/VerifyBackupPartitionsTaskV2.java:
##########
@@ -138,34 +139,43 @@ public class VerifyBackupPartitionsTaskV2 extends
ComputeTaskAdapter<CacheIdleVe
}
}
- /**
- * @param results Received results of broadcast remote requests.
- * @return Idle verify job result constructed from results of remote
executions.
- */
- public static IdleVerifyResultV2 reduce0(List<ComputeJobResult> results) {
- Map<PartitionKeyV2, List<PartitionHashRecordV2>> clusterHashes = new
HashMap<>();
- Map<ClusterNode, Exception> ex = new HashMap<>();
+ /** */
+ public static IdleVerifyResultV2 reduceJobResults(List<ComputeJobResult>
jobResults) throws IgniteException {
+ Map<ClusterNode, Map<PartitionKeyV2, PartitionHashRecordV2>> results =
new HashMap<>();
+ Map<ClusterNode, Exception> errors = new HashMap<>();
- for (ComputeJobResult res : results) {
- if (res.getException() != null) {
- ex.put(res.getNode(), res.getException());
+ jobResults.forEach(jr -> {
+ if (jr.getData() != null)
+ results.put(jr.getNode(), jr.getData());
- continue;
- }
+ if (jr.getException() != null)
+ errors.put(jr.getNode(), jr.getException());
+ });
- Map<PartitionKeyV2, PartitionHashRecordV2> nodeHashes =
res.getData();
+ return reduceHashesAndErrors(results, errors);
+ }
+
+ /** */
+ public static IdleVerifyResultV2 reduceHashesAndErrors(
+ Map<ClusterNode, Map<PartitionKeyV2, PartitionHashRecordV2>> results,
+ Map<ClusterNode, Exception> errors
+ ) {
+ Map<PartitionKeyV2, List<PartitionHashRecordV2>> clusterHashes = new
HashMap<>();
+
+ results.forEach((node, nodeHashes) -> {
+ assert errors.get(node) == null;
for (Map.Entry<PartitionKeyV2, PartitionHashRecordV2> e :
nodeHashes.entrySet()) {
List<PartitionHashRecordV2> records =
clusterHashes.computeIfAbsent(e.getKey(), k -> new ArrayList<>());
records.add(e.getValue());
}
- }
+ });
- if (results.size() != ex.size())
- return new IdleVerifyResultV2(clusterHashes, ex);
+ if (results.size() != errors.size())
+ return new IdleVerifyResultV2(clusterHashes, errors);
else
- return new IdleVerifyResultV2(ex);
+ return new IdleVerifyResultV2(errors);
Review Comment:
Irrelevant. The code was already changed.
--
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]