Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d95e36d

Browse files
Remove obsolete nbtree split REDO routine comment.
Commit dd299df, which added suffix truncation to nbtree, simplified the WAL record format used by page splits. It became necessary to explicitly WAL-log the new high key for the left half of a split in all cases, which relieved the REDO routine from having to reconstruct a new high key for the left page by copying the first item from the right page. Remove a comment that referred to the previous practice.
1 parent 6163981 commit d95e36d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/backend/access/nbtree/nbtxlog.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -248,19 +248,16 @@ btree_xlog_split(bool onleft, XLogReaderState *record)
248248
PageSetLSN(rpage, lsn);
249249
MarkBufferDirty(rbuf);
250250

251-
/* don't release the buffer yet; we touch right page's first item below */
252-
253251
/* Now reconstruct left (original) sibling page */
254252
if (XLogReadBufferForRedo(record, 0, &lbuf) == BLK_NEEDS_REDO)
255253
{
256254
/*
257255
* To retain the same physical order of the tuples that they had, we
258256
* initialize a temporary empty page for the left page and add all the
259257
* items to that in item number order. This mirrors how _bt_split()
260-
* works. It's not strictly required to retain the same physical
261-
* order, as long as the items are in the correct item number order,
262-
* but it helps debugging. See also _bt_restore_page(), which does
263-
* the same for the right page.
258+
* works. Retaining the same physical order makes WAL consistency
259+
* checking possible. See also _bt_restore_page(), which does the
260+
* same for the right page.
264261
*/
265262
Page lpage = (Page) BufferGetPage(lbuf);
266263
BTPageOpaque lopaque = (BTPageOpaque) PageGetSpecialPointer(lpage);
@@ -345,7 +342,10 @@ btree_xlog_split(bool onleft, XLogReaderState *record)
345342
MarkBufferDirty(lbuf);
346343
}
347344

348-
/* We no longer need the buffers */
345+
/*
346+
* We no longer need the buffers. They must be released together, so that
347+
* readers cannot observe two inconsistent halves.
348+
*/
349349
if (BufferIsValid(lbuf))
350350
UnlockReleaseBuffer(lbuf);
351351
UnlockReleaseBuffer(rbuf);

0 commit comments

Comments
 (0)