RongtongJin commented on code in PR #10566:
URL: https://github.com/apache/rocketmq/pull/10566#discussion_r3510146508
##########
store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:
##########
@@ -1271,7 +1279,13 @@ public void initializeWithOffset(long offset, long
minPhyOffset) {
// transientStorePool is null, only need set wrote position here
MappedFile mappedFile = mappedFileQueue.getLastMappedFile(offset *
ConsumeQueue.CQ_STORE_UNIT_SIZE, true);
- fillPreBlank(mappedFile, offset * ConsumeQueue.CQ_STORE_UNIT_SIZE);
+ if (mappedFile != null && mappedFile.hold()) {
+ try {
+ fillPreBlank(mappedFile, offset *
ConsumeQueue.CQ_STORE_UNIT_SIZE);
+ } finally {
+ mappedFile.release();
+ }
+ }
Review Comment:
`initializeWithOffset()` should not silently continue when the mapped file
cannot be created or held. This path relies on continuous ConsumeQueue files,
and skipping `fillPreBlank()` while still calling `flush(0)` makes
initialization look successful even though the pre-blank area was never
written. Please fail fast here, or at least log an error and abort the
initialization, so a file creation/availability problem does not leave the
consume queue in an inconsistent state.
--
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]