corrected_block_id_reference_in_hash_vacuum_get_latestRemovedXid.patch

application/x-download

Filename: corrected_block_id_reference_in_hash_vacuum_get_latestRemovedXid.patch
Type: application/x-download
Part: 0
Message: Re: segfault in hot standby for hash indexes

Patch

Format: unified
File+
src/backend/access/hash/hash_xlog.c 2 2
diff --git a/src/backend/access/hash/hash_xlog.c b/src/backend/access/hash/hash_xlog.c
index de7522e..2d3d77b 100644
--- a/src/backend/access/hash/hash_xlog.c
+++ b/src/backend/access/hash/hash_xlog.c
@@ -982,7 +982,7 @@ hash_xlog_vacuum_get_latestRemovedXid(XLogReaderState *record)
 	 * InvalidTransactionId to cancel all HS transactions.  That's probably
 	 * overkill, but it's safe, and certainly better than panicking here.
 	 */
-	XLogRecGetBlockTag(record, 1, &rnode, NULL, &blkno);
+	XLogRecGetBlockTag(record, 0, &rnode, NULL, &blkno);
 	ibuffer = XLogReadBufferExtended(rnode, MAIN_FORKNUM, blkno, RBM_NORMAL);
 
 	if (!BufferIsValid(ibuffer))
@@ -994,7 +994,7 @@ hash_xlog_vacuum_get_latestRemovedXid(XLogReaderState *record)
 	 * Loop through the deleted index items to obtain the TransactionId from
 	 * the heap items they point to.
 	 */
-	ptr = XLogRecGetBlockData(record, 1, &len);
+	ptr = XLogRecGetBlockData(record, 0, &len);
 
 	unused = (OffsetNumber *) ptr;