aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/access/transam/xlogreader.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c
index fa9432eb677..0a75c360260 100644
--- a/src/backend/access/transam/xlogreader.c
+++ b/src/backend/access/transam/xlogreader.c
@@ -1264,7 +1264,13 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
{
if (blk->data)
pfree(blk->data);
- blk->data_bufsz = blk->data_len;
+
+ /*
+ * Force the initial request to be BLCKSZ so that we don't
+ * waste time with lots of trips through this stanza as a
+ * result of WAL compression.
+ */
+ blk->data_bufsz = MAXALIGN(Max(blk->data_len, BLCKSZ));
blk->data = palloc(blk->data_bufsz);
}
memcpy(blk->data, ptr, blk->data_len);