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


##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactory.java:
##########
@@ -360,6 +369,49 @@ private static ColumnFamilyOptions 
createColumnFamilyOptions() {
         return opts;
     }
 
+    @Override
+    public Set<String> raftNodeStorageIdsOnDisk(GroupIdFastForward 
fastForward) {
+        Set<String> groupIdsForStorage = new HashSet<>();
+
+        byte[] upperBound = incrementPrefix(STORAGE_CREATED_META_PREFIX);

Review Comment:
   Maybe inline this value?



##########
modules/raft/src/test/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactoryTest.java:
##########
@@ -61,6 +62,12 @@ class DefaultLogStorageFactoryTest {
 
     private final Peer peer = new Peer("127.0.0.1");
 
+    private final GroupIdFastForward fastForward = idForStorage -> {
+        String zoneIdString = idForStorage.substring(0, 
idForStorage.indexOf("_part_"));
+        int nextZoneId = Integer.parseInt(zoneIdString) + 1;
+        return new RaftNodeId(new ZonePartitionId(nextZoneId, 0), 
peer).nodeIdStringForStorage();

Review Comment:
   Why is only the zone incremented and not the partition?



##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactory.java:
##########
@@ -360,6 +369,49 @@ private static ColumnFamilyOptions 
createColumnFamilyOptions() {
         return opts;
     }
 
+    @Override
+    public Set<String> raftNodeStorageIdsOnDisk(GroupIdFastForward 
fastForward) {
+        Set<String> groupIdsForStorage = new HashSet<>();
+
+        byte[] upperBound = incrementPrefix(STORAGE_CREATED_META_PREFIX);
+
+        try (
+                Slice upperBoundSlice = new Slice(upperBound);
+                ReadOptions readOptions = new 
ReadOptions().setIterateUpperBound(upperBoundSlice);
+                RocksIterator iterator = db.newIterator(metaHandle, 
readOptions)
+        ) {
+            iterator.seek(STORAGE_CREATED_META_PREFIX);
+
+            while (iterator.isValid()) {

Review Comment:
   If a new group appears during the method execution (for example, in 
parallel), then we won't see it like that? It won't ruin anything for us?



##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactory.java:
##########
@@ -360,6 +369,49 @@ private static ColumnFamilyOptions 
createColumnFamilyOptions() {
         return opts;
     }
 
+    @Override
+    public Set<String> raftNodeStorageIdsOnDisk(GroupIdFastForward 
fastForward) {

Review Comment:
   Do we even need "fastForward"?
   Can't we go through the meta and get all the groups?



##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/LogStorageFactory.java:
##########
@@ -40,4 +41,11 @@ public interface LogStorageFactory extends LogSyncer, 
IgniteComponent {
      * @param uri Log storage URI.
      */
     void destroyLogStorage(String uri);
+
+    /**
+     * Obtains group IDs for storage of all Raft groups existing on disk.
+     *
+     * @param fastForward Fast forward that may be used to do fast forwards 
when iterating.

Review Comment:
   Do I understand correctly that this is ultimately a function for obtaining 
the next ID from the one found?
   If so, then maybe we should indicate that this is precisely a function, 
otherwise it confuses me a little.



##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactory.java:
##########
@@ -360,6 +369,49 @@ private static ColumnFamilyOptions 
createColumnFamilyOptions() {
         return opts;
     }
 
+    @Override
+    public Set<String> raftNodeStorageIdsOnDisk(GroupIdFastForward 
fastForward) {
+        Set<String> groupIdsForStorage = new HashSet<>();

Review Comment:
   U can use var.



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