1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-01 01:04:50 +03:00

Remove dead code and add comments.

'cbuffer' variable was left over from an earlier version of the patch to
rewrite the incomplete split handling.
This commit is contained in:
Heikki Linnakangas 2014-03-24 11:02:23 +02:00
parent 3ed249b741
commit 2f3afc0979

View File

@ -130,7 +130,6 @@ btree_xlog_insert(bool isleaf, bool ismeta,
{ {
xl_btree_insert *xlrec = (xl_btree_insert *) XLogRecGetData(record); xl_btree_insert *xlrec = (xl_btree_insert *) XLogRecGetData(record);
Buffer buffer; Buffer buffer;
Buffer cbuffer = InvalidBuffer;
Page page; Page page;
char *datapos; char *datapos;
int datalen; int datalen;
@ -158,6 +157,15 @@ btree_xlog_insert(bool isleaf, bool ismeta,
datalen -= sizeof(xl_btree_metadata); datalen -= sizeof(xl_btree_metadata);
} }
/*
* Insertion to an internal page finishes an incomplete split at the
* child level. Clear the incomplete-split flag in the child. Note:
* during normal operation, the child and parent pages are locked at the
* same time, so that clearing the flag and inserting the downlink appear
* atomic to other backends. We don't bother with that during replay,
* because readers don't care about the incomplete-split flag and there
* cannot be updates happening.
*/
if (!isleaf) if (!isleaf)
{ {
if (record->xl_info & XLR_BKP_BLOCK(0)) if (record->xl_info & XLR_BKP_BLOCK(0))
@ -194,9 +202,6 @@ btree_xlog_insert(bool isleaf, bool ismeta,
} }
} }
if (BufferIsValid(cbuffer))
UnlockReleaseBuffer(cbuffer);
/* /*
* Note: in normal operation, we'd update the metapage while still holding * Note: in normal operation, we'd update the metapage while still holding
* lock on the page we inserted into. But during replay it's not * lock on the page we inserted into. But during replay it's not
@ -273,7 +278,8 @@ btree_xlog_split(bool onleft, bool isroot,
/* /*
* Clear the incomplete split flag on the left sibling of the child page * Clear the incomplete split flag on the left sibling of the child page
* this is a downlink for. * this is a downlink for. (Like in btree_xlog_insert, this can be done
* before locking the other pages)
*/ */
if (!isleaf) if (!isleaf)
{ {