rpuch commented on code in PR #6211:
URL: https://github.com/apache/ignite-3/pull/6211#discussion_r2192201067


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/store/FilePageStoreManager.java:
##########
@@ -500,4 +505,32 @@ public void destroyGroupIfExists(int groupId) throws 
IOException {
     private Path groupDir(int groupId) {
         return dbDir.resolve(GROUP_DIR_PREFIX + groupId);
     }
+
+    /**
+     * Scans the working directory to find IDs of all groups for which 
directories still remain.
+     *
+     * @return IDs of groups.
+     */
+    public Set<Integer> allGroupIdsOnFs() {
+        try (Stream<Path> tableDirs = Files.find(dbDir, 1, isTableDir())) {
+            return 
tableDirs.map(FilePageStoreManager::extractTableId).collect(toUnmodifiableSet());
+        } catch (IOException e) {
+            throw new IgniteInternalException(Common.INTERNAL_ERR, "Cannot 
scan for groupIDs", e);
+        }
+    }
+
+    private BiPredicate<Path, BasicFileAttributes> isTableDir() {
+        return (path, attrs) -> {
+            return attrs.isDirectory() && !dbDir.startsWith(path) && 
path.getFileName().toString().startsWith(GROUP_DIR_PREFIX);

Review Comment:
   Rewrote it with `Files.list()` which does not need this



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to