aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-07-18 15:40:35 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2012-07-18 15:40:35 -0400
commit1e9326d6a3efcb5648a85c1653cc263bc787efa0 (patch)
treefa1103086f04915d82d07780c23345b5501f0364 /src
parentd843589e5ab361dd4738dab5c9016e704faf4153 (diff)
downloadpostgresql-1e9326d6a3efcb5648a85c1653cc263bc787efa0.tar.gz
postgresql-1e9326d6a3efcb5648a85c1653cc263bc787efa0.zip
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.)
Diffstat (limited to 'src')
-rw-r--r--src/backend/postmaster/checkpointer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index aa5577d3570..ec5690bb69c 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -1135,7 +1135,8 @@ ForwardFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno)
LWLockAcquire(CheckpointerCommLock, LW_EXCLUSIVE);
/* Count all backend writes regardless of if they fit in the queue */
- CheckpointerShmem->num_backend_writes++;
+ if (!AmBackgroundWriterProcess())
+ CheckpointerShmem->num_backend_writes++;
/*
* If the checkpointer isn't running or the request queue is full, the
@@ -1150,7 +1151,8 @@ ForwardFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno)
* Count the subset of writes where backends have to do their own
* fsync
*/
- CheckpointerShmem->num_backend_fsync++;
+ if (!AmBackgroundWriterProcess())
+ CheckpointerShmem->num_backend_fsync++;
LWLockRelease(CheckpointerCommLock);
return false;
}