aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xlogreader.c17
-rw-r--r--src/include/access/heapam_xlog.h8
2 files changed, 17 insertions, 8 deletions
diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c
index 0973d778ac9..db8f3a34e21 100644
--- a/src/backend/access/transam/xlogreader.c
+++ b/src/backend/access/transam/xlogreader.c
@@ -1248,7 +1248,22 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg)
{
if (state->main_data)
pfree(state->main_data);
- state->main_data_bufsz = state->main_data_len;
+
+ /*
+ * main_data_bufsz must be MAXALIGN'ed. In many xlog record
+ * types, we omit trailing struct padding on-disk to save a few
+ * bytes; but compilers may generate accesses to the xlog struct
+ * that assume that padding bytes are present. If the palloc
+ * request is not large enough to include such padding bytes then
+ * we'll get valgrind complaints due to otherwise-harmless fetches
+ * of the padding bytes.
+ *
+ * In addition, force the initial request to be reasonably large
+ * so that we don't waste time with lots of trips through this
+ * stanza. BLCKSZ / 2 seems like a good compromise choice.
+ */
+ state->main_data_bufsz = MAXALIGN(Max(state->main_data_len,
+ BLCKSZ / 2));
state->main_data = palloc(state->main_data_bufsz);
}
memcpy(state->main_data, ptr, state->main_data_len);
diff --git a/src/include/access/heapam_xlog.h b/src/include/access/heapam_xlog.h
index caa0f14f4bf..2a3ce355d99 100644
--- a/src/include/access/heapam_xlog.h
+++ b/src/include/access/heapam_xlog.h
@@ -333,13 +333,7 @@ typedef struct xl_heap_new_cid
TransactionId top_xid;
CommandId cmin;
CommandId cmax;
-
- /*
- * don't really need the combocid since we have the actual values right in
- * this struct, but the padding makes it free and its useful for
- * debugging.
- */
- CommandId combocid;
+ CommandId combocid; /* just for debugging */
/*
* Store the relfilenode/ctid pair to facilitate lookups.