Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
b0a30de6
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,体验更适合开发者的 AI 搜索 >>
提交
b0a30de6
编写于
9月 29, 2017
作者:
A
Ashwin Agrawal
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pgindent cdb directory (part-3).
上级
ad1b8386
变更
25
展开全部
隐藏空白更改
内联
并排
Showing
25 changed file
with
11979 addition
and
11101 deletion
+11979
-11101
src/backend/cdb/cdbdatabaseinfo.c
src/backend/cdb/cdbdatabaseinfo.c
+553
-532
src/backend/cdb/cdbdirectopen.c
src/backend/cdb/cdbdirectopen.c
+177
-170
src/backend/cdb/cdbdistributedsnapshot.c
src/backend/cdb/cdbdistributedsnapshot.c
+61
-55
src/backend/cdb/cdbdistributedxacts.c
src/backend/cdb/cdbdistributedxacts.c
+5
-7
src/backend/cdb/cdbdistributedxid.c
src/backend/cdb/cdbdistributedxid.c
+1
-2
src/backend/cdb/cdbdoublylinked.c
src/backend/cdb/cdbdoublylinked.c
+44
-44
src/backend/cdb/cdbfilerepresyncmanager.c
src/backend/cdb/cdbfilerepresyncmanager.c
+763
-690
src/backend/cdb/cdbfilerepresyncworker.c
src/backend/cdb/cdbfilerepresyncworker.c
+340
-318
src/backend/cdb/cdbfilerepservice.c
src/backend/cdb/cdbfilerepservice.c
+371
-349
src/backend/cdb/cdbfts.c
src/backend/cdb/cdbfts.c
+34
-27
src/backend/cdb/cdbglobalsequence.c
src/backend/cdb/cdbglobalsequence.c
+53
-48
src/backend/cdb/cdbgroup.c
src/backend/cdb/cdbgroup.c
+2404
-2199
src/backend/cdb/cdbpartition.c
src/backend/cdb/cdbpartition.c
+2392
-2193
src/backend/cdb/cdbpath.c
src/backend/cdb/cdbpath.c
+1035
-1008
src/backend/cdb/cdbpathlocus.c
src/backend/cdb/cdbpathlocus.c
+446
-413
src/backend/cdb/cdbpathtoplan.c
src/backend/cdb/cdbpathtoplan.c
+150
-149
src/backend/cdb/cdbpersistentbuild.c
src/backend/cdb/cdbpersistentbuild.c
+377
-368
src/backend/cdb/cdbpersistentcheck.c
src/backend/cdb/cdbpersistentcheck.c
+391
-352
src/backend/cdb/cdbresynchronizechangetracking.c
src/backend/cdb/cdbresynchronizechangetracking.c
+1583
-1465
src/backend/cdb/cdbsetop.c
src/backend/cdb/cdbsetop.c
+232
-214
src/backend/cdb/cdbshareddoublylinked.c
src/backend/cdb/cdbshareddoublylinked.c
+89
-90
src/backend/cdb/cdbsharedoidsearch.c
src/backend/cdb/cdbsharedoidsearch.c
+203
-184
src/backend/cdb/cdbsreh.c
src/backend/cdb/cdbsreh.c
+110
-104
src/backend/cdb/cdbsrlz.c
src/backend/cdb/cdbsrlz.c
+35
-33
src/backend/cdb/partitionselection.c
src/backend/cdb/partitionselection.c
+130
-87
未找到文件。
src/backend/cdb/cdbdatabaseinfo.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbdirectopen.c
浏览文件 @
b0a30de6
...
...
@@ -21,7 +21,7 @@
#include "storage/smgr.h"
#include "utils/memutils.h"
#include "catalog/pg_authid.h"
#include "utils/fmgroids.h"
/* include this before pg_am.h, for Am_btree */
#include "utils/fmgroids.h"
/* include this before pg_am.h, for Am_btree */
#include "catalog/pg_am.h"
#include "catalog/pg_class.h"
#include "catalog/pg_index.h"
...
...
@@ -34,133 +34,133 @@
/*
* pg_class.
*/
static
FormData_pg_class
DatabaseInfo_PgClassPgClass
=
{
Class_pg_class
};
static
FormData_pg_class
DatabaseInfo_PgClassPgClass
=
{
Class_pg_class
};
static
FormData_pg_attribute
static
FormData_pg_attribute
DatabaseInfo_PgClassAttrArray
[
Natts_pg_class
]
=
{
Schema_pg_class
};
{
Schema_pg_class
};
DirectOpenDefineStatic
(
DirectOpen_PgClass
,
\
DatabaseInfo_PgClassPgClass
,
\
DatabaseInfo_PgClassAttrArray
,
\
true
);
DirectOpenDefineStatic
(
DirectOpen_PgClass
,
\
DatabaseInfo_PgClassPgClass
,
\
DatabaseInfo_PgClassAttrArray
,
\
true
);
/*
* gp_relation_node.
*/
static
FormData_pg_class
DatabaseInfo_GpRelationNodePgClass
=
{
Class_gp_relation_node
};
static
FormData_pg_attribute
static
FormData_pg_class
DatabaseInfo_GpRelationNodePgClass
=
{
Class_gp_relation_node
};
static
FormData_pg_attribute
DatabaseInfo_GpRelationNodeAttrArray
[
Natts_gp_relation_node
]
=
{
Schema_gp_relation_node
};
{
Schema_gp_relation_node
};
DirectOpenDefineStatic
(
DirectOpen_GpRelationNode
,
\
DatabaseInfo_GpRelationNodePgClass
,
\
DatabaseInfo_GpRelationNodeAttrArray
,
\
false
);
DirectOpenDefineStatic
(
DirectOpen_GpRelationNode
,
\
DatabaseInfo_GpRelationNodePgClass
,
\
DatabaseInfo_GpRelationNodeAttrArray
,
\
false
);
/*
* pg_appendonly.
*/
static
FormData_pg_class
DatabaseInfo_PgAppendOnlyPgClass
=
{
Class_pg_appendonly
};
static
FormData_pg_class
DatabaseInfo_PgAppendOnlyPgClass
=
{
Class_pg_appendonly
};
static
FormData_pg_attribute
static
FormData_pg_attribute
DatabaseInfo_PgAppendOnlyAttrArray
[
Natts_pg_appendonly
]
=
{
Schema_pg_appendonly
};
{
Schema_pg_appendonly
};
DirectOpenDefineStatic
(
DirectOpen_PgAppendOnly
,
\
DatabaseInfo_PgAppendOnlyPgClass
,
\
DatabaseInfo_PgAppendOnlyAttrArray
,
\
false
);
DirectOpenDefineStatic
(
DirectOpen_PgAppendOnly
,
\
DatabaseInfo_PgAppendOnlyPgClass
,
\
DatabaseInfo_PgAppendOnlyAttrArray
,
\
false
);
/*
* pg_aogseg.
*/
static
FormData_pg_class
DatabaseInfo_PgAoSegPgClass
=
{
Class_pg_aoseg
};
static
FormData_pg_class
DatabaseInfo_PgAoSegPgClass
=
{
Class_pg_aoseg
};
static
FormData_pg_attribute
static
FormData_pg_attribute
DatabaseInfo_PgAoSegAttrArray
[
Natts_pg_aoseg
]
=
{
Schema_pg_aoseg
};
{
Schema_pg_aoseg
};
DirectOpenDefineStatic
(
DirectOpen_PgAoSeg
,
\
DatabaseInfo_PgAoSegPgClass
,
\
DatabaseInfo_PgAoSegAttrArray
,
\
false
);
DirectOpenDefineStatic
(
DirectOpen_PgAoSeg
,
\
DatabaseInfo_PgAoSegPgClass
,
\
DatabaseInfo_PgAoSegAttrArray
,
\
false
);
/*
* pg_aocsseg.
*/
static
FormData_pg_class
DatabaseInfo_PgAoCsSegPgClass
=
{
Class_pg_aocsseg
};
static
FormData_pg_class
DatabaseInfo_PgAoCsSegPgClass
=
{
Class_pg_aocsseg
};
static
FormData_pg_attribute
static
FormData_pg_attribute
DatabaseInfo_PgAoCsSegAttrArray
[
Natts_pg_aocsseg
]
=
{
Schema_pg_aocsseg
};
{
Schema_pg_aocsseg
};
DirectOpenDefineStatic
(
DirectOpen_PgAoCsSeg
,
\
DatabaseInfo_PgAoCsSegPgClass
,
\
DatabaseInfo_PgAoCsSegAttrArray
,
\
false
);
DirectOpenDefineStatic
(
DirectOpen_PgAoCsSeg
,
\
DatabaseInfo_PgAoCsSegPgClass
,
\
DatabaseInfo_PgAoCsSegAttrArray
,
\
false
);
/*
* gp_global_sequence.
*/
static
FormData_pg_class
GlobalSequence_PgClass
=
{
Class_gp_global_sequence
};
static
FormData_pg_class
GlobalSequence_PgClass
=
{
Class_gp_global_sequence
};
static
FormData_pg_attribute
static
FormData_pg_attribute
GlobalSequence_AttrArray
[
Natts_gp_global_sequence
]
=
{
Schema_gp_global_sequence
};
{
Schema_gp_global_sequence
};
DirectOpenDefineStatic
(
DirectOpen_GpGlobalSequence
,
\
GlobalSequence_PgClass
,
\
GlobalSequence_AttrArray
,
\
false
);
DirectOpenDefineStatic
(
DirectOpen_GpGlobalSequence
,
\
GlobalSequence_PgClass
,
\
GlobalSequence_AttrArray
,
\
false
);
/*
* gp_persistent_relation_node.
*/
static
FormData_pg_class
PersistentFileSysObj_RelationPgClass
=
{
Class_gp_persistent_relation_node
};
static
FormData_pg_class
PersistentFileSysObj_RelationPgClass
=
{
Class_gp_persistent_relation_node
};
static
FormData_pg_attribute
static
FormData_pg_attribute
PersistentFileSysObj_RelationAttrArray
[
Natts_gp_persistent_relation_node
]
=
{
Schema_gp_persistent_relation_node
};
{
Schema_gp_persistent_relation_node
};
DirectOpenDefineStatic
(
DirectOpen_GpPersistentRelationNode
,
\
PersistentFileSysObj_RelationPgClass
,
\
PersistentFileSysObj_RelationAttrArray
,
\
false
);
DirectOpenDefineStatic
(
DirectOpen_GpPersistentRelationNode
,
\
PersistentFileSysObj_RelationPgClass
,
\
PersistentFileSysObj_RelationAttrArray
,
\
false
);
/*
* gp_persistent_database_node.
*/
static
FormData_pg_class
PersistentFileSysObj_DatabasePgClass
=
{
Class_gp_persistent_database_node
};
static
FormData_pg_class
PersistentFileSysObj_DatabasePgClass
=
{
Class_gp_persistent_database_node
};
static
FormData_pg_attribute
static
FormData_pg_attribute
PersistentFileSysObj_DatabaseAttrArray
[
Natts_gp_persistent_database_node
]
=
{
Schema_gp_persistent_database_node
};
{
Schema_gp_persistent_database_node
};
DirectOpenDefineStatic
(
DirectOpen_GpPersistentDatabaseNode
,
\
PersistentFileSysObj_DatabasePgClass
,
\
PersistentFileSysObj_DatabaseAttrArray
,
\
false
);
DirectOpenDefineStatic
(
DirectOpen_GpPersistentDatabaseNode
,
\
PersistentFileSysObj_DatabasePgClass
,
\
PersistentFileSysObj_DatabaseAttrArray
,
\
false
);
/*
* This HUGE MAGIC DEFINE expands into module globals and two routines:
...
...
@@ -168,18 +168,18 @@ false);
* PersistentFileSysObj_TablespaceClose
* It allows for opening the relation without going through pg_class, etc.
*/
static
FormData_pg_class
PersistentFileSysObj_TablespacePgClass
=
{
Class_gp_persistent_tablespace_node
};
static
FormData_pg_class
PersistentFileSysObj_TablespacePgClass
=
{
Class_gp_persistent_tablespace_node
};
static
FormData_pg_attribute
static
FormData_pg_attribute
PersistentFileSysObj_TablespaceAttrArray
[
Natts_gp_persistent_tablespace_node
]
=
{
Schema_gp_persistent_tablespace_node
};
{
Schema_gp_persistent_tablespace_node
};
DirectOpenDefineStatic
(
DirectOpen_GpPersistentTableSpaceNode
,
\
PersistentFileSysObj_TablespacePgClass
,
\
PersistentFileSysObj_TablespaceAttrArray
,
\
false
);
DirectOpenDefineStatic
(
DirectOpen_GpPersistentTableSpaceNode
,
\
PersistentFileSysObj_TablespacePgClass
,
\
PersistentFileSysObj_TablespaceAttrArray
,
\
false
);
/*
...
...
@@ -188,93 +188,95 @@ false);
* PersistentFileSysObj_FilespaceClose
* It allows for opening the relation without going through pg_class, etc.
*/
static
FormData_pg_class
PersistentFileSysObj_FilespacePgClass
=
{
Class_gp_persistent_filespace_node
};
static
FormData_pg_class
PersistentFileSysObj_FilespacePgClass
=
{
Class_gp_persistent_filespace_node
};
static
FormData_pg_attribute
static
FormData_pg_attribute
PersistentFileSysObj_FilespaceAttrArray
[
Natts_gp_persistent_filespace_node
]
=
{
Schema_gp_persistent_filespace_node
};
{
Schema_gp_persistent_filespace_node
};
DirectOpenDefineStatic
(
DirectOpen_GpPersistentFileSpaceNode
,
\
PersistentFileSysObj_FilespacePgClass
,
\
PersistentFileSysObj_FilespaceAttrArray
,
\
false
);
DirectOpenDefineStatic
(
DirectOpen_GpPersistentFileSpaceNode
,
\
PersistentFileSysObj_FilespacePgClass
,
\
PersistentFileSysObj_FilespaceAttrArray
,
\
false
);
/
/ INDEX Variants
/
* INDEX Variants */
/*
* gp_relation_node_index.
*/
static
FormData_pg_class
DatabaseInfo_GpRelationNodeIndexPgClass
=
{
Class_gp_relation_node_index
};
static
FormData_pg_attribute
static
FormData_pg_class
DatabaseInfo_GpRelationNodeIndexPgClass
=
{
Class_gp_relation_node_index
};
static
FormData_pg_attribute
DatabaseInfo_GpRelationNodeIndexAttrArray
[
Natts_gp_relation_node_index
]
=
{
Schema_gp_relation_node_index
};
{
Schema_gp_relation_node_index
};
static
FormData_pg_am
static
FormData_pg_am
DatabaseInfo_GpRelationNodeIndexPgAm
=
{
Am_gp_relation_node_index
};
{
Am_gp_relation_node_index
};
static
FormData_pg_index
static
FormData_pg_index
DatabaseInfo_GpRelationNodeIndexPgIndex
=
{
Index_gp_relation_node_index
};
{
Index_gp_relation_node_index
};
static
int2
DatabaseInfo_GpRelationNodeIndexIndKeyArray
[
Natts_gp_relation_node_index
]
=
{
IndKey_gp_relation_node_index
};
{
IndKey_gp_relation_node_index
};
static
Oid
DatabaseInfo_GpRelationNodeIndexIndClassArray
[
Natts_gp_relation_node_index
]
=
{
IndClass_gp_relation_node_index
};
static
Oid
DatabaseInfo_GpRelationNodeIndexIndClassArray
[
Natts_gp_relation_node_index
]
=
{
IndClass_gp_relation_node_index
};
DirectOpenIndexDefineStatic
(
DirectOpen_GpRelationNodeIndex
,
\
DatabaseInfo_GpRelationNodeIndexPgClass
,
\
DatabaseInfo_GpRelationNodeIndexAttrArray
,
\
DatabaseInfo_GpRelationNodeIndexPgAm
,
\
DatabaseInfo_GpRelationNodeIndexPgIndex
,
\
DatabaseInfo_GpRelationNodeIndexIndKeyArray
,
\
DatabaseInfo_GpRelationNodeIndexIndClassArray
,
\
false
);
DirectOpenIndexDefineStatic
(
DirectOpen_GpRelationNodeIndex
,
\
DatabaseInfo_GpRelationNodeIndexPgClass
,
\
DatabaseInfo_GpRelationNodeIndexAttrArray
,
\
DatabaseInfo_GpRelationNodeIndexPgAm
,
\
DatabaseInfo_GpRelationNodeIndexPgIndex
,
\
DatabaseInfo_GpRelationNodeIndexIndKeyArray
,
\
DatabaseInfo_GpRelationNodeIndexIndClassArray
,
\
false
);
Relation
DirectOpen_Open
(
DirectOpen
*
direct
,
Relation
DirectOpen_Open
(
DirectOpen
*
direct
,
Oid
relationId
,
Oid
relationId
,
Oid
tablespace
,
Oid
tablespace
,
Oid
database
,
Oid
database
,
Oid
relfilenode
,
Oid
relfilenode
,
FormData_pg_class
*
pgClass
,
FormData_pg_class
*
pgClass
,
FormData_pg_attribute
*
attrArray
,
FormData_pg_attribute
*
attrArray
,
FormData_pg_am
*
pgAm
,
FormData_pg_am
*
pgAm
,
FormData_pg_index
*
pgIndex
,
FormData_pg_index
*
pgIndex
,
int2
*
indKeyArray
,
int2
*
indKeyArray
,
Oid
*
indClassArray
,
Oid
*
indClassArray
,
bool
relHasOid
)
bool
relHasOid
)
{
int
natts
;
int
i
;
int
natts
;
int
i
;
Assert
(
pgClass
!=
NULL
);
natts
=
pgClass
->
relnatts
;
if
(
relationId
==
-
1
)
relationId
=
pgClass
->
relfilenode
;
// Assume it is ok to use the relfilenode as the relationId in our limited usage.
relationId
=
pgClass
->
relfilenode
;
/* Assume it is ok to use the relfilenode as the relationId in our limited usage. */
if
(
relfilenode
==
-
1
)
if
(
relfilenode
==
-
1
)
relfilenode
=
pgClass
->
relfilenode
;
if
(
!
direct
->
isInit
)
...
...
@@ -293,15 +295,15 @@ Relation DirectOpen_Open(
if
(
pgIndex
!=
NULL
)
{
int
pgIndexFixedLen
=
offsetof
(
FormData_pg_index
,
indkey
);
int
indKeyVectorLen
=
Int2VectorSize
(
natts
);
int
pgIndexFixedLen
=
offsetof
(
FormData_pg_index
,
indkey
);
int
indKeyVectorLen
=
Int2VectorSize
(
natts
);
int2vector
*
indKeyVector
;
oidvector
*
indClassVector
;
uint16
amstrategies
;
uint16
amsupport
;
Oid
*
operator
;
Oid
*
operator
;
RegProcedure
*
support
;
FmgrInfo
*
supportinfo
;
...
...
@@ -310,21 +312,21 @@ Relation DirectOpen_Open(
Assert
(
indClassArray
!=
NULL
);
/*
* Allocate Formdata_pg_index with fields through indkey
*
where
indkey is a variable length int2vector with indKeyArray values.
* Allocate Formdata_pg_index with fields through indkey
where
* indkey is a variable length int2vector with indKeyArray values.
*/
direct
->
relationData
.
rd_index
=
(
FormData_pg_index
*
)
palloc
(
pgIndexFixedLen
+
indKeyVectorLen
);
direct
->
relationData
.
rd_index
=
(
FormData_pg_index
*
)
palloc
(
pgIndexFixedLen
+
indKeyVectorLen
);
memcpy
(
direct
->
relationData
.
rd_index
,
pgIndex
,
pgIndexFixedLen
);
indKeyVector
=
buildint2vector
(
indKeyArray
,
natts
);
indKeyArray
,
natts
);
memcpy
(
&
direct
->
relationData
.
rd_index
->
indkey
,
indKeyVector
,
indKeyVectorLen
);
&
direct
->
relationData
.
rd_index
->
indkey
,
indKeyVector
,
indKeyVectorLen
);
pfree
(
indKeyVector
);
...
...
@@ -379,10 +381,11 @@ Relation DirectOpen_Open(
* Create oidvector in rd_indclass with values from indClassArray.
*/
indClassVector
=
buildoidvector
(
indClassArray
,
natts
);
/*
* Fill the operator and support procedure OID arrays. (aminfo and
* supportinfo are left as zeroes, and are filled on-the-fly when used)
* supportinfo are left as zeroes, and are filled on-the-fly when
* used)
*/
IndexSupportInitialize
(
indClassVector
,
operator
,
support
,
...
...
@@ -395,10 +398,10 @@ Relation DirectOpen_Open(
*/
direct
->
relationData
.
rd_indexprs
=
NIL
;
direct
->
relationData
.
rd_indpred
=
NIL
;
direct
->
relationData
.
rd_amcache
=
NULL
;
direct
->
relationData
.
rd_amcache
=
NULL
;
}
/
/ Not much in terms of contraints.
/
* Not much in terms of contraints. */
direct
->
constrData
.
has_not_null
=
true
;
/*
...
...
@@ -406,24 +409,24 @@ Relation DirectOpen_Open(
*/
direct
->
descData
.
natts
=
pgClass
->
relnatts
;
/
/ Make the array of pointers.
direct
->
descData
.
attrs
=
(
Form_pg_attribute
*
)
MemoryContextAllocZero
(
TopMemoryContext
,
sizeof
(
Form_pg_attribute
*
)
*
pgClass
->
relnatts
);
/
* Make the array of pointers. */
direct
->
descData
.
attrs
=
(
Form_pg_attribute
*
)
MemoryContextAllocZero
(
TopMemoryContext
,
sizeof
(
Form_pg_attribute
*
)
*
pgClass
->
relnatts
);
for
(
i
=
0
;
i
<
pgClass
->
relnatts
;
i
++
)
{
direct
->
descData
.
attrs
[
i
]
=
(
Form_pg_attribute
)
MemoryContextAllocZero
(
TopMemoryContext
,
sizeof
(
FormData_pg_attribute
));
direct
->
descData
.
attrs
[
i
]
=
(
Form_pg_attribute
)
MemoryContextAllocZero
(
TopMemoryContext
,
sizeof
(
FormData_pg_attribute
));
memcpy
(
direct
->
descData
.
attrs
[
i
],
&
(
attrArray
[
i
]),
sizeof
(
FormData_pg_attribute
));
/
/ Patch up relation id.
/
* Patch up relation id. */
direct
->
descData
.
attrs
[
i
]
->
attrelid
=
relationId
;
}
...
...
@@ -445,9 +448,12 @@ Relation DirectOpen_Open(
direct
->
isInit
=
true
;
}
// UNDONE: Should verify for NON-SHARED relations we don't open relations in different databases / or
// UNDONE: open different relations in same database at same time !!!
/*
* UNDONE: Should verify for NON-SHARED relations we don't open relations
* in different databases or open different relations in same database at
* same time !!!
*/
direct
->
relationData
.
rd_node
.
spcNode
=
tablespace
;
direct
->
relationData
.
rd_node
.
dbNode
=
database
;
direct
->
relationData
.
rd_node
.
relNode
=
relfilenode
;
...
...
@@ -457,8 +463,8 @@ Relation DirectOpen_Open(
for
(
i
=
0
;
i
<
direct
->
relationData
.
rd_rel
->
relnatts
;
i
++
)
{
Assert
(
direct
->
descData
.
attrs
[
i
]
!=
NULL
);
/
/ Patch up relation id.
/
* Patch up relation id. */
direct
->
descData
.
attrs
[
i
]
->
attrelid
=
direct
->
relationData
.
rd_id
;
}
...
...
@@ -469,12 +475,13 @@ Relation DirectOpen_Open(
return
&
direct
->
relationData
;
}
void
DirectOpen_Close
(
DirectOpen
*
direct
,
Relation
rel
)
void
DirectOpen_Close
(
DirectOpen
*
direct
,
Relation
rel
)
{
Assert
(
rel
==
&
direct
->
relationData
);
Assert
(
direct
->
isInit
);
Assert
(
direct
->
isInit
);
RelationCloseSmgr
(
&
direct
->
relationData
);
...
...
src/backend/cdb/cdbdistributedsnapshot.c
浏览文件 @
b0a30de6
...
...
@@ -51,6 +51,7 @@ bool
localXidSatisfiesAnyDistributedSnapshot
(
TransactionId
localXid
)
{
DistributedSnapshotCommitted
distributedSnapshotCommitted
;
Assert
(
TransactionIdIsNormal
(
localXid
));
/*
...
...
@@ -72,9 +73,9 @@ localXidSatisfiesAnyDistributedSnapshot(TransactionId localXid)
{
distributedSnapshotCommitted
=
DistributedSnapshotWithLocalMapping_CommittedTest
(
&
SerializableSnapshot
->
distribSnapshotWithLocalMapping
,
localXid
,
true
);
&
SerializableSnapshot
->
distribSnapshotWithLocalMapping
,
localXid
,
true
);
switch
(
distributedSnapshotCommitted
)
{
...
...
@@ -108,15 +109,15 @@ localXidSatisfiesAnyDistributedSnapshot(TransactionId localXid)
* The caller should've checked that the XID is committed (in clog),
* otherwise the result of this function is undefined.
*/
DistributedSnapshotCommitted
DistributedSnapshotCommitted
DistributedSnapshotWithLocalMapping_CommittedTest
(
DistributedSnapshotWithLocalMapping
*
dslm
,
TransactionId
localXid
,
bool
isVacuumCheck
)
DistributedSnapshotWithLocalMapping
*
dslm
,
TransactionId
localXid
,
bool
isVacuumCheck
)
{
DistributedSnapshot
*
ds
=
&
dslm
->
ds
;
uint32
i
;
DistributedTransactionId
distribXid
=
InvalidDistributedTransactionId
;
uint32
i
;
DistributedTransactionId
distribXid
=
InvalidDistributedTransactionId
;
/*
* Return early if local xid is not normal as it cannot have distributed
...
...
@@ -163,8 +164,8 @@ DistributedSnapshotWithLocalMapping_CommittedTest(
&
distribXid
))
{
/*
* We cache local-only committed transactions for better
*
performance,
too.
* We cache local-only committed transactions for better
performance,
* too.
*/
if
(
distribXid
==
InvalidDistributedTransactionId
)
return
DISTRIBUTEDSNAPSHOT_COMMITTED_IGNORE
;
...
...
@@ -199,7 +200,8 @@ DistributedSnapshotWithLocalMapping_CommittedTest(
return
DISTRIBUTEDSNAPSHOT_COMMITTED_IGNORE
;
/*
* We have a distributed committed xid that corresponds to the local xid.
* We have a distributed committed xid that corresponds to the
* local xid.
*/
Assert
(
distribXid
!=
InvalidDistributedTransactionId
);
...
...
@@ -207,9 +209,9 @@ DistributedSnapshotWithLocalMapping_CommittedTest(
* Since we did not find it in our process local cache, add it.
*/
LocalDistribXactCache_AddCommitted
(
localXid
,
ds
->
distribTransactionTimeStamp
,
distribXid
);
localXid
,
ds
->
distribTransactionTimeStamp
,
distribXid
);
}
else
{
...
...
@@ -220,19 +222,20 @@ DistributedSnapshotWithLocalMapping_CommittedTest(
*/
LocalDistribXactCache_AddCommitted
(
localXid
,
ds
->
distribTransactionTimeStamp
,
/* distribXid */
InvalidDistributedTransactionId
);
/* distribXid */
InvalidDistributedTransactionId
);
return
DISTRIBUTEDSNAPSHOT_COMMITTED_IGNORE
;
}
}
Assert
(
ds
->
xminAllDistributedSnapshots
!=
InvalidDistributedTransactionId
);
/*
* If this distributed transaction is older than all the distributed
* snapshots, then we can ignore it from now on.
*/
Assert
(
ds
->
xmin
>=
ds
->
xminAllDistributedSnapshots
);
if
(
distribXid
<
ds
->
xminAllDistributedSnapshots
)
return
DISTRIBUTEDSNAPSHOT_COMMITTED_IGNORE
;
...
...
@@ -247,8 +250,10 @@ DistributedSnapshotWithLocalMapping_CommittedTest(
if
(
distribXid
<
ds
->
xmin
)
return
DISTRIBUTEDSNAPSHOT_COMMITTED_VISIBLE
;
/* Any xid >= xmax is in-progress, distributed xmax points to the
* committer, so it must be visible, so ">" instead of ">=" */
/*
* Any xid >= xmax is in-progress, distributed xmax points to the
* committer, so it must be visible, so ">" instead of ">="
*/
if
(
distribXid
>
ds
->
xmax
)
{
elog
((
Debug_print_snapshot_dtm
?
LOG
:
DEBUG5
),
...
...
@@ -291,10 +296,10 @@ DistributedSnapshotWithLocalMapping_CommittedTest(
}
/*
* Leverage the fact that ds->inProgressXidArray is sorted in
ascending
* order based on distribXid while creating the snapshot in
* createDtxSnapshot. So, can fail fast once known are lower than
*
rest
of them.
* Leverage the fact that ds->inProgressXidArray is sorted in
*
ascending
order based on distribXid while creating the snapshot in
* createDtxSnapshot. So, can fail fast once known are lower than
rest
* of them.
*/
if
(
distribXid
<
ds
->
inProgressXidArray
[
i
])
break
;
...
...
@@ -319,7 +324,7 @@ DistributedSnapshot_Reset(DistributedSnapshot *distributedSnapshot)
distributedSnapshot
->
xmin
=
InvalidDistributedTransactionId
;
distributedSnapshot
->
xmax
=
InvalidDistributedTransactionId
;
distributedSnapshot
->
count
=
0
;
/* maxCount and inProgressXidArray left untouched */
}
...
...
@@ -329,45 +334,45 @@ DistributedSnapshot_Reset(DistributedSnapshot *distributedSnapshot)
*/
void
DistributedSnapshot_Copy
(
DistributedSnapshot
*
target
,
DistributedSnapshot
*
source
)
DistributedSnapshot
*
target
,
DistributedSnapshot
*
source
)
{
if
(
source
->
maxCount
<=
0
||
source
->
count
>
source
->
maxCount
)
elog
(
ERROR
,
"Invalid distributed snapshot (maxCount %d, count %d)"
,
source
->
maxCount
,
source
->
count
);
source
->
count
>
source
->
maxCount
)
elog
(
ERROR
,
"Invalid distributed snapshot (maxCount %d, count %d)"
,
source
->
maxCount
,
source
->
count
);
DistributedSnapshot_Reset
(
target
);
elog
((
Debug_print_full_dtm
?
LOG
:
DEBUG5
),
"DistributedSnapshot_Copy target maxCount %d, inProgressXidArray %p, and "
"source maxCount %d, count %d, inProgressXidArray %p"
,
"source maxCount %d, count %d, inProgressXidArray %p"
,
target
->
maxCount
,
target
->
inProgressXidArray
,
target
->
inProgressXidArray
,
source
->
maxCount
,
source
->
count
,
source
->
inProgressXidArray
);
/*
* If we have allocated space for the in-progress distributed
* transactions, check against that space. Otherwise,
*
use the source
maxCount as guide in allocating space.
* transactions, check against that space. Otherwise,
use the source
* maxCount as guide in allocating space.
*/
if
(
target
->
maxCount
>
0
)
{
Assert
(
target
->
inProgressXidArray
!=
NULL
);
if
(
source
->
count
>
target
->
maxCount
)
elog
(
ERROR
,
"Too many distributed transactions for snapshot (maxCount %d, count %d)"
,
target
->
maxCount
,
source
->
count
);
if
(
source
->
count
>
target
->
maxCount
)
elog
(
ERROR
,
"Too many distributed transactions for snapshot (maxCount %d, count %d)"
,
target
->
maxCount
,
source
->
count
);
}
else
{
Assert
(
target
->
inProgressXidArray
==
NULL
);
target
->
inProgressXidArray
=
(
DistributedTransactionId
*
)
malloc
(
source
->
maxCount
*
sizeof
(
DistributedTransactionId
));
target
->
inProgressXidArray
=
(
DistributedTransactionId
*
)
malloc
(
source
->
maxCount
*
sizeof
(
DistributedTransactionId
));
if
(
target
->
inProgressXidArray
==
NULL
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_OUT_OF_MEMORY
),
...
...
@@ -384,9 +389,9 @@ DistributedSnapshot_Copy(
target
->
count
=
source
->
count
;
memcpy
(
target
->
inProgressXidArray
,
source
->
inProgressXidArray
,
source
->
count
*
sizeof
(
DistributedTransactionId
));
target
->
inProgressXidArray
,
source
->
inProgressXidArray
,
source
->
count
*
sizeof
(
DistributedTransactionId
));
}
int
...
...
@@ -394,18 +399,18 @@ DistributedSnapshot_SerializeSize(DistributedSnapshot *ds)
{
return
sizeof
(
DistributedTransactionTimeStamp
)
+
sizeof
(
DistributedSnapshotId
)
+
/*
xminAllDistributedSnapshots, xmin, xmax */
/*
xminAllDistributedSnapshots, xmin, xmax */
3
*
sizeof
(
DistributedTransactionId
)
+
/* count, maxCount */
/* count, maxCount */
2
*
sizeof
(
int32
)
+
/* Size of inProgressXidArray */
/* Size of inProgressXidArray */
sizeof
(
DistributedTransactionId
)
*
ds
->
count
;
}
int
DistributedSnapshot_Serialize
(
DistributedSnapshot
*
ds
,
char
*
buf
)
{
char
*
p
=
buf
;
char
*
p
=
buf
;
memcpy
(
p
,
&
ds
->
distribTransactionTimeStamp
,
sizeof
(
DistributedTransactionTimeStamp
));
p
+=
sizeof
(
DistributedTransactionTimeStamp
);
...
...
@@ -422,8 +427,8 @@ DistributedSnapshot_Serialize(DistributedSnapshot *ds, char *buf)
memcpy
(
p
,
&
ds
->
maxCount
,
sizeof
(
int32
));
p
+=
sizeof
(
int32
);
memcpy
(
p
,
ds
->
inProgressXidArray
,
sizeof
(
DistributedTransactionId
)
*
ds
->
count
);
p
+=
sizeof
(
DistributedTransactionId
)
*
ds
->
count
;
memcpy
(
p
,
ds
->
inProgressXidArray
,
sizeof
(
DistributedTransactionId
)
*
ds
->
count
);
p
+=
sizeof
(
DistributedTransactionId
)
*
ds
->
count
;
Assert
((
p
-
buf
)
==
DistributedSnapshot_SerializeSize
(
ds
));
...
...
@@ -434,7 +439,7 @@ int
DistributedSnapshot_Deserialize
(
const
char
*
buf
,
DistributedSnapshot
*
ds
)
{
const
char
*
p
=
buf
;
int32
maxCount
;
int32
maxCount
;
memcpy
(
&
ds
->
distribTransactionTimeStamp
,
p
,
sizeof
(
DistributedTransactionTimeStamp
));
p
+=
sizeof
(
DistributedTransactionTimeStamp
);
...
...
@@ -462,8 +467,8 @@ DistributedSnapshot_Deserialize(const char *buf, DistributedSnapshot *ds)
/*
* If we have allocated space for the in-progress distributed
* transactions, check against that space. Otherwise,
*
use the received
maxCount as guide in allocating space.
* transactions, check against that space. Otherwise,
use the received
* maxCount as guide in allocating space.
*/
if
(
ds
->
inProgressXidArray
!=
NULL
)
{
...
...
@@ -491,7 +496,7 @@ DistributedSnapshot_Deserialize(const char *buf, DistributedSnapshot *ds)
ds
->
maxCount
=
maxCount
;
}
ds
->
inProgressXidArray
=
(
DistributedTransactionId
*
)
malloc
(
maxCount
*
sizeof
(
DistributedTransactionId
));
ds
->
inProgressXidArray
=
(
DistributedTransactionId
*
)
malloc
(
maxCount
*
sizeof
(
DistributedTransactionId
));
if
(
ds
->
inProgressXidArray
==
NULL
)
{
ereport
(
ERROR
,
...
...
@@ -503,7 +508,8 @@ DistributedSnapshot_Deserialize(const char *buf, DistributedSnapshot *ds)
if
(
ds
->
count
>
0
)
{
int
xipsize
;
int
xipsize
;
Assert
(
ds
->
inProgressXidArray
!=
NULL
);
xipsize
=
sizeof
(
DistributedTransactionId
)
*
ds
->
count
;
...
...
src/backend/cdb/cdbdistributedxacts.c
浏览文件 @
b0a30de6
...
...
@@ -37,8 +37,7 @@ gp_distributed_xacts__(PG_FUNCTION_ARGS)
funcctx
=
SRF_FIRSTCALL_INIT
();
/*
* switch to memory context appropriate for multiple function
* calls
* switch to memory context appropriate for multiple function calls
*/
oldcontext
=
MemoryContextSwitchTo
(
funcctx
->
multi_call_memory_ctx
);
...
...
@@ -59,8 +58,8 @@ gp_distributed_xacts__(PG_FUNCTION_ARGS)
funcctx
->
tuple_desc
=
BlessTupleDesc
(
tupdesc
);
/*
* Collect all the locking information that we will format and
*
send
out as a result set.
* Collect all the locking information that we will format and
send
* out as a result set.
*/
getAllDistributedXactStatus
(
&
allDistributedXactStatus
);
funcctx
->
user_fctx
=
(
void
*
)
allDistributedXactStatus
;
...
...
@@ -74,14 +73,14 @@ gp_distributed_xacts__(PG_FUNCTION_ARGS)
while
(
true
)
{
TMGXACTSTATUS
*
distributedXactStatus
;
Datum
values
[
6
];
bool
nulls
[
6
];
HeapTuple
tuple
;
Datum
result
;
if
(
!
getNextDistributedXactStatus
(
allDistributedXactStatus
,
&
distributedXactStatus
))
&
distributedXactStatus
))
break
;
/*
...
...
@@ -104,4 +103,3 @@ gp_distributed_xacts__(PG_FUNCTION_ARGS)
SRF_RETURN_DONE
(
funcctx
);
}
src/backend/cdb/cdbdistributedxid.c
浏览文件 @
b0a30de6
...
...
@@ -20,11 +20,10 @@ Datum gp_distributed_xid(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1
(
gp_distributed_xid
);
Datum
gp_distributed_xid
(
PG_FUNCTION_ARGS
__attribute__
((
unused
))
)
gp_distributed_xid
(
PG_FUNCTION_ARGS
__attribute__
((
unused
)))
{
DistributedTransactionId
xid
=
getDistributedTransactionId
();
PG_RETURN_XID
(
xid
);
}
src/backend/cdb/cdbdoublylinked.c
浏览文件 @
b0a30de6
...
...
@@ -11,26 +11,26 @@
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "cdb/cdbdoublylinked.h"
void
DoublyLinkedHead_Init
(
DoublyLinkedHead
*
head
)
DoublyLinkedHead
*
head
)
{
head
->
first
=
NULL
;
head
->
last
=
NULL
;
head
->
count
=
0
;
}
void
*
void
*
DoublyLinkedHead_First
(
int
offsetToDoubleLinks
,
DoublyLinkedHead
*
head
)
int
offsetToDoubleLinks
,
DoublyLinkedHead
*
head
)
{
DoubleLinks
*
doubleLinks
;
DoubleLinks
*
doubleLinks
;
if
(
head
->
first
==
NULL
)
{
Assert
(
head
->
last
==
NULL
);
...
...
@@ -43,16 +43,16 @@ DoublyLinkedHead_First(
doubleLinks
=
head
->
first
;
Assert
(
doubleLinks
->
prev
==
NULL
);
return
((
uint8
*
)
doubleLinks
)
-
offsetToDoubleLinks
;
return
((
uint8
*
)
doubleLinks
)
-
offsetToDoubleLinks
;
}
void
*
void
*
DoublyLinkedHead_Last
(
int
offsetToDoubleLinks
,
DoublyLinkedHead
*
head
)
int
offsetToDoubleLinks
,
DoublyLinkedHead
*
head
)
{
DoubleLinks
*
doubleLinks
;
DoubleLinks
*
doubleLinks
;
if
(
head
->
last
==
NULL
)
{
Assert
(
head
->
first
==
NULL
);
...
...
@@ -65,18 +65,18 @@ DoublyLinkedHead_Last(
doubleLinks
=
head
->
last
;
Assert
(
doubleLinks
->
next
==
NULL
);
return
((
uint8
*
)
doubleLinks
)
-
offsetToDoubleLinks
;
return
((
uint8
*
)
doubleLinks
)
-
offsetToDoubleLinks
;
}
void
*
void
*
DoublyLinkedHead_Next
(
int
offsetToDoubleLinks
,
DoublyLinkedHead
*
head
,
void
*
ele
)
int
offsetToDoubleLinks
,
DoublyLinkedHead
*
head
,
void
*
ele
)
{
DoubleLinks
*
doubleLinks
;
DoubleLinks
*
doubleLinks
;
doubleLinks
=
(
DoubleLinks
*
)(((
uint8
*
)
ele
)
+
offsetToDoubleLinks
);
doubleLinks
=
(
DoubleLinks
*
)
(((
uint8
*
)
ele
)
+
offsetToDoubleLinks
);
if
(
head
->
last
==
doubleLinks
)
{
...
...
@@ -97,19 +97,19 @@ DoublyLinkedHead_Next(
doubleLinks
=
doubleLinks
->
next
;
Assert
(
doubleLinks
!=
NULL
);
return
((
uint8
*
)
doubleLinks
)
-
offsetToDoubleLinks
;
return
((
uint8
*
)
doubleLinks
)
-
offsetToDoubleLinks
;
}
void
DoublyLinkedHead_AddFirst
(
int
offsetToDoubleLinks
,
DoublyLinkedHead
*
head
,
void
*
ele
)
int
offsetToDoubleLinks
,
DoublyLinkedHead
*
head
,
void
*
ele
)
{
DoubleLinks
*
doubleLinks
;
DoubleLinks
*
doubleLinks
;
doubleLinks
=
(
DoubleLinks
*
)(((
uint8
*
)
ele
)
+
offsetToDoubleLinks
);
doubleLinks
=
(
DoubleLinks
*
)
(((
uint8
*
)
ele
)
+
offsetToDoubleLinks
);
Assert
(
doubleLinks
->
prev
==
NULL
);
Assert
(
doubleLinks
->
next
==
NULL
);
...
...
@@ -131,16 +131,16 @@ DoublyLinkedHead_AddFirst(
}
head
->
count
++
;
}
void
*
void
*
DoublyLinkedHead_RemoveLast
(
int
offsetToDoubleLinks
,
DoublyLinkedHead
*
head
)
int
offsetToDoubleLinks
,
DoublyLinkedHead
*
head
)
{
DoubleLinks
*
doubleLinks
;
DoubleLinks
*
doubleLinks
;
if
(
head
->
last
==
NULL
)
{
Assert
(
head
->
first
==
NULL
);
...
...
@@ -166,12 +166,12 @@ DoublyLinkedHead_RemoveLast(
head
->
count
--
;
Assert
(
head
->
count
>=
0
);
return
((
uint8
*
)
doubleLinks
)
-
offsetToDoubleLinks
;
return
((
uint8
*
)
doubleLinks
)
-
offsetToDoubleLinks
;
}
void
DoubleLinks_Init
(
DoubleLinks
*
doubleLinks
)
DoubleLinks
*
doubleLinks
)
{
doubleLinks
->
next
=
NULL
;
doubleLinks
->
prev
=
NULL
;
...
...
@@ -179,13 +179,13 @@ DoubleLinks_Init(
void
DoubleLinks_Remove
(
int
offsetToDoubleLinks
,
DoublyLinkedHead
*
head
,
void
*
ele
)
int
offsetToDoubleLinks
,
DoublyLinkedHead
*
head
,
void
*
ele
)
{
DoubleLinks
*
removeDoubleLinks
;
DoubleLinks
*
removeDoubleLinks
;
removeDoubleLinks
=
(
DoubleLinks
*
)(((
uint8
*
)
ele
)
+
offsetToDoubleLinks
);
removeDoubleLinks
=
(
DoubleLinks
*
)
(((
uint8
*
)
ele
)
+
offsetToDoubleLinks
);
if
(
removeDoubleLinks
->
prev
==
NULL
&&
removeDoubleLinks
->
next
==
NULL
)
...
...
@@ -204,22 +204,22 @@ DoubleLinks_Remove(
* Removing the first element.
*/
Assert
(
head
->
first
==
removeDoubleLinks
);
Assert
(
removeDoubleLinks
->
next
->
prev
==
removeDoubleLinks
);
removeDoubleLinks
->
next
->
prev
=
NULL
;
head
->
first
=
removeDoubleLinks
->
next
;
}
else
if
(
removeDoubleLinks
->
next
==
NULL
)
{
Assert
(
head
->
last
==
removeDoubleLinks
);
/*
* Removing the last element.
*/
Assert
(
removeDoubleLinks
->
prev
->
next
==
removeDoubleLinks
);
removeDoubleLinks
->
prev
->
next
=
NULL
;
head
->
last
=
removeDoubleLinks
->
prev
;
}
else
...
...
src/backend/cdb/cdbfilerepresyncmanager.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbfilerepresyncworker.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbfilerepservice.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbfts.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbglobalsequence.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbgroup.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbpartition.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbpath.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbpathlocus.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbpathtoplan.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbpersistentbuild.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbpersistentcheck.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbresynchronizechangetracking.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbsetop.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbshareddoublylinked.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbsharedoidsearch.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbsreh.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/cdbsrlz.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
src/backend/cdb/partitionselection.c
浏览文件 @
b0a30de6
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录