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

Commit32914d9

Browse files
committed
Fix race condition in stats.sql added in5264add
Very occasionally the stats test failed due to the number of sessions notbeing updated yet. Likely this requires that there is contention on thedatabase's stats entry. Solve this by forcing pending stats to be flushedbefore fetching the stats.I verified that there are no other test failures after makingpgstat_report_stat() only flush stats when force = true.Per message from Tom Lane and buildfarm member crake.Discussion:https://postgr.es/m/3428246.1663271992@sss.pgh.pa.usBackpatch: 15-, where5264add added the test
1 parentbfd6b3b commit32914d9

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

‎src/test/regress/expected/stats.out

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,12 @@ DROP TABLE prevstats;
560560
-- Test that sessions is incremented when a new session is started in pg_stat_database
561561
SELECT sessions AS db_stat_sessions FROM pg_stat_database WHERE datname = (SELECT current_database()) \gset
562562
\c
563+
SELECT pg_stat_force_next_flush();
564+
pg_stat_force_next_flush
565+
--------------------------
566+
567+
(1 row)
568+
563569
SELECT sessions > :db_stat_sessions FROM pg_stat_database WHERE datname = (SELECT current_database());
564570
?column?
565571
----------

‎src/test/regress/sql/stats.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ DROP TABLE prevstats;
294294
-- Test that sessions is incremented when a new session is started in pg_stat_database
295295
SELECT sessionsAS db_stat_sessionsFROM pg_stat_databaseWHERE datname= (SELECT current_database()) \gset
296296
\c
297+
SELECT pg_stat_force_next_flush();
297298
SELECT sessions> :db_stat_sessionsFROM pg_stat_databaseWHERE datname= (SELECT current_database());
298299

299300
-- Test pg_stat_bgwriter checkpointer-related stats, together with pg_stat_wal

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp