rich7420 commented on PR #11187: URL: https://github.com/apache/ozone/pull/11187#issuecomment-6322062164
Thanks @sumitagrawl. Agreed that add/remove never run in parallel, since both hold `DeletedBlockLogImpl.lock`. The race is between the counter updates and the reload, which run on different threads: 1. The counters and the `getSummary()` snapshot are computed on the caller thread (OM RPC, `SCMBlockDeletingService`, EventQueue) and passed into the `@Replicate` call. Apply only writes the precomputed summary. 2. `notifyLeaderChanged` runs on the Ratis LeaderElection thread, before previous-term entries finish applying. Reloading there was the original undercount, so reverting `SCMStateMachine` would bring it back. 3. Ratis marks the leader as ready before it calls `notifyLeaderReady`, so `deleteKeyBlocks` can arrive before the reload. The wait on `summaryReloadPending` covers that window. The buffer lock is still needed because `flush()` runs on other threads (checkpoint download, monitor task). A small simplification is possible (fail fast instead of waiting, drop `summaryReloadCount`), and I can open a follow-up for it, but I don't think we should revert the two classes. -- 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]
