Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
daf75276
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,发现更多精彩内容 >>
提交
daf75276
编写于
1月 29, 1997
作者:
V
Vadim B. Mikheev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
New func _vc_scanoneind: scan one index relation to update statistic
in pg_class if no one page was reapped by vacuum.
上级
f3c3458b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
63 addition
and
13 deletion
+63
-13
src/backend/commands/vacuum.c
src/backend/commands/vacuum.c
+63
-13
未找到文件。
src/backend/commands/vacuum.c
浏览文件 @
daf75276
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.1
7 1997/01/25 19:29:36 scrappy
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.1
8 1997/01/29 02:59:03 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -68,6 +68,7 @@ static void _vc_rpfheap (VRelList curvrl, Relation onerel, VPageList Vvpl, VPage
...
@@ -68,6 +68,7 @@ static void _vc_rpfheap (VRelList curvrl, Relation onerel, VPageList Vvpl, VPage
static
void
_vc_vacheap
(
VRelList
curvrl
,
Relation
onerel
,
VPageList
vpl
);
static
void
_vc_vacheap
(
VRelList
curvrl
,
Relation
onerel
,
VPageList
vpl
);
static
void
_vc_vacpage
(
Page
page
,
VPageDescr
vpd
,
Relation
archrel
);
static
void
_vc_vacpage
(
Page
page
,
VPageDescr
vpd
,
Relation
archrel
);
static
void
_vc_vaconeind
(
VPageList
vpl
,
Relation
indrel
,
int
nhtups
);
static
void
_vc_vaconeind
(
VPageList
vpl
,
Relation
indrel
,
int
nhtups
);
static
void
_vc_scanoneind
(
Relation
indrel
,
int
nhtups
);
static
void
_vc_updstats
(
Oid
relid
,
int
npages
,
int
ntuples
,
bool
hasindex
);
static
void
_vc_updstats
(
Oid
relid
,
int
npages
,
int
ntuples
,
bool
hasindex
);
static
void
_vc_setpagelock
(
Relation
rel
,
BlockNumber
blkno
);
static
void
_vc_setpagelock
(
Relation
rel
,
BlockNumber
blkno
);
static
VPageDescr
_vc_tidreapped
(
ItemPointer
itemptr
,
VPageList
curvrl
);
static
VPageDescr
_vc_tidreapped
(
ItemPointer
itemptr
,
VPageList
curvrl
);
...
@@ -400,34 +401,38 @@ _vc_vacone (VRelList curvrl)
...
@@ -400,34 +401,38 @@ _vc_vacone (VRelList curvrl)
Vvpl
.
vpl_npages
=
Fvpl
.
vpl_npages
=
0
;
Vvpl
.
vpl_npages
=
Fvpl
.
vpl_npages
=
0
;
_vc_scanheap
(
curvrl
,
onerel
,
&
Vvpl
,
&
Fvpl
);
_vc_scanheap
(
curvrl
,
onerel
,
&
Vvpl
,
&
Fvpl
);
/* Now open
/count
indices */
/* Now open indices */
Irel
=
(
Relation
*
)
NULL
;
Irel
=
(
Relation
*
)
NULL
;
if
(
Vvpl
.
vpl_npages
>
0
)
_vc_getindices
(
curvrl
->
vrl_relid
,
&
nindices
,
&
Irel
);
/* Open all indices of this relation */
_vc_getindices
(
curvrl
->
vrl_relid
,
&
nindices
,
&
Irel
);
else
/* Count indices only */
_vc_getindices
(
curvrl
->
vrl_relid
,
&
nindices
,
NULL
);
if
(
nindices
>
0
)
if
(
nindices
>
0
)
curvrl
->
vrl_hasindex
=
true
;
curvrl
->
vrl_hasindex
=
true
;
else
else
curvrl
->
vrl_hasindex
=
false
;
curvrl
->
vrl_hasindex
=
false
;
/* Clean
index'
relation(s) */
/* Clean
/scan index
relation(s) */
if
(
Irel
!=
(
Relation
*
)
NULL
)
if
(
Irel
!=
(
Relation
*
)
NULL
)
{
{
for
(
i
=
0
;
i
<
nindices
;
i
++
)
if
(
Vvpl
.
vpl_npages
>
0
)
_vc_vaconeind
(
&
Vvpl
,
Irel
[
i
],
curvrl
->
vrl_ntups
);
{
for
(
i
=
0
;
i
<
nindices
;
i
++
)
_vc_vaconeind
(
&
Vvpl
,
Irel
[
i
],
curvrl
->
vrl_ntups
);
}
else
/* just scan indices to update statistic */
{
for
(
i
=
0
;
i
<
nindices
;
i
++
)
_vc_scanoneind
(
Irel
[
i
],
curvrl
->
vrl_ntups
);
}
}
}
if
(
Fvpl
.
vpl_npages
>
0
)
/* Try to shrink heap */
if
(
Fvpl
.
vpl_npages
>
0
)
/* Try to shrink heap */
_vc_rpfheap
(
curvrl
,
onerel
,
&
Vvpl
,
&
Fvpl
,
nindices
,
Irel
);
_vc_rpfheap
(
curvrl
,
onerel
,
&
Vvpl
,
&
Fvpl
,
nindices
,
Irel
);
else
if
(
Vvpl
.
vpl_npages
>
0
)
/* Clean pages from Vvpl list */
else
{
{
if
(
Irel
!=
(
Relation
*
)
NULL
)
if
(
Irel
!=
(
Relation
*
)
NULL
)
_vc_clsindices
(
nindices
,
Irel
);
_vc_clsindices
(
nindices
,
Irel
);
_vc_vacheap
(
curvrl
,
onerel
,
&
Vvpl
);
if
(
Vvpl
.
vpl_npages
>
0
)
/* Clean pages from Vvpl list */
_vc_vacheap
(
curvrl
,
onerel
,
&
Vvpl
);
}
}
/* ok - free Vvpl list of reapped pages */
/* ok - free Vvpl list of reapped pages */
...
@@ -1266,6 +1271,51 @@ _vc_vacpage (Page page, VPageDescr vpd, Relation archrel)
...
@@ -1266,6 +1271,51 @@ _vc_vacpage (Page page, VPageDescr vpd, Relation archrel)
}
/* _vc_vacpage */
}
/* _vc_vacpage */
/*
* _vc_scanoneind() -- scan one index relation to update statistic.
*
*/
static
void
_vc_scanoneind
(
Relation
indrel
,
int
nhtups
)
{
RetrieveIndexResult
res
;
IndexScanDesc
iscan
;
int
nitups
;
int
nipages
;
struct
rusage
ru0
,
ru1
;
getrusage
(
RUSAGE_SELF
,
&
ru0
);
/* walk through the entire index */
iscan
=
index_beginscan
(
indrel
,
false
,
0
,
(
ScanKey
)
NULL
);
nitups
=
0
;
while
((
res
=
index_getnext
(
iscan
,
ForwardScanDirection
))
!=
(
RetrieveIndexResult
)
NULL
)
{
nitups
++
;
pfree
(
res
);
}
index_endscan
(
iscan
);
/* now update statistics in pg_class */
nipages
=
RelationGetNumberOfBlocks
(
indrel
);
_vc_updstats
(
indrel
->
rd_id
,
nipages
,
nitups
,
false
);
getrusage
(
RUSAGE_SELF
,
&
ru1
);
elog
(
MESSLEV
,
"Ind %.*s: Pages %u; Tuples %u. Elapsed %u/%u sec."
,
NAMEDATALEN
,
indrel
->
rd_rel
->
relname
.
data
,
nipages
,
nitups
,
ru1
.
ru_stime
.
tv_sec
-
ru0
.
ru_stime
.
tv_sec
,
ru1
.
ru_utime
.
tv_sec
-
ru0
.
ru_utime
.
tv_sec
);
if
(
nitups
!=
nhtups
)
elog
(
NOTICE
,
"NUMBER OF INDEX' TUPLES (%u) IS NOT THE SAME AS HEAP' (%u)"
,
nitups
,
nhtups
);
}
/* _vc_scanoneind */
/*
/*
* _vc_vaconeind() -- vacuum one index relation.
* _vc_vaconeind() -- vacuum one index relation.
*
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录