xtern commented on code in PR #10036:
URL: https://github.com/apache/ignite/pull/10036#discussion_r882810124


##########
modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotMetricsTest.java:
##########
@@ -212,6 +226,87 @@ public void testRestoreSnapshotError() throws Exception {
         }
     }
 
+    /** @throws Exception If fails. */
+    @Test
+    public void testCreateSnapshotProgress() throws Exception {
+        CacheConfiguration<Integer, Object> ccfg1 = cacheConfig("cache1");
+
+        IgniteEx ignite = startGridsWithCache(DEDICATED_CNT, CACHE_KEYS_RANGE, 
key -> new Account(key, key), ccfg1);
+
+        MetricRegistry mreg = 
ignite.context().metric().registry(SNAPSHOT_METRICS);
+
+        LongMetric totalSize = mreg.findMetric("CurrentSnapshotTotalSize");
+        LongMetric processedSize = 
mreg.findMetric("CurrentSnapshotProcessedSize");
+
+        assertEquals(-1, totalSize.value());
+        assertEquals(-1, processedSize.value());
+
+        // Calculate transfer rate limit.
+        PdsFolderSettings<?> folderSettings = 
ignite.context().pdsFolderResolver().resolveFolders();
+        File storeWorkDir = new File(folderSettings.persistentStoreRootPath(), 
folderSettings.folderName());
+
+        long rate = FileUtils.sizeOfDirectory(storeWorkDir) / 5;
+
+        // Limit snapshot transfer rate.
+        DistributedChangeableProperty<Serializable> rateProp =
+            
ignite.context().distributedConfiguration().property(SNAPSHOT_TRANSFER_RATE_DMS_KEY);
+
+        rateProp.propagate(rate);
+
+        // Start cluster snapshot.
+        IgniteFuture<Void> fut = 
ignite.snapshot().createSnapshot(SNAPSHOT_NAME);
+
+        // Run load.
+        IgniteInternalFuture<?> loadFut = GridTestUtils.runAsync(() -> {
+            IgniteCache<Integer, Object> cache = 
ignite.getOrCreateCache(ccfg1);
+
+            while (!fut.isDone()) {

Review Comment:
   || Thread.currentThread().isInterrupted() ?



-- 
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]

Reply via email to