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

KAFKA-5251: Producer should cancel unsent AddPartitions and Produce requests on abort #3161

Closed
wants to merge 5 commits into from

Conversation

hachikuji
Copy link

No description provided.

@hachikuji
Copy link
Author

@apurvam Please review when you have a chance. I don't think this is a blocker. If we receive an abortable error in AddPartitions, we don't add the partitions back to the pending set. And since they were already moved from the new partitions set, we won't add them back to the queue in nextRequestHandler. Nevertheless, there are a few cleanups in here which might be worth having.

@asfbot
Copy link

asfbot commented May 29, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/4500/
Test FAILed (JDK 8 and Scala 2.12).

@asfbot
Copy link

asfbot commented May 29, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/4515/
Test FAILed (JDK 7 and Scala 2.11).

return false;
}
String transactionalId = transactionManager.transactionalId();
if (transactionManager.isCompletingTransaction() && !transactionManager.hasPartitionsToAdd() && accumulator.hasUnflushedBatches()) {
Copy link
Author

Choose a reason for hiding this comment

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

Note that this is a bug fix. The call to nextRequestHandler may complete the transaction without sending an EndTxnRequest. In that case, there would still be queued produce requests which will probably fall into the next transaction.

Copy link
Contributor

Choose a reason for hiding this comment

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

I do not fully understand your comment here.. Is that actually fixing the original line 308?

Copy link
Contributor

Choose a reason for hiding this comment

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

EDIT: nvm, I think I understand it now.

Copy link
Contributor

@guozhangwang guozhangwang left a comment

Choose a reason for hiding this comment

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

LGTM overall. ping @apurvam to take another look as I'm not as familiar on producer client end.

return false;
}
String transactionalId = transactionManager.transactionalId();
if (transactionManager.isCompletingTransaction() && !transactionManager.hasPartitionsToAdd() && accumulator.hasUnflushedBatches()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not fully understand your comment here.. Is that actually fixing the original line 308?

return false;
}
String transactionalId = transactionManager.transactionalId();
if (transactionManager.isCompletingTransaction() && !transactionManager.hasPartitionsToAdd() && accumulator.hasUnflushedBatches()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

EDIT: nvm, I think I understand it now.

Copy link
Contributor

@apurvam apurvam left a comment

Choose a reason for hiding this comment

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

LGTM. Left a couple of minor comments.


if (nextRequestHandler.isEndTxn() && transactionManager.isCompletingTransaction() && accumulator.hasUnflushedBatches()) {
if (!accumulator.flushInProgress())
Copy link
Contributor

Choose a reason for hiding this comment

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

A comment to the effect of 'There may be batches in the queue which were previously sent and are in retry. We have to flush those to keep the sequence numbers on the client and servers in sync'.

sender.run(time.milliseconds()); // Resend ProduceRequest
sender.run(time.milliseconds()); // Send EndTxn

assertTrue(abortResult.isCompleted());
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably worth checking that the responseFuture succeeded here as well.

Copy link
Author

Choose a reason for hiding this comment

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

Actually we do this below.

@hachikuji
Copy link
Author

Tests passing locally. Merging to trunk and 0.11.0.

@asfbot
Copy link

asfbot commented May 31, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/4592/
Test FAILed (JDK 7 and Scala 2.11).

@asfbot
Copy link

asfbot commented May 31, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/4577/
Test FAILed (JDK 8 and Scala 2.12).

@asfbot
Copy link

asfbot commented May 31, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/4615/
Test FAILed (JDK 7 and Scala 2.11).

asfgit pushed a commit that referenced this pull request May 31, 2017
…equests on abort

Author: Jason Gustafson <jason@confluent.io>

Reviewers: Apurva Mehta <apurva@confluent.io>, Guozhang Wang <wangguoz@gmail.com>

Closes #3161 from hachikuji/KAFKA-5251

(cherry picked from commit d41cf1b)
Signed-off-by: Jason Gustafson <jason@confluent.io>
@asfgit asfgit closed this in d41cf1b May 31, 2017
@asfbot
Copy link

asfbot commented May 31, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/4600/
Test FAILed (JDK 8 and Scala 2.12).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants