*: support returning commit ts for Get / BatchGet / Coprocessor (#19230)#19295
*: support returning commit ts for Get / BatchGet / Coprocessor (#19230)#19295ti-chi-bot[bot] merged 3 commits intotikv:release-8.5from
Conversation
…#19230) close tikv#19102, ref pingcap/tidb#64949 - The Get / BatchGet will return the commit_ts for each value if `need_commit_ts` is specified. - coprocessor: support return _tidb_commit_ts column for TableScan coprocessor request Signed-off-by: Chao Wang <cclcwangchao@hotmail.com> Signed-off-by: tiancaiamao <tiancaiamao@gmail.com> Co-authored-by: tiancaiamao <tiancaiamao@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support for returning commit timestamps in Get/BatchGet operations and introduces the _tidb_commit_ts column for TableScan coprocessor requests. The implementation introduces new type ValueEntry that wraps a value with an optional commit timestamp, and extends the storage layer, MVCC readers, and coprocessor executors to propagate this information.
Changes:
- Added
ValueEntryandKvPairEntrytypes to wrap values with optional commit timestamps - Extended Get/BatchGet APIs to accept
need_commit_ts/load_commit_tsparameters - Added support for
EXTRA_COMMIT_TS_COL_IDcolumn in TableScan executor
Reviewed changes
Copilot reviewed 30 out of 31 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| components/txn_types/src/types.rs | Added ValueEntry and KvPairEntry types with commit_ts field |
| src/storage/txn/store.rs | Updated Store trait with get_entry, incremental_get_entry, batch_get methods |
| src/storage/mvcc/reader/point_getter.rs | Added get_entry method supporting load_commit_ts flag |
| src/storage/mvcc/reader/scanner/*.rs | Updated scanners to return ValueEntry with commit_ts |
| src/server/service/kv.rs | Modified Get/BatchGet handlers to use need_commit_ts parameter |
| src/storage/errors.rs | Added mapping functions for KvPairEntry to protobuf |
| components/tidb_query_executors/src/table_scan_executor.rs | Added EXTRA_COMMIT_TS_COL_ID column support |
| components/tidb_query_datatype/src/codec/table.rs | Defined EXTRA_COMMIT_TS_COL_ID constant |
| components/api_version/src/keyspace.rs | Updated KvPairEntry trait with commit_ts method |
| tests/integrations/server/kv_service.rs | Added integration tests for Get/BatchGet with need_commit_ts |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/retest |
1 similar comment
|
/retest |
|
/retest |
…K handle columns (tikv#19300) close tikv#19299 fix panic when _tidb_commit_ts column is placed before PK handle columns Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
…19301) close tikv#19102 support `need_commit_ts` for TiKV command batch_get_command Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…#19230) (tikv#19295) close tikv#19312 support returning commit ts for Get / BatchGet / Coprocessor Signed-off-by: Chao Wang <cclcwangchao@hotmail.com> Signed-off-by: tiancaiamao <tiancaiamao@gmail.com> Co-authored-by: tiancaiamao <tiancaiamao@gmail.com>
…#19230) (tikv#19295) close tikv#19312 support returning commit ts for Get / BatchGet / Coprocessor Signed-off-by: Chao Wang <cclcwangchao@hotmail.com> Signed-off-by: tiancaiamao <tiancaiamao@gmail.com> Co-authored-by: tiancaiamao <tiancaiamao@gmail.com> Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
…#19230) (tikv#19295) close tikv#19312 support returning commit ts for Get / BatchGet / Coprocessor Signed-off-by: Chao Wang <cclcwangchao@hotmail.com> Signed-off-by: tiancaiamao <tiancaiamao@gmail.com> Co-authored-by: tiancaiamao <tiancaiamao@gmail.com> Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
This is a cherry-pick of #19230
need_commit_tsis specified.This is also a cherry-pick of #19300
This is also a cherry-pick of #19301
What is changed and how it works?
Issue Number: Close #19312
What's Changed:
Review guidelines
This PR supports returning the commit timestamp for the following cases:
need_commit_ts == true. It will return a non-zerocommit_tsin GetResponse / BatchGetResponse.TableScan.columnshas a column with idEXTRA_COMMIT_TS_COL_IDwhich is-5, it fills the commit ts of the row.Please review this PR and pay close attention to the following points:
need_commit_tsisfalseorEXTRA_COMMIT_TS_COL_IDis not used, the behavior should be exactly the same as the previous implementation. And the commit_ts field should be zero inGetResponse / BatchGetResponseneed_commit_tsistrueorEXTRA_COMMIT_TS_COL_IDone of the columns in the coprocessor request, the right commit ts should be returned. Please take care of some corner cases, for example, whenresolved_locksorcommitted_locksis set in the rpc requests.Related changes
pingcap/docs/pingcap/docs-cn:Check List
Tests
Side effects
Release note