timoninmaxim commented on code in PR #11346:
URL: https://github.com/apache/ignite/pull/11346#discussion_r1615578508
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotMetadataVerificationTask.java:
##########
@@ -187,39 +249,62 @@ private void checkWalSegments(IncrementalSnapshotMetadata
meta, long startWalSeg
}
/** {@inheritDoc} */
- @Override public @Nullable SnapshotMetadataVerificationTaskResult
reduce(List<ComputeJobResult> results) throws IgniteException {
+ @Override public SnapshotMetadataVerificationTaskResult reduce(
+ List<ComputeJobResult> results) throws IgniteException {
Map<ClusterNode, List<SnapshotMetadata>> reduceRes = new HashMap<>();
- Map<ClusterNode, Exception> exs = new HashMap<>();
+ Map<ClusterNode, Exception> exceptions = new HashMap<>();
SnapshotMetadata first = null;
+ Set<String> baselineMetasLeft = Collections.emptySet();
- for (ComputeJobResult res: results) {
+ for (ComputeJobResult res : results) {
if (res.getException() != null) {
- exs.put(res.getNode(), res.getException());
+ exceptions.put(res.getNode(), res.getException());
continue;
}
List<SnapshotMetadata> metas = res.getData();
for (SnapshotMetadata meta : metas) {
- if (first == null)
+ if (first == null) {
first = meta;
+ baselineMetasLeft = new HashSet<>(meta.baselineNodes());
+ }
+
+ baselineMetasLeft.remove(meta.consistentId());
+
if (!first.sameSnapshot(meta)) {
- exs.put(res.getNode(),
+ exceptions.put(res.getNode(),
new IgniteException("An error occurred during
comparing snapshot metadata from cluster nodes " +
"[first=" + first + ", meta=" + meta + ", nodeId="
+ res.getNode().id() + ']'));
continue;
}
- reduceRes.computeIfAbsent(res.getNode(), n -> new
ArrayList<>())
Review Comment:
useless change
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java:
##########
@@ -1903,86 +1903,19 @@ public
IgniteInternalFuture<SnapshotPartitionsVerifyTaskResult> checkSnapshot(
Collection<ClusterNode> bltNodes =
F.view(cctx.discovery().serverNodes(AffinityTopologyVersion.NONE),
(node) -> CU.baselineNode(node, kctx0.state().clusterState()));
- SnapshotMetadataVerificationTaskArg taskArg = new
SnapshotMetadataVerificationTaskArg(name, snpPath, incIdx);
+ Collection<Integer> grpIds = grps == null ? Collections.emptySet() :
F.viewReadOnly(grps, CU::cacheId);
+
+ SnapshotMetadataVerificationTaskArg taskArg = new
SnapshotMetadataVerificationTaskArg(name, snpPath, incIdx, grpIds);
kctx0.task().execute(
SnapshotMetadataVerificationTask.class,
taskArg,
options(bltNodes)
- ).listen(f0 -> {
- if (f0.error() == null && F.isEmpty(f0.result().exceptions())) {
- Map<ClusterNode, List<SnapshotMetadata>> metas =
f0.result().meta();
-
- Map<Integer, String> grpIds = grps == null ?
Collections.emptyMap() :
- grps.stream().collect(Collectors.toMap(CU::cacheId, v ->
v));
-
- byte[] masterKeyDigest =
kctx0.config().getEncryptionSpi().masterKeyDigest();
-
- for (List<SnapshotMetadata> nodeMetas : metas.values()) {
- for (SnapshotMetadata meta : nodeMetas) {
- byte[] snpMasterKeyDigest = meta.masterKeyDigest();
-
- if (masterKeyDigest == null && snpMasterKeyDigest !=
null) {
- res.onDone(new
SnapshotPartitionsVerifyTaskResult(metas, new IdleVerifyResultV2(
- Collections.singletonMap(cctx.localNode(), new
IllegalArgumentException("Snapshot '" +
- meta.snapshotName() + "' has encrypted
caches while encryption is disabled. To " +
- "restore this snapshot, start Ignite with
configured encryption and the same " +
- "master key.")))));
-
- return;
- }
-
- if (snpMasterKeyDigest != null &&
!Arrays.equals(snpMasterKeyDigest, masterKeyDigest)) {
- res.onDone(new
SnapshotPartitionsVerifyTaskResult(metas, new IdleVerifyResultV2(
- Collections.singletonMap(cctx.localNode(), new
IllegalArgumentException("Snapshot '" +
- meta.snapshotName() + "' has different
master key digest. To restore this " +
- "snapshot, start Ignite with the same
master key.")))));
-
- return;
- }
-
- if (meta.hasCompressedGroups() &&
grpIds.keySet().stream().anyMatch(meta::isGroupWithCompression)) {
- try {
-
kctx0.compress().checkPageCompressionSupported();
- }
- catch (IgniteCheckedException e) {
- String grpWithCompr =
grpIds.entrySet().stream()
- .filter(grp ->
meta.isGroupWithCompression(grp.getKey()))
-
.map(Map.Entry::getValue).collect(Collectors.joining(", "));
-
- String msg = "Requested cache groups [" +
grpWithCompr + "] for check " +
- "from snapshot '" + meta.snapshotName() +
"' are compressed while " +
- "disk page compression is disabled. To
check these groups please " +
- "start Ignite with ignite-compress module
in classpath";
-
- res.onDone(new
SnapshotPartitionsVerifyTaskResult(metas, new IdleVerifyResultV2(
- Collections.singletonMap(cctx.localNode(),
new IllegalArgumentException(msg)))));
+ ).listen(metaFut -> {
Review Comment:
metaFut -> f0. Let's store old naming to reduce amount of code to be changed.
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotMetadataVerificationTask.java:
##########
@@ -187,39 +249,62 @@ private void checkWalSegments(IncrementalSnapshotMetadata
meta, long startWalSeg
}
/** {@inheritDoc} */
- @Override public @Nullable SnapshotMetadataVerificationTaskResult
reduce(List<ComputeJobResult> results) throws IgniteException {
+ @Override public SnapshotMetadataVerificationTaskResult reduce(
+ List<ComputeJobResult> results) throws IgniteException {
Map<ClusterNode, List<SnapshotMetadata>> reduceRes = new HashMap<>();
- Map<ClusterNode, Exception> exs = new HashMap<>();
Review Comment:
Useless renaming
--
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]