diff options
| author | Andres Freund | 2024-10-08 15:37:45 +0000 |
|---|---|---|
| committer | Andres Freund | 2024-10-08 15:37:45 +0000 |
| commit | 488f826c729bd570c36df369fa8ac90c9a5a1b46 (patch) | |
| tree | 6e8ee0e4ac43568b77875364ecf98dab982963fe /src | |
| parent | c01fd93088da36f2473a6b1bad3fce3e04c685a1 (diff) | |
bufmgr: Return early in ScheduleBufferTagForWriteback() if fsync=off
As pg_flush_data() doesn't do anything with fsync disabled, there's no point
in tracking the buffer for writeback. Arguably the better fix would be to
change pg_flush_data() to flush data even with fsync off, but that's a
behavioral change, whereas this is just a small optimization.
Reviewed-by: Heikki Linnakangas <[email protected]>
Reviewed-by: Noah Misch <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src')
| -rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 48520443001..b8680cc8fd4 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -5899,7 +5899,12 @@ ScheduleBufferTagForWriteback(WritebackContext *wb_context, IOContext io_context { PendingWriteback *pending; - if (io_direct_flags & IO_DIRECT_DATA) + /* + * As pg_flush_data() doesn't do anything with fsync disabled, there's no + * point in tracking in that case. + */ + if (io_direct_flags & IO_DIRECT_DATA || + !enableFsync) return; /* |
