Skip to content

Commit a5fae04

Browse files
author
hackorum
committed
Apply xloginsert-memchk.patch
1 parent 72e6184 commit a5fae04

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/backend/access/transam/xloginsert.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,8 +979,21 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
979979
*/
980980
INIT_CRC32C(rdata_crc);
981981
COMP_CRC32C(rdata_crc, hdr_scratch + SizeOfXLogRecord, hdr_rdt.len - SizeOfXLogRecord);
982+
983+
char block1_copy[BLCKSZ];
984+
char *block1_ptr = NULL;
985+
int block1_len = 0;
986+
982987
for (rdt = hdr_rdt.next; rdt != NULL; rdt = rdt->next)
988+
{
989+
if (!block1_ptr)
990+
{
991+
memcpy(block1_copy, rdt->data, rdt->len);
992+
block1_ptr = rdt->data;
993+
block1_len = rdt->len;
994+
}
983995
COMP_CRC32C(rdata_crc, rdt->data, rdt->len);
996+
}
984997

985998
/*
986999
* Ensure that the XLogRecord is not too large.
@@ -1007,6 +1020,12 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
10071020
rechdr->xl_prev = InvalidXLogRecPtr;
10081021
rechdr->xl_crc = rdata_crc;
10091022

1023+
if (block1_ptr)
1024+
{
1025+
pg_usleep(100);
1026+
Assert(memcmp(block1_ptr, block1_copy, block1_len) == 0);
1027+
}
1028+
10101029
return &hdr_rdt;
10111030
}
10121031

0 commit comments

Comments
 (0)