Skip to content

MINOR: remove FetchResponse.AbortedTransaction and redundant construc…#9758

Merged
chia7712 merged 43 commits intoapache:trunkfrom
chia7712:MINOR-9758
Mar 4, 2021
Merged

MINOR: remove FetchResponse.AbortedTransaction and redundant construc…#9758
chia7712 merged 43 commits intoapache:trunkfrom
chia7712:MINOR-9758

Conversation

@chia7712
Copy link
Copy Markdown
Member

@chia7712 chia7712 commented Dec 16, 2020

Changes

  1. rename INVALID_HIGHWATERMARK to INVALID_HIGH_WATERMARK
  2. replace FetchResponse.AbortedTransaction by FetchResponseData.AbortedTransaction
  3. remove redundant constructors from FetchResponse.PartitionData
  4. rename recordSet to records

Performance Tests

loop 10 times and get average.

case 1: @parametrize(acks=1, topic=TOPIC_REP_ONE)

diff: -0.3994016685 %

  • trunk: 64.847 MB/sec
  • patch: 64.588 MB/sec

case 2: @parametrize(acks=-1, topic=TOPIC_REP_THREE)

diff: +0.4917916785 %

  • trunk: 28.264 MB/sec
  • patch: 28.403 MB/sec

Committer Checklist (excluded from commit message)

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

@chia7712 chia7712 changed the title MINOR: remove FetchResponse.AbortedTransaction and duplicate construc… MINOR: remove FetchResponse.AbortedTransaction and redundant construc… Dec 16, 2020
@chia7712 chia7712 force-pushed the MINOR-9758 branch 2 times, most recently from 0fe301e to bae931b Compare December 19, 2020 06:35
Comment thread core/src/main/scala/kafka/server/KafkaApis.scala Outdated
@chia7712 chia7712 force-pushed the MINOR-9758 branch 2 times, most recently from 2a3ce40 to 3b606da Compare December 29, 2020 07:25
Copy link
Copy Markdown
Member

@ijuma ijuma left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. A couple of initial comments.

Comment thread clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java Outdated
Comment thread clients/src/main/java/org/apache/kafka/common/requests/FetchResponse.java Outdated
Comment thread clients/src/main/java/org/apache/kafka/common/requests/FetchResponse.java Outdated
@chia7712 chia7712 force-pushed the MINOR-9758 branch 2 times, most recently from 86da652 to 1a5def5 Compare January 5, 2021 20:03
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't batch the partitions again in this PR as it create a new FetchResponseData.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you clarify what you mean here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh, I planed to remove all usages of this method from production (i.e KafkaApis should generate batched response directly). However, it can produce a big patch so I will keep this method in next commit.

Comment thread core/src/main/scala/kafka/server/FetchSession.scala Outdated
@chia7712
Copy link
Copy Markdown
Member Author

fix conflicting files

@chia7712
Copy link
Copy Markdown
Member Author

fix conflicting files again

Copy link
Copy Markdown
Member

@ijuma ijuma left a comment

Choose a reason for hiding this comment

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

Thanks for the updates. A few more comments below.

Comment thread clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java Outdated
Comment thread clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java Outdated
Comment thread clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java Outdated
Comment thread core/src/main/scala/kafka/server/AbstractFetcherThread.scala Outdated
Comment thread core/src/test/scala/unit/kafka/server/FetchSessionTest.scala
Comment thread core/src/main/scala/kafka/server/KafkaApis.scala Outdated
Comment thread clients/src/main/java/org/apache/kafka/common/requests/FetchResponse.java Outdated
Comment thread clients/src/main/java/org/apache/kafka/common/requests/FetchResponse.java Outdated
Comment thread clients/src/main/java/org/apache/kafka/common/requests/FetchResponse.java Outdated
@chia7712
Copy link
Copy Markdown
Member Author

chia7712 commented Mar 2, 2021

@ijuma Thanks for all your great comments. I have updated this PR. Please take a look.

Copy link
Copy Markdown
Member

@ijuma ijuma left a comment

Choose a reason for hiding this comment

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

Thanks for the updates. I think these are the last comments and then we should be good. :)

Comment thread clients/src/main/java/org/apache/kafka/common/requests/FetchResponse.java Outdated
Comment thread core/src/main/scala/kafka/server/KafkaApis.scala Outdated
@chia7712
Copy link
Copy Markdown
Member Author

chia7712 commented Mar 2, 2021

@ijuma thanks for your comments. I have addressed them in latest commit (55b35ab). Please take a look.

Comment thread clients/src/main/java/org/apache/kafka/common/requests/FetchResponse.java Outdated
Copy link
Copy Markdown
Member

@ijuma ijuma left a comment

Choose a reason for hiding this comment

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

I left one comment, the rest LGTM.

@chia7712
Copy link
Copy Markdown
Member Author

chia7712 commented Mar 4, 2021

Build / JDK 11 / org.apache.kafka.connect.integration.BlockingConnectorTest.testWorkerRestartWithBlockInConnectorStop

unrelated flaky

@chia7712 chia7712 merged commit 8205051 into apache:trunk Mar 4, 2021
@ijuma
Copy link
Copy Markdown
Member

ijuma commented Mar 4, 2021

Great to see this merged. @chia7712 Will you follow up with the items we split into separate JIRAs? I think the 3 key ones are:

  1. Remove unnecessary copying, if possible, in KafkaApis
  2. Remove the lazily populated map in FetchResponse
  3. I think you had an idea for removing FetchResponse.toMessage

@chia7712
Copy link
Copy Markdown
Member Author

chia7712 commented Mar 4, 2021

Remove unnecessary copying, if possible, in KafkaApis

https://issues.apache.org/jira/browse/KAFKA-12385

Remove the lazily populated map in FetchResponse

https://issues.apache.org/jira/browse/KAFKA-12387

I think you had an idea for removing FetchResponse.toMessage

ugh, I missed this one. opened: https://issues.apache.org/jira/browse/KAFKA-12410

@jolshan
Copy link
Copy Markdown
Member

jolshan commented Mar 8, 2021

@chia7712 I noticed that all of these JIRAs are listed as open, but they reference this PR. Are there further changes to be made? Asking because I'm working on similar code for #9944 and want to minimize merge conflicts as best as possible.

@chia7712
Copy link
Copy Markdown
Member Author

chia7712 commented Mar 9, 2021

I noticed that all of these JIRAs are listed as open, but they reference this PR. Are there further changes to be made? Asking because I'm working on similar code for #9944 and want to minimize merge conflicts as best as possible.

thanks for this response. Only #10269 is in progress. I'm sorry that this PR brings a bunch of conflicting files to #9944. I'd like to merge #9944 before other minor refactor-related patches.

@jolshan
Copy link
Copy Markdown
Member

jolshan commented Mar 9, 2021

@chia7712 sounds good. So is the plan to merge #10269 first or after #9944? Also thanks for making these changes. I noticed a lot of this when working on #9944

@chia7712
Copy link
Copy Markdown
Member Author

chia7712 commented Mar 9, 2021

So is the plan to merge #10269 first or after #9944?

yep. #10269 is in progress (tweak performance). I will take a look at #9944 :)

@ijuma
Copy link
Copy Markdown
Member

ijuma commented Mar 9, 2021

Does the refactoring simplify #9944 or not?

@jolshan
Copy link
Copy Markdown
Member

jolshan commented Mar 9, 2021

@ijuma on first glance, I'm not sure if it simplifies. But it will introduce changes. And these are likely changes we want to have eventually.

@jolshan
Copy link
Copy Markdown
Member

jolshan commented Mar 9, 2021

So should we go forward with #10269 first still?

@chia7712
Copy link
Copy Markdown
Member Author

chia7712 commented Mar 9, 2021

So should we go forward with #10269 first still?

It needs some time to complete performance tests. It seems to me we can fix conflicting files in #9944 to get reviews and then push it before merging #10269. BTW, don't worry about causing potential conflicting files to #10269 :)

@jolshan
Copy link
Copy Markdown
Member

jolshan commented Mar 9, 2021

@chia7712 I see. Thanks for the response. I'm not sure if #9944 will be ready after fixing conflicts. There were still a few critical tests failing. I can try to fix those but still figuring out the timeline. I can go ahead and start with the conflicts though.

@dengziming dengziming mentioned this pull request Mar 30, 2021
3 tasks
@chia7712 chia7712 deleted the MINOR-9758 branch March 25, 2024 15:21
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.

3 participants