aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/activity/pgstat_wal.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/backend/utils/activity/pgstat_wal.c b/src/backend/utils/activity/pgstat_wal.c
index bcaed14d02e..6a81b781357 100644
--- a/src/backend/utils/activity/pgstat_wal.c
+++ b/src/backend/utils/activity/pgstat_wal.c
@@ -38,13 +38,25 @@ static WalUsage prevWalUsage;
*
* Must be called by processes that generate WAL, that do not call
* pgstat_report_stat(), like walwriter.
+ *
+ * "force" set to true ensures that the statistics are flushed; note that
+ * this needs to acquire the pgstat shmem LWLock, waiting on it. When
+ * set to false, the statistics may not be flushed if the lock could not
+ * be acquired.
*/
void
pgstat_report_wal(bool force)
{
- pgstat_flush_wal(force);
+ bool nowait;
+
+ /* like in pgstat.c, don't wait for lock acquisition when !force */
+ nowait = !force;
+
+ /* flush wal stats */
+ pgstat_flush_wal(nowait);
- pgstat_flush_io(force);
+ /* flush IO stats */
+ pgstat_flush_io(nowait);
}
/*