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

Commit0c504a8

Browse files
committed
Remove dedicated B-tree root-split record types.
Since commit40dae7e, which changed the way b-tree page splittingworks, there has been no difference in the handling of root, and non-rootsplit WAL records. We don't need to distinguish them anymoreIf you're worried about the loss of debugging information, note thatusually a root split record will normally be followed by a WAL record tocreate the new root page. The root page will also have the BTP_ROOT flagset on the page itself, and there is a pointer to it from the metapage.Author: Aleksander AlekseevDiscussion:https://www.postgresql.org/message-id/20170406122116.GA11081@e733.localdomain
1 parent77d0570 commit0c504a8

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
OffsetNumbermaxoff;
982982
OffsetNumberi;
983-
boolisroot;
984983
boolisleaf;
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
staticvoid
196-
btree_xlog_split(boolonleft,boolisroot,XLogReaderState*record)
196+
btree_xlog_split(boolonleft,XLogReaderState*record)
197197
{
198198
XLogRecPtrlsn=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
caseXLOG_BTREE_SPLIT_L:
999-
btree_xlog_split(true,false,record);
999+
btree_xlog_split(true,record);
10001000
break;
10011001
caseXLOG_BTREE_SPLIT_R:
1002-
btree_xlog_split(false, false,record);
1003-
break;
1004-
caseXLOG_BTREE_SPLIT_L_ROOT:
1005-
btree_xlog_split(true, true,record);
1006-
break;
1007-
caseXLOG_BTREE_SPLIT_R_ROOT:
1008-
btree_xlog_split(false, true,record);
1002+
btree_xlog_split(false,record);
10091003
break;
10101004
caseXLOG_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
caseXLOG_BTREE_SPLIT_L:
3737
caseXLOG_BTREE_SPLIT_R:
38-
caseXLOG_BTREE_SPLIT_L_ROOT:
39-
caseXLOG_BTREE_SPLIT_R_ROOT:
4038
{
4139
xl_btree_split*xlrec= (xl_btree_split*)rec;
4240

@@ -121,12 +119,6 @@ btree_identify(uint8 info)
121119
caseXLOG_BTREE_SPLIT_R:
122120
id="SPLIT_R";
123121
break;
124-
caseXLOG_BTREE_SPLIT_L_ROOT:
125-
id="SPLIT_L_ROOT";
126-
break;
127-
caseXLOG_BTREE_SPLIT_R_ROOT:
128-
id="SPLIT_R_ROOT";
129-
break;
130122
caseXLOG_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
#defineXLOG_BTREE_INSERT_META0x20/* same, plus update metapage */
2929
#defineXLOG_BTREE_SPLIT_L0x30/* add index tuple with split */
3030
#defineXLOG_BTREE_SPLIT_R0x40/* as above, new item on right */
31-
#defineXLOG_BTREE_SPLIT_L_ROOT 0x50/* add tuple with split of root */
32-
#defineXLOG_BTREE_SPLIT_R_ROOT 0x60/* as above, new item on right */
31+
/* 0x50 and 0x60 are unused */
3332
#defineXLOG_BTREE_DELETE0x70/* delete leaf index tuples for a page */
3433
#defineXLOG_BTREE_UNLINK_PAGE0x80/* delete a half-dead page */
3534
#defineXLOG_BTREE_UNLINK_PAGE_META 0x90/* same, and update metapage */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp