github-actions[bot] commented on code in PR #68282:
URL: https://github.com/apache/doris/pull/68282#discussion_r4082465267


##########
fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java:
##########
@@ -812,7 +812,7 @@ private void replaceTableInternal(Database db, OlapTable 
origTable, OlapTable ne
             } else {
                 Env.getCurrentRecycleBin().recycleTable(db.getId(), origTable, 
isReplay, isForce, 0);
             }
-            
Env.getCurrentEnv().getAnalysisManager().removeTableStats(origTable.getId());
+            
Env.getCurrentEnv().getAnalysisManager().removeTableStatsAndLog(origTable.getId());

Review Comment:
   [P1] Keep REPLACE TABLE replay journal-free
   
   `replayReplaceTable()` passes `isReplay=true` into this same non-swap 
branch, so this call appends `OP_DELETE_TABLE_STATS` while a 
follower/checkpoint is replaying `OP_REPLACE_TABLE`; on a BDB replica that 
write is fatal. It is a separate path from `unprotectDropTable`, and on the 
live path it also makes stats deletion durable before `logReplaceTable`, 
leaving the original table restored without stats if the outer journal never 
lands. Use the plain removal here and let the replacement journal/replay own 
the transition; add a replay test that rejects any edit-log write.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java:
##########
@@ -1058,7 +1058,7 @@ public boolean unprotectDropTable(Database db, Table 
table, boolean isForceDrop,
         if (table instanceof BaseTableStream) {
             
Env.getCurrentEnv().getTableStreamManager().removeTableStream((BaseTableStream) 
table);
         }
-        
Env.getCurrentEnv().getAnalysisManager().removeTableStats(table.getId());
+        
Env.getCurrentEnv().getAnalysisManager().removeTableStatsAndLog(table.getId());

Review Comment:
   [P1] Keep DROP replay journal-free
   
   `unprotectDropTable` is also used by `replayDropTable`, `replayDropDb` (once 
per table), and replay-time MTMV stream cleanup, all with `isReplay=true`. This 
unconditional helper tries to append `OP_DELETE_TABLE_STATS` during replay; 
BDBJE treats a replica-side write as fatal (`ReplicaWriteException`). On the 
live path it also durably deletes stats before the enclosing DROP TABLE/DB 
journal, so a crash before that outer entry restores the object without its 
stats. Please use the plain replay-safe removal here and let the enclosing DROP 
journal/replay own this state change, with a replay test whose edit log rejects 
writes.



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