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

Appearance settings

Commit 734c057

Browse filesBrowse files
committed
Add assertion in pgstat_write_statsfile() about processes allowed
This routine can currently only be called from the postmaster in single-user mode or the checkpointer, but there was no sanity check to make sure that this was always the case. This has proved to be useful when hacking the zone (at least to me), to make sure that the write of the pgstats file happens at shutdown, as wanted by design, in the correct process context. Discussion: https://postgr.es/m/ZnEiqAITL-VgZDoY@paquier.xyz
1 parent 63909da commit 734c057
Copy full SHA for 734c057

File tree

Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed

‎src/backend/utils/activity/pgstat.c

Copy file name to clipboardExpand all lines: src/backend/utils/activity/pgstat.c
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,9 @@ pgstat_write_statsfile(void)
13601360

13611361
pgstat_assert_is_up();
13621362

1363+
/* should be called only by the checkpointer or single user mode */
1364+
Assert(!IsUnderPostmaster || MyBackendType == B_CHECKPOINTER);
1365+
13631366
/* we're shutting down, so it's ok to just override this */
13641367
pgstat_fetch_consistency = PGSTAT_FETCH_CONSISTENCY_NONE;
13651368

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.