Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
e80b0212
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 搜索 >>
提交
e80b0212
编写于
9月 02, 2019
作者:
G
Gang Xiong
提交者:
xiong-gang
9月 19, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The XactLogCommitRecord logical is broken when merge 9.5, doing minor refactor
to fix it.
上级
9471a04d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
54 deletion
+27
-54
src/backend/access/transam/twophase.c
src/backend/access/transam/twophase.c
+1
-2
src/backend/access/transam/xact.c
src/backend/access/transam/xact.c
+25
-50
src/include/access/xact.h
src/include/access/xact.h
+1
-2
未找到文件。
src/backend/access/transam/twophase.c
浏览文件 @
e80b0212
...
...
@@ -1997,8 +1997,7 @@ RecordTransactionCommitPrepared(TransactionId xid,
ninvalmsgs
,
invalmsgs
,
ndeldbs
,
deldbs
,
initfileinval
,
false
,
xid
,
NULL
/* commit prepared */
);
xid
);
/*
* We don't currently try to sleep before flush here ... nor is there any
...
...
src/backend/access/transam/xact.c
浏览文件 @
e80b0212
...
...
@@ -1422,7 +1422,6 @@ RecordTransactionCommit(void)
bool
wrote_xlog
;
bool
isDtxPrepared
=
0
;
bool
isOnePhaseQE
=
(
Gp_role
==
GP_ROLE_EXECUTE
&&
MyTmGxactLocal
->
isOnePhaseCommit
);
XLogRecPtr
recptr
=
InvalidXLogRecPtr
;
/* Like in CommitTransaction(), treat a QE reader as if there was no XID */
if
(
DistributedTransactionContext
==
DTX_CONTEXT_QE_ENTRY_DB_SINGLETON
||
...
...
@@ -1527,31 +1526,13 @@ RecordTransactionCommit(void)
SIMPLE_FAULT_INJECTOR
(
"onephase_transaction_commit"
);
if
(
isDtxPrepared
)
{
char
gid
[
TMGIDSIZE
];
dtxFormGID
(
gid
,
MyTmGxact
->
distribTimeStamp
,
MyTmGxact
->
gxid
);
insertingDistributedCommitted
();
XactLogCommitRecord
(
xactStopTimestamp
,
GetPendingTablespaceForDeletionForCommit
(),
nchildren
,
children
,
nrels
,
rels
,
nmsgs
,
invalMessages
,
ndeldbs
,
deldbs
,
RelcacheInitFileInval
,
forceSyncCommit
,
InvalidTransactionId
/* plain commit */
,
gid
/* distributed commit */
);
insertedDistributedCommitted
();
}
else
XactLogCommitRecord
(
xactStopTimestamp
,
GetPendingTablespaceForDeletionForCommit
(),
nchildren
,
children
,
nrels
,
rels
,
nmsgs
,
invalMessages
,
ndeldbs
,
deldbs
,
RelcacheInitFileInval
,
forceSyncCommit
,
InvalidTransactionId
/* plain commit */
,
NULL
);
XactLogCommitRecord
(
xactStopTimestamp
,
GetPendingTablespaceForDeletionForCommit
(),
nchildren
,
children
,
nrels
,
rels
,
nmsgs
,
invalMessages
,
ndeldbs
,
deldbs
,
RelcacheInitFileInval
,
forceSyncCommit
,
InvalidTransactionId
/* plain commit */
);
/*
* Record plain commit ts if not replaying remote actions, or if no
...
...
@@ -1633,14 +1614,9 @@ RecordTransactionCommit(void)
getDistributedTransactionId
(),
/* isRedo */
false
);
else
if
(
isOnePhaseQE
)
{
DistributedTransactionTimeStamp
distribTimeStamp
;
DistributedTransactionId
distribXid
;
dtxCrackOpenGid
(
MyTmGxact
->
gid
,
&
distribTimeStamp
,
&
distribXid
);
DistributedLog_SetCommittedTree
(
xid
,
nchildren
,
children
,
MyTmGxact
->
distribTimeStamp
,
MyTmGxact
->
gxid
,
/* isRedo */
false
);
}
TransactionIdCommitTree
(
xid
,
nchildren
,
children
);
}
...
...
@@ -6423,8 +6399,7 @@ XactLogCommitRecord(TimestampTz commit_time,
int
nmsgs
,
SharedInvalidationMessage
*
msgs
,
int
ndeldbs
,
DbDirNode
*
deldbs
,
bool
relcacheInval
,
bool
forceSync
,
TransactionId
twophase_xid
,
const
char
*
gid
)
TransactionId
twophase_xid
)
{
xl_xact_commit
xlrec
;
xl_xact_xinfo
xl_xinfo
;
...
...
@@ -6436,6 +6411,9 @@ XactLogCommitRecord(TimestampTz commit_time,
xl_xact_origin
xl_origin
;
xl_xact_distrib
xl_distrib
;
xl_xact_deldbs
xl_deldbs
;
XLogRecPtr
recptr
;
bool
isOnePhaseQE
=
(
Gp_role
==
GP_ROLE_EXECUTE
&&
MyTmGxactLocal
->
isOnePhaseCommit
);
bool
isDtxPrepared
=
isPreparedDtxTransaction
();
uint8
info
;
...
...
@@ -6443,11 +6421,8 @@ XactLogCommitRecord(TimestampTz commit_time,
xl_xinfo
.
xinfo
=
0
;
/* cannot log commit prepared and distributed commit record at the same time */
Assert
(
!
(
TransactionIdIsValid
(
twophase_xid
)
&&
gid
!=
NULL
));
/* decide between a plain and 2pc commit */
if
(
gi
d
)
if
(
isDtxPrepare
d
)
info
=
XLOG_XACT_DISTRIBUTED_COMMIT
;
else
if
(
!
TransactionIdIsValid
(
twophase_xid
))
info
=
XLOG_XACT_COMMIT
;
...
...
@@ -6514,19 +6489,11 @@ XactLogCommitRecord(TimestampTz commit_time,
xl_origin
.
origin_timestamp
=
replorigin_sesssion_origin_timestamp
;
}
if
(
gid
)
if
(
isDtxPrepared
||
isOnePhaseQE
)
{
DistributedTransactionTimeStamp
distrib_timestamp
;
DistributedTransactionId
distrib_xid
;
dtxCrackOpenGid
(
gid
,
&
distrib_timestamp
,
&
distrib_xid
);
if
(
Gp_role
==
GP_ROLE_EXECUTE
&&
MyTmGxact
->
isOnePhaseCommit
)
xl_xinfo
.
xinfo
|=
XLOG_XACT_COMMIT
;
else
xl_xinfo
.
xinfo
|=
XACT_XINFO_HAS_DISTRIB
;
xl_distrib
.
distrib_xid
=
distrib_xid
;
xl_distrib
.
distrib_timestamp
=
distrib_timestamp
;
xl_xinfo
.
xinfo
|=
XACT_XINFO_HAS_DISTRIB
;
xl_distrib
.
distrib_timestamp
=
MyTmGxact
->
distribTimeStamp
;
xl_distrib
.
distrib_xid
=
MyTmGxact
->
gxid
;
}
if
(
xl_xinfo
.
xinfo
!=
0
)
...
...
@@ -6586,7 +6553,15 @@ XactLogCommitRecord(TimestampTz commit_time,
/* we allow filtering by xacts */
XLogIncludeOrigin
();
return
XLogInsert
(
RM_XACT_ID
,
info
);
if
(
isDtxPrepared
)
insertingDistributedCommitted
();
recptr
=
XLogInsert
(
RM_XACT_ID
,
info
);
if
(
isDtxPrepared
)
insertedDistributedCommitted
();
return
recptr
;
}
/*
...
...
src/include/access/xact.h
浏览文件 @
e80b0212
...
...
@@ -430,8 +430,7 @@ extern XLogRecPtr XactLogCommitRecord(TimestampTz commit_time,
int
nmsgs
,
SharedInvalidationMessage
*
msgs
,
int
ndeldbs
,
DbDirNode
*
deldbs
,
bool
relcacheInval
,
bool
forceSync
,
TransactionId
twophase_xid
,
const
char
*
gid
);
TransactionId
twophase_xid
);
extern
XLogRecPtr
XactLogAbortRecord
(
TimestampTz
abort_time
,
Oid
tablespace_oid_to_abort
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录