Skip to content

Derive Cloudberry session waiting fields from wait events - #52

Merged
leborchuk merged 2 commits into
apache:mainfrom
leborchuk:fix/issue-39-session-waiting
Dec 2, 2026
Merged

leborchuk merged 2 commits into
apache:mainfrom
leborchuk:fix/issue-39-session-waiting

Conversation

@leborchuk

Copy link
Copy Markdown
Contributor

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

@leborchuk
leborchuk requested review from tuhaihe and a balanced review from Copilot December 1, 2026 14:40
@leborchuk
leborchuk enabled auto-merge (rebase) December 1, 2026 14:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 waiting when wait_event_type is non-null.
  • Sets WaitingReason to 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
tuhaihe force-pushed the fix/issue-39-session-waiting branch from ad888d9 to 5396ef4 Compare December 2, 2026 03:18
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 tuhaihe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@leborchuk
leborchuk merged commit 79bdd13 into apache:main Dec 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] UI: session detail shows Waiting "No" for sessions waiting on a lock

3 participants