Skip to content

Commit

Permalink
codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladsz83 committed Dec 28, 2024
1 parent eca56f6 commit 4a402e6
Showing 1 changed file with 18 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,24 @@ public class VerifyBackupPartitionsTaskV2 extends ComputeTaskAdapter<CacheIdleVe

/** {@inheritDoc} */
@Nullable @Override public IdleVerifyResultV2 reduce(List<ComputeJobResult> results) throws IgniteException {
return reduce0(results);
Map<ClusterNode, Exception> ex = new HashMap<>();
Map<ClusterNode, Map<PartitionKeyV2, List<PartitionHashRecordV2>>> hashes = new HashMap<>();

for (ComputeJobResult res : results) {
if (res.getException() != null) {
ex.put(res.getNode(), res.getException());

continue;
}

Map<PartitionKeyV2, List<PartitionHashRecordV2>> nodePartsRes = hashes.computeIfAbsent(res.getNode(), node -> new HashMap<>());

Map<PartitionKeyV2, PartitionHashRecordV2> nodeData = res.getData();

nodeData.forEach((partKey, partHash) -> nodePartsRes.computeIfAbsent(partKey, k -> new ArrayList<>()).add(partHash));
}

return SnapshotChecker.reduceHashesResults(hashes, ex);
}

/** {@inheritDoc} */
Expand Down Expand Up @@ -140,31 +157,6 @@ 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<ClusterNode, Exception> ex = new HashMap<>();
Map<ClusterNode, Map<PartitionKeyV2, List<PartitionHashRecordV2>>> hashes = new HashMap<>();

for (ComputeJobResult res : results) {
if (res.getException() != null) {
ex.put(res.getNode(), res.getException());

continue;
}

Map<PartitionKeyV2, List<PartitionHashRecordV2>> nodePartsRes = hashes.computeIfAbsent(res.getNode(), node -> new HashMap<>());

Map<PartitionKeyV2, PartitionHashRecordV2> nodeData = res.getData();

nodeData.forEach((partKey, partHash) -> nodePartsRes.computeIfAbsent(partKey, k -> new ArrayList<>()).add(partHash));
}

return SnapshotChecker.reduceHashesResults(hashes, ex);
}

/**
* Job that collects update counters and hashes of local partitions.
*/
Expand Down

0 comments on commit 4a402e6

Please sign in to comment.