ingest: skip write when the region has no leader#64442
Conversation
|
Skipping CI for Draft Pull Request. |
|
Hi @D3Hunter. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. DetailsInstructions 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. |
|
/cherry-pick release-nextgen-20251011 |
|
@D3Hunter: once the present PR merges, I will cherry-pick it on top of release-nextgen-20251011 in the new PR and assign it to you. DetailsIn response to this:
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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #64442 +/- ##
================================================
+ Coverage 72.6813% 73.6174% +0.9361%
================================================
Files 1866 1889 +23
Lines 506188 514301 +8113
================================================
+ Hits 367904 378615 +10711
+ Misses 115892 112742 -3150
- Partials 22392 22944 +552
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/retest |
|
@D3Hunter: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
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. |
|
/hold |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: GMHDBJD, joechenrh 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 |
| // Also note, valid store ID > 0. | ||
| if job.region.Leader.GetStoreId() == 0 { | ||
| job.lastRetryableErr = errdef.ErrNoLeader.GenWithStackByArgs(job.region.Region.GetId()) | ||
| job.convertStageTo(needRescan) |
There was a problem hiding this comment.
If the raft member state are not change and only PD losts the latest state, change to "regionScanned" is better
There was a problem hiding this comment.
how to determine raft member state are not change and only PD losts the latest state?
There was a problem hiding this comment.
If we optimistically & wrongly change to regionScanned, later in write RPC TiDB will see "epoch not match", "request too old" and it comes to needRescan. Luckily we don't need to scan region, but the tradeoff is we may have an extra round to process the job.
There was a problem hiding this comment.
I don't know the background context of this issue. If only PD reboot, I think TiKV's raft epoch is not changed, regionScanned is better.
There was a problem hiding this comment.
if we cannot determine based on the scanned region info, we have to write or ingest and let tikv return the error back to us
in the case of this PR, the above check is to check whether the scanned region have leader or not, if no, we have to rescan
|
/retest |
|
@D3Hunter: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
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. |
|
/unhold |
|
/retest |
|
@D3Hunter: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
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. |
|
@D3Hunter: new pull request created to branch DetailsIn response to this:
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. |
What problem does this PR solve?
Issue Number: close #64422, ref #61702
Problem Summary:
What changed and how does it work?
this issue only happens in nextgen, as classic region job worker already have an additional leader check after write to tikv, we fix this by check region leader before write, so for classic kernel we can avoid the useless write
tidb/pkg/lightning/backend/local/region_job.go
Line 632 in 87152f7
also log the unretryable error, to help debug and direct us to add more retryable error
Check List
Tests
we run the same scenario in the issue, no such error again, and we can see errors like below when there is no leader for some scanned region
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.