Skip to content

ingest: skip write when the region has no leader (#64442)#64470

Merged
ti-chi-bot[bot] merged 1 commit into
pingcap:release-nextgen-20251011from
ti-chi-bot:cherry-pick-64442-to-release-nextgen-20251011
Nov 14, 2025
Merged

ingest: skip write when the region has no leader (#64442)#64470
ti-chi-bot[bot] merged 1 commit into
pingcap:release-nextgen-20251011from
ti-chi-bot:cherry-pick-64442-to-release-nextgen-20251011

Conversation

@ti-chi-bot

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #64442

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

if len(leaderPeerMetas) == 0 {

also log the unretryable error, to help debug and direct us to add more retryable error

Check List

Tests

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

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

[2025/11/13 15:46:11.734 +08:00] [INFO] [local.go:1497] ["put job back to jobCh to retry later"] [keyspaceName=SYSTEM] [task-id=120016] [task-key=keyspace_a/ImportInto/120016] [subtaskID=270022] [step=ingest] [startKey=780000017480000000000000C55F7280000000003C8F88] [endKey=780000017480000000000000C55F7280000000003C9901] [stage=regionScanned] [retryCount=1] [waitUntil=2025/11/13 15:46:13.734 +08:00] [error="[KV:ErrNoLeader]region has no leader, region '326782'"]
  • No need to test
    • I checked and no code files have been changed.

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

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot added 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-nextgen-20251011 labels Nov 13, 2025
@ti-chi-bot ti-chi-bot Bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 13, 2025
@codecov

codecov Bot commented Nov 13, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.26087% with 5 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release-nextgen-20251011@146db01). Learn more about missing BASE report.

Additional details and impacted files
@@                      Coverage Diff                      @@
##             release-nextgen-20251011     #64470   +/-   ##
=============================================================
  Coverage                            ?   72.5618%           
=============================================================
  Files                               ?       1856           
  Lines                               ?     503955           
  Branches                            ?          0           
=============================================================
  Hits                                ?     365679           
  Misses                              ?     116189           
  Partials                            ?      22087           
Flag Coverage Δ
unit 72.0863% <78.2608%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.8700% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 46.4097% <0.0000%> (?)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Benjamin2037 Benjamin2037 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot

ti-chi-bot Bot commented Nov 14, 2025

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Benjamin2037, D3Hunter

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 added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 14, 2025
@ti-chi-bot

ti-chi-bot Bot commented Nov 14, 2025

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2025-11-13 11:57:31.804979265 +0000 UTC m=+962501.248009144: ☑️ agreed by D3Hunter.
  • 2025-11-14 01:58:32.734111984 +0000 UTC m=+1012962.177141863: ☑️ agreed by Benjamin2037.

@ti-chi-bot ti-chi-bot Bot merged commit e62af4b into pingcap:release-nextgen-20251011 Nov 14, 2025
17 checks passed
@ti-chi-bot ti-chi-bot Bot deleted the cherry-pick-64442-to-release-nextgen-20251011 branch November 14, 2025 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm 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-nextgen-20251011

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants