-
Notifications
You must be signed in to change notification settings - Fork 287
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
codec(cdc): fix encoder max-message-bytes
#4074
codec(cdc): fix encoder max-message-bytes
#4074
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #4074 +/- ##
================================================
- Coverage 57.0741% 55.1457% -1.9285%
================================================
Files 478 486 +8
Lines 56551 60050 +3499
================================================
+ Hits 32276 33115 +839
- Misses 20978 23568 +2590
- Partials 3297 3367 +70 |
/run-all-tests |
/run-all-tests |
/run-leak-test |
/run-all-tests |
Need to confirm:
|
d.maxMessageBytes = config.DefaultMaxMessageBytes | ||
if maxMessageBytes, ok := params["max-message-bytes"]; ok { | ||
d.maxMessageBytes, err = strconv.Atoi(maxMessageBytes) | ||
if err != nil { | ||
return cerror.ErrSinkInvalidConfig.Wrap(err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original logic is not elegant, but what is the bug in it?
- If
max-message-bytes
is set in sink-uri, the following lines set it:Lines 419 to 422 in 43a599d
s = sinkURI.Query().Get("max-message-bytes") if s != "" { opts["max-message-bytes"] = s } - If
max-message-bytes
is not set in sink-uri,config.DefaultMaxMessageBytes
will be used here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have to update the config once more.because we would query Kafka broker to get topicMaxMessageBytes
or brokerMessageMaxBytes
, and then choose the minimum of min(max-message-bytes
, topicMaxMessageBytes
, brokerMessageMaxBytes
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense, maybe more scenario tests can be added, either in integration test or test infra.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have to refact the configuration in the kafka, Config
, sarama.Config
, opts
, and cover the adjust logic.
Co-authored-by: amyangfei <amyangfei@gmail.com>
Co-authored-by: amyangfei <amyangfei@gmail.com>
/run-all-tests |
/run-leak-test |
/run-integration-test |
/run-kafka-integration-test |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #4075. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #4076. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #4077. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #4078. |
In response to a cherrypick label: new pull request created: #4079. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
* This is an automated cherry-pick of #4074 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io> * remove craft. * fix json. * fix more. * fix mq test. * fix json test. * fix mq test. * fix kafka test. * fix json test. * fix kafka test * fix kafka test * fix kafka test * comment out. * revert comment. * update go sum. * move opt out. Co-authored-by: Ling Jin <7138436+3AceShowHand@users.noreply.github.com> Co-authored-by: 3AceShowHand <jinl1037@hotmail.com>
* fix encoder. * add test. * fix test. * fix encoder SetParams. * fix test in json. * update craft test. * fix craft test. * Refine error. * Update cdc/sink/codec/craft.go Co-authored-by: amyangfei <amyangfei@gmail.com> * Update cdc/sink/codec/craft.go Co-authored-by: amyangfei <amyangfei@gmail.com> * fix test in craft. Co-authored-by: amyangfei <amyangfei@gmail.com>
* 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>
What problem does this PR solve?
close #4089
when initializing the encoder, make sure
max-message-bytes
in theopts
, and set identical to producer's configuration.What is changed and how it works?
Check List
Tests
Code changes
Side effects
Related changes
Release note