Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
63e97345
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,发现更多精彩内容 >>
提交
63e97345
编写于
11月 13, 2002
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update xact.c comments for clarity.
上级
34529aeb
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
102 addition
and
114 deletion
+102
-114
src/backend/access/transam/xact.c
src/backend/access/transam/xact.c
+94
-107
src/include/access/xact.h
src/include/access/xact.h
+8
-7
未找到文件。
src/backend/access/transam/xact.c
浏览文件 @
63e97345
...
...
@@ -8,13 +8,13 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.13
7 2002/11/11 22:19:20 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.13
8 2002/11/13 03:12:05 momjian
Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
*
* 1) system dies from some internal cause (
Assert
, etc..)
* 2) user types
abort
* 1) system dies from some internal cause (
syntax error
, etc..)
* 2) user types
ABORT
*
* These two cases used to be treated identically, but now
* we need to distinguish them. Why? consider the following
...
...
@@ -30,8 +30,8 @@
* In case 1, we want to abort the transaction and return to the
* default state. In case 2, there may be more commands coming
* our way which are part of the same transaction block and we have
* to ignore these commands until we see a
n END transaction.
*
(or an ABORT! --djm)
* to ignore these commands until we see a
COMMIT transaction or
*
ROLLBACK.
*
* Internal aborts are now handled by AbortTransactionBlock(), just as
* they always have been, and user aborts are now handled by
...
...
@@ -52,14 +52,6 @@
* TransactionCommandContext until this point.
*
* NOTES
* This file is an attempt at a redesign of the upper layer
* of the V1 transaction system which was too poorly thought
* out to describe. This new system hopes to be both simpler
* in design, simpler to extend and needs to contain added
* functionality to solve problems beyond the scope of the V1
* system. (In particuler, communication of transaction
* information between parallel backends has to be supported)
*
* The essential aspects of the transaction system are:
*
* o transaction id generation
...
...
@@ -69,7 +61,7 @@
* o lock cleanup
*
* Hence, the functional division of the transaction code is
* based on wh
at
of the above things need to be done during
* based on wh
ich
of the above things need to be done during
* a start/commit/abort transaction. For instance, the
* routine AtCommit_Memory() takes care of all the memory
* cleanup stuff done at commit time.
...
...
@@ -99,17 +91,17 @@
* CommitTransactionBlock
* AbortTransactionBlock
*
* These are invoked only in responce to a user "BEGIN
", "END
",
* or "
ABORT
" command. The tricky part about these functions
* These are invoked only in responce to a user "BEGIN
WORK", "COMMIT
",
* or "
ROLLBACK
" command. The tricky part about these functions
* is that they are called within the postgres main loop, in between
* the StartTransactionCommand() and CommitTransactionCommand().
*
* For example, consider the following sequence of user commands:
*
* 1) begin
* 2)
retrieve (foo.all)
* 3)
append
foo (bar = baz)
* 4)
end
* 2)
select * from foo
* 3)
insert into
foo (bar = baz)
* 4)
commit
*
* in the main processing loop, this results in the following
* transaction sequence:
...
...
@@ -120,15 +112,15 @@
* \ CommitTransactionCommand();
*
* / StartTransactionCommand();
* 2) < ProcessQuery(); <<
retrieve (foo.all)
* 2) < ProcessQuery(); <<
select * from foo
* \ CommitTransactionCommand();
*
* / StartTransactionCommand();
* 3) < ProcessQuery(); <<
append
foo (bar = baz)
* 3) < ProcessQuery(); <<
insert into
foo (bar = baz)
* \ CommitTransactionCommand();
*
* / StartTransactionCommand();
* 4) / ProcessUtility(); <<
end
* 4) / ProcessUtility(); <<
commit
* \ CommitTransactionBlock();
* \ CommitTransactionCommand();
*
...
...
@@ -139,19 +131,14 @@
* outside these calls they need to do normal start/commit
* processing.
*
* Furthermore, suppose the "
retrieve (foo.all)
" caused an abort
* Furthermore, suppose the "
select * from foo
" caused an abort
* condition. We would then want to abort the transaction and
* ignore all subsequent commands up to the "
end
".
* ignore all subsequent commands up to the "
commit
".
* -cim 3/23/90
*
*-------------------------------------------------------------------------
*/
/*
* Large object clean up added in CommitTransaction() to prevent buffer leaks.
* [PA, 7/17/98]
* [PA] is Pascal André <andre@via.ecp.fr>
*/
#include "postgres.h"
#include <unistd.h>
...
...
@@ -201,9 +188,8 @@ static void CommitTransaction(void);
static
void
RecordTransactionAbort
(
void
);
static
void
StartTransaction
(
void
);
/*
----------------
/*
* global variables holding the current transaction state.
* ----------------
*/
static
TransactionStateData
CurrentTransactionStateData
=
{
0
,
/* transaction id */
...
...
@@ -211,7 +197,7 @@ static TransactionStateData CurrentTransactionStateData = {
0
,
/* scan command id */
0x0
,
/* start time */
TRANS_DEFAULT
,
/* transaction state */
TBLOCK_DEFAULT
/* transaction block state */
TBLOCK_DEFAULT
/* transaction block state
of client queries
*/
};
TransactionState
CurrentTransactionState
=
&
CurrentTransactionStateData
;
...
...
@@ -853,7 +839,6 @@ AtCleanup_Memory(void)
/* --------------------------------
* StartTransaction
*
* --------------------------------
*/
static
void
...
...
@@ -930,7 +915,6 @@ CurrentXactInProgress(void)
/* --------------------------------
* CommitTransaction
*
* --------------------------------
*/
static
void
...
...
@@ -1051,7 +1035,6 @@ CommitTransaction(void)
/* --------------------------------
* AbortTransaction
*
* --------------------------------
*/
static
void
...
...
@@ -1158,7 +1141,6 @@ AbortTransaction(void)
/* --------------------------------
* CleanupTransaction
*
* --------------------------------
*/
static
void
...
...
@@ -1730,6 +1712,11 @@ IsTransactionBlock(void)
return
false
;
}
/*
* XLOG support routines
*/
void
xact_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
)
{
...
...
src/include/access/xact.h
浏览文件 @
63e97345
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: xact.h,v 1.4
6 2002/10/21 22:06:20 tgl
Exp $
* $Id: xact.h,v 1.4
7 2002/11/13 03:12:05 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -46,9 +46,11 @@ typedef struct TransactionStateData
typedef
TransactionStateData
*
TransactionState
;
/* ----------------
* transaction states
* ----------------
/*
* transaction states - transaction state from server perspective
*
* Syntax error could cause transaction to abort, but client code thinks
* it is still in a transaction, so we have to wait for COMMIT/ROLLBACK.
*/
#define TRANS_DEFAULT 0
#define TRANS_START 1
...
...
@@ -56,9 +58,8 @@ typedef TransactionStateData *TransactionState;
#define TRANS_COMMIT 3
#define TRANS_ABORT 4
/* ----------------
* transaction block states
* ----------------
/*
* transaction block states - transaction state of client queries
*/
#define TBLOCK_DEFAULT 0
#define TBLOCK_BEGIN 1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录