Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e1f95ec

Browse filesBrowse files
committed
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
1 parent 5b7b382 commit e1f95ec
Copy full SHA for e1f95ec

File tree

Expand file treeCollapse file tree

2 files changed

+7
-6
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-6
lines changed

‎src/backend/access/transam/xloginsert.c

Copy file name to clipboardExpand all lines: src/backend/access/transam/xloginsert.c
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
897897
*
898898
* XLogReader machinery is only able to handle records up to a certain
899899
* size (ignoring machine resource limitations), so make sure that we will
900-
* not emit records larger than the sizes advertised to be supported. This
901-
* cap is based on DecodeXLogRecordRequiredSpace().
900+
* not emit records larger than the sizes advertised to be supported.
902901
*/
903902
if (total_len > XLogRecordMaxSize)
904903
ereport(ERROR,
@@ -1339,10 +1338,12 @@ InitXLogInsert(void)
13391338

13401339
/*
13411340
* Check that any records assembled can be decoded. This is capped based
1342-
* on what XLogReader would require at its maximum bound. This code path
1341+
* on what XLogReader would require at its maximum bound. The XLOG_BLCKSZ
1342+
* addend covers the larger allocate_recordbuf() demand. This code path
13431343
* is called once per backend, more than enough for this check.
13441344
*/
1345-
size_t max_required = DecodeXLogRecordRequiredSpace(XLogRecordMaxSize);
1345+
size_t max_required =
1346+
DecodeXLogRecordRequiredSpace(XLogRecordMaxSize + XLOG_BLCKSZ);
13461347

13471348
Assert(AllocSizeIsValid(max_required));
13481349
#endif

‎src/include/access/xlogrecord.h

Copy file name to clipboardExpand all lines: src/include/access/xlogrecord.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ typedef struct XLogRecord
6868
* in length if we ignore any allocation overhead of the XLogReader.
6969
*
7070
* To accommodate some overhead, this value allows for 4M of allocation
71-
* overhead, that should be plenty enough for what
72-
* DecodeXLogRecordRequiredSpace() expects as extra.
71+
* overhead, that should be plenty enough for what the XLogReader
72+
* infrastructure expects as extra.
7373
*/
7474
#define XLogRecordMaxSize (1020 * 1024 * 1024)
7575

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.