Repository navigation
feat: add CN RSS pressure observability - #24538
Conversation
Add lightweight metrics for logtail replay retained batches and LockOp batch hold time so TPCC RSS pressure can be diagnosed without changing execution semantics. Co-authored-by: Copilot <[email protected]>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
Pull request overview
Adds Prometheus histograms to improve observability into CN RSS pressure by quantifying (a) logtail replay “retained” row-entry batches and (b) LockOp batch size + time held during lock acquisition. This fits into the existing pkg/util/metric/v2 Prometheus registry and instruments two hot paths (logtailreplay and lockop) without changing execution behavior.
Changes:
- Add
mo_logtail_replay_retained_batch_{rows,bytes}{type=insert|delete}histograms and observe them whenPartitionStateretains row-entry batches. - Add
mo_txn_lock_op_batch_{rows,bytes}andmo_txn_lock_op_batch_hold_duration_secondshistograms and observe them for non-empty LockOp batches. - Register the new metrics in the v2 metrics registry init functions.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/vm/engine/disttae/logtailreplay/partition_state.go | Observe retained logtail replay batch row/byte histograms for insert/delete paths when !p.noData. |
| pkg/util/metric/v2/logtail.go | Define logtail replay retained batch histogram vecs (rows/bytes) with type label. |
| pkg/util/metric/v2/txn.go | Define txn LockOp batch rows/bytes and hold-duration histograms. |
| pkg/util/metric/v2/metrics.go | Register the newly added logtail and txn metrics with the v2 registry. |
| pkg/sql/colexec/lockop/lock_op.go | Instrument LockOp non-blocking path to observe batch size and hold duration around performLock. |
Use a single defer to record LockOp batch hold duration so the metric remains consistent across all return paths. Co-authored-by: Copilot <[email protected]>
aptend
left a comment
There was a problem hiding this comment.
LGTM. Clean observability PR.
- Metrics are well-scoped: logtail replay retained batches + LockOp batch hold
- No functional changes to execution semantics
- Consistent bucketing with existing patterns
noDataguard on partition_state avoids metric noise from ghost partitions- Runtime overhead limited to histogram observations and existing
Batch.Size()call
aunjgr
left a comment
There was a problem hiding this comment.
Review: CN RSS pressure observability
Approve.
This PR adds observability histograms/counters and registration wiring, plus lock-op/logtail replay metric observations, without changing transaction or lock semantics.
No blocking correctness or safety issue found.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed from multiple angles: metric registration/wiring, lockop control flow, logtail replay retention semantics, and potential init/observe/concurrency issues. The new histograms are correctly registered, the observations are guarded on the right paths (!p.noData for retained logtail batches, non-empty batches for lockop), and I don't see a correctness or regression risk from these observability-only changes. LGTM.
Merge Queue Status
This pull request spent 2 hours 58 minutes 48 seconds in the queue, including 1 hour 46 minutes 23 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #24534
What this PR does / why we need it:
This PR adds lightweight observability for diagnosing CN RSS pressure during TPCC and similar high-concurrency workloads.
mo_logtail_replay_retained_batch_rows{type="insert|delete"}mo_logtail_replay_retained_batch_bytes{type="insert|delete"}mo_txn_lock_op_batch_rowsmo_txn_lock_op_batch_bytesmo_txn_lock_op_batch_hold_duration_secondsBatch.Size()call per non-empty LockOp batch / retained logtail replay batch.Validation: