Details
-
Improvement
-
Status: Patch Available
-
Major
-
Resolution: Unresolved
-
3.0.0-alpha-3
-
None
-
None
Description
AsyncFSWAL uses consumeLock to synchronize operations between AsyncFSWAL.consumeExecutor and AsyncFSWAL.doReplaceWriter (also AsyncFSWAL.doShutdown), I think we could further use the event-driven approach again to eliminate the consumeLock:
- For AsyncFSWAL.doReplaceWriter ,it could just publish the request for replacing writer event to AsyncFSWAL and wait for the event to complete.
- For AsyncFSWAL.consumeExecutor ,it could detect the replacing writer event at its safe point (i.e. writer is broken or no FSWALEntry to write) and executes replacing writer event by itself, and after it completes , it notifies LogRoller thread that the event is completed. Replacing writer is a very lightweight operation and only replacing writer is completed, AsyncFSWAL.consumeExecutor could continue to write WAL, so it is harmless for AsyncFSWAL.consumeExecutor and could avoid using consumeLock.
The main difference between the PR and the current implementation is AsyncFSWAL.consumeExecutor replacing the writer by itself.
Attachments
Issue Links
- links to