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


##########
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:
   What does `!dbDir.startsWith(path)` do here? I don't think I understand it



##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/impl/TestStorageEngineTest.java:
##########
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.storage.impl;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.is;
+
+import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
+import org.junit.jupiter.api.Test;
+
+class TestStorageEngineTest extends BaseIgniteAbstractTest {

Review Comment:
   What if we extend it from 
`org.apache.ignite.internal.storage.engine.AbstractStorageEngineTest`? Maybe it 
won't work, I don't know. Have you tried?
   
   Also, maybe this test should be in base class, for all engines at once



##########
modules/storage-api/src/main/java/org/apache/ignite/internal/storage/engine/StorageEngine.java:
##########
@@ -78,4 +80,12 @@ static long defaultDataRegionSize() {
         //noinspection NumericCastThatLosesPrecision
         return Math.max(256 * MiB, (long) (0.2 * getTotalMemoryAvailable()));
     }
+
+    /**
+     * Returns IDs of tables for which there are MV partition storages that 
were created, but they were not yet destroyed
+     * (or the destruction did not finish).
+     */
+    default Set<Integer> nonDestroyedTableIds() {

Review Comment:
   Does it really make sense to use word "destroy" in this context? I feel like 
the name would be simpler if we called it something like `getAllTableIds`, 
because that's what it does. Is this correct?



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