aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xloginsert.c
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2023-10-01 12:20:55 -0700
committerNoah Misch <noah@leadboat.com>2023-10-01 12:20:55 -0700
commite1f95ec8cf6ea75d90905b2c746e2e1e9f3c9fc1 (patch)
treeaa7e4a2a68eec440cb7dc111db14e4a7608c147d /src/backend/access/transam/xloginsert.c
parent5b7b3824648d6324f649bc74713a6b35e53b91ac (diff)
downloadpostgresql-e1f95ec8cf6ea75d90905b2c746e2e1e9f3c9fc1.tar.gz
postgresql-e1f95ec8cf6ea75d90905b2c746e2e1e9f3c9fc1.zip
Correct assertion and comments about XLogRecordMaxSize.
The largest allocation, of xl_tot_len+8192, is in allocate_recordbuf(). Discussion: https://postgr.es/m/20230812211327.GB2326466@rfd.leadboat.com
Diffstat (limited to 'src/backend/access/transam/xloginsert.c')
-rw-r--r--src/backend/access/transam/xloginsert.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/access/transam/xloginsert.c b/src/backend/access/transam/xloginsert.c
index 258cbd70355..588626424e6 100644
--- a/src/backend/access/transam/xloginsert.c
+++ b/src/backend/access/transam/xloginsert.c
@@ -897,8 +897,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
*
* XLogReader machinery is only able to handle records up to a certain
* size (ignoring machine resource limitations), so make sure that we will
- * not emit records larger than the sizes advertised to be supported. This
- * cap is based on DecodeXLogRecordRequiredSpace().
+ * not emit records larger than the sizes advertised to be supported.
*/
if (total_len > XLogRecordMaxSize)
ereport(ERROR,
@@ -1339,10 +1338,12 @@ InitXLogInsert(void)
/*
* Check that any records assembled can be decoded. This is capped based
- * on what XLogReader would require at its maximum bound. This code path
+ * on what XLogReader would require at its maximum bound. The XLOG_BLCKSZ
+ * addend covers the larger allocate_recordbuf() demand. This code path
* is called once per backend, more than enough for this check.
*/
- size_t max_required = DecodeXLogRecordRequiredSpace(XLogRecordMaxSize);
+ size_t max_required =
+ DecodeXLogRecordRequiredSpace(XLogRecordMaxSize + XLOG_BLCKSZ);
Assert(AllocSizeIsValid(max_required));
#endif