Commit 2f3afc09 authored by Heikki Linnakangas's avatar Heikki Linnakangas

Remove dead code and add comments.

'cbuffer' variable was left over from an earlier version of the patch to
rewrite the incomplete split handling.
parent 3ed249b7
...@@ -130,7 +130,6 @@ btree_xlog_insert(bool isleaf, bool ismeta, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment