imbajin commented on code in PR #2888:
URL: 
https://github.com/apache/incubator-hugegraph/pull/2888#discussion_r2462800763


##########
hugegraph-server/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlStore.java:
##########
@@ -223,6 +223,7 @@ public void truncate() {
         this.checkOpened();
 
         this.truncateTables();
+        this.init();

Review Comment:
   ⚠️ **Important: Potential inefficiency in fix approach**
   
   While calling `init()` after `truncateTables()` fixes the meta table issue, 
this approach re-initializes ALL tables, not just the meta table. This may be 
inefficient.
   
   **Analysis:**
   - `init()` calls `initTables()` which iterates through all tables and calls 
`table.init(session)` for each
   - After truncation, only the meta table needs to be re-initialized
   - Other backend stores (RocksDB, HBase) don't seem to require this step
   
   **Suggested improvement:**
   Consider a more targeted fix that only re-initializes the meta table:
   ```java
   public void truncate() {
       this.checkOpened();
       
       this.truncateTables();
       // Only re-init the meta table instead of all tables
       this.initMetaTable();
       LOG.debug("Store truncated: {}", this.store);
   }
   
   private void initMetaTable() {
       Session session = this.sessions.session();
       this.sessions.systemStore().meta.init(session);
   }
   ```
   
   This would be more efficient and clearer in intent.



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