Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
e319e679
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 搜索 >>
提交
e319e679
编写于
1月 16, 2010
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bogus initialization of KnownAssignedXids shared memory state ---
didn't work in EXEC_BACKEND case.
上级
8bfd1a88
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
44 deletion
+34
-44
src/backend/storage/ipc/procarray.c
src/backend/storage/ipc/procarray.c
+34
-44
未找到文件。
src/backend/storage/ipc/procarray.c
浏览文件 @
e319e679
...
...
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.5
6 2010/01/16 10:05:50 sriggs
Exp $
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.5
7 2010/01/16 17:17:26 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -135,8 +135,6 @@ static void DisplayXidCache(void);
#endif
/* XIDCACHE_DEBUG */
/* Primitives for KnownAssignedXids array handling for standby */
static
Size
KnownAssignedXidsShmemSize
(
int
size
);
static
void
KnownAssignedXidsInit
(
int
size
);
static
int
KnownAssignedXidsGet
(
TransactionId
*
xarray
,
TransactionId
xmax
);
static
int
KnownAssignedXidsGetAndSetXmin
(
TransactionId
*
xarray
,
TransactionId
*
xmin
,
TransactionId
xmax
);
...
...
@@ -161,16 +159,19 @@ ProcArrayShmemSize(void)
size
=
add_size
(
size
,
mul_size
(
sizeof
(
PGPROC
*
),
PROCARRAY_MAXPROCS
));
/*
* During recovery processing we have a data structure called KnownAssignedXids,
* created in shared memory. Local data structures are also created in various
* backends during GetSnapshotData(), TransactionIdIsInProgress() and
* GetRunningTransactionData(). All of the main structures created in those
* functions must be identically sized, since we may at times copy the whole
* of the data structures around. We refer to this as TOTAL_MAX_CACHED_SUBXIDS.
* During recovery processing we have a data structure called
* KnownAssignedXids, created in shared memory. Local data structures are
* also created in various backends during GetSnapshotData(),
* TransactionIdIsInProgress() and GetRunningTransactionData(). All of the
* main structures created in those functions must be identically sized,
* since we may at times copy the whole of the data structures around. We
* refer to this size as TOTAL_MAX_CACHED_SUBXIDS.
*/
#define TOTAL_MAX_CACHED_SUBXIDS ((PGPROC_MAX_CACHED_SUBXIDS + 1) * PROCARRAY_MAXPROCS)
if
(
XLogRequestRecoveryConnections
)
size
=
add_size
(
size
,
KnownAssignedXidsShmemSize
(
TOTAL_MAX_CACHED_SUBXIDS
));
size
=
add_size
(
size
,
hash_estimate_size
(
TOTAL_MAX_CACHED_SUBXIDS
,
sizeof
(
TransactionId
)));
return
size
;
}
...
...
@@ -186,8 +187,8 @@ CreateSharedProcArray(void)
/* Create or attach to the ProcArray shared structure */
procArray
=
(
ProcArrayStruct
*
)
ShmemInitStruct
(
"Proc Array"
,
mul_size
(
sizeof
(
PGPROC
*
),
PROCARRAY_MAXPROCS
),
&
found
);
mul_size
(
sizeof
(
PGPROC
*
),
PROCARRAY_MAXPROCS
),
&
found
);
if
(
!
found
)
{
...
...
@@ -197,9 +198,28 @@ CreateSharedProcArray(void)
/* Normal processing */
procArray
->
numProcs
=
0
;
procArray
->
maxProcs
=
PROCARRAY_MAXPROCS
;
procArray
->
numKnownAssignedXids
=
0
;
procArray
->
maxKnownAssignedXids
=
TOTAL_MAX_CACHED_SUBXIDS
;
procArray
->
lastOverflowedXid
=
InvalidTransactionId
;
}
if
(
XLogRequestRecoveryConnections
)
KnownAssignedXidsInit
(
TOTAL_MAX_CACHED_SUBXIDS
);
if
(
XLogRequestRecoveryConnections
)
{
/* Create or attach to the KnownAssignedXids hash table */
HASHCTL
info
;
MemSet
(
&
info
,
0
,
sizeof
(
info
));
info
.
keysize
=
sizeof
(
TransactionId
);
info
.
entrysize
=
sizeof
(
TransactionId
);
info
.
hash
=
tag_hash
;
KnownAssignedXidsHash
=
ShmemInitHash
(
"KnownAssignedXids Hash"
,
TOTAL_MAX_CACHED_SUBXIDS
,
TOTAL_MAX_CACHED_SUBXIDS
,
&
info
,
HASH_ELEM
|
HASH_FUNCTION
);
if
(
!
KnownAssignedXidsHash
)
elog
(
FATAL
,
"could not initialize known assigned xids hash table"
);
}
}
...
...
@@ -2291,36 +2311,6 @@ ExpireOldKnownAssignedTransactionIds(TransactionId xid)
* high availability. So we choose to implement as a hash table.
*/
static
Size
KnownAssignedXidsShmemSize
(
int
size
)
{
return
hash_estimate_size
(
size
,
sizeof
(
TransactionId
));
}
static
void
KnownAssignedXidsInit
(
int
size
)
{
HASHCTL
info
;
/* assume no locking is needed yet */
info
.
keysize
=
sizeof
(
TransactionId
);
info
.
entrysize
=
sizeof
(
TransactionId
);
info
.
hash
=
tag_hash
;
KnownAssignedXidsHash
=
ShmemInitHash
(
"KnownAssignedXids Hash"
,
size
,
size
,
&
info
,
HASH_ELEM
|
HASH_FUNCTION
);
if
(
!
KnownAssignedXidsHash
)
elog
(
FATAL
,
"could not initialize known assigned xids hash table"
);
procArray
->
numKnownAssignedXids
=
0
;
procArray
->
maxKnownAssignedXids
=
TOTAL_MAX_CACHED_SUBXIDS
;
procArray
->
lastOverflowedXid
=
InvalidTransactionId
;
}
/*
* Add xids into KnownAssignedXids.
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录