GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — [fix][client] Keep transactional and non-transactional messages in separate batches by SongOf · Pull Request #26547 · apache/pulsar Conversation
Contributor
MotivationA batch carries a single transaction id in its metadata, so every message inside it inherits that // BatchMessageContainerImpl.createOpSendMsg if (currentTxnidMostBits != -1) { messageMetadata.setTxnidMostBits(currentTxnidMostBits); }
public boolean hasSameTxn(MessageImpl<?> msg) { if (!msg.getMessageBuilder().hasTxnidMostBits() || !msg.getMessageBuilder().hasTxnidLeastBits()) { return true; // (1) } if (currentTxnidMostBits == -1 || currentTxnidLeastBits == -1) { currentTxnidMostBits = msg.getMessageBuilder().getTxnidMostBits(); // (2) mutates the batch currentTxnidLeastBits = msg.getMessageBuilder().getTxnidLeastBits(); return true; } return currentTxnidMostBits == msg.getMessageBuilder().getTxnidMostBits() // (3) && currentTxnidLeastBits == msg.getMessageBuilder().getTxnidLeastBits(); } Branch (1) inspects only the message, never the batch, so a plain message is admitted into any batch Three consequences, all reachable from a single batching producer used for both
For reference, the sibling admission check on the same line of Modifications
Nothing changes at the call site. When the guard rejects a message, Applications that mix both kinds of send on one producer will see batches split more often. That is the Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:If the box was checked, please highlight the changes
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
lhotari
requested changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for fixing this transaction isolation issue and adding the abort regression test. The normal batching paths look correct. There is one remaining allocation-recovery path that can still mix transactional and plain messages, plus a small cleanup issue in the new unit tests.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page.
lhotari
approved these changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM. The follow-up resets the key-based transaction identity on every first add, including a plain message after a failed allocation, and adds the requested recovery regression test. The container tests also release their batch buffers in
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page.
nodece
added a commit
to nodece/pulsar
that referenced
this pull request
Conflict with apache#26547 (transactional/non-transactional batch isolation) in BatchMessageContainerImplTest: both sides appended tests at the end of the class. Resolution keeps both sets — apache#26547's transaction-batch tests and this PR's buffer-ownership tests — with the import block rebuilt as the sorted union. Verified: BatchMessageContainerImplTest 21/21, ProducerImplTest 23/23, spotless + checkstyle clean.
lhotari
pushed a commit
that referenced
this pull request
…parate batches (#26547) Co-authored-by: maxlisongsong <[email protected]> (cherry picked from commit fa05c3e)
lhotari
pushed a commit
that referenced
this pull request
…parate batches (#26547) Co-authored-by: maxlisongsong <[email protected]> (cherry picked from commit fa05c3e)
3 of 4 tasks
Radiancebobo
pushed a commit
to Radiancebobo/pulsar
that referenced
this pull request
…parate batches (apache#26547) Co-authored-by: maxlisongsong <[email protected]>
4 of 5 tasks
nodece
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
…parate batches (apache#26547) Co-authored-by: maxlisongsong <[email protected]> (cherry picked from commit fa05c3e)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedProjectsDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |