v1-0002-bug-fix-in-foce-within-pgstat_report_wal.patch
text/x-diff
Filename: v1-0002-bug-fix-in-foce-within-pgstat_report_wal.patch
Type: text/x-diff
Part: 0
Patch
Format: unified
Series: patch v1-0002
| File | + | − |
|---|---|---|
| src/backend/utils/activity/pgstat_wal.c | 7 | 2 |
diff --git a/src/backend/utils/activity/pgstat_wal.c b/src/backend/utils/activity/pgstat_wal.c
index bcaed14d02..6f3bac5d0f 100644
--- a/src/backend/utils/activity/pgstat_wal.c
+++ b/src/backend/utils/activity/pgstat_wal.c
@@ -38,13 +38,18 @@ static WalUsage prevWalUsage;
*
* Must be called by processes that generate WAL, that do not call
* pgstat_report_stat(), like walwriter.
+ *
+ * force=false is the same as nowait=true, and the statistics will
+ * not be flushed if the lock cannot be acquired.
+ * force=true is the same as nowait=false, and waits until the lock
+ * is acquired and ensures that the statistics are flushed.
*/
void
pgstat_report_wal(bool force)
{
- pgstat_flush_wal(force);
+ pgstat_flush_wal(!force);
- pgstat_flush_io(force);
+ pgstat_flush_io(!force);
}
/*