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
c8a38d5d
Commit
c8a38d5d
authored
Jun 06, 1997
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added check is new item successfuly inserted to a page or not.
parent
8d1f52ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
17 deletions
+29
-17
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtinsert.c
+23
-13
src/backend/access/nbtree/nbtsort.c
src/backend/access/nbtree/nbtsort.c
+6
-4
No files found.
src/backend/access/nbtree/nbtinsert.c
View file @
c8a38d5d
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.1
4 1997/05/31 06:35:56
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.1
5 1997/06/06 03:11:42
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -488,7 +488,8 @@ _bt_insertonpg(Relation rel,
...
@@ -488,7 +488,8 @@ _bt_insertonpg(Relation rel,
upditem_offset
=
P_FIRSTKEY
;
upditem_offset
=
P_FIRSTKEY
;
if
(
!
P_LEFTMOST
(
lpageop
)
||
if
(
!
P_LEFTMOST
(
lpageop
)
||
stack
->
bts_offset
!=
upditem_offset
)
stack
->
bts_offset
!=
upditem_offset
)
elog
(
FATAL
,
"btree: items are out of order"
);
elog
(
FATAL
,
"btree: items are out of order (leftmost %d, stack %u, update %u)"
,
P_LEFTMOST
(
lpageop
),
stack
->
bts_offset
,
upditem_offset
);
}
}
/*
/*
* There was bug caused by deletion all minimum keys (K1) from
* There was bug caused by deletion all minimum keys (K1) from
...
@@ -682,7 +683,8 @@ _bt_split(Relation rel, Buffer buf, BTItem hiRightItem)
...
@@ -682,7 +683,8 @@ _bt_split(Relation rel, Buffer buf, BTItem hiRightItem)
+
(
sizeof
(
BTItemData
)
-
sizeof
(
IndexTupleData
));
+
(
sizeof
(
BTItemData
)
-
sizeof
(
IndexTupleData
));
itemsz
=
DOUBLEALIGN
(
itemsz
);
itemsz
=
DOUBLEALIGN
(
itemsz
);
}
}
(
void
)
PageAddItem
(
rightpage
,
(
Item
)
item
,
itemsz
,
P_HIKEY
,
LP_USED
);
if
(
PageAddItem
(
rightpage
,
(
Item
)
item
,
itemsz
,
P_HIKEY
,
LP_USED
)
==
InvalidOffsetNumber
)
elog
(
FATAL
,
"btree: failed to add hikey to the right sibling"
);
rightoff
=
P_FIRSTKEY
;
rightoff
=
P_FIRSTKEY
;
}
else
{
}
else
{
/* splitting a rightmost page, "high key" is the first data item */
/* splitting a rightmost page, "high key" is the first data item */
...
@@ -702,12 +704,14 @@ _bt_split(Relation rel, Buffer buf, BTItem hiRightItem)
...
@@ -702,12 +704,14 @@ _bt_split(Relation rel, Buffer buf, BTItem hiRightItem)
/* decide which page to put it on */
/* decide which page to put it on */
if
(
i
<
firstright
)
{
if
(
i
<
firstright
)
{
(
void
)
PageAddItem
(
leftpage
,
(
Item
)
item
,
itemsz
,
leftoff
,
if
(
PageAddItem
(
leftpage
,
(
Item
)
item
,
itemsz
,
leftoff
,
LP_USED
);
LP_USED
)
==
InvalidOffsetNumber
)
elog
(
FATAL
,
"btree: failed to add item to the left sibling"
);
leftoff
=
OffsetNumberNext
(
leftoff
);
leftoff
=
OffsetNumberNext
(
leftoff
);
}
else
{
}
else
{
(
void
)
PageAddItem
(
rightpage
,
(
Item
)
item
,
itemsz
,
rightoff
,
if
(
PageAddItem
(
rightpage
,
(
Item
)
item
,
itemsz
,
rightoff
,
LP_USED
);
LP_USED
)
==
InvalidOffsetNumber
)
elog
(
FATAL
,
"btree: failed to add item to the right sibling"
);
rightoff
=
OffsetNumberNext
(
rightoff
);
rightoff
=
OffsetNumberNext
(
rightoff
);
}
}
}
}
...
@@ -735,7 +739,8 @@ _bt_split(Relation rel, Buffer buf, BTItem hiRightItem)
...
@@ -735,7 +739,8 @@ _bt_split(Relation rel, Buffer buf, BTItem hiRightItem)
*/
*/
PageManagerModeSet
(
OverwritePageManagerMode
);
PageManagerModeSet
(
OverwritePageManagerMode
);
(
void
)
PageAddItem
(
leftpage
,
(
Item
)
item
,
itemsz
,
P_HIKEY
,
LP_USED
);
if
(
PageAddItem
(
leftpage
,
(
Item
)
item
,
itemsz
,
P_HIKEY
,
LP_USED
)
==
InvalidOffsetNumber
)
elog
(
FATAL
,
"btree: failed to add hikey to the left sibling"
);
PageManagerModeSet
(
ShufflePageManagerMode
);
PageManagerModeSet
(
ShufflePageManagerMode
);
/*
/*
...
@@ -913,7 +918,8 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
...
@@ -913,7 +918,8 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
* page is the rightmost page on its level so the "high key" item
* page is the rightmost page on its level so the "high key" item
* is the first data item.
* is the first data item.
*/
*/
(
void
)
PageAddItem
(
rootpage
,
(
Item
)
new_item
,
itemsz
,
P_HIKEY
,
LP_USED
);
if
(
PageAddItem
(
rootpage
,
(
Item
)
new_item
,
itemsz
,
P_HIKEY
,
LP_USED
)
==
InvalidOffsetNumber
)
elog
(
FATAL
,
"btree: failed to add leftkey to new root page"
);
pfree
(
new_item
);
pfree
(
new_item
);
/*
/*
...
@@ -929,7 +935,8 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
...
@@ -929,7 +935,8 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
/*
/*
* insert the right page pointer into the new root page.
* insert the right page pointer into the new root page.
*/
*/
(
void
)
PageAddItem
(
rootpage
,
(
Item
)
new_item
,
itemsz
,
P_FIRSTKEY
,
LP_USED
);
if
(
PageAddItem
(
rootpage
,
(
Item
)
new_item
,
itemsz
,
P_FIRSTKEY
,
LP_USED
)
==
InvalidOffsetNumber
)
elog
(
FATAL
,
"btree: failed to add rightkey to new root page"
);
pfree
(
new_item
);
pfree
(
new_item
);
/* write and let go of the root buffer */
/* write and let go of the root buffer */
...
@@ -981,7 +988,8 @@ _bt_pgaddtup(Relation rel,
...
@@ -981,7 +988,8 @@ _bt_pgaddtup(Relation rel,
}
while
(
!
BTItemSame
(
chkitem
,
afteritem
)
);
}
while
(
!
BTItemSame
(
chkitem
,
afteritem
)
);
}
}
(
void
)
PageAddItem
(
page
,
(
Item
)
btitem
,
itemsize
,
itup_off
,
LP_USED
);
if
(
PageAddItem
(
page
,
(
Item
)
btitem
,
itemsize
,
itup_off
,
LP_USED
)
==
InvalidOffsetNumber
)
elog
(
FATAL
,
"btree: failed to add item to the page"
);
/* write the buffer, but hold our lock */
/* write the buffer, but hold our lock */
_bt_wrtnorelbuf
(
rel
,
buf
);
_bt_wrtnorelbuf
(
rel
,
buf
);
...
@@ -1325,14 +1333,16 @@ _bt_shift (Relation rel, Buffer buf, BTStack stack, int keysz,
...
@@ -1325,14 +1333,16 @@ _bt_shift (Relation rel, Buffer buf, BTStack stack, int keysz,
itemsz
=
IndexTupleDSize
(
hikey
->
bti_itup
)
itemsz
=
IndexTupleDSize
(
hikey
->
bti_itup
)
+
(
sizeof
(
BTItemData
)
-
sizeof
(
IndexTupleData
));
+
(
sizeof
(
BTItemData
)
-
sizeof
(
IndexTupleData
));
itemsz
=
DOUBLEALIGN
(
itemsz
);
itemsz
=
DOUBLEALIGN
(
itemsz
);
(
void
)
PageAddItem
(
page
,
(
Item
)
hikey
,
itemsz
,
P_HIKEY
,
LP_USED
);
if
(
PageAddItem
(
page
,
(
Item
)
hikey
,
itemsz
,
P_HIKEY
,
LP_USED
)
==
InvalidOffsetNumber
)
elog
(
FATAL
,
"btree: failed to add hikey in _bt_shift"
);
pfree
(
hikey
);
pfree
(
hikey
);
/* add btitem */
/* add btitem */
itemsz
=
IndexTupleDSize
(
btitem
->
bti_itup
)
itemsz
=
IndexTupleDSize
(
btitem
->
bti_itup
)
+
(
sizeof
(
BTItemData
)
-
sizeof
(
IndexTupleData
));
+
(
sizeof
(
BTItemData
)
-
sizeof
(
IndexTupleData
));
itemsz
=
DOUBLEALIGN
(
itemsz
);
itemsz
=
DOUBLEALIGN
(
itemsz
);
(
void
)
PageAddItem
(
page
,
(
Item
)
btitem
,
itemsz
,
P_FIRSTKEY
,
LP_USED
);
if
(
PageAddItem
(
page
,
(
Item
)
btitem
,
itemsz
,
P_FIRSTKEY
,
LP_USED
)
==
InvalidOffsetNumber
)
elog
(
FATAL
,
"btree: failed to add firstkey in _bt_shift"
);
pfree
(
btitem
);
pfree
(
btitem
);
nitem
=
(
BTItem
)
PageGetItem
(
page
,
PageGetItemId
(
page
,
P_FIRSTKEY
));
nitem
=
(
BTItem
)
PageGetItem
(
page
,
PageGetItemId
(
page
,
P_FIRSTKEY
));
btitem
=
_bt_formitem
(
&
(
nitem
->
bti_itup
));
btitem
=
_bt_formitem
(
&
(
nitem
->
bti_itup
));
...
...
src/backend/access/nbtree/nbtsort.c
View file @
c8a38d5d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Id: nbtsort.c,v 1.1
6 1997/05/30 18:35:40
vadim Exp $
* $Id: nbtsort.c,v 1.1
7 1997/06/06 03:11:46
vadim Exp $
*
*
* NOTES
* NOTES
*
*
...
@@ -938,8 +938,9 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
...
@@ -938,8 +938,9 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
o
<=
last_off
;
o
<=
last_off
;
o
=
OffsetNumberNext
(
o
),
n
=
OffsetNumberNext
(
n
))
{
o
=
OffsetNumberNext
(
o
),
n
=
OffsetNumberNext
(
n
))
{
ii
=
PageGetItemId
(
opage
,
o
);
ii
=
PageGetItemId
(
opage
,
o
);
(
void
)
PageAddItem
(
npage
,
PageGetItem
(
opage
,
ii
),
if
(
PageAddItem
(
npage
,
PageGetItem
(
opage
,
ii
),
ii
->
lp_len
,
n
,
LP_USED
);
ii
->
lp_len
,
n
,
LP_USED
)
==
InvalidOffsetNumber
)
elog
(
FATAL
,
"btree: failed to add item to the page in _bt_sort (1)"
);
#if 0
#if 0
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
{
{
...
@@ -1021,7 +1022,8 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
...
@@ -1021,7 +1022,8 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
* new chain of duplicates.
* new chain of duplicates.
*/
*/
off
=
OffsetNumberNext
(
last_off
);
off
=
OffsetNumberNext
(
last_off
);
(
void
)
PageAddItem
(
npage
,
(
Item
)
bti
,
btisz
,
off
,
LP_USED
);
if
(
PageAddItem
(
npage
,
(
Item
)
bti
,
btisz
,
off
,
LP_USED
)
==
InvalidOffsetNumber
)
elog
(
FATAL
,
"btree: failed to add item to the page in _bt_sort (2)"
);
#if 0
#if 0
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
{
{
...
...
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