Skip to content

eventservice: replace scan window with fair memory admission - #5953

Draft
asddongmen wants to merge 1 commit into
pingcap:masterfrom
asddongmen:0811-fix-scan-admission-fairness
Draft

eventservice: replace scan window with fair memory admission#5953
asddongmen wants to merge 1 commit into
pingcap:masterfrom
asddongmen:0811-fix-scan-admission-fairness

Conversation

@asddongmen

@asddongmen asddongmen commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: close #5949

The changefeed-wide scan window caps every dispatcher using the slowest dispatcher's sent resolved timestamp. Under TPC-C-like skew, one hot or blocked table stalls independent tables and reduces downstream throughput. Disabling it reintroduces starvation risk during DDL/syncpoint pressure.

What is changed and how it works?

  • Replace the timestamp fence with two-level byte admission that reserves changefeed and dispatcher credit before queueing a scan.
  • Retry denied dispatchers with a periodic O(n) sweep. Per downstream node, one oldest waiter receives protected headroom and up to a 1 MiB scan quantum; syncpoint waiters are protected immediately.
  • Coalesce notifications received while a scan is queued or running.
  • Report dynstream resident memory as input-buffered, pending, and handler-await bytes, while keeping pending-only release behavior.
  • Remove scan-window controller, metrics, and dashboards. Keep enable-scan-window as an accepted, deprecated no-op for configuration compatibility.
  • Keep batch-by-bytes and the congestion-control V2 wire format unchanged.

Check List

Tests

  • Unit test

Focused race/failpoint tests (318 tests), the CDC build, formatting/dashboard checks, and changed-line lint passed. A 1,000,000-dispatcher sweep took 167 ms and 24 B/op on Apple M4 Max.

Questions

Will it cause performance regression or break compatibility?

No expected regression. Admission remains O(1) on the fast path; the once-per-second fairness sweep is O(n), with no heap, sort, or per-dispatcher timer. Existing configuration still parses.

Do you need to update user documentation, design documentation or monitoring documentation?

Monitoring is updated by removing scan-window-only metrics and panels. No user documentation change is needed because the retained setting is under debug configuration.

Release note

Fix scan throughput degradation caused by changefeed-wide scan-window blocking while preserving dispatcher fairness under memory pressure.

@ti-chi-bot

ti-chi-bot Bot commented Aug 11, 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

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

ti-chi-bot Bot commented Aug 11, 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 nongfushanquan 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

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

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: b39fa57d-d658-4b4a-8401-f1835d91e079

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

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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eventservice: scan window throttles bursty TPC-C workloads

1 participant