Repository navigation
fix(logtail): reduce consumer backlog pressure (#24323) - #24330
mergify[bot] merged 2 commits into
Conversation
Fixes the CN logtail consumer backlog risk found in nightly sysbench write-heavy regressions. The bad run had `logtail.consumer.slow.*` in the `update_pk_1000` window, with `signal-chan-len` around 7373~7738 on one CN consumer routine. The good control run using the same MO image did not have these slow logs in the same case window. No sysbench reconnect/retry storm, workspace quota shortage, or UPDATE table-lock upgrade was found. This PR reduces internal backpressure without changing table assignment or increasing consumer routine count: - coalesces update-response timestamp commands for routines that already have table logtail commands, - advances the routine applied timestamp only after that routine consumes the last table logtail for the response, - keeps timestamp-only commands for routines that do not receive table logtails, preserving global min applied timestamp semantics, - makes timestamp waiter commit-ts notifications non-blocking and coalesced to the latest timestamp, - adds tests for non-blocking timestamp notifications, bounded notification draining, and logtail timestamp advancement ordering. Approved by: @XuPeng-SH
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
There was a problem hiding this comment.
Pull request overview
This PR mitigates CN logtail consumer backlog/backpressure in the disttae logtail push path by coalescing timestamp-only work and making timestamp waiter notifications non-blocking, aiming to reduce queue growth during write-heavy workloads (issue #24322).
Changes:
- Coalesce per-routine applied-timestamp updates into the last table-logtail command for routines that already receive table logtails, avoiding extra timestamp-only commands.
- Advance routine applied timestamps only after that routine consumes the last logtail for a response, while preserving global min-applied semantics for routines with no logtails.
- Make
TimestampWaiter.NotifyLatestCommitTSnon-blocking and coalesce notifications to the latest timestamp; add targeted tests for these behaviors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/vm/engine/disttae/logtail_consumer.go | Coalesces timestamp advancement with the final logtail command per routine; reduces timestamp-only command fanout. |
| pkg/vm/engine/disttae/logtail_consumer_test.go | Adds tests validating timestamp-command coalescing and “advance-after-last-logtail” ordering. |
| pkg/txn/client/timestamp_waiter.go | Switches to non-blocking, coalesced wakeups using a struct notification channel plus an atomic “latest notified” timestamp. |
| pkg/txn/client/timestamp_waiter_test.go | Adds tests for non-blocking behavior under full channel, redundant wakeup skipping, and bounded draining. |
gouhongshen
left a comment
There was a problem hiding this comment.
🔍 Code Review — LGTM
This is a clean cherry-pick of #24323 (squashed into a single commit) backported to main. The code changes are identical — verified via diff comparison.
This PR was already reviewed in depth as part of #24323 with the 七人陪审团 multi-agent review process. Summary of that review:
- 🔴 Must Fix: 0
- 🟡 Should Fix: 3 (pool reset style, dual-loop duplication, concurrent test coverage)
- 🟢 Nit: 4
- Design: Sound — lock-free CAS coalescing + two-phase dispatch correctly eliminates per-response redundant timestamp commands
- Correctness: Monotonic advancement guard in
handleEventensures no timestamp regression even under ABA race
The squashed single-commit form is cleaner than the original 3-commit history. No additional concerns for the backport.
Approved ✅
Merge Queue Status
This pull request spent 59 minutes 15 seconds in the queue, including 58 minutes 56 seconds running CI. Required conditions to merge
|
…atrixorigin#24330) Fixes the CN logtail consumer backlog risk found in nightly sysbench write-heavy regressions. The bad run had `logtail.consumer.slow.*` in the `update_pk_1000` window, with `signal-chan-len` around 7373~7738 on one CN consumer routine. The good control run using the same MO image did not have these slow logs in the same case window. No sysbench reconnect/retry storm, workspace quota shortage, or UPDATE table-lock upgrade was found. This PR reduces internal backpressure without changing table assignment or increasing consumer routine count: - coalesces update-response timestamp commands for routines that already have table logtail commands, - advances the routine applied timestamp only after that routine consumes the last table logtail for the response, - keeps timestamp-only commands for routines that do not receive table logtails, preserving global min applied timestamp semantics, - makes timestamp waiter commit-ts notifications non-blocking and coalesced to the latest timestamp, - adds tests for non-blocking timestamp notifications, bounded notification draining, and logtail timestamp advancement ordering. Approved by: @gouhongshen, @XuPeng-SH, @iamlinjunhong
…atrixorigin#24330) Fixes the CN logtail consumer backlog risk found in nightly sysbench write-heavy regressions. The bad run had `logtail.consumer.slow.*` in the `update_pk_1000` window, with `signal-chan-len` around 7373~7738 on one CN consumer routine. The good control run using the same MO image did not have these slow logs in the same case window. No sysbench reconnect/retry storm, workspace quota shortage, or UPDATE table-lock upgrade was found. This PR reduces internal backpressure without changing table assignment or increasing consumer routine count: - coalesces update-response timestamp commands for routines that already have table logtail commands, - advances the routine applied timestamp only after that routine consumes the last table logtail for the response, - keeps timestamp-only commands for routines that do not receive table logtails, preserving global min applied timestamp semantics, - makes timestamp waiter commit-ts notifications non-blocking and coalesced to the latest timestamp, - adds tests for non-blocking timestamp notifications, bounded notification draining, and logtail timestamp advancement ordering. Approved by: @gouhongshen, @XuPeng-SH, @iamlinjunhong
…atrixorigin#24330) Fixes the CN logtail consumer backlog risk found in nightly sysbench write-heavy regressions. The bad run had `logtail.consumer.slow.*` in the `update_pk_1000` window, with `signal-chan-len` around 7373~7738 on one CN consumer routine. The good control run using the same MO image did not have these slow logs in the same case window. No sysbench reconnect/retry storm, workspace quota shortage, or UPDATE table-lock upgrade was found. This PR reduces internal backpressure without changing table assignment or increasing consumer routine count: - coalesces update-response timestamp commands for routines that already have table logtail commands, - advances the routine applied timestamp only after that routine consumes the last table logtail for the response, - keeps timestamp-only commands for routines that do not receive table logtails, preserving global min applied timestamp semantics, - makes timestamp waiter commit-ts notifications non-blocking and coalesced to the latest timestamp, - adds tests for non-blocking timestamp notifications, bounded notification draining, and logtail timestamp advancement ordering. Approved by: @gouhongshen, @XuPeng-SH, @iamlinjunhong
What type of PR is this?
Which issue(s) this PR fixes:
issue #24322
What this PR does / why we need it:
Fixes the CN logtail consumer backlog risk found in nightly sysbench write-heavy regressions.
The bad run had
logtail.consumer.slow.*in theupdate_pk_1000window, withsignal-chan-lenaround 7373~7738 on one CN consumer routine. The good control run using the same MO image did not have these slow logs in the same case window. No sysbench reconnect/retry storm, workspace quota shortage, or UPDATE table-lock upgrade was found.This PR reduces internal backpressure without changing table assignment or increasing consumer routine count: