Skip to content
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] Fix individual ack with transaction decrease unAckMessageCounnt #14020

Conversation

congbobo184
Copy link
Contributor

link #13383

Motivation

#13383 has fixed the batch message ack does not decrease the unacked-msg count, but ack with transaction don't fix
because decrease unAckMessageCount move to another method. ack with transaction can't decrease unackMessageCount.

Modifications

change ack with transaction decrease unackMessageCount to normal ack(ack no transaction).

Verifying this change

Add the tests for it

Does this pull request potentially affect one of the following parts:
If yes was chosen, please highlight the changes

Dependencies (does it add or upgrade a dependency): (no)
The public API: (no)
The schema: (no)
The default values of configurations: (no)
The wire protocol: (no)
The rest endpoints: (no)
The admin cli options: (no)
Anything that affects deployment: (no)

@github-actions
Copy link

@congbobo184:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@github-actions
Copy link

@congbobo184:Thanks for providing doc info!

Comment on lines 479 to 488
if (isAcknowledgmentAtBatchIndexLevelEnabled) {
long[] cursorAckSet = getCursorAckSet(position);
if (cursorAckSet != null) {
ackedCount = batchSize - BitSet.valueOf(cursorAckSet).cardinality();
} else {
ackedCount = batchSize;
}
} else {
ackedCount = batchSize;
}
Copy link
Contributor

@gaoran10 gaoran10 Jan 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a little suggestion. Could we reuse this code block for methods individualAckNormal and individualAckWithTransaction?

@@ -249,6 +246,63 @@ public void produceAbortTest() throws Exception {
log.info("finished test partitionAbortTest");
}

@Test(dataProvider="enableBatch")
private void testAckWithTransactionReduceUnAckMessageCount(boolean enableBatch) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test should enable batch index ack for the broker and the consumer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TransactionTestBase has enable batch index ack

@codelipenghui codelipenghui merged commit 1e2ff8a into apache:master Jan 30, 2022
codelipenghui pushed a commit that referenced this pull request Jan 30, 2022
…geCounnt (#14020)

link #13383
## Motivation
#13383 has fixed  the batch message ack does not decrease the unacked-msg count, but ack with transaction don't fix
because decrease unAckMessageCount move to another method. ack with transaction can't decrease unackMessageCount.

(cherry picked from commit 1e2ff8a)
@codelipenghui codelipenghui added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Jan 30, 2022
Nicklee007 pushed a commit to Nicklee007/pulsar that referenced this pull request Apr 20, 2022
…geCounnt (apache#14020)

link apache#13383
## Motivation
apache#13383 has fixed  the batch message ack does not decrease the unacked-msg count, but ack with transaction don't fix
because decrease unAckMessageCount move to another method. ack with transaction can't decrease unackMessageCount.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/transaction cherry-picked/branch-2.9 Archived: 2.9 is end of life doc-not-needed Your PR changes do not impact docs release/2.9.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants