BILLYisavailable opened a new pull request, #11644:
URL: https://github.com/apache/rocketmq/pull/11644

   ### Which Issue(s) This PR Fixes
   
   - Fixes #10241
   
   ### Brief Description
   
   Issue #10241 has remained open since 2026-04-03, with no linked 
implementation PR at the time of this submission. It affects the core message 
storage path: switching a running broker from asynchronous to synchronous 
flushing can fail after the message has already been appended.
   
   The flush worker is chosen at construction, but both `handleDiskFlush` 
overloads cast that worker according to the current configuration. An 
ASYNC_FLUSH startup followed by a SYNC_FLUSH update therefore casts 
`FlushRealTimeService` to `GroupCommitService` and throws `ClassCastException`.
   
   Use one group-commit worker for both policies. It drains pending synchronous 
requests even if the mode changes back to asynchronous, and otherwise observes 
the configured asynchronous flush interval and page thresholds. Timed 
asynchronous flushing still ignores ordinary wakeups; synchronous requests 
always wake the worker. There is only one writer advancing the flush offset, 
and the mode field is volatile so runtime updates are visible to it.
   
   ### How Did You Test This Change?
   
   - Before the fix, the asynchronous-startup-to-synchronous regression fails 
with the reported `ClassCastException` on current `develop` (`19352a246`).
   - Six flush-manager tests cover in-flight requests across mode changes, 
repeated changes, both flush APIs, timed/untimed wakeups, and failure to reach 
the requested flush offset.
   - A real message-store test alternates policies while writing and reading 24 
messages across commit-log file boundaries, checking the flushed offset before 
each synchronous success.
   - Related store tests: 49 tests, 0 failures, 0 errors, 0 skipped. Checkstyle 
and SpotBugs pass.
   
   ```sh
   mvn -pl store -am \
     
-Dtest=CommitLogFlushModeTest,DefaultMessageStoreTest,BatchPutMessageTest,DefaultMessageStoreShutDownTest,ReputMessageServiceTest
 \
     -Dsurefire.failIfNoSpecifiedTests=false \
     -Djacoco-maven-plugin.version=0.8.12 test
   ```
   
   Tested with JDK 17 and Maven 3.9.11. The command-line JaCoCo override 
supports JDK 17; the project POM is unchanged.
   


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

  • [PR] [ISSUE #10241] Support swi... BILLYisavailable (via GitHub) via commits

Reply via email to