dataroaring commented on PR #62059: URL: https://github.com/apache/doris/pull/62059#issuecomment-4260224685
Addressed all three Copilot review comments in commit a79084d: 1. **TOCTOU race in `flushEditLog()` and `logEditDirectly()`** — Replaced `txId.set(0)` with `txId.updateAndGet(v -> v % Config.edit_log_roll_num)` in both methods. This atomically preserves any increments made by concurrent threads during `rollEditLog()`, preventing lost transaction accounting. 2. **Non-atomic multi-step sequence** — Same fix applies. The `updateAndGet` uses an internal CAS retry loop, so it correctly handles concurrent modifications to `txId` between the roll and the reset. 3. **Multiple `txId.get()` calls in `flushEditLog()`** — Captured `addAndGet(batch.size())` return value into local `newTxId`, now used for both the threshold check and the log message. This ensures consistent values are observed and logged. — ThinkOps 🤖 -- 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]
