imbajin commented on code in PR #3330:
URL: https://github.com/apache/hugegraph/pull/3330#discussion_r4264436883


##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java:
##########
@@ -267,6 +271,23 @@ public LogStorage createLogStorage(final String uri, final 
RaftOptions raftOptio
         return this.started;
     }
 
+    private void checkLegacyGraphIdData(int partitionId) {
+        Metapb.PartitionStore location =
+                
this.partitionManager.getStoreMetadata().getPartitionStore(partitionId);
+        // Looking up or assigning a new store location would write metadata 
before inspection.
+        String[] roots = location != null ? new 
String[]{location.getStoreLocation()} :
+                         this.storeEngine.getOption().getDataPath().split(",");
+        String dbName = BusinessHandlerImpl.getDbName(partitionId);
+        for (String root : roots) {
+            String dataPath = Paths.get(root, 
HgStoreEngineOptions.DB_Path_Prefix).toString();
+            String existing = RocksDBSession.resolveExistingDBPath(
+                    dataPath, dbName, 
this.storeEngine.getCommittedIndex(partitionId));
+            if (existing != null) {
+                GraphIdManager.checkLegacyGraphIdData(existing, partitionId);

Review Comment:
   PartitionEngine now borrows the factory's cached RW session and runs the 
existing preflight checker on that primary view, then closes only the clone. A 
cache miss keeps the original read-only path checks. The native regression 
writes legacy rows with WAL disabled and no flush: the separate RO view misses 
them, while the cached primary rejects them before task/FSM/Raft 
initialization. Valid cached data avoids another path probe, and reference 
counts/native handle ownership remain unchanged. The complete preflight suite, 
Java 17 reactor compilation, formatting and three independent reviews pass. 
This local correction does not complete the broader GraphID upgrade/design 
acceptance; the PR remains draft.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to