anton-vinogradov commented on code in PR #10603:
URL: https://github.com/apache/ignite/pull/10603#discussion_r1152029432
##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AbstractSnapshotSelfTest.java:
##########
@@ -543,6 +589,122 @@ protected IgniteEx startGridsWithSnapshot(int nodesCnt,
int keysCnt, boolean sta
return ignite;
}
+ /** */
+ protected void createAndCheckSnapshot(IgniteEx ig, String snpName) throws
IgniteCheckedException {
+ createAndCheckSnapshot(ig, snpName, null);
+ }
+
+ /** */
+ protected void createAndCheckSnapshot(IgniteEx ig, String snpName, String
snpPath) throws IgniteCheckedException {
+ createAndCheckSnapshot(ig, snpName, snpPath, 0);
+ }
+
+ /** */
+ protected void createAndCheckSnapshot(
+ IgniteEx ig,
+ String snpName,
+ String snpPath,
+ long timeout
+ ) throws IgniteCheckedException {
+ IgniteFutureImpl<Void> fut = snp(ig).createSnapshot(snpName, snpPath,
false, onlyPrimary);
+
+ if (timeout == 0)
+ fut.get();
+ else
+ fut.get(timeout);
+
+ checkSnapshot(snpName, snpPath);
+ }
+
+ /** @param snpName Snapshot name. */
+ protected void checkSnapshot(String snpName, String snpPath) throws
IgniteCheckedException {
+ Map<String, Map<Integer, Integer>> cachesParts = new HashMap<>();
+
+ Predicate<Ignite> filter = node -> !node.configuration().isClientMode()
+ &&
node.cluster().currentBaselineTopology().contains(node.cluster().localNode());
+
+ for (Ignite node: G.allGrids()) {
+ if (!filter.test(node))
+ continue;
+
+ IgniteEx node0 = (IgniteEx)node;
+
+ File nodeSnapDir = new File(
+ snp(node0).snapshotLocalDir(snpName,
snpPath).getAbsolutePath(),
+
databaseRelativePath(node0.context().pdsFolderResolver().resolveFolders().folderName())
+ );
+
+ assertTrue(nodeSnapDir.exists());
+
+ File[] cacheDirs = nodeSnapDir.listFiles(f -> f.isDirectory() &&
!f.getName().equals(METASTORAGE_DIR_NAME));
+
+ for (File cacheDir : cacheDirs) {
+ String name =
cacheDir.getName().startsWith(CACHE_GRP_DIR_PREFIX)
+ ?
cacheDir.getName().substring(CACHE_GRP_DIR_PREFIX.length())
+ : cacheDir.getName().substring(CACHE_DIR_PREFIX.length());
+
+ Map<Integer, Integer> cacheParts = cachesParts.compute(name,
(k, v) -> v == null ? new HashMap<>() : v);
Review Comment:
computeIfAbsent?
##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotStreamerTest.java:
##########
@@ -441,7 +451,8 @@ private SnapshotPartitionsVerifyTaskResult
createAndCheckSnapshot(IgniteEx snpHn
SnapshotPartitionsVerifyTaskResult checkRes =
snp(snpHnd).checkSnapshot(SNAPSHOT_NAME, null).get();
assertTrue(checkRes.exceptions().isEmpty());
- assertTrue((expWrn != null) ==
checkRes.idleVerifyResult().hasConflicts());
+ if (!onlyPrimary)
Review Comment:
newline missed
##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManagerSelfTest.java:
##########
@@ -466,9 +468,11 @@ public void testSnapshotIteratorLargeRows() throws
Exception {
for (int i = 0; i < keys; i++)
ignite.getOrCreateCache(ccfg).put(i, new Value(new
byte[SIZE_FOR_FIT_3_PAGES]));
+ ignite = grid(ignite.affinity(ccfg.getName()).mapPartitionToNode(0));
Review Comment:
Why this particular node?
##########
modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotRestoreWithIndexingTest.java:
##########
@@ -76,8 +76,11 @@ public void testBasicClusterSnapshotRestore() throws
Exception {
grid(0).snapshot().restoreSnapshot(SNAPSHOT_NAME,
Collections.singleton(DEFAULT_CACHE_NAME)).get(TIMEOUT);
+ if (onlyPrimary)
+ awaitPartitionMapExchange();
Review Comment:
Why this is not necessary for regular snapshot?
--
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]