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

lightning: set the 17th bit of the txn_source to indicate the write source is lightning physical mode import #57706

Merged

Conversation

3AceShowHand
Copy link
Contributor

@3AceShowHand 3AceShowHand commented Nov 26, 2024

What problem does this PR solve?

Issue Number: close #57714

Problem Summary:

  • TiCDC changefeed need to filter the lightning physical mode imported data, but there is no clue to indicate whether one row is inserted by the lightning or not.

What changed and how does it work?

  • set the 17th bit of the field txn_source, to indicates that the row is inserted by the lightning physical mode, so the TiKV-CDC can skip this row

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

The blow images shows that:

  1. No row change event data send to the TiCDC
  2. TiKV-CDC still triggers incremental scan, this is comes from the Lightning physical imported data
image image image image image

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 26, 2024
Copy link

tiprow bot commented Nov 26, 2024

Hi @3AceShowHand. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

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.

Copy link

codecov bot commented Nov 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.7729%. Comparing base (b11d034) to head (6cc3f2a).
Report is 38 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #57706        +/-   ##
================================================
+ Coverage   72.8126%   73.7729%   +0.9603%     
================================================
  Files          1677       1707        +30     
  Lines        463954     479295     +15341     
================================================
+ Hits         337817     353590     +15773     
+ Misses       105277     104134      -1143     
- Partials      20860      21571       +711     
Flag Coverage Δ
integration 46.2078% <100.0000%> (?)
unit 72.2720% <100.0000%> (+0.0570%) ⬆️

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

Components Coverage Δ
dumpling 52.7673% <ø> (ø)
parser ∅ <ø> (∅)
br 44.7318% <ø> (-0.7704%) ⬇️

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 26, 2024
@3AceShowHand 3AceShowHand changed the title lightning: set the 17th to indicate the write source lightning: set the 17th bit of the txn_source to indicate the write source is lightning physical mode import Nov 26, 2024
ResourceGroupName: ResourceGroupName,
},
RequestSource: util.BuildRequestSource(true, kv.InternalTxnLightning, TaskType),
TxnSource: kv.LightningPhysicalImportTxnSource,
Copy link
Contributor

Choose a reason for hiding this comment

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

please post manual test result. I'm not sure TiKV import service will use this value.

And maybe we can add a SST table / block property to skip scanning the whole SST to reduce IO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe we can add a SST table / block property to skip scanning the whole SST to reduce IO.

It sounds great to do so, but looks more complicated since we have to consider the case such as region merge or split? Also, is it possible that there is one sst that contains lightning physical imported data and normal inserted data at the same time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

please post manual test result. I'm not sure TiKV import service will use this value.

Yes, this PR should be get merged after test, I will post the manual test result.

https://github.com/tikv/tikv/pull/17895/files This PR set the txn_source to initialize the txn_sst_writer

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can add a SST table / block property to skip scanning the whole SST to reduce IO.

It sounds great to do so, but looks more complicated since we have to consider the case such as region merge or split? Also, is it possible that there is one sst that contains lightning physical imported data and normal inserted data at the same time?

Yes, just as a fast path. If SST merging happened we have to scan all KV.

@3AceShowHand
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Nov 26, 2024

@3AceShowHand: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@purelind
Copy link
Contributor

/retest

Copy link

tiprow bot commented Nov 26, 2024

@purelind: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@3AceShowHand
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Nov 26, 2024

@3AceShowHand: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@wuhuizuo
Copy link
Contributor

/test build

Copy link

tiprow bot commented Nov 26, 2024

@wuhuizuo: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test build

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.

@3AceShowHand
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Nov 26, 2024

@3AceShowHand: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@3AceShowHand
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Nov 26, 2024

@3AceShowHand: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@wuhuizuo
Copy link
Contributor

/test build

Copy link

tiprow bot commented Nov 26, 2024

@wuhuizuo: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test build

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 approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 28, 2024
@3AceShowHand 3AceShowHand requested a review from hicqu November 29, 2024 08:02
Copy link

ti-chi-bot bot commented Nov 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hicqu, lance6716

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

The pull request process is described 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

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 29, 2024
Copy link

ti-chi-bot bot commented Nov 29, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-28 02:22:04.762236478 +0000 UTC m=+689512.381890993: ☑️ agreed by lance6716.
  • 2024-11-29 09:11:52.820091201 +0000 UTC m=+800500.439745716: ☑️ agreed by hicqu.

Copy link

tiprow bot commented Nov 29, 2024

@3AceShowHand: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
fast_test_tiprow 6cc3f2a link true /test fast_test_tiprow

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@ti-chi-bot ti-chi-bot bot merged commit d3936a2 into pingcap:master Nov 29, 2024
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lightning set write source when import data in the physical mode
5 participants