Skip to content

Raft: Fix coprocessor ignore new added RegionReadStatus thus cause inconsistent result (#10543)#10544

Merged
ti-chi-bot[bot] merged 3 commits intopingcap:release-8.5from
ti-chi-bot:cherry-pick-10543-to-release-8.5
Nov 28, 2025
Merged

Raft: Fix coprocessor ignore new added RegionReadStatus thus cause inconsistent result (#10543)#10544
ti-chi-bot[bot] merged 3 commits intopingcap:release-8.5from
ti-chi-bot:cherry-pick-10543-to-release-8.5

Conversation

@ti-chi-bot
Copy link
Member

@ti-chi-bot ti-chi-bot commented Nov 11, 2025

This is an automated cherry-pick of #10543

What problem does this PR solve?

Issue Number: close #10510

Problem Summary:

From the failure test logging, we can see that all of those failure read request meet an RegionException: ... message: Region error STALE_COMMAND(). #10494 adds new enum values including STALE_COMMAND in RegionException:: RegionReadStatus.

https://github.com/JaySon-Huang/tiflash/blob/eb407fdfdeb9865794868009245bb0e1adb20c0e/dbms/src/Storages/KVStore/Read/RegionException.h#L42-L44

endless-htap-consistency-chaos-tps-7973167-1-292

-- read index return stale_command
server.log:[2025/11/08 23:31:38.634 +08:00] [WARN] [LearnerReadWorker.cpp:332] ["meet abnormal region error region_error { message: \"stale command\" stale_command { } }, region_id=18056"] [source="Coprocessor, is_remote_read: true, start_ts: 462059181271678978, region_info: {18056, 7, 109}"] [thread_id=678]
server.log:[2025/11/08 23:31:38.634 +08:00] [INFO] [LearnerReadWorker.cpp:432] ["[Learner Read] Batch read index, num_regions=1 num_requests=1 num_stale_read=0 num_cached_index=0 n_unavailable=1 read_cost=1016ms start_ts=462059181271678978 unavailable_regions={ids=[{region_id:18056,s:STALE_COMMAND,msg:}] locks=[]}"] [source="Coprocessor, is_remote_read: true, start_ts: 462059181271678978, region_info: {18056, 7, 109}"] [thread_id=678]
server.log:[2025/11/08 23:31:38.634 +08:00] [INFO] [LearnerReadWorker.cpp:534] ["[Learner Read] Finish wait index and resolve locks, wait_cost=0ms n_regions=1 n_unavailable=1 start_ts=462059181271678978 unavailable_regions={ids=[{region_id:18056,s:STALE_COMMAND,msg:}] locks=[]}"] [source="Coprocessor, is_remote_read: true, start_ts: 462059181271678978, region_info: {18056, 7, 109}"] [thread_id=678]
server.log:[2025/11/08 23:31:38.634 +08:00] [DEBUG] [LearnerReadWorker.cpp:573] ["[Learner Read] Learner Read Summary, regions_info=(region_id=18056 to_wait=0 applied_index=18534 bypass_locks=[]) unavailable_regions={ids=[{region_id:18056,s:STALE_COMMAND,msg:}] locks=[]} start_ts=462059181271678978"] [source="Coprocessor, is_remote_read: true, start_ts: 462059181271678978, region_info: {18056, 7, 109}"] [thread_id=678]
server.log:[2025/11/08 23:31:38.634 +08:00] [WARN] [CoprocessorHandler.cpp:239] ["RegionException: region_id=18056, message: Region error STALE_COMMAND()"] [source="Coprocessor, is_remote_read: true, start_ts: 462059181271678978, region_info: {18056, 7, 109}"] [thread_id=678]

endless-htap-consistency-chaos-tps-7972869-1-937

server.log:[2025/11/08 03:40:24.408 +08:00] [DEBUG] [LearnerReadWorker.cpp:405] ["[Learner Read] Start read index, start_ts=462040445410344962 num_regions=1"] [source="Coprocessor, is_remote_read: true, start_ts: 462040445410344962, region_info: {17930, 7, 84}"] [thread_id=993]
server.log:[2025/11/08 03:40:25.885 +08:00] [WARN] [LearnerReadWorker.cpp:332] ["meet abnormal region error region_error { message: \"stale command\" stale_command { } }, region_id=17930"] [source="Coprocessor, is_remote_read: true, start_ts: 462040445410344962, region_info: {17930, 7, 84}"] [thread_id=993]
server.log:[2025/11/08 03:40:25.885 +08:00] [INFO] [LearnerReadWorker.cpp:432] ["[Learner Read] Batch read index, num_regions=1 num_requests=1 num_stale_read=0 num_cached_index=0 n_unavailable=1 read_cost=1477ms start_ts=462040445410344962 unavailable_regions={ids=[{region_id:17930,s:STALE_COMMAND,msg:}] locks=[]}"] [source="Coprocessor, is_remote_read: true, start_ts: 462040445410344962, region_info: {17930, 7, 84}"] [thread_id=993]
server.log:[2025/11/08 03:40:25.885 +08:00] [INFO] [LearnerReadWorker.cpp:534] ["[Learner Read] Finish wait index and resolve locks, wait_cost=0ms n_regions=1 n_unavailable=1 start_ts=462040445410344962 unavailable_regions={ids=[{region_id:17930,s:STALE_COMMAND,msg:}] locks=[]}"] [source="Coprocessor, is_remote_read: true, start_ts: 462040445410344962, region_info: {17930, 7, 84}"] [thread_id=993]
server.log:[2025/11/08 03:40:25.885 +08:00] [DEBUG] [LearnerReadWorker.cpp:573] ["[Learner Read] Learner Read Summary, regions_info=(region_id=17930 to_wait=0 applied_index=12790 bypass_locks=[462040445318594567]) unavailable_regions={ids=[{region_id:17930,s:STALE_COMMAND,msg:}] locks=[]} start_ts=462040445410344962"] [source="Coprocessor, is_remote_read: true, start_ts: 462040445410344962, region_info: {17930, 7, 84}"] [thread_id=993]
server.log:[2025/11/08 03:40:25.885 +08:00] [WARN] [CoprocessorHandler.cpp:239] ["RegionException: region_id=17930, message: Region error STALE_COMMAND()"] [source="Coprocessor, is_remote_read: true, start_ts: 462040445410344962, region_info: {17930, 7, 84}"] [thread_id=993]

endless-htap-consistency-chaos-tps-7911630-1-667

server.log:[2025/11/08 02:34:11.944 +08:00] [DEBUG] [LearnerReadWorker.cpp:405] ["[Learner Read] Start read index, start_ts=462039392040517633 num_regions=1"] [source="Coprocessor, is_remote_read: true, start_ts: 462039392040517633, region_info: {17945, 7, 103}"] [thread_id=1000]
server.log:[2025/11/08 02:34:11.946 +08:00] [WARN] [LearnerReadWorker.cpp:332] ["meet abnormal region error region_error { message: \"stale command\" stale_command { } }, region_id=17945"] [source="Coprocessor, is_remote_read: true, start_ts: 462039392040517633, region_info: {17945, 7, 103}"] [thread_id=1000]
server.log:[2025/11/08 02:34:11.946 +08:00] [INFO] [LearnerReadWorker.cpp:432] ["[Learner Read] Batch read index, num_regions=1 num_requests=1 num_stale_read=0 num_cached_index=0 n_unavailable=1 read_cost=1ms start_ts=462039392040517633 unavailable_regions={ids=[{region_id:17945,s:STALE_COMMAND,msg:}] locks=[]}"] [source="Coprocessor, is_remote_read: true, start_ts: 462039392040517633, region_info: {17945, 7, 103}"] [thread_id=1000]
server.log:[2025/11/08 02:34:11.946 +08:00] [INFO] [LearnerReadWorker.cpp:534] ["[Learner Read] Finish wait index and resolve locks, wait_cost=0ms n_regions=1 n_unavailable=1 start_ts=462039392040517633 unavailable_regions={ids=[{region_id:17945,s:STALE_COMMAND,msg:}] locks=[]}"] [source="Coprocessor, is_remote_read: true, start_ts: 462039392040517633, region_info: {17945, 7, 103}"] [thread_id=1000]
server.log:[2025/11/08 02:34:11.946 +08:00] [DEBUG] [LearnerReadWorker.cpp:573] ["[Learner Read] Learner Read Summary, regions_info=(region_id=17945 to_wait=0 applied_index=5 bypass_locks=[]) unavailable_regions={ids=[{region_id:17945,s:STALE_COMMAND,msg:}] locks=[]} start_ts=462039392040517633"] [source="Coprocessor, is_remote_read: true, start_ts: 462039392040517633, region_info: {17945, 7, 103}"] [thread_id=1000]
server.log:[2025/11/08 02:34:11.946 +08:00] [WARN] [CoprocessorHandler.cpp:239] ["RegionException: region_id=17945, message: Region error STALE_COMMAND()"] [source="Coprocessor, is_remote_read: true, start_ts: 462039392040517633, region_info: {17945, 7, 103}"] [thread_id=1000]

What is changed and how it works?

* Handling new added RegionReadStatus enum values for error response of coprocessor
  * Do not set the `default` branch for switch (e.status) so that the compiler will throw an error if there is not covered new enum values

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

Documentation

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

Release note

None

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Nov 11, 2025
@ti-chi-bot
Copy link
Member Author

@JaySon-Huang This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Nov 11, 2025

@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide.

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 ti-community-infra/tichi repository.

Signed-off-by: JaySon-Huang <tshent@qq.com>
@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 Nov 27, 2025
@JaySon-Huang
Copy link
Contributor

/retest

2 similar comments
@JaySon-Huang
Copy link
Contributor

/retest

@JaySon-Huang
Copy link
Contributor

/retest

@JaySon-Huang JaySon-Huang removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 28, 2025
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Nov 28, 2025
Copy link
Contributor

@JaySon-Huang JaySon-Huang left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Nov 28, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JaySon-Huang, JinheLin

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:
  • OWNERS [JaySon-Huang,JinheLin]

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 28, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Nov 28, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-11-28 10:17:41.380760318 +0000 UTC m=+870825.029954765: ☑️ agreed by JinheLin.
  • 2025-11-28 14:46:49.632429253 +0000 UTC m=+15554.446206826: ☑️ agreed by JaySon-Huang.

@ti-chi-bot ti-chi-bot bot added the cherry-pick-approved Cherry pick PR approved by release team. label Nov 28, 2025
@ti-chi-bot ti-chi-bot bot merged commit b50ff41 into pingcap:release-8.5 Nov 28, 2025
4 checks passed
@ti-chi-bot ti-chi-bot bot deleted the cherry-pick-10543-to-release-8.5 branch November 28, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved cherry-pick-approved Cherry pick PR approved by release team. lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants