Copilot commented on code in PR #3494:
URL: https://github.com/apache/fluss/pull/3494#discussion_r3464103194


##########
fluss-server/src/main/java/org/apache/fluss/server/coordinator/CoordinatorEventProcessor.java:
##########
@@ -2113,6 +2113,7 @@ private void handleCommitLakeTableSnapshotV2(
                                     throw new FlussRuntimeException(
                                             "Lake snapshot metadata is null 
for table " + tableId);
                                 }
+                                ensureTableCanAcceptLakeSnapshot(tableId);
                                 lakeTableHelper.registerLakeTableSnapshotV2(

Review Comment:
   `CoordinatorContext` is annotated `@NotThreadSafe`, but this V2 commit path 
now reads it from the `ioExecutor` thread (`ensureTableCanAcceptLakeSnapshot`). 
This introduces a real data race with the coordinator event thread mutating the 
context (e.g., during drop/cleanup), and can lead to inconsistent decisions or 
unsafe concurrent access to the underlying `HashMap`/`HashSet` state.
   
   A safer pattern (also used by the V1 path above) is to snapshot any needed 
context information on the coordinator event thread *before* submitting the IO 
task (e.g., precompute `canAccept` per tableId, or build a 
`tablePathById`/`queuedForDeletion` lookup), and then only use that snapshot 
inside `ioExecutor`.



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

Reply via email to