Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commite55e6ec

Browse files
committed
Fix replay of XLOG_HEAP_NEWPAGE WAL records to pay attention to the forknum
field of the WAL record. The previous coding always wrote to the main fork,resulting in data corruption if the page was meant to go into a non-defaultfork.At present, the only operation that can produce such WAL records isALTER TABLE/INDEX SET TABLESPACE when executed with archive_mode = on.Data corruption would be observed on standby slaves, and could occur on themaster as well if a database crash and recovery occurred after committingthe ALTER and before the next checkpoint. Per report from Gordon Shannon.Back-patch to 8.4; the problem doesn't exist in earlier branches becausewe didn't have a concept of multiple relation forks then.
1 parent3a0939e commite55e6ec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.289 2010/04/22 02:15:45 sriggs Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.290 2010/05/02 22:28:05 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -4257,8 +4257,10 @@ heap_xlog_newpage(XLogRecPtr lsn, XLogRecord *record)
42574257
* Note: the NEWPAGE log record is used for both heaps and indexes, so do
42584258
* not do anything that assumes we are touching a heap.
42594259
*/
4260-
buffer=XLogReadBuffer(xlrec->node,xlrec->blkno, true);
4260+
buffer=XLogReadBufferExtended(xlrec->node,xlrec->forknum,xlrec->blkno,
4261+
RBM_ZERO);
42614262
Assert(BufferIsValid(buffer));
4263+
LockBuffer(buffer,BUFFER_LOCK_EXCLUSIVE);
42624264
page= (Page)BufferGetPage(buffer);
42634265

42644266
Assert(record->xl_len==SizeOfHeapNewpage+BLCKSZ);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp