Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
b0e5efef
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,发现更多精彩内容 >>
提交
b0e5efef
编写于
1月 17, 2018
作者:
P
Pengzhou Tang
提交者:
Tang Pengzhou
4月 02, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a syscache for gp_distribution_policy
This can make GpPolicyFetch() a little bit faster.
上级
6beb8eb3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
27 deletion
+26
-27
src/backend/cdb/cdbcat.c
src/backend/cdb/cdbcat.c
+14
-27
src/backend/utils/cache/syscache.c
src/backend/utils/cache/syscache.c
+11
-0
src/include/utils/syscache.h
src/include/utils/syscache.h
+1
-0
未找到文件。
src/backend/cdb/cdbcat.c
浏览文件 @
b0e5efef
...
...
@@ -29,6 +29,7 @@
#include "utils/fmgroids.h"
#include "utils/lsyscache.h"
#include "utils/tqual.h"
#include "utils/syscache.h"
static
void
extract_INT2OID_array
(
Datum
array_datum
,
int
*
lenp
,
int16
**
vecp
);
...
...
@@ -106,7 +107,6 @@ GpPolicy *
GpPolicyCopy
(
MemoryContext
mcxt
,
const
GpPolicy
*
src
)
{
GpPolicy
*
tgt
;
size_t
nb
;
int
i
;
if
(
!
src
)
...
...
@@ -223,9 +223,6 @@ GpPolicy *
GpPolicyFetch
(
MemoryContext
mcxt
,
Oid
tbloid
)
{
GpPolicy
*
policy
=
NULL
;
/* The result */
Relation
gp_policy_rel
;
ScanKeyData
scankey
;
SysScanDesc
scan
;
HeapTuple
gp_policy_tuple
=
NULL
;
/*
...
...
@@ -262,24 +259,13 @@ GpPolicyFetch(MemoryContext mcxt, Oid tbloid)
}
}
/*
* We need to read the gp_distribution_policy table
*/
gp_policy_rel
=
heap_open
(
GpPolicyRelationId
,
AccessShareLock
);
/*
* Select by value of the localoid field
*
* SELECT * FROM gp_distribution_policy WHERE localoid = :1
*/
ScanKeyInit
(
&
scankey
,
Anum_gp_policy_localoid
,
BTEqualStrategyNumber
,
F_OIDEQ
,
ObjectIdGetDatum
(
tbloid
));
scan
=
systable_beginscan
(
gp_policy_rel
,
GpPolicyLocalOidIndexId
,
true
,
SnapshotNow
,
1
,
&
scankey
);
gp_policy_tuple
=
systable_getnext
(
scan
);
gp_policy_tuple
=
SearchSysCache1
(
GPPOLICYID
,
ObjectIdGetDatum
(
tbloid
));
/*
* Read first (and only) tuple
...
...
@@ -292,8 +278,11 @@ GpPolicyFetch(MemoryContext mcxt, Oid tbloid)
nattrs
=
0
;
int16
*
attrnums
=
NULL
;
attr
=
heap_getattr
(
gp_policy_tuple
,
Anum_gp_policy_type
,
RelationGetDescr
(
gp_policy_rel
),
&
isNull
);
attr
=
SysCacheGetAttr
(
GPPOLICYID
,
gp_policy_tuple
,
Anum_gp_policy_type
,
&
isNull
);
Assert
(
!
isNull
);
char
ptype
=
DatumGetChar
(
attr
);
...
...
@@ -306,8 +295,9 @@ GpPolicyFetch(MemoryContext mcxt, Oid tbloid)
/*
* Get the attributes on which to partition.
*/
attr
=
heap_getattr
(
gp_policy_tuple
,
Anum_gp_policy_attrnums
,
RelationGetDescr
(
gp_policy_rel
),
&
isNull
);
attr
=
SysCacheGetAttr
(
GPPOLICYID
,
gp_policy_tuple
,
Anum_gp_policy_attrnums
,
&
isNull
);
/*
* Get distribution keys only if this table has a policy.
...
...
@@ -327,15 +317,12 @@ GpPolicyFetch(MemoryContext mcxt, Oid tbloid)
}
break
;
default:
ReleaseSysCache
(
gp_policy_tuple
);
elog
(
ERROR
,
"unrecognized distribution policy type"
);
}
}
/*
* Cleanup the scan and relation objects.
*/
systable_endscan
(
scan
);
heap_close
(
gp_policy_rel
,
AccessShareLock
);
ReleaseSysCache
(
gp_policy_tuple
);
}
/* Interpret absence of a valid policy row as POLICYTYPE_ENTRY */
if
(
policy
==
NULL
)
...
...
src/backend/utils/cache/syscache.c
浏览文件 @
b0e5efef
...
...
@@ -404,6 +404,17 @@ static const struct cachedesc cacheinfo[] = {
},
32
},
{
GpPolicyRelationId
,
/* GPPOLICYID */
GpPolicyLocalOidIndexId
,
1
,
{
Anum_gp_policy_localoid
,
0
,
0
,
0
},
1024
},
{
IndexRelationId
,
/* INDEXRELID */
IndexRelidIndexId
,
1
,
...
...
src/include/utils/syscache.h
浏览文件 @
b0e5efef
...
...
@@ -56,6 +56,7 @@ enum SysCacheIdentifier
FOREIGNDATAWRAPPEROID
,
FOREIGNSERVERNAME
,
FOREIGNSERVEROID
,
GPPOLICYID
,
INDEXRELID
,
LANGNAME
,
LANGOID
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录