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

api,config(ticdc): support update transaction-atomicity and protocol via config file (#7980) #8022

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #7980

What problem does this PR solve?

Issue Number: close #7935

What is changed and how it works?

  1. For testing purposes, make blackhole compatible with any protocol.
  2. Replace defaultMqTxnAtomicity and defaultMysqlTxnAtomicity with defaultTxnAtomicity. Remove the logic for changing default value of TxnAtomicity) and simplify such logic in ShouldSplitTxn and validate.
  3. Check whether the sinkURI is compatible with the sink config when updating configs.

Note compatibility change: After this pr, transaction-atomicity will not be automatically changed when creating changefeed and an error will be returned when any incompatible configuration is encountered.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test api
  1. create changefeed use config: curl -X POST -H "'Content-type':'application/json'" http://127.0.0.1:8300/api/v1/changefeeds -d '{"changefeed_id":"test","sink_uri":"blackhole://root@10.1.1.1", "sink_config":{"protocol":"canal", "transaction-atomicity":"table"}}', then pause changefeed
  2. update via config file: curl -X PUT -H "'Content-type':'application/json'" http://127.0.0.1:8300/api/v1/changefeeds/test -d '{"sink_config":{"protocol":"canal-json", "transaction-atomicity":"none"}}', then query config:

./cdc cli changefeed query -c test --server=127.0.0.1:8300

  "sink_uri": "blackhole://root@10.1.1.1",
...
  "sink": {
      "protocol": "canal-json",
      "schema_registry": "",
      "csv": null,
      "column_selectors": null,
      "transaction_atomicity": "none",
      "encoder_concurrency": 0,
      "terminator": "\r\n",
      "date_separator": "",
      "enable_partition_separator": false
    }
...
  1. update both sinkuri and config file, the configuration in file will be ignored: curl -X PUT -H "'Content-type':'application/json'" http://127.0.0.1:8300/api/v1/changefeeds/test -d '{"sink_uri":"blackhole://root@10.1.1.1?protocol=canal&transaction-atomicity=table", "sink_config":{"protocol":"avro", "transaction-atomicity":"none"}}'

./cdc cli changefeed query -c test --server=127.0.0.1:8300

   "sink_uri": "blackhole://root@10.1.1.1?protocol=canal\u0026transaction-atomicity=table",
...
   "sink": {
      "protocol": "canal",
      "schema_registry": "",
      "csv": null,
      "column_selectors": null,
      "transaction_atomicity": "table",
      "encoder_concurrency": 0,
      "terminator": "\r\n",
      "date_separator": "",
      "enable_partition_separator": false
    },
...
  1. If set config in sinkuri, can not update via config file: curl -X PUT -H "'Content-type':'application/json'" http://127.0.0.1:8300/api/v1/changefeeds/test -d '{"sink_config":{"protocol":"avro", "transaction-atomicity":"none"}}'
{
    "error_msg": "[CDC:ErrChangefeedUpdateRefused]changefeed update error: [CDC:ErrIncompatibleSinkConfig]incompatible configuration in sink uri(transaction-atomicity=table, protocol=canal) and config file(transaction-atomicity=none, protocol=avro)",
    "error_code": "CDC:ErrChangefeedUpdateRefused"
}#
  • Manual test cli
  1. create changefeed use config:
cat > ./cfg.yaml <<  EOF                                                                            
sink.protocol="canal"
sink.transaction-atomicity="table"
EOF
./cdc cli changefeed create --sink-uri="blackhole://root@10.1.1.1" -c test --server=127.0.0.1:8300 --config cfg.y
aml
 then pause changefeed
  1. update via config file:
cat > ./cfg.yaml <<  EOF                                                                           
sink.protocol="canal-json"
sink.transaction-atomicity="none"
EOF
 ./cdc cli changefeed update -c test --server  http://127.0.0.1:8300/ --config ./cfg.yaml             
Diff of changefeed config:
{Type:update Path:[Config Sink Protocol] From:canal To:canal-json}
{Type:update Path:[Config Sink TxnAtomicity] From:table To:none}
Could you agree to apply changes above to changefeed [Y/N]
Y
Update changefeed config successfully!
ID: test
Info: {"upstream_id":7182840064097419647,"namespace":"default","id":"test","sink_uri":"blackhole://root@10.1.1.1","create_time":"2022-12-30T16:58:23.431511759+08:00","start_ts":438407188528496644,"admin_job_type":1,"engine":"unified","config":{"memory_quota":268435456,"case_sensitive":true,"enable_old_value":true,"force_replicate":false,"ignore_ineligible_table":false,"check_gc_safe_point":true,"enable_sync_point":false,"bdr_mode":false,"sync_point_interval":600000000000,"sync_point_retention":86400000000000,"filter":{"rules":["*.*"],"event_filters":null},"mounter":{"worker_num":16},"sink":{"protocol":"canal-json","schema_registry":"","csv":{"delimiter":",","quote":"\"","null":"\\N","include_commit_ts":false},"column_selectors":null,"transaction_atomicity":"none","encoder_concurrency":16,"terminator":"\r\n","date_separator":"none","enable_partition_separator":false},"consistent":{"level":"none","max_log_size":64,"flush_interval":2000,"storage":""}},"state":"stopped","creator_version":"v6.5.0-master"}
  1. update both sinkuri and config file, the configuration in file will be ignored:
cat > ./cfg.yaml <<  EOF                                                                         
sink.protocol="avro"
sink.transaction-atomicity="none"
EOF
./cdc cli changefeed update -c test --server  http://127.0.0.1:8300/ --sink-uri "blackhole://root@10.1.1.1?protocol=canal&transaction-atomicity=table" --config ./cfg.yaml
Diff of changefeed config:
{Type:update Path:[SinkURI] From:blackhole://root@10.1.1.1 To:blackhole://root@10.1.1.1?protocol=canal&transaction-atomicity=table}
{Type:update Path:[Config Sink Protocol] From:canal-json To:avro}
Could you agree to apply changes above to changefeed [Y/N]
Y
Update changefeed config successfully!
ID: test
Info: {"upstream_id":7182840064097419647,"namespace":"default","id":"test","sink_uri":"blackhole://root@10.1.1.1?protocol=canal\u0026transaction-atomicity=table","create_time":"2022-12-30T16:58:23.431511759+08:00","start_ts":438407188528496644,"admin_job_type":1,"engine":"unified","config":{"memory_quota":268435456,"case_sensitive":true,"enable_old_value":true,"force_replicate":false,"ignore_ineligible_table":false,"check_gc_safe_point":true,"enable_sync_point":false,"bdr_mode":false,"sync_point_interval":600000000000,"sync_point_retention":86400000000000,"filter":{"rules":["*.*"],"event_filters":null},"mounter":{"worker_num":16},"sink":{"protocol":"canal","schema_registry":"","csv":{"delimiter":",","quote":"\"","null":"\\N","include_commit_ts":false},"column_selectors":null,"transaction_atomicity":"table","encoder_concurrency":16,"terminator":"\r\n","date_separator":"none","enable_partition_separator":false},"consistent":{"level":"none","max_log_size":64,"flush_interval":2000,"storage":""}},"state":"stopped","creator_version":"v6.5.0-master"}
  1. If set config in sinkuri, can not update via file:
 ./cdc cli changefeed update -c test --server  http://127.0.0.1:8300/ --config ./cfg.yaml            
Diff of changefeed config:
{Type:update Path:[Config Sink Protocol] From:canal To:avro}
{Type:update Path:[Config Sink TxnAtomicity] From:table To:none}
Could you agree to apply changes above to changefeed [Y/N]
Y
Error: [CDC:ErrChangefeedUpdateRefused]changefeed update error: [CDC:ErrIncompatibleSinkConfig]incompatible configuration in sink uri(transaction-atomicity=table, protocol=canal) and config file(transaction-atomicity=none, protocol=avro)

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

`Fix the issue of transaction-atomicity and protocol can't be updated via config file`.

@ti-chi-bot
Copy link
Member Author

[REVIEW NOTIFICATION]

This pull request has not been approved.

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. do-not-merge/cherry-pick-not-approved labels Jan 5, 2023
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. status/LGT2 Indicates that a PR has LGTM 2. type/cherry-pick-for-release-6.1 This PR is cherry-picked to release-6.1 from a source PR. labels Jan 5, 2023
@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 5, 2023
@VelocityLight VelocityLight added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Jan 10, 2023
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 10, 2023
@CharlesCheung96
Copy link
Contributor

/run-all-tests

@CharlesCheung96
Copy link
Contributor

/run-verify
/run-unit-test

1 similar comment
@nongfushanquan
Copy link
Contributor

/run-verify
/run-unit-test

@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2023

Codecov Report

❗ No coverage uploaded for pull request base (release-6.1@9613e94). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 815f2d0 differs from pull request most recent head a4d96eb. Consider uploading reports for the commit a4d96eb to get more accurate results

Additional details and impacted files
Flag Coverage Δ
cdc 61.8648% <0.0000%> (?)
dm 52.0829% <0.0000%> (?)

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

@@               Coverage Diff                @@
##             release-6.1      #8022   +/-   ##
================================================
  Coverage               ?   56.5102%           
================================================
  Files                  ?        548           
  Lines                  ?      71656           
  Branches               ?          0           
================================================
  Hits                   ?      40493           
  Misses                 ?      27298           
  Partials               ?       3865           

@CharlesCheung96
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member Author

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

Commit hash: cc19ca1

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 10, 2023
@ti-chi-bot
Copy link
Member Author

@ti-chi-bot: 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

trigger some heavy tests which will not run always when PR updated.

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.

@nongfushanquan
Copy link
Contributor

/run-dm-integration-test
/run-kafka-integration-test

@CharlesCheung96
Copy link
Contributor

/run-kafka-integration-test

@ti-chi-bot ti-chi-bot merged commit 5fa2dc9 into pingcap:release-6.1 Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Cherry pick PR approved by release team. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 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. type/cherry-pick-for-release-6.1 This PR is cherry-picked to release-6.1 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants