Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
716d506a
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
716d506a
编写于
10月 25, 1996
作者:
M
Marc G. Fournier
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make sure the btree patch gets into 2.0 as well...
Still submitted by: Massimo Dal Zotto <dz@cs.unitn.it>
上级
e18d49d8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
50 addition
and
9 deletion
+50
-9
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtinsert.c
+50
-9
未找到文件。
src/backend/access/nbtree/nbtinsert.c
浏览文件 @
716d506a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.
3 1996/10/23 07:39:00
scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.
4 1996/10/25 09:55:36
scrappy Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -815,7 +815,8 @@ _bt_itemcmp(Relation rel,
/*
* _bt_updateitem() -- updates the key of the item identified by the
* oid with the key of newItem (done in place)
* oid with the key of newItem (done in place if
* possible)
*
*/
static
void
...
...
@@ -829,14 +830,17 @@ _bt_updateitem(Relation rel,
OffsetNumber
maxoff
;
OffsetNumber
i
;
ItemPointerData
itemPtrData
;
BTItem
item
;
BTItem
item
,
itemCopy
;
IndexTuple
oldIndexTuple
,
newIndexTuple
;
int
newSize
,
oldSize
,
first
;
page
=
BufferGetPage
(
buf
);
maxoff
=
PageGetMaxOffsetNumber
(
page
);
/* locate item on the page */
i
=
P_HIKEY
;
first
=
P_RIGHTMOST
((
BTPageOpaque
)
PageGetSpecialPointer
(
page
))
\
?
P_HIKEY
:
P_FIRSTKEY
;
i
=
first
;
do
{
item
=
(
BTItem
)
PageGetItem
(
page
,
PageGetItemId
(
page
,
i
));
i
=
OffsetNumberNext
(
i
);
...
...
@@ -849,9 +853,46 @@ _bt_updateitem(Relation rel,
oldIndexTuple
=
&
(
item
->
bti_itup
);
newIndexTuple
=
&
(
newItem
->
bti_itup
);
/* keep the original item pointer */
ItemPointerCopy
(
&
(
oldIndexTuple
->
t_tid
),
&
itemPtrData
);
CopyIndexTuple
(
newIndexTuple
,
&
oldIndexTuple
);
ItemPointerCopy
(
&
itemPtrData
,
&
(
oldIndexTuple
->
t_tid
));
oldSize
=
DOUBLEALIGN
(
IndexTupleSize
(
oldIndexTuple
));
newSize
=
DOUBLEALIGN
(
IndexTupleSize
(
newIndexTuple
));
#ifdef NBTINSERT_PATCH_DEBUG
printf
(
"_bt_updateitem: newSize=%d, oldSize=%d
\n
"
,
newSize
,
oldSize
);
#endif
/*
* If new and old item have the same size do the update in place
* and return.
*/
if
(
oldSize
==
newSize
)
{
/* keep the original item pointer */
ItemPointerCopy
(
&
(
oldIndexTuple
->
t_tid
),
&
itemPtrData
);
CopyIndexTuple
(
newIndexTuple
,
&
oldIndexTuple
);
ItemPointerCopy
(
&
itemPtrData
,
&
(
oldIndexTuple
->
t_tid
));
return
;
}
/*
* If new and old items have different size the update in place
* is not possible. In this case the old item is deleted and the
* new one is inserted.
* The new insertion should be done using _bt_insertonpg which
* would also takes care of the page splitting if needed, but
* unfortunately it doesn't work, so PageAddItem is used instead.
* There is the possibility that there is not enough space in the
* page and the item is not inserted.
*/
itemCopy
=
palloc
(
newSize
);
memmove
((
char
*
)
itemCopy
,
(
char
*
)
newItem
,
newSize
);
itemCopy
->
bti_oid
=
item
->
bti_oid
;
newIndexTuple
=
&
(
itemCopy
->
bti_itup
);
ItemPointerCopy
(
&
(
oldIndexTuple
->
t_tid
),
&
(
newIndexTuple
->
t_tid
));
/*
* Get the offset number of the item then delete it and insert
* the new item in the same place.
*/
i
=
OffsetNumberPrev
(
i
);
PageIndexTupleDelete
(
page
,
i
);
PageAddItem
(
page
,
(
Item
)
itemCopy
,
newSize
,
i
,
LP_USED
);
pfree
(
itemCopy
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录