tkalkirill commented on code in PR #6297:
URL: https://github.com/apache/ignite-3/pull/6297#discussion_r2224571838


##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactory.java:
##########
@@ -360,6 +368,41 @@ private static ColumnFamilyOptions 
createColumnFamilyOptions() {
         return opts;
     }
 
+    @Override
+    public Set<String> raftNodeStorageIdsOnDisk() {
+        var groupIdsForStorage = new HashSet<String>();
+
+        try (
+                Slice upperBoundSlice = new 
Slice(incrementPrefix(STORAGE_CREATED_META_PREFIX));
+                ReadOptions readOptions = new 
ReadOptions().setIterateUpperBound(upperBoundSlice);
+                RocksIterator iterator = db.newIterator(metaHandle, 
readOptions)
+        ) {
+            iterator.seek(STORAGE_CREATED_META_PREFIX);
+
+            while (iterator.isValid()) {
+                byte[] key = iterator.key();
+
+                String idForStorage = new String(
+                        key,
+                        STORAGE_CREATED_META_PREFIX.length,
+                        key.length - STORAGE_CREATED_META_PREFIX.length,
+                        UTF_8
+                );
+                groupIdsForStorage.add(idForStorage);
+
+                iterator.next();
+            }
+
+            // Doing this to make an exception thrown if the iteration was 
stopped due to an error and not due to exhausting
+            // the iteration space.
+            iterator.status();
+        } catch (RocksDBException e) {
+            throw new IgniteInternalException(INTERNAL_ERR, "Cannot get group 
storage IDs", e);
+        }
+
+        return Set.copyOf(groupIdsForStorage);

Review Comment:
   Maybe we should replace it with `java.util.Collections#unmodifiableSet`?
   To avoid copying?



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