Skip to content

Commit 0c504a8

Browse files
committed
Remove dedicated B-tree root-split record types.
Since commit 40dae7e, which changed the way b-tree page splitting works, there has been no difference in the handling of root, and non-root split WAL records. We don't need to distinguish them anymore If you're worried about the loss of debugging information, note that usually a root split record will normally be followed by a WAL record to create the new root page. The root page will also have the BTP_ROOT flag set on the page itself, and there is a pointer to it from the metapage. Author: Aleksander Alekseev Discussion: https://www.postgresql.org/message-id/20170406122116.GA11081@e733.localdomain
1 parent 77d0570 commit 0c504a8

File tree

4 files changed

+5
-26
lines changed

4 files changed

+5
-26
lines changed

src/backend/access/nbtree/nbtinsert.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,6 @@ _bt_split(Relation rel, Buffer buf, Buffer cbuf, OffsetNumber firstright,
980980
rightoff;
981981
OffsetNumber maxoff;
982982
OffsetNumber i;
983-
bool isroot;
984983
bool isleaf;
985984

986985
/* Acquire a new page to split into */
@@ -1019,7 +1018,6 @@ _bt_split(Relation rel, Buffer buf, Buffer cbuf, OffsetNumber firstright,
10191018
lopaque = (BTPageOpaque) PageGetSpecialPointer(leftpage);
10201019
ropaque = (BTPageOpaque) PageGetSpecialPointer(rightpage);
10211020

1022-
isroot = P_ISROOT(oopaque);
10231021
isleaf = P_ISLEAF(oopaque);
10241022

10251023
/* if we're splitting this page, it won't be the root when we're done */
@@ -1330,11 +1328,7 @@ _bt_split(Relation rel, Buffer buf, Buffer cbuf, OffsetNumber firstright,
13301328
(char *) rightpage + ((PageHeader) rightpage)->pd_upper,
13311329
((PageHeader) rightpage)->pd_special - ((PageHeader) rightpage)->pd_upper);
13321330

1333-
if (isroot)
1334-
xlinfo = newitemonleft ? XLOG_BTREE_SPLIT_L_ROOT : XLOG_BTREE_SPLIT_R_ROOT;
1335-
else
1336-
xlinfo = newitemonleft ? XLOG_BTREE_SPLIT_L : XLOG_BTREE_SPLIT_R;
1337-
1331+
xlinfo = newitemonleft ? XLOG_BTREE_SPLIT_L : XLOG_BTREE_SPLIT_R;
13381332
recptr = XLogInsert(RM_BTREE_ID, xlinfo);
13391333

13401334
PageSetLSN(origpage, recptr);

src/backend/access/nbtree/nbtxlog.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ btree_xlog_insert(bool isleaf, bool ismeta, XLogReaderState *record)
193193
}
194194

195195
static void
196-
btree_xlog_split(bool onleft, bool isroot, XLogReaderState *record)
196+
btree_xlog_split(bool onleft, XLogReaderState *record)
197197
{
198198
XLogRecPtr lsn = record->EndRecPtr;
199199
xl_btree_split *xlrec = (xl_btree_split *) XLogRecGetData(record);
@@ -996,16 +996,10 @@ btree_redo(XLogReaderState *record)
996996
btree_xlog_insert(false, true, record);
997997
break;
998998
case XLOG_BTREE_SPLIT_L:
999-
btree_xlog_split(true, false, record);
999+
btree_xlog_split(true, record);
10001000
break;
10011001
case XLOG_BTREE_SPLIT_R:
1002-
btree_xlog_split(false, false, record);
1003-
break;
1004-
case XLOG_BTREE_SPLIT_L_ROOT:
1005-
btree_xlog_split(true, true, record);
1006-
break;
1007-
case XLOG_BTREE_SPLIT_R_ROOT:
1008-
btree_xlog_split(false, true, record);
1002+
btree_xlog_split(false, record);
10091003
break;
10101004
case XLOG_BTREE_VACUUM:
10111005
btree_xlog_vacuum(record);

src/backend/access/rmgrdesc/nbtdesc.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ btree_desc(StringInfo buf, XLogReaderState *record)
3535
}
3636
case XLOG_BTREE_SPLIT_L:
3737
case XLOG_BTREE_SPLIT_R:
38-
case XLOG_BTREE_SPLIT_L_ROOT:
39-
case XLOG_BTREE_SPLIT_R_ROOT:
4038
{
4139
xl_btree_split *xlrec = (xl_btree_split *) rec;
4240

@@ -121,12 +119,6 @@ btree_identify(uint8 info)
121119
case XLOG_BTREE_SPLIT_R:
122120
id = "SPLIT_R";
123121
break;
124-
case XLOG_BTREE_SPLIT_L_ROOT:
125-
id = "SPLIT_L_ROOT";
126-
break;
127-
case XLOG_BTREE_SPLIT_R_ROOT:
128-
id = "SPLIT_R_ROOT";
129-
break;
130122
case XLOG_BTREE_VACUUM:
131123
id = "VACUUM";
132124
break;

src/include/access/nbtxlog.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
#define XLOG_BTREE_INSERT_META 0x20 /* same, plus update metapage */
2929
#define XLOG_BTREE_SPLIT_L 0x30 /* add index tuple with split */
3030
#define XLOG_BTREE_SPLIT_R 0x40 /* as above, new item on right */
31-
#define XLOG_BTREE_SPLIT_L_ROOT 0x50 /* add tuple with split of root */
32-
#define XLOG_BTREE_SPLIT_R_ROOT 0x60 /* as above, new item on right */
31+
/* 0x50 and 0x60 are unused */
3332
#define XLOG_BTREE_DELETE 0x70 /* delete leaf index tuples for a page */
3433
#define XLOG_BTREE_UNLINK_PAGE 0x80 /* delete a half-dead page */
3534
#define XLOG_BTREE_UNLINK_PAGE_META 0x90 /* same, and update metapage */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy