sashapolo commented on code in PR #902:
URL: https://github.com/apache/ignite-3/pull/902#discussion_r910799319


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/store/FilePageStoreManager.java:
##########
@@ -237,19 +237,16 @@ public FilePageStore getStore(int grpId, int partId) 
throws IgniteInternalChecke
      * @param cleanFiles Delete files.
      */
     void stopAllGroupFilePageStores(boolean cleanFiles) {
-        List<List<FilePageStore>> holders = new 
ArrayList<>(groupPageStoreHolders.size());
+        List<List<FilePageStore>> holders = 
List.copyOf(groupPageStoreHolders.allPageStores());
 
-        for (Iterator<List<FilePageStore>> it = 
groupPageStoreHolders.values().iterator(); it.hasNext(); ) {
-            List<FilePageStore> holder = it.next();
-
-            it.remove();
-
-            holders.add(holder);
-        }
+        groupPageStoreHolders.clear();
 
         Runnable stopPageStores = () -> {
             try {
-                stopGroupFilePageStores(holders, cleanFiles);
+                stopGroupFilePageStores(
+                        
holders.stream().flatMap(Collection::stream).collect(toList()),

Review Comment:
   I actually meant that you could flatten this list when copying it on line 240



##########
modules/page-memory/src/test/java/org/apache/ignite/internal/pagememory/persistence/store/FilePageStoreManagerTest.java:
##########
@@ -223,12 +220,10 @@ void testStopAllGroupFilePageStores() throws Exception {
 
             manager1.stopAllGroupFilePageStores(true);
 
-            assertTrue(waitForCondition(
-                    () -> 
workDir.resolve("db/group-test1").toFile().listFiles().length == 0,
-                    10,
-                    // Because deleting files happens in a new thread.
-                    1_000
-            ));
+            // Waits for all asynchronous operations to complete.
+            manager1.stop();
+
+            assertThat(workDir.resolve("db/group-test1").toFile().listFiles(), 
emptyArray());

Review Comment:
   same here



##########
modules/page-memory/src/test/java/org/apache/ignite/internal/pagememory/persistence/store/FilePageStoreManagerTest.java:
##########
@@ -196,15 +196,12 @@ void testStopAllGroupFilePageStores() throws Exception {
 
             manager0.stopAllGroupFilePageStores(false);
 
-            assertFalse(waitForCondition(
-                    () -> 
workDir.resolve("db/group-test0").toFile().listFiles().length == 0,
-                    10,
-                    100
-            ));
+            // Waits for all asynchronous operations to complete.
+            manager0.stop();
 
             assertThat(

Review Comment:
   you now stop the manager twice, I think this assertion should simply be 
moved further below



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