Skip to content

logpuller: extract generic priority queue (#5487) - #5750

Merged
ti-chi-bot[bot] merged 8 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-5487-to-release-8.5
Jul 25, 2026
Merged

logpuller: extract generic priority queue (#5487)#5750
ti-chi-bot[bot] merged 8 commits into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-5487-to-release-8.5

Conversation

@ti-chi-bot

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #5487

What problem does this PR solve?

Issue Number: close #5488

What is changed and how it works?

This pull request refactors the priority queue used in the log service into a generic utility package. By moving this logic to utils/priorityqueue, the codebase reduces duplication and provides a more robust, thread-safe implementation that can be leveraged by other components. The changes include updating existing consumers to use the new generic queue and ensuring proper error handling during queue closure.

Highlights

  • Refactoring Priority Queue: Extracted the priority queue implementation from logservice/logpuller into a generic, reusable utils/priorityqueue package.
  • Improved Queue API: Updated the priority queue to support generic types and improved the blocking Pop mechanism with proper ErrClosed handling.
  • Code Cleanup: Removed the redundant local PriorityQueue implementation in logservice/logpuller and updated all references to use the new utility.

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`.

Summary by CodeRabbit

  • Refactor
    • Consolidated custom priority queue into a reusable generic utility package.
    • Updated region task queue to use the new utility.
    • Added test coverage for priority ordering verification.

@ti-chi-bot ti-chi-bot Bot added do-not-merge/cherry-pick-not-approved release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jul 25, 2026
@ti-chi-bot ti-chi-bot added lgtm size/XXL Denotes a PR that changes 1000+ 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 Jul 25, 2026
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8c4be9ae-eeda-4bb8-822d-2d7500666acc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 commented Jul 25, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lidezhu

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 approved cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Jul 25, 2026
@ti-chi-bot
ti-chi-bot Bot merged commit 09d1997 into pingcap:release-8.5 Jul 25, 2026
9 checks passed
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 Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ 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.

2 participants