Skip to content

Commit

Permalink
[#20997] YSQL, ASH: New wait event for the ASH collector
Browse files Browse the repository at this point in the history
Summary:
This diff adds a new wait event for the ASH collector.
Jira: DB-9971

Test Plan:
Tested manually

```
yugabyte=# select application_name, wait_event, wait_event_type from pg_stat_activity where application_name = 'yb_ash collector';
 application_name | wait_event | wait_event_type
------------------+------------+-----------------
 yb_ash collector | YbAshMain  | Activity

```

Reviewers: hbhanawat, amitanand

Reviewed By: hbhanawat, amitanand

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D36457
  • Loading branch information
abhinab-yb committed Aug 7, 2024
1 parent 95317f9 commit 44486bc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/postgres/src/backend/postmaster/pgstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -3800,6 +3800,9 @@ pgstat_get_wait_activity(WaitEventActivity w)
case YB_WAIT_EVENT_QUERY_DIAGNOSTICS_MAIN:
event_name = "QueryDiagnosticsMain";
break;
case WAIT_EVENT_YB_ASH_MAIN:
event_name = "YbAshMain";
break;
/* no default case, so that compiler will warn */
}

Expand Down
2 changes: 1 addition & 1 deletion src/postgres/src/backend/utils/misc/yb_ash.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ YbAshMain(Datum main_arg)
int rc;
/* Wait necessary amount of time */
rc = WaitLatch(MyLatch, WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
yb_ash_sampling_interval_ms, PG_WAIT_EXTENSION);
yb_ash_sampling_interval_ms, WAIT_EVENT_YB_ASH_MAIN);
ResetLatch(MyLatch);

/* Bailout if postmaster has died */
Expand Down
3 changes: 2 additions & 1 deletion src/postgres/src/include/pgstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,8 @@ typedef enum
WAIT_EVENT_WAL_RECEIVER_MAIN,
WAIT_EVENT_WAL_SENDER_MAIN,
WAIT_EVENT_WAL_WRITER_MAIN,
YB_WAIT_EVENT_QUERY_DIAGNOSTICS_MAIN
YB_WAIT_EVENT_QUERY_DIAGNOSTICS_MAIN,
WAIT_EVENT_YB_ASH_MAIN
} WaitEventActivity;

/* ----------
Expand Down

0 comments on commit 44486bc

Please sign in to comment.