Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
3888b53a
Commit
3888b53a
authored
Apr 22, 1999
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix duplicating ROOT page in concurrent updates.
parent
00fbb64b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
16 deletions
+41
-16
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtinsert.c
+14
-2
src/backend/access/nbtree/nbtpage.c
src/backend/access/nbtree/nbtpage.c
+27
-14
No files found.
src/backend/access/nbtree/nbtinsert.c
View file @
3888b53a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.3
7 1999/04/12 16:56:08
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.3
8 1999/04/22 08:19:59
vadim Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -398,6 +398,7 @@ _bt_insertonpg(Relation rel,
OffsetNumber
maxoff
;
bool
shifted
=
false
;
bool
left_chained
=
(
lpageop
->
btpo_flags
&
BTP_CHAIN
)
?
true
:
false
;
bool
is_root
=
lpageop
->
btpo_flags
&
BTP_ROOT
;
/*
* If we have to split leaf page in the chain of duplicates by new
...
...
@@ -570,9 +571,20 @@ _bt_insertonpg(Relation rel,
* reasoning).
*/
l_spl:
;
if
(
stack
==
(
BTStack
)
NULL
)
{
if
(
!
is_root
)
/* if this page was not root page */
{
elog
(
DEBUG
,
"btree: concurrent ROOT page split"
);
stack
=
(
BTStack
)
palloc
(
sizeof
(
BTStackData
));
stack
->
bts_blkno
=
lpageop
->
btpo_parent
;
stack
->
bts_offset
=
InvalidOffsetNumber
;
stack
->
bts_btitem
=
(
BTItem
)
palloc
(
sizeof
(
BTItemData
));
/* bts_btitem will be initialized below */
stack
->
bts_parent
=
NULL
;
goto
l_spl
;
}
/* create a new root node and release the split buffers */
_bt_newroot
(
rel
,
buf
,
rbuf
);
_bt_relbuf
(
rel
,
buf
,
BT_WRITE
);
...
...
src/backend/access/nbtree/nbtpage.c
View file @
3888b53a
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.
19 1999/03/28 20:31:57
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.
20 1999/04/22 08:19:59
vadim Exp $
*
* NOTES
* Postgres btree pages look like ordinary relation pages. The opaque
...
...
@@ -494,7 +494,18 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
opaque
=
(
BTPageOpaque
)
PageGetSpecialPointer
(
page
);
maxoff
=
PageGetMaxOffsetNumber
(
page
);
if
(
maxoff
>=
stack
->
bts_offset
)
if
(
stack
->
bts_offset
==
InvalidOffsetNumber
||
maxoff
>=
stack
->
bts_offset
)
{
/*
* _bt_insertonpg set bts_offset to InvalidOffsetNumber
* in the case of concurrent ROOT page split
*/
if
(
stack
->
bts_offset
==
InvalidOffsetNumber
)
{
i
=
P_RIGHTMOST
(
opaque
)
?
P_HIKEY
:
P_FIRSTKEY
;
}
else
{
itemid
=
PageGetItemId
(
page
,
stack
->
bts_offset
);
item
=
(
BTItem
)
PageGetItem
(
page
,
itemid
);
...
...
@@ -509,9 +520,11 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
stack
->
bts_btitem
=
item_save
;
return
buf
;
}
i
=
OffsetNumberNext
(
stack
->
bts_offset
);
}
/* if the item has just moved right on this page, we're done */
for
(
i
=
OffsetNumberNext
(
stack
->
bts_offset
)
;
for
(
;
i
<=
maxoff
;
i
=
OffsetNumberNext
(
i
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment