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

txn-file: Get first key inside range of both region & txn chunk #1455

Merged
merged 1 commit into from
Sep 2, 2024

Conversation

pingyu
Copy link
Contributor

@pingyu pingyu commented Sep 2, 2024

Changes

  • Get first key inside range of both region & txn chunk
    • Otherwise, commit request will have duplicated keys as all txn chunks in the same region will get the same key.
    • An alternative solution is just passing one key for every batch. But it's more reasonable that the commit keys is in the range of txn chunks.

Manual Test

From logs of tikv:

[cmd="kv::command::txn_file start_ts: 452262720810778627 chunk_ids: 452262720810778634 user_meta: 01030014638CC246060500FC668CC24606 shard_ver: 70 inner_lower_bound: 748000000000000036 inner_upper_bound: 7480000000000000665F72 \"kv::command::commit [7800000174800000FF00000000645F7280FF0000000000000200FE] 452262720810778627 -> 452262720876314629 | region_id: 1298 region_epoch { conf_ver: 17 version: 70 } peer { id: 1385 store_id: 4 } max_execution_duration_ms: 60000 api_version: V2 request_source: \\\"external_Insert\\\" resource_control_context { resource_group_name: \\\"default\\\" penalty {} override_priority: 8 } keyspace_id: 1\""]

[cmd="kv::command::txn_file start_ts: 452262720810778631 chunk_ids: 452262721217101826 chunk_ids: 452262721217101828 chunk_ids: 452262721217101825 chunk_ids: 452262721230209027 user_meta: 01070014638CC246060100CC688DC24606 shard_ver: 92 inner_lower_bound: 74800000000000006B5F7203800000000000000103800000000000000403800000000000000A inner_upper_bound: 74800000000000006B5F7203800000000000000103800000000000000403800000000000000E \"kv::command::commit [7800000174800000FF000000006B5F7203FF8000000000000001FF0380000000000000FF0403800000000000FF000A000000000000F9, 7800000174800000FF000000006B5F7203FF8000000000000001FF0380000000000000FF0403800000000000FF000B000000000000F9, 7800000174800000FF000000006B5F7203FF8000000000000001FF0380000000000000FF0403800000000000FF000C000000000000F9, 7800000174800000FF000000006B5F7203FF8000000000000001FF0380000000000000FF0403800000000000FF000D000000000000F9] 452262720810778631 -> 452262725201690625 | region_id: 2802 region_epoch { conf_ver: 11 version: 92 } peer { id: 2805 store_id: 6 } max_execution_duration_ms: 60000 api_version: V2 request_source: \\\"external_Insert\\\" resource_control_context { resource_group_name: \\\"default\\\" penalty {} override_priority: 8 } keyspace_id: 1\""]

[cmd="kv::command::txn_file start_ts: 452262720810778631 chunk_ids: 452262720968065025 chunk_ids: 452262720982220803 chunk_ids: 452262720994279425 chunk_ids: 452262720994279427 user_meta: 01070014638CC246060100CC688DC24606 shard_ver: 92 inner_lower_bound: 74800000000000006B5F698000000000000002038000000000000001038000000000000004014241524241524553FF4500000000000000F801516E67316932336EFF3978766875000000FC038000000000000001038000000000000004038000000000000012 inner_upper_bound: 74800000000000006B5F698000000000000002038000000000000001038000000000000004014241524241525052FF4553000000000000F9014F61596661337250FF0000000000000000F7038000000000000001038000000000000004038000000000000017 \"kv::command::commit [7800000174800000FF000000006B5F6980FF0000000000000203FF8000000000000001FF0380000000000000FF0401424152424152FF4553FF4500000000FF000000F801516E67FF316932336EFF3978FF766875000000FC03FF8000000000000001FF0380000000000000FF0403800000000000FF0012000000000000F9, 7800000174800000FF000000006B5F6980FF0000000000000203FF8000000000000001FF0380000000000000FF0401424152424152FF4F55FF4748540000FF000000FA01424434FF726A4D7247FF5670FF4E5A3761344AFF00FF00000000000000F7FF0380000000000000FF0103800000000000FF0004038000000000FF00000F0000000000FA, 7800000174800000FF000000006B5F6980FF0000000000000203FF8000000000000001FF0380000000000000FF0401424152424152FF4F55FF4748540000FF000000FA01655A53FF636D356E78FF504CFF000000000000F903FF8000000000000001FF0380000000000000FF0403800000000000FF000E000000000000F9, 7800000174800000FF000000006B5F6980FF0000000000000203FF8000000000000001FF0380000000000000FF0401424152424152FF4F55FF4748540000FF000000FA01794E67FF366A4D4176FF0000FF000000000000F703FF8000000000000001FF0380000000000000FF0403800000000000FF0002000000000000F9] 452262720810778631 -> 452262725201690625 | region_id: 2786 region_epoch { conf_ver: 11 version: 92 } peer { id: 2789 store_id: 6 } max_execution_duration_ms: 60000 api_version: V2 request_source: \\\"external_Insert\\\" resource_control_context { resource_group_name: \\\"default\\\" penalty {} override_priority: 8 } keyspace_id: 1\""]

Signed-off-by: Ping Yu <[email protected]>
@ti-chi-bot ti-chi-bot bot added dco-signoff: yes Indicates the PR's author has signed the dco. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 2, 2024
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Sep 2, 2024
Copy link

ti-chi-bot bot commented Sep 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: coocood, iosmanthus

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 Sep 2, 2024
Copy link

ti-chi-bot bot commented Sep 2, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-09-02 07:20:52.641294412 +0000 UTC m=+256177.159347338: ☑️ agreed by coocood.
  • 2024-09-02 07:23:37.47502453 +0000 UTC m=+256341.993077447: ☑️ agreed by iosmanthus.

@ti-chi-bot ti-chi-bot bot merged commit 8cc71f4 into tikv:tidb-cse-7.5 Sep 2, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm 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.

3 participants