mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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
This commit is contained in:
@ -897,8 +897,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
|
|||||||
*
|
*
|
||||||
* XLogReader machinery is only able to handle records up to a certain
|
* XLogReader machinery is only able to handle records up to a certain
|
||||||
* size (ignoring machine resource limitations), so make sure that we will
|
* size (ignoring machine resource limitations), so make sure that we will
|
||||||
* not emit records larger than the sizes advertised to be supported. This
|
* not emit records larger than the sizes advertised to be supported.
|
||||||
* cap is based on DecodeXLogRecordRequiredSpace().
|
|
||||||
*/
|
*/
|
||||||
if (total_len > XLogRecordMaxSize)
|
if (total_len > XLogRecordMaxSize)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
@ -1339,10 +1338,12 @@ InitXLogInsert(void)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that any records assembled can be decoded. This is capped based
|
* 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.
|
* 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));
|
Assert(AllocSizeIsValid(max_required));
|
||||||
#endif
|
#endif
|
||||||
|
@ -68,8 +68,8 @@ typedef struct XLogRecord
|
|||||||
* in length if we ignore any allocation overhead of the XLogReader.
|
* in length if we ignore any allocation overhead of the XLogReader.
|
||||||
*
|
*
|
||||||
* To accommodate some overhead, this value allows for 4M of allocation
|
* To accommodate some overhead, this value allows for 4M of allocation
|
||||||
* overhead, that should be plenty enough for what
|
* overhead, that should be plenty enough for what the XLogReader
|
||||||
* DecodeXLogRecordRequiredSpace() expects as extra.
|
* infrastructure expects as extra.
|
||||||
*/
|
*/
|
||||||
#define XLogRecordMaxSize (1020 * 1024 * 1024)
|
#define XLogRecordMaxSize (1020 * 1024 * 1024)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user