Skip to content

KAFKA-8639: Replace AddPartitionsToTxn with Automated Protocol #8326

Merged
guozhangwang merged 3 commits intoapache:trunkfrom
abbccdda:KAFKA-8639
Apr 24, 2020
Merged

KAFKA-8639: Replace AddPartitionsToTxn with Automated Protocol #8326
guozhangwang merged 3 commits intoapache:trunkfrom
abbccdda:KAFKA-8639

Conversation

@abbccdda
Copy link
Copy Markdown

Part of the protocol automation effort.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Mostly side cleanup

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Only side cleanups in this file

@abbccdda abbccdda changed the title KAFKA-8639 (WIP): Replace AddPartitionsToTxn with Automated Protocol KAFKA-8639: Replace AddPartitionsToTxn with Automated Protocol Mar 23, 2020
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Simplify boolean logic

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fix the alignment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The test only checks partition 0, no need for 3 partitions

@guozhangwang
Copy link
Copy Markdown
Contributor

test this

Copy link
Copy Markdown
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.

Made a pass.


public List<TopicPartition> partitions() {
return partitions;
return Builder.getPartitions(data);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Although today we are only calling this func once, if in the future we call it multiple times we'd pay the cycles each time to parse the map into the list. Could we cache the parsed list locally and when it is called again we can avoid Builder.getPartitions?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sg

public AddPartitionsToTxnResponse getErrorResponse(int throttleTimeMs, Throwable e) {
final HashMap<TopicPartition, Errors> errors = new HashMap<>();
for (TopicPartition partition : partitions) {
for (TopicPartition partition : Builder.getPartitions(data)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here, we can cache the result of Builder.getPartitions(data) for re-use.


public Map<TopicPartition, Errors> errors() {
return errors;
Map<TopicPartition, Errors> errorsMap = new HashMap<>();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar here, we can cache the result in case to be reused.

class AddPartitionsToTxnRequestTest extends BaseRequestTest {
private val topic1 = "foobartopic"
val numPartitions = 3
class AddPartitionsToTxnRequestServerTest extends BaseRequestTest {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why we want to change the test name?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Because its name has a conflict with our added AddPartitionsToTxnRequestTest, just want to clarify that.

@guozhangwang
Copy link
Copy Markdown
Contributor

test this please

@abbccdda
Copy link
Copy Markdown
Author

Test only fails the flaky test: kafka.api.ConsumerBounceTest.testRollingBrokerRestartsWithSmallerMaxGroupSizeConfigDisruptsBigGroup

@guozhangwang guozhangwang merged commit f3c8bff into apache:trunk Apr 24, 2020
ijuma added a commit to ijuma/kafka that referenced this pull request Apr 29, 2020
…t-for-generated-requests

* apache-github/trunk: (366 commits)
  MINOR: Improve producer test BufferPoolTest#testCloseNotifyWaiters. (apache#7982)
  MINOR: document how to escape json parameters to ducktape tests (apache#8546)
  KAFKA-9885; Evict last members of a group when the maximum allowed is reached (apache#8525)
  KAFKA-9866: Avoid election for topics where preferred leader is not in ISR (apache#8524)
  KAFKA-9839; Broker should accept control requests with newer broker epoch (apache#8509)
  KAKFA-9612: Add an option to kafka-configs.sh to add configs from a prop file (KIP-574)
  MINOR: Partition is under reassignment when adding and removing (apache#8364)
  MINOR: reduce allocations in log start and recovery checkpoints (apache#8467)
  MINOR: Remove unused foreign-key join class (apache#8547)
  HOTFIX: Fix broker bounce system tests (apache#8532)
  KAFKA-9704: Fix the issue z/OS won't let us resize file when mmap. (apache#8224)
  KAFKA-8639: Replace AddPartitionsToTxn with Automated Protocol  (apache#8326)
  MINOR: equals() should compare all fields for generated classes (apache#8539)
  KAFKA-9844; Fix race condition which allows more than maximum number of members(apache#8454)
  KAFKA-9823: Remember the sent generation for the coordinator request (apache#8445)
  KAFKA-9883: Add better error message when REST API forwards a request and leader is not known (apache#8536)
  KAFKA-9907: Switch default build to Scala 2.13 (apache#8537)
  MINOR: Some html fixes in Streams DSL documentation (apache#8503)
  MINOR: Enable fatal warnings with scala 2.13 (apache#8429)
  KAFKA-9852: Change the max duration that calls to the buffer pool can block from 2000ms to 10ms to reduce overall test runtime (apache#8464)
  ...
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.

2 participants