0001-Fix-BgBufferSync-to-limit-batch-size-under-io_bounce.patch
text/x-patch
Filename: 0001-Fix-BgBufferSync-to-limit-batch-size-under-io_bounce.patch
Type: text/x-patch
Part: 0
Message:
Re: AIO v2.0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch 0001
Subject: Fix BgBufferSync to limit batch size under io_bounce_buffers for bgwriter.
| File | + | − |
|---|---|---|
| src/backend/storage/buffer/bufmgr.c | 4 | 1 |
From bd04bd18ce62cf3f88568d3578503d4efeeb6603 Mon Sep 17 00:00:00 2001
From: Robert Pang <robertpang@google.com>
Date: Thu, 12 Sep 2024 14:36:16 -0700
Subject: [PATCH] Fix BgBufferSync to limit batch size under io_bounce_buffers
for bgwriter.
---
src/backend/storage/buffer/bufmgr.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 44b1b6fb31..4cd959b295 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -3396,6 +3396,7 @@ BgBufferSync(IOQueue *ioq, WritebackContext *wb_context)
uint32 new_recent_alloc;
BuffersToWrite to_write;
+ int max_combine;
/*
* Find out where the freelist clock sweep currently is, and how many
@@ -3417,6 +3418,8 @@ BgBufferSync(IOQueue *ioq, WritebackContext *wb_context)
return true;
}
+ max_combine = Min(io_bounce_buffers, io_combine_limit);
+
/*
* Compute strategy_delta = how many buffers have been scanned by the
* clock sweep since last time. If first time through, assume none. Then
@@ -3604,7 +3607,7 @@ BgBufferSync(IOQueue *ioq, WritebackContext *wb_context)
{
Assert(sync_state & BUF_REUSABLE);
- if (to_write.nbuffers == io_combine_limit)
+ if (to_write.nbuffers == max_combine)
{
WriteBuffers(&to_write, ioq, wb_context);
}
--
2.46.0.662.g92d0881bb0-goog