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

sink(ticdc): set max-message-bytes default to 10m #4036

Merged
merged 19 commits into from
Dec 24, 2021

Conversation

3AceShowHand
Copy link
Contributor

@3AceShowHand 3AceShowHand commented Dec 23, 2021

What problem does this PR solve?

close #4041
set Kafka producer's default max-message-bytes to 10M, and use the minimum value among sink-uri's max-message-bytes, broker's message.max.bytes, topic's max.message.bytes to initialize the producer.

What is changed and how it works?

  • set the default value of max-message-bytes to 10M
  • use the min value of the 3 mentioned above to initialize the producer.

Check List

Tests

  • Unit test

Code changes

Side effects

Related changes

Release note

Set `max-message-bytes` default to 10M, and use the min value with topic and broker to initialize the producer.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 23, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • amyangfei
  • overvenus

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 23, 2021
@3AceShowHand 3AceShowHand added needs-cherry-pick-release-4.0 Should cherry pick this PR to release-4.0 branch. needs-cherry-pick-release-5.0 Should cherry pick this PR to release-5.0 branch. needs-cherry-pick-release-5.1 Should cherry pick this PR to release-5.1 branch. needs-cherry-pick-release-5.2 Should cherry pick this PR to release-5.2 branch. needs-cherry-pick-release-5.3 Should cherry pick this PR to release-5.3 branch. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 23, 2021
@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 23, 2021
@3AceShowHand
Copy link
Contributor Author

/run-all-tests

cdc/sink/codec/json.go Outdated Show resolved Hide resolved
cdc/sink/producer/kafka/kafka.go Show resolved Hide resolved
cdc/sink/codec/json.go Outdated Show resolved Hide resolved
Copy link
Contributor

@amyangfei amyangfei left a comment

Choose a reason for hiding this comment

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

rest lgtm

@3AceShowHand
Copy link
Contributor Author

/run-all-tests

@codecov-commenter
Copy link

codecov-commenter commented Dec 23, 2021

Codecov Report

Merging #4036 (a1c0a4c) into master (3873d39) will decrease coverage by 1.7871%.
The diff coverage is 67.3196%.

Flag Coverage Δ
cdc 58.8141% <67.3196%> (+0.5775%) ⬆️
dm 52.2983% <ø> (-3.7363%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@@               Coverage Diff                @@
##             master      #4036        +/-   ##
================================================
- Coverage   57.0741%   55.2870%   -1.7872%     
================================================
  Files           478        486         +8     
  Lines         56551      60043      +3492     
================================================
+ Hits          32276      33196       +920     
- Misses        20978      23498      +2520     
- Partials       3297       3349        +52     

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 23, 2021
cdc/sink/codec/craft_test.go Outdated Show resolved Hide resolved
cdc/sink/codec/json_test.go Outdated Show resolved Hide resolved
pkg/config/sink.go Outdated Show resolved Hide resolved
@@ -345,7 +345,7 @@ func kafkaClientID(role, captureAddr, changefeedID, configuredClientID string) (
return
}

func validateMaxMessageBytesAndCreateTopic(admin kafka.ClusterAdminClient, topic string, config *Config) error {
func validateMaxMessageBytesAndCreateTopic(admin kafka.ClusterAdminClient, topic string, config *Config, saramaConfig *sarama.Config) error {
Copy link
Member

@Rustin170506 Rustin170506 Dec 23, 2021

Choose a reason for hiding this comment

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

This func seems strange at the moment. Can we split it up?

  1. getMaxMessageBytes is responsible for getting the right value
  2. createTopic is used to create the topic

This way we won't have to pass two configurations and modify them at the same time. Now this function has become very complicated. Originally we didn't modify Sarama's configuration in this method. Now it is not only responsible for creating the topic, but also for setting the sarma configuration correctly, but this configuration is not directly related to creating the topic(It will affect when syncing, but it may be a pre-condition. So I think it can be separated). It does too many things. I prefer to keep them separate.

Copy link
Member

Choose a reason for hiding this comment

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

If there is a better way to get it not to set it up at the same time that would work too. I can only think of separating it at the moment.
The sarma configuration has been patched once above via kafka's configuration, but we're modifying it at the same time in this function.

It is currently confusing from either the caller's or the test code's point of view.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This worthy another PR to do it.

Copy link
Member

Choose a reason for hiding this comment

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

I think it might be better to do it in this time. It should just be a simple split method will work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I still think it would be better to do this after the release, to prevent some potential new problems.

@Rustin170506 Rustin170506 changed the title cdc/sink: set max-message-bytes default to 10m sink(ticdc): set max-message-bytes default to 10m Dec 23, 2021
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Dec 24, 2021
@overvenus
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: a1c0a4c

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 24, 2021
@ti-chi-bot
Copy link
Member

@3AceShowHand: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot merged commit 166fff0 into pingcap:master Dec 24, 2021
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4059.

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 24, 2021
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 24, 2021
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4060.

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 24, 2021
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4061.

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 24, 2021
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4062.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4063.

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 24, 2021
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
3AceShowHand added a commit that referenced this pull request Dec 24, 2021
* This is an automated cherry-pick of #4036

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>

* remove craft.

* try to fix.

* try to fix.

* remove config.

* sink.

* add mq_sink_protocol.

* add new error.

* fix json.

* fix json test.

* fix kafka.

* fix kafka tets.

* remove kafka config.

* fix.

* tiny fix.

* fix.

* fix kafka test.

* fix kafka test.

* update toml

Co-authored-by: Ling Jin <7138436+3AceShowHand@users.noreply.github.com>
Co-authored-by: 3AceShowHand <jinl1037@hotmail.com>
3AceShowHand added a commit to ti-chi-bot/tiflow that referenced this pull request Dec 25, 2021
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
zhaoxinyu pushed a commit to zhaoxinyu/ticdc that referenced this pull request Dec 29, 2021
overvenus pushed a commit that referenced this pull request Jan 24, 2022
* This is an automated cherry-pick of #4036

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>

* remove config.

* fix kafka.

* This is an automated cherry-pick of #4074

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>

* Resolve mq.

* remove unncessary mock impl.

* try fix .

* resolve conflict.

Co-authored-by: Ling Jin <7138436+3AceShowHand@users.noreply.github.com>
Co-authored-by: 3AceShowHand <jinl1037@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-4.0 Should cherry pick this PR to release-4.0 branch. needs-cherry-pick-release-5.0 Should cherry pick this PR to release-5.0 branch. needs-cherry-pick-release-5.1 Should cherry pick this PR to release-5.1 branch. needs-cherry-pick-release-5.2 Should cherry pick this PR to release-5.2 branch. needs-cherry-pick-release-5.3 Should cherry pick this PR to release-5.3 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
6 participants