Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #11576 +/- ##
=============================================
+ Coverage 50.04% 50.11% +0.06%
- Complexity 14515 14547 +32
=============================================
Files 1391 1391
Lines 103460 103466 +6
Branches 13558 13561 +3
=============================================
+ Hits 51777 51852 +75
+ Misses 45449 45377 -72
- Partials 6234 6237 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
frotmo
marked this pull request as ready for review
November 23, 2026 11:41
…nt commitLog read failure TransMessageRocksDBStore#getMessage returns null after retries when the half message body cannot be read or decoded. Treating that as permanent absence deletes the only durable handle used for transaction check-back. Only delete records that are invalid or older than the commitLog min physical offset; keep ambiguous read failures for the next check and do not consume transaction check attempts. Add regression cases for transient read failure, the minPhyOffset boundary, expired records, and invalid offset/size values.
frotmo
force-pushed
the
fix/tx-rocksdb-null-read
branch
from
November 23, 2026 12:22
61bbe97 to
c4c1b79
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which Issue(s) This PR Fixes
Brief Description
This PR prevents the RocksDB transaction check path from deleting a half
record when the half message body cannot be read.
Background
TransactionalMessageRocksDBService#checkTransRecordsStatuscurrently treatsgetMessage() == nullas "the message does not exist" and setshalfRecord.setDelete(true). However,TransMessageRocksDBStore#getMessageretries three times, and
StoreUtil.getMessagereturns null when:messageStore.getData(...)returns false (commitLog/mmap read failure,truncated file, invalid offset, ...);
MessageDecoder.decode(...)throws (partial/corrupt bytes);So null is an ambiguous "could not read/validate" result, not a proof of
absence. Deleting the record on the first null removes the only durable handle
used for transaction check-back. The old
TransactionalMessageServiceImplpath retries/advances and only callsresolveDiscardMsgafterneedDiscard/needSkip; the default listener movesthe message to
TRANS_CHECK_MAXTIME_TOPICinstead of silently deleting it.Scope: this only affects deployments with
transRocksDBEnable=true; thedefault path is unchanged.
Change
When
getMessagereturns null:maxMessageSize), keep the existing cleanup behavior: mark it deleted.definitely been purged; keep the existing cleanup behavior: mark it deleted.
do not increment
checkTimes, log a warning, and retry on the nexttransactionCheckInterval.Key part of the diff:
Why this design
"definitely invalid/purged" from "unknown".
minPhyOffsetis a conservative discriminator: below it, the commitLog filecontaining the record is already gone; otherwise the message may still be
valid and the read may succeed on the next scan.
checkTimesis left untouched on a read failure. It is the transactioncheck-back counter, not a read-failure counter; incrementing it would let a
transient outage exhaust
transactionCheckMaxand indirectly delete therecord.
Alternatives considered
getMessageto returnFOUND / NOT_FOUND / READ_ERROR / INVALID. Cleaner long term, but a largerAPI change; happy to follow up if maintainers prefer this direction.
log every interval; the invalid/expired checks avoid that for the obvious
cases.
recovery handle on transient read failures.
Known limitation / follow-up
A record whose offset is still within
[minPhyOffset, maxPhyOffset]but whosebody is permanently corrupt/unreadable will be retained and logged on each
scan. This PR intentionally favors data safety over silent deletion. A
follow-up can add an age/quarantine policy or a dedicated read-failure metric
without conflating it with
checkTimes.This PR is intentionally opened as a draft to confirm the null/read-failure
contract first. If maintainers prefer a typed
getMessageresult, I canrework this PR around that design instead.
How Did You Test This Change?
Added
TransactionalMessageRocksDBServiceNullReadRegressionTestwith sixcases:
checkTimesunchanged, noupdateRecordsForTranscall;The two "retain" cases fail against the unmodified code (
delete=true) andpass with this change. The expired/invalid cases keep the previous cleanup
behavior, and the two new invalid cases cover both remaining invalid-record
branches. The existing
TransactionalMessageRocksDBServiceTestalso passes.Commands:
mvn -pl broker \ -Dtest=TransactionalMessageRocksDBServiceNullReadRegressionTest,TransactionalMessageRocksDBServiceTest \ testResult:
checkstyle: checkpassed andspotbugs:checkreportedBugInstance size is 0.The tests use reflection to invoke the private
checkTransRecordsStatusmethod, following the existing
TransactionalMessageRocksDBServiceTestpattern. No production API or configuration is changed.