Skip to content

logpuller: simplify region failure handling pipeline#5613

Open
lidezhu wants to merge 6 commits into
masterfrom
ldz/refactor-puller03
Open

logpuller: simplify region failure handling pipeline#5613
lidezhu wants to merge 6 commits into
masterfrom
ldz/refactor-puller03

Conversation

@lidezhu

@lidezhu lidezhu commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: close #5612

What is changed and how it works?

This pull request simplifies the region failure handling pipeline in the logpuller component. By removing unnecessary concurrency primitives like errgroup and dedicated error channels, the implementation becomes more straightforward and easier to maintain. The changes focus on improving how cached errors are processed, ensuring efficient batch handling and proper resource management during shutdown.

Highlights

  • Pipeline Simplification: Removed the errCh channel and the errgroup usage in regionFailureHandler.Run, replacing them with a more direct polling and notification mechanism.
  • Error Handling Optimization: Refactored the error cache processing to use a ticker and a notification channel, reducing complexity and potential lock contention.
  • Testing Improvements: Added a new test file logservice/logpuller/region_failure_handler_test.go and removed outdated tests in subscription_client_test.go to reflect the new architecture.

Check List

Tests

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

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note.

If you don't think this PR needs a release note then fill it with `None`.

@ti-chi-bot ti-chi-bot Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jul 9, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@lidezhu lidezhu marked this pull request as ready for review July 9, 2026 15:30
@ti-chi-bot ti-chi-bot Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@lidezhu, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0b8d6a36-c410-49e4-ab83-eb444447df41

📥 Commits

Reviewing files that changed from the base of the PR and between 1971d2b and 075d517.

📒 Files selected for processing (3)
  • logservice/logpuller/region_failure_handler.go
  • logservice/logpuller/region_failure_handler_test.go
  • logservice/logpuller/subscription_client_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ldz/refactor-puller03

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ti-chi-bot ti-chi-bot Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jul 9, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the regionFailureHandler to simplify error handling by removing the background dispatcher goroutine and the errCh channel, instead processing cached errors directly in the main loop of Run using a ticker and a ready notification channel. Additionally, new unit tests are introduced to verify the error cache and handler behavior, while obsolete tests are removed. The reviewer suggests refactoring the inline closure handleCachedErrors into a dedicated method on regionFailureHandler to improve readability and performance, and increasing the timeout in require.Eventually in the test to 5 seconds to prevent flaky test failures in CI/CD environments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread logservice/logpuller/region_failure_handler.go
Comment thread logservice/logpuller/region_failure_handler_test.go Outdated
@lidezhu lidezhu changed the title Ldz/refactor puller03 logpuller: simplify region failure handling pipeline Jul 9, 2026
Base automatically changed from ldz/refactor-puller01 to master July 10, 2026 09:42
@ti-chi-bot ti-chi-bot Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 10, 2026
@lidezhu lidezhu force-pushed the ldz/refactor-puller03 branch from 91aa615 to 0934266 Compare July 10, 2026 10:09
@ti-chi-bot

ti-chi-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign wk989898 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found 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 size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 10, 2026
@lidezhu

lidezhu commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

/test all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

logpuller: simplify region failure handling pipeline

1 participant