frotmo commented on PR #11588: URL: https://github.com/apache/rocketmq/pull/11588#issuecomment-7132879388
Thanks for the detailed review @ShannonDing — both points are addressed in commit 5fc7ca79. 1. **Preserved entry beyond the local CommitLog**: `appendEpochEntry` now reuses the existing entry only when `existingEntry.getStartOffset() <= maxPhyOffset`. Otherwise it logs a warning, truncates this epoch via `truncateSuffixByEpoch(masterEpoch)` and re-appends the entry at `maxPhyOffset`, avoiding the silent divergence on `[maxPhyOffset, recordedStartOffset)`. Added `testChangeToMasterRewritesEpochWhenStartOffsetExceedsMaxPhyOffset`, which covers exactly your scenario (epoch 2 recorded at 5000, restart recovers to 4800, entry rewritten to `(2, 4800)`). `AutoSwitchHAServiceTest` now has 4 cases, the related store suite passes 15/15, and JaCoCo shows all lines and branches of `appendEpochEntry` covered. 2. **Truncation below `confirmOffset`**: documented in the PR description as a known behavior change together with the pre-existing root cause (the controller re-electing the old master without comparing offsets / no fencing). I'm happy to file the follow-up issue for refusing truncation below `confirmOffset` if you think it is worth tracking — just let me know. Please take another look when you have a moment. -- 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]
