dataroaring opened a new pull request, #62051: URL: https://github.com/apache/doris/pull/62051
## Summary Fix multiple concurrency, NPE, and robustness issues found during deep review of the editlog subsystem: - **txId data race**: `txId` was a plain `long` accessed from multiple threads (EditLog-Flusher, caller threads via `logEditDirectly`, `logEdit(op, List)`) without synchronization. Converted to `AtomicLong`. - **logEdit(op, List) missing roll check**: The batch list variant bypassed the queue and never checked whether to roll the edit log, causing unbounded edit log growth in cloud replica update paths. - **BDBEnvironment.close() thread safety**: `close()` iterated and cleared `openedDatabases` without holding the write lock, racing with `openDatabase()` and `removeDatabase()` during FE role transitions. - **BDBHA.getLeader() NPE**: `getReplicationGroupAdmin()` returns null when no alive followers exist, but `getLeader()` didn't null-check, causing NPE during network partitions. - **Flusher batch notification on error**: When `flushEditLog()` hit a Throwable, pending `EditLogItem`s were never notified, leaving producer threads hung if `System.exit` was delayed by shutdown hooks. - **BDBJEJournal ID burn on failure**: `nextJournalId` was advanced before the write attempt. Now deferred until after successful commit to avoid burning IDs. - **removeDatabase() index corruption**: Manual index tracking with `openedDatabases.remove(index)` was fragile. Replaced with `iterator.remove()`. - **upperBound() binary search**: Replaced non-standard binary search with the standard upper_bound pattern for correctness and maintainability. - **Dead code removal**: Removed unused `editStream` field and `getEditLogSize()` which always NPEs. ## Test plan - [ ] Verify FE startup and master election work correctly - [ ] Verify edit log writing and replay on follower nodes - [ ] Verify edit log roll triggers correctly after threshold - [ ] Verify graceful shutdown doesn't hang threads - [ ] Run existing EditLog unit tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
