-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[Transaction] Consume transaction message logic optimized #7833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Transaction] Consume transaction message logic optimized #7833
Conversation
/pulsarbot run-failure-checks |
010d775
to
ea9bbaf
Compare
/pulsarbot run-failure-checks |
2 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, could you please add a test for the batch indexes of a transaction at the consumer side?
if (!batchDeletedIndexes.containsKey(position)) { | ||
BitSetRecyclable bitSetRecyclable = BitSetRecyclable.create(); | ||
bitSetRecyclable.set(0, totalNumMessageInBatch); | ||
batchDeletedIndexes.put(position, bitSetRecyclable); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
batchDeletedIndexes.computeIfAbsent().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll use this method instead.
|
||
- name: run unit tests for pulsar-broker | ||
if: steps.docs.outputs.changed_only == 'no' | ||
run: ./build/retry.sh mvn -B -ntp test -pl pulsar-broker -Dinclude='org/apache/pulsar/broker/**/*.java' -Dexclude='org/apache/pulsar/broker/zookeeper/**/*.java,org/apache/pulsar/broker/loadbalance/**/*.java,org/apache/pulsar/broker/service/**/*.java,**/AdminApiOffloadTest.java,**/TransactionProduceTest.java' | ||
run: ./build/retry.sh mvn -B -ntp test -pl pulsar-broker -Dinclude='org/apache/pulsar/broker/**/*.java' -Dexclude='org/apache/pulsar/broker/zookeeper/**/*.java,org/apache/pulsar/broker/loadbalance/**/*.java,org/apache/pulsar/broker/service/**/*.java,**/AdminApiOffloadTest.java,org/apache/pulsar/broker/transaction/**/*.java,org/apache/pulsar/client/transaction/**/*.java' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we need this change?
b19df42
to
fde7cd4
Compare
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
### Motivation The transaction message consuming logic needs to be optimized. One transaction commit marker in the topic partition consists of many Entries in the TransactionBuffer, so one transaction could be seen as one batch. ### Modifications 1. When sending messages to consumers use the `batchIndex` in the MessageIdData to present the startBatchIndex of the Entry. 2. Calculate the transaction messages number. 3. When the first reading one transaction init it's batchDeletedIndexes in the ManagedCursorImpl.
### Motivation The transaction message consuming logic needs to be optimized. One transaction commit marker in the topic partition consists of many Entries in the TransactionBuffer, so one transaction could be seen as one batch. ### Modifications 1. When sending messages to consumers use the `batchIndex` in the MessageIdData to present the startBatchIndex of the Entry. 2. Calculate the transaction messages number. 3. When the first reading one transaction init it's batchDeletedIndexes in the ManagedCursorImpl.
### Motivation The transaction message consuming logic needs to be optimized. One transaction commit marker in the topic partition consists of many Entries in the TransactionBuffer, so one transaction could be seen as one batch. ### Modifications 1. When sending messages to consumers use the `batchIndex` in the MessageIdData to present the startBatchIndex of the Entry. 2. Calculate the transaction messages number. 3. When the first reading one transaction init it's batchDeletedIndexes in the ManagedCursorImpl.
Motivation
The transaction message consuming logic needs to be optimized. One transaction commit marker in the topic partition consists of many Entries in the TransactionBuffer, so one transaction could be seen as one batch.
Modifications
When sending messages to consumers use the
batchIndex
in the MessageIdData to present the startBatchIndex of the Entry.Calculate the transaction messages number.
When the first reading one transaction init it's batchDeletedIndexes in the ManagedCursorImpl.
Verifying this change
This change can be verified as follows:
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation