Skip to content

coprocessor: support return _tidb_commit_ts column for TableScan coprocessor request#19166

Merged
ti-chi-bot[bot] merged 7 commits intotikv:feature/active-activefrom
tiancaiamao:table_scan_commit_ts
Dec 16, 2025
Merged

coprocessor: support return _tidb_commit_ts column for TableScan coprocessor request#19166
ti-chi-bot[bot] merged 7 commits intotikv:feature/active-activefrom
tiancaiamao:table_scan_commit_ts

Conversation

@tiancaiamao
Copy link
Contributor

@tiancaiamao tiancaiamao commented Dec 4, 2025

What is changed and how it works?

Issue Number: close pingcap/tidb#64949

What's Changed:

  • change KVPair to KvPairEntry to include the commit ts information
  • pass load_commit_ts from top side down
  • no protocol change, for coprocessor request, DAG contains the executors like TableScan, and also column info are available, there is an extra EXTRA_COMMIT_TS_COL_ID = -5 column for the _tidb_commit_ts
  • In table scan executor, when it detects EXTRA_COMMIT_TS_COL_ID, pass load_commit_ts = true to get the extra commit ts, fill data to that _tidb_commit_ts column
  • In MVCC scanner, return commit_ts by ValueEntry
coprocessor: support return _tidb_commit_ts column for TableScan coprocessor request

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

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

Side effects

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

Release note

support return _tidb_commit_ts column for TableScan coprocessor request

@ti-chi-bot ti-chi-bot bot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. 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. dco-signoff: no Indicates the PR's author has not signed dco. labels Dec 4, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 4, 2025

Hi @tiancaiamao. Thanks for your PR.

I'm waiting for a tikv 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.

Details

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 the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 4, 2025
…quest

Signed-off-by: tiancaiamao <tiancaiamao@gmail.com>
@ti-chi-bot ti-chi-bot bot added dco-signoff: yes Indicates the PR's author has signed the dco. and removed dco-signoff: no Indicates the PR's author has not signed dco. labels Dec 4, 2025
Signed-off-by: tiancaiamao <tiancaiamao@gmail.com>
@tiancaiamao tiancaiamao changed the title coprocessor: support return _tidb_commit_ts column for coprocessor request (WIP) coprocessor: support return _tidb_commit_ts column for TableScan coprocessor request (WIP) Dec 10, 2025
@tiancaiamao tiancaiamao changed the title coprocessor: support return _tidb_commit_ts column for TableScan coprocessor request (WIP) coprocessor: support return _tidb_commit_ts column for TableScan coprocessor request Dec 10, 2025
Signed-off-by: tiancaiamao <tiancaiamao@gmail.com>
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Dec 10, 2025
@you06
Copy link
Contributor

you06 commented Dec 10, 2025

/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 Dec 10, 2025
Signed-off-by: tiancaiamao <tiancaiamao@gmail.com>
@tiancaiamao
Copy link
Contributor Author

/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 Dec 11, 2025
Signed-off-by: tiancaiamao <tiancaiamao@gmail.com>
@tiancaiamao
Copy link
Contributor Author

/retest

@tiancaiamao
Copy link
Contributor Author

/unhold

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

I use codex to review this code, it seems no obvious bug for this PR

No regressions or functional issues surfaced while reviewing the changes for commit timestamp loading; interfaces were updated consistently and the new logic preserves existing
behavior when the flag is disabled.

columns[*idx]
.mut_decoded()
.push_int(Some(ts.into_inner() as i64));
self.is_column_filled[*idx] = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we return an error when EXTRA_COMMIT_TS_COL_ID but commit_ts is None? I think it is unexpected

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

assert_eq!(result, expect, "expect {:?}, but got {:?}", expect, result);

// cover load commit ts
let mut scanner1 = snapshot_store
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we also add some tests to test access_locks should be ignored when requiring commit ts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

columns[*idx]
.mut_decoded()
.push_int(Some(ts.into_inner() as i64));
self.is_column_filled[*idx] = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

Copy link
Collaborator

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

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Dec 15, 2025
Signed-off-by: tiancaiamao <tiancaiamao@gmail.com>
@lcwangchao
Copy link
Contributor

LGTM

Signed-off-by: tiancaiamao <tiancaiamao@gmail.com>
@ti-chi-bot ti-chi-bot bot added the lgtm label Dec 16, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 16, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfzjywxk, ekexium

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

The pull request process is described here

Details 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 removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 16, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 16, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-12-15 02:30:42.010593216 +0000 UTC m=+1440186.824370788: ☑️ agreed by cfzjywxk.
  • 2025-12-16 02:12:21.365200347 +0000 UTC m=+1525486.178977929: ☑️ agreed by ekexium.

@ti-chi-bot ti-chi-bot bot merged commit 15c08c0 into tikv:feature/active-active Dec 16, 2025
5 checks passed
@tiancaiamao tiancaiamao deleted the table_scan_commit_ts branch December 16, 2025 02:58
lcwangchao pushed a commit to lcwangchao/tikv that referenced this pull request Dec 25, 2025
…ocessor request (tikv#19166)

close pingcap/tidb#64949

coprocessor: support return _tidb_commit_ts column for TableScan coprocessor request

Signed-off-by: tiancaiamao <tiancaiamao@gmail.com>
lcwangchao pushed a commit to lcwangchao/tikv that referenced this pull request Dec 25, 2025
…ocessor request (tikv#19166)

close pingcap/tidb#64949

coprocessor: support return _tidb_commit_ts column for TableScan coprocessor request

Signed-off-by: tiancaiamao <tiancaiamao@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved contribution This PR is from a community contributor. dco-signoff: yes Indicates the PR's author has signed the dco. 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants