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


##########
hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseStore.java:
##########
@@ -402,6 +402,8 @@ public void truncate() {
                     "Failed to truncate table for '%s' store", e, this.store);
         }
 
+        this.init();

Review Comment:
   ‼️ **Root cause analysis: Design issue in truncate implementation**
   
   After reviewing the code, I found the real problem:
   
   **Current Issue:**
   - `HbaseSystemStore.tableNames()` (line 572-576) includes the meta table in 
the list
   - `truncate()` clears ALL tables returned by `tableNames()`, including the 
meta table
   - Adding `init()` is a workaround, but meta table should never be cleared in 
the first place
   
   **Proper Fix:**
   Override `truncate()` in `HbaseSystemStore` to exclude meta table:
   
   ```java
   @Override
   public void truncate() {
       // Save meta table before truncate
       List<String> originalTables = this.tableNames();
       
       // Temporarily remove meta table from truncation
       // Then call super.truncate() on data tables only
       // Or better: add a separate method tableNamesToTruncate()
   }
   ```
   
   **Alternative approach** (cleaner):
   ```java
   protected List<String> tableNamesToTruncate() {
       // Only return data tables, not meta/system tables
       return super.tableNames(); // Don't include meta.table()
   }
   ```
   
   Then use `tableNamesToTruncate()` in the truncate() method instead of 
`tableNames()`.
   
   This matches how MySQL backend works - it only truncates data tables, never 
system tables.



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