Skip to content

Commit c36b636

Browse files
committed
Fix off-by-one in XLogRecordMaxSize check.
pg_logical_emit_message(false, '_', repeat('x', 1069547465)) failed with self-contradictory message "WAL record would be 1069547520 bytes (of maximum 1069547520 bytes)". There's no particular benefit from allowing or denying one byte in either direction; XLogRecordMaxSize could rise a few megabytes without trouble. Hence, this is just for cleanliness. Back-patch to v16, where this check first appeared.
1 parent 638d42a commit c36b636

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/access/transam/xloginsert.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
900900
* not emit records larger than the sizes advertised to be supported. This
901901
* cap is based on DecodeXLogRecordRequiredSpace().
902902
*/
903-
if (total_len >= XLogRecordMaxSize)
903+
if (total_len > XLogRecordMaxSize)
904904
ereport(ERROR,
905905
(errmsg_internal("oversized WAL record"),
906906
errdetail_internal("WAL record would be %llu bytes (of maximum %u bytes); rmid %u flags %u.",

0 commit comments

Comments
 (0)