Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit18088dd

Browse files
author
Valeriy Zainullin
committed
Check collector has started in pg_wait_sampling_reset_profile.
The worker might have not started yet or it may never start,because its registration was cancelled due to worker limit.This commit adds a check for NULL value of pgws_collector_hdr->latch.The previous usage in pg_wait_sampling.c has such a check, weshould do the same here.
1 parentfafeda0 commit18088dd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎pg_wait_sampling.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,26 @@ pg_wait_sampling_reset_profile(PG_FUNCTION_ARGS)
808808
{
809809
LOCKTAGcollectorTag;
810810

811+
/*
812+
* This also guards against the case when the
813+
* extension was not loaded at all, but this
814+
* function was called. pgws_collector_hdr is
815+
* NULL in this case.
816+
*/
811817
check_shmem();
812818

819+
/* The collector may have not started yet (it'd be a
820+
* race condition with background worker startup to
821+
* use latch without a check here).
822+
* Or worse, registration of the worker might have been
823+
* denied, if there are too many workers already.
824+
* This is why we cannot wait for its start with a while
825+
* loop.
826+
*/
827+
if (!pgws_collector_hdr->latch)
828+
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
829+
errmsg("pg_wait_sampling collector wasn't started")));
830+
813831
pgws_init_lock_tag(&queueTag,PGWS_QUEUE_LOCK);
814832

815833
LockAcquire(&queueTag,ExclusiveLock, false, false);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp