Skip to content

syncer(dm): option for explicit auto-id-cache handling in create table DDLs #12040

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

michaelmdeng
Copy link
Contributor

@michaelmdeng michaelmdeng commented Jan 29, 2025

What problem does this PR solve?

Issue Number: close #12039

What is changed and how it works?

Adds a new create-table-auto-id-cache-size Syncer config. create-table refers to the fact that this config affects CREATE TABLE statements, and when set, DM incremental replication of new tables will update the create table statement w/ the corresponding auto-id-cache size. When unset (0 or default), the statement will be left as is.

syncers:
  <name>:
    auto-id-cache-size: 1 # This sets MySQL-compatiblity mode for new tables
    ...

...

I believe this change should not affect other DM components, including import for "full" or "all" mode, but would appreciate guidance here as well.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Questions

Will it cause performance regression or break compatibility?

No

Do you need to update user documentation, design documentation or monitoring documentation?

Yes, needs documentation on the new config setting and its purpose/usage.

Release note

Allow control of `AUTO_ID_CACHE` size when DM in incremental mode creates new tables

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. contribution This PR is from a community contributor. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Jan 29, 2025
Copy link
Contributor

ti-chi-bot bot commented Jan 29, 2025

Hi @michaelmdeng. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot added area/dm Issues or PRs related to DM. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 29, 2025
@sre-bot
Copy link

sre-bot commented Jan 29, 2025

CLA assistant check
All committers have signed the CLA.

@michaelmdeng michaelmdeng force-pushed the michaelmdeng/syncer-auto-id-cache branch 3 times, most recently from 4aa676d to c43a3d9 Compare January 30, 2025 04:38
@lance6716
Copy link
Contributor

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Feb 5, 2025
@michaelmdeng michaelmdeng force-pushed the michaelmdeng/syncer-auto-id-cache branch from 01ddbdd to b55208d Compare February 10, 2025 21:09
@michaelmdeng
Copy link
Contributor Author

@lance6716 sorry about the delay, just managed to fix the relevant integration tests, can you take a look and also check if the release notes and any docs/education look ok?

@OliverS929
Copy link
Contributor

Since a new configuration is added in here, could you also add this option to OpenAPI so we can keep it aligned on both ends?

@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 18, 2025
@OliverS929
Copy link
Contributor

/retest

@OliverS929
Copy link
Contributor

@michaelmdeng Just a quick reminder — one of the two Git email addresses you used for commits in this PR hasn’t signed the CLA yet. Please make sure to sign it so we can proceed with the review. Thanks!

@OliverS929
Copy link
Contributor

/cc @D3Hunter @lance6716 @GMHDBJD

@ti-chi-bot ti-chi-bot bot requested review from D3Hunter, GMHDBJD and lance6716 April 24, 2025 06:54
@OliverS929
Copy link
Contributor

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 24, 2025
Copy link
Contributor

@lance6716 lance6716 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

@michaelmdeng michaelmdeng force-pushed the michaelmdeng/syncer-auto-id-cache branch from 2f30bab to 88eb0ff Compare May 1, 2025 17:26
@michaelmdeng
Copy link
Contributor Author

michaelmdeng commented May 1, 2025

@lance6716 Thanks for the review! addressed your feedback and made a couple of naming changes based on discussion in #12039

@lance6716
Copy link
Contributor

/retest

1 similar comment
@lance6716
Copy link
Contributor

/retest

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label May 5, 2025
Copy link
Contributor

ti-chi-bot bot commented May 5, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-05-05 07:52:54.452793279 +0000 UTC m=+255221.635696537: ☑️ agreed by lance6716.

@michaelmdeng
Copy link
Contributor Author

@lance6716 can I get help w/ approval for the dm/config changes?

@lance6716
Copy link
Contributor

ptal @D3Hunter @GMHDBJD @OliverS929

@michaelmdeng
Copy link
Contributor Author

@OliverS929 thanks for taking a look! wanted to tag you because we were specifically discussing this in the upstream issue

@OliverS929
Copy link
Contributor

Hi @michaelmdeng, thanks for tagging me again. I noticed that my earlier comment about default value initialization in the syncer config hasn't received a response yet.

I believe it's important to ensure default values are properly set when creating a new sync subtask. Could you take a look and consider making the suggested changes?

For reference, please see
https://github.com/pingcap/tiflow/blob/master/cmd/dm-syncer/config.go#L63
and
https://github.com/pingcap/tiflow/blob/master/cmd/dm-syncer/config.go#L146

@michaelmdeng
Copy link
Contributor Author

Hi @michaelmdeng, thanks for tagging me again. I noticed that my earlier comment about default value initialization in the syncer config hasn't received a response yet.

I believe it's important to ensure default values are properly set when creating a new sync subtask. Could you take a look and consider making the suggested changes?

sorry @OliverS929 , not sure I understand the request here. those are configs for the dm-syncer cmd/binary, which appears to me to be unused?

and when/if dm-syncer is run, it should initialize configs either here or from parsing the config toml file, which uses the default SubTaskConfig and SyncerConfig struct initialization which will set AutoIDCacheSize to 0, which is the desired default behavior.

@OliverS929
Copy link
Contributor

Hi @michaelmdeng, thanks for tagging me again. I noticed that my earlier comment about default value initialization in the syncer config hasn't received a response yet.
I believe it's important to ensure default values are properly set when creating a new sync subtask. Could you take a look and consider making the suggested changes?

sorry @OliverS929 , not sure I understand the request here. those are configs for the dm-syncer cmd/binary, which appears to me to be unused?

and when/if dm-syncer is run, it should initialize configs either here or from parsing the config toml file, which uses the default SubTaskConfig and SyncerConfig struct initialization which will set AutoIDCacheSize to 0, which is the desired default behavior.

I understand that this is handled by Go’s struct defaulting mechanism. I was just hoping that AutoIDCacheSize (and similar fields) could be explicitly initialized with comments, so it's more obvious to future readers and maintainers. That said, I agree it doesn't affect the functionality of this PR.

@@ -404,6 +404,8 @@ type SyncerConfig struct {
Compact bool `yaml:"compact" toml:"compact" json:"compact"`
MultipleRows bool `yaml:"multiple-rows" toml:"multiple-rows" json:"multiple-rows"`

AutoIDCacheSize uint64 `yaml:"auto-id-cache-size" toml:"auto-id-cache-size" json:"auto-id-cache-size"`
Copy link
Contributor

@OliverS929 OliverS929 Apr 27, 2025

Choose a reason for hiding this comment

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

It seems that the new config "auto-id-cache-size" does not have a default value attached to it when it is not included in the config. I think it would be great if we could have a explicit default value here that aligns with behavior from previous versions, for clarity purpose.

@OliverS929
Copy link
Contributor

OliverS929 commented Jun 16, 2025

rest LGTM

Copy link
Contributor

ti-chi-bot bot commented Jun 16, 2025

@OliverS929: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

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 kubernetes-sigs/prow repository.

Copy link
Contributor

ti-chi-bot bot commented Jun 16, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lance6716, OliverS929
Once this PR has been reviewed and has the lgtm label, please assign yudongusa for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@OliverS929
Copy link
Contributor

/cc @alastori. Because this PR involves modification to DM config, I think it would need approval from you and Ben.

@alastori
Copy link

/cc @alastori. Because this PR involves modification to DM config, I think it would need approval from you and Ben.

@OliverS929, thanks for asking. The longer key name create-table-auto-id-cache-size looks great and matches what we agreed on in the original issue discussion (link).

@michaelmdeng Tiny nit: the sample YAML in the PR description still shows the old
auto-id-cache-size. Could you update that snippet (and any other docs/tests) to use the new name so everything stays consistent before we merge?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dm Issues or PRs related to DM. contribution This PR is from a community contributor. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-1-more-lgtm Indicates a PR needs 1 more LGTM. ok-to-test Indicates a PR is ready to be tested. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow explicit control of AUTO_ID_CACHE in DM incremental sync of new tables
5 participants