Repository navigation
Derive Cloudberry session waiting fields from wait events - #52
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the change deriving Cloudberry waiting metadata from wait events.
No open issues 🎉
What changed in this PR
Updates Cloudberry session telemetry to derive waiting metadata from wait events instead of hardcoded values, while leaving the GP6 query unchanged.
Changes:
- Sets
waitingwhenwait_event_typeis non-null. - Sets
WaitingReasonto the lowercase wait-event type, defaulting to an empty string when absent.
| File | Description |
|---|---|
internal/gp/stat_activity/lister.go |
Derives Cloudberry session waiting status and reason from wait_event_type. |
Review effort: Balanced
Replace hardcoded false/empty waiting metadata with wait_event_type presence and its normalized wait class. Existing session API fields now report lock waits consistently with wait events and blocker information. Leave the GP6 query unchanged. Fixes apache#39
tuhaihe
force-pushed
the
fix/issue-39-session-waiting
branch
from
December 2, 2026 03:18
ad888d9 to
5396ef4
Compare
On Cloudberry every session reports a wait event: idle clients wait on Client/ClientRead and background processes on Activity/*. Deriving "waiting" from wait_event_type IS NOT NULL therefore marked every idle session as waiting with reason "client". Count only lock, resource group, resource queue and synchronous replication waits, and map them to the GP6 waiting_reason values (lock, resgroup, resqueue, replication) that GetStatus expects. Treat resource queue waits as "waiting" in GetStatus, like resource group waits, and cover the status mapping with a unit test. Assisted-by: Claude Code
tuhaihe
approved these changes
Dec 2, 2026
tuhaihe
left a comment
Member
There was a problem hiding this comment.
Verified on a 4-node Cloudberry 3.0 demo cluster: idle and background sessions report waiting=false, lock waits report waiting=true/lock (blocked), resource queue waits report waiting=true/resqueue (waiting).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace hardcoded false/empty waiting metadata with wait_event_type presence and its normalized wait class. Existing session API fields now report lock waits consistently with wait events and blocker information. Leave the GP6 query unchanged.
Fixes #39