Fix statistics breakage from bgwriter/checkpointer process split.
ForwardFsyncRequest() supposed that it could only be called in regular backends, which used to be true; but since the splitup of bgwriter and checkpointer, it is also called in the bgwriter. We do not want to count such calls in pg_stat_bgwriter.buffers_backend statistics, so fix things so that they aren't. (It's worth noting here that this implies an alarmingly large increase in the expected amount of cross-process fsync request traffic, which may well mean that the process splitup was not such a hot idea.)
This commit is contained in:
parent
4a9c30a8a1
commit
80e373c3a8
|
@ -1132,6 +1132,7 @@ ForwardFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno)
|
||||||
LWLockAcquire(CheckpointerCommLock, LW_EXCLUSIVE);
|
LWLockAcquire(CheckpointerCommLock, LW_EXCLUSIVE);
|
||||||
|
|
||||||
/* Count all backend writes regardless of if they fit in the queue */
|
/* Count all backend writes regardless of if they fit in the queue */
|
||||||
|
if (!AmBackgroundWriterProcess())
|
||||||
CheckpointerShmem->num_backend_writes++;
|
CheckpointerShmem->num_backend_writes++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1147,6 +1148,7 @@ ForwardFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno)
|
||||||
* Count the subset of writes where backends have to do their own
|
* Count the subset of writes where backends have to do their own
|
||||||
* fsync
|
* fsync
|
||||||
*/
|
*/
|
||||||
|
if (!AmBackgroundWriterProcess())
|
||||||
CheckpointerShmem->num_backend_fsync++;
|
CheckpointerShmem->num_backend_fsync++;
|
||||||
LWLockRelease(CheckpointerCommLock);
|
LWLockRelease(CheckpointerCommLock);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue