Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
2a0caefe
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,发现更多精彩内容 >>
提交
2a0caefe
编写于
12月 21, 2003
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Previous change exposed some opportunities for further simplification
in _bt_first().
上级
569659ae
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
37 deletion
+11
-37
src/backend/access/nbtree/nbtsearch.c
src/backend/access/nbtree/nbtsearch.c
+11
-37
未找到文件。
src/backend/access/nbtree/nbtsearch.c
浏览文件 @
2a0caefe
...
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.8
4 2003/12/21 01:23:06
tgl Exp $
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.8
5 2003/12/21 03:00:04
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -495,10 +495,9 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
BlockNumber
blkno
;
StrategyNumber
strat
;
bool
res
;
int32
result
;
bool
nextkey
;
bool
continuescan
;
ScanKey
scankeys
=
NULL
;
ScanKey
scankeys
;
ScanKey
*
startKeys
=
NULL
;
int
keysCount
=
0
;
int
i
;
...
...
@@ -695,8 +694,6 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
pfree
(
startKeys
);
current
=
&
(
scan
->
currentItemData
);
/*
* We want to locate either the first item >= boundary point, or
* first item > boundary point, depending on the initial-positioning
...
...
@@ -746,6 +743,8 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
/* don't need to keep the stack around... */
_bt_freestack
(
stack
);
current
=
&
(
scan
->
currentItemData
);
if
(
!
BufferIsValid
(
buf
))
{
/* Only get here if index is completely empty */
...
...
@@ -765,6 +764,9 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
ItemPointerSet
(
current
,
blkno
,
offnum
);
/* done with manufactured scankey, now */
pfree
(
scankeys
);
/*
* It's now time to examine the initial-positioning strategy to find the
* exact place to start the scan.
...
...
@@ -802,10 +804,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
* that is always the correct starting position.)
*/
if
(
!
_bt_step
(
scan
,
&
buf
,
BackwardScanDirection
))
{
pfree
(
scankeys
);
return
false
;
}
break
;
case
BTLessEqualStrategyNumber
:
...
...
@@ -818,10 +817,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
* that is always the correct starting position.)
*/
if
(
!
_bt_step
(
scan
,
&
buf
,
BackwardScanDirection
))
{
pfree
(
scankeys
);
return
false
;
}
break
;
case
BTEqualStrategyNumber
:
...
...
@@ -834,14 +830,11 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
/*
* We are on first item > scankey.
*
* Back up one to arrive at last item <= scankey
, then
*
check
to see if it is equal to scankey.
* Back up one to arrive at last item <= scankey
.
*
We will check below
to see if it is equal to scankey.
*/
if
(
!
_bt_step
(
scan
,
&
buf
,
BackwardScanDirection
))
{
pfree
(
scankeys
);
return
false
;
}
}
else
{
...
...
@@ -849,25 +842,15 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
* We are on first item >= scankey.
*
* Make sure we are on a real item; might have to
* step forward if currently at end of page.
Then check
* to see if it is equal to scankey.
* step forward if currently at end of page.
*
We will check below
to see if it is equal to scankey.
*/
if
(
offnum
>
PageGetMaxOffsetNumber
(
page
))
{
if
(
!
_bt_step
(
scan
,
&
buf
,
ForwardScanDirection
))
{
pfree
(
scankeys
);
return
false
;
}
}
}
/* If we are not now on an equal item, then there ain't any. */
offnum
=
ItemPointerGetOffsetNumber
(
current
);
page
=
BufferGetPage
(
buf
);
result
=
_bt_compare
(
rel
,
keysCount
,
scankeys
,
page
,
offnum
);
if
(
result
!=
0
)
goto
nomatches
;
/* no equal items! */
break
;
case
BTGreaterEqualStrategyNumber
:
...
...
@@ -879,10 +862,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
if
(
offnum
>
PageGetMaxOffsetNumber
(
page
))
{
if
(
!
_bt_step
(
scan
,
&
buf
,
ForwardScanDirection
))
{
pfree
(
scankeys
);
return
false
;
}
}
break
;
...
...
@@ -895,10 +875,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
if
(
offnum
>
PageGetMaxOffsetNumber
(
page
))
{
if
(
!
_bt_step
(
scan
,
&
buf
,
ForwardScanDirection
))
{
pfree
(
scankeys
);
return
false
;
}
}
break
;
}
...
...
@@ -924,15 +901,12 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
else
{
/* no tuples in the index match this scan key */
nomatches:
ItemPointerSetInvalid
(
current
);
so
->
btso_curbuf
=
InvalidBuffer
;
_bt_relbuf
(
rel
,
buf
);
res
=
false
;
}
pfree
(
scankeys
);
return
res
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录