timoninmaxim commented on code in PR #11596:
URL: https://github.com/apache/ignite/pull/11596#discussion_r1898402464
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotChecker.java:
##########
@@ -634,23 +634,16 @@ else if (!res.exceptions().isEmpty())
/** */
public static IdleVerifyResultV2 reduceHashesResults(
- Map<ClusterNode, Map<PartitionKeyV2, PartitionHashRecordV2>> results,
+ Map<ClusterNode, Map<PartitionKeyV2, List<PartitionHashRecordV2>>>
results,
Map<ClusterNode, Exception> ex
) {
- Map<PartitionKeyV2, List<PartitionHashRecordV2>> clusterHashes = new
HashMap<>();
-
- results.forEach((node, nodeHashes) -> {
- assert ex.get(node) == null;
+ Map<PartitionKeyV2, List<PartitionHashRecordV2>> hashesRes = new
HashMap<>();
- for (Map.Entry<PartitionKeyV2, PartitionHashRecordV2> e :
nodeHashes.entrySet()) {
- List<PartitionHashRecordV2> records =
clusterHashes.computeIfAbsent(e.getKey(), k -> new ArrayList<>());
-
- records.add(e.getValue());
- }
- });
+ results.forEach((node, partsHashes) -> partsHashes.forEach((partKey,
partHashLst) -> hashesRes.computeIfAbsent(partKey,
Review Comment:
Could you please replace it with for-loop? Three `->` in single construction
is hard to read.
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotChecker.java:
##########
@@ -634,23 +634,16 @@ else if (!res.exceptions().isEmpty())
/** */
public static IdleVerifyResultV2 reduceHashesResults(
- Map<ClusterNode, Map<PartitionKeyV2, PartitionHashRecordV2>> results,
+ Map<ClusterNode, Map<PartitionKeyV2, List<PartitionHashRecordV2>>>
results,
Map<ClusterNode, Exception> ex
) {
- Map<PartitionKeyV2, List<PartitionHashRecordV2>> clusterHashes = new
HashMap<>();
-
- results.forEach((node, nodeHashes) -> {
- assert ex.get(node) == null;
+ Map<PartitionKeyV2, List<PartitionHashRecordV2>> hashesRes = new
HashMap<>();
Review Comment:
Let's not rename the variable.
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCheckProcess.java:
##########
@@ -474,70 +690,112 @@ private <T> GridFutureAdapter<T> phaseFuture() {
}
}
- /** A DTO used to transfer nodes' results for the both phases. */
- private static final class SnapshotCheckResponse implements Serializable {
- /** Serial version uid. */
- private static final long serialVersionUID = 0L;
+ /** A DTO base to transfer node's results for the both phases. */
+ private abstract static class AbstractSnapshotCheckResponse implements
Serializable {
Review Comment:
Looks like, all implementations differ only by result type. Can be replaced
with
```
<T> T result() {
return (T)result;
}
```
--
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]