Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
0b86ade1
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,发现更多精彩内容 >>
提交
0b86ade1
编写于
3月 11, 2004
作者:
T
Tatsuo Ishii
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add NOWAIT option to LOCK command
上级
60a068b3
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
56 addition
and
15 deletion
+56
-15
doc/src/sgml/ref/lock.sgml
doc/src/sgml/ref/lock.sgml
+6
-4
src/backend/access/heap/heapam.c
src/backend/access/heap/heapam.c
+28
-1
src/backend/commands/lockcmds.c
src/backend/commands/lockcmds.c
+2
-2
src/backend/nodes/copyfuncs.c
src/backend/nodes/copyfuncs.c
+2
-1
src/backend/nodes/equalfuncs.c
src/backend/nodes/equalfuncs.c
+2
-1
src/backend/parser/gram.y
src/backend/parser/gram.y
+10
-3
src/backend/parser/keywords.c
src/backend/parser/keywords.c
+2
-1
src/include/access/heapam.h
src/include/access/heapam.h
+2
-1
src/include/nodes/parsenodes.h
src/include/nodes/parsenodes.h
+2
-1
未找到文件。
doc/src/sgml/ref/lock.sgml
浏览文件 @
0b86ade1
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/lock.sgml,v 1.4
0 2003/12/14 00:05:29 neilc
Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/lock.sgml,v 1.4
1 2004/03/11 01:47:35 ishii
Exp $
PostgreSQL documentation
-->
...
...
@@ -20,7 +20,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ IN <replaceable class="PARAMETER">lockmode</replaceable> MODE ]
LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ IN <replaceable class="PARAMETER">lockmode</replaceable> MODE ]
[ NOWAIT ]
where <replaceable class="PARAMETER">lockmode</replaceable> is one of:
...
...
@@ -34,8 +34,10 @@ where <replaceable class="PARAMETER">lockmode</replaceable> is one of:
<para>
<command>LOCK TABLE</command> obtains a table-level lock, waiting if
necessary for any conflicting locks to be released. Once obtained,
the lock is held for the remainder of the current transaction.
necessary for any conflicting locks to be released.
If <literal>NOWAIT</literal> is given, <command>LOCK TABLE</command>
does not wait for acquiring lock, and throws an error instead.
Once obtained, the lock is held for the remainder of the current transaction.
(There is no <command>UNLOCK TABLE</command> command; locks are always
released at transaction end.)
</para>
...
...
src/backend/access/heap/heapam.c
浏览文件 @
0b86ade1
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.16
2 2004/01/16 20:51:30 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.16
3 2004/03/11 01:47:35 ishii
Exp $
*
*
* INTERFACE ROUTINES
...
...
@@ -464,6 +464,33 @@ relation_open(Oid relationId, LOCKMODE lockmode)
return
r
;
}
Relation
conditional_relation_open
(
Oid
relationId
,
LOCKMODE
lockmode
,
bool
nowait
)
{
Relation
r
;
Assert
(
lockmode
>=
NoLock
&&
lockmode
<
MAX_LOCKMODES
);
/* The relcache does all the real work... */
r
=
RelationIdGetRelation
(
relationId
);
if
(
!
RelationIsValid
(
r
))
elog
(
ERROR
,
"could not open relation with OID %u"
,
relationId
);
if
(
lockmode
!=
NoLock
)
{
if
(
nowait
)
{
if
(
!
ConditionalLockRelation
(
r
,
lockmode
))
elog
(
ERROR
,
"could not aquire relation lock"
);
}
else
LockRelation
(
r
,
lockmode
);
}
return
r
;
}
/* ----------------
* relation_openrv - open any relation specified by a RangeVar
*
...
...
src/backend/commands/lockcmds.c
浏览文件 @
0b86ade1
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/lockcmds.c,v 1.
8 2003/11/29 19:51:47 pgsql
Exp $
* $PostgreSQL: pgsql/src/backend/commands/lockcmds.c,v 1.
9 2004/03/11 01:47:35 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -59,7 +59,7 @@ LockTableCommand(LockStmt *lockstmt)
aclcheck_error
(
aclresult
,
ACL_KIND_CLASS
,
get_rel_name
(
reloid
));
rel
=
relation_open
(
reloid
,
lockstmt
->
mode
);
rel
=
conditional_relation_open
(
reloid
,
lockstmt
->
mode
,
lockstmt
->
nowait
);
/* Currently, we only allow plain tables to be locked */
if
(
rel
->
rd_rel
->
relkind
!=
RELKIND_RELATION
)
...
...
src/backend/nodes/copyfuncs.c
浏览文件 @
0b86ade1
...
...
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.27
7 2004/01/14 23:01:54 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.27
8 2004/03/11 01:47:35 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -2316,6 +2316,7 @@ _copyLockStmt(LockStmt *from)
COPY_NODE_FIELD
(
relations
);
COPY_SCALAR_FIELD
(
mode
);
COPY_SCALAR_FIELD
(
nowait
);
return
newnode
;
}
...
...
src/backend/nodes/equalfuncs.c
浏览文件 @
0b86ade1
...
...
@@ -18,7 +18,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.21
5 2004/01/14 23:01:55 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.21
6 2004/03/11 01:47:35 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1252,6 +1252,7 @@ _equalLockStmt(LockStmt *a, LockStmt *b)
{
COMPARE_NODE_FIELD
(
relations
);
COMPARE_SCALAR_FIELD
(
mode
);
COMPARE_SCALAR_FIELD
(
nowait
);
return
true
;
}
...
...
src/backend/parser/gram.y
浏览文件 @
0b86ade1
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.44
7 2004/03/09 05:05:41 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.44
8 2004/03/11 01:47:37 ishii
Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -169,6 +169,7 @@ static void doNegateFloat(Value *v);
%type <ival> opt_lock lock_type cast_context
%type <boolean> opt_force opt_or_replace transaction_access_mode
opt_grant_grant_option opt_revoke_grant_option
opt_nowait
%type <boolean> like_including_defaults
...
...
@@ -375,7 +376,7 @@ static void doNegateFloat(Value *v);
MATCH MAXVALUE MINUTE_P MINVALUE MODE MONTH_P MOVE
NAMES NATIONAL NATURAL NCHAR NEW NEXT NO NOCREATEDB
NOCREATEUSER NONE NOT NOTHING NOTIFY NOTNULL NULL_P
NOCREATEUSER NONE NOT NOTHING NOTIFY NOTNULL N
OWAIT N
ULL_P
NULLIF NUMERIC
OBJECT_P OF OFF OFFSET OIDS OLD ON ONLY OPERATOR OPTION OR
...
...
@@ -4347,12 +4348,13 @@ DeleteStmt: DELETE_P FROM relation_expr where_clause
}
;
LockStmt: LOCK_P opt_table qualified_name_list opt_lock
LockStmt: LOCK_P opt_table qualified_name_list opt_lock
opt_nowait
{
LockStmt *n = makeNode(LockStmt);
n->relations = $3;
n->mode = $4;
n->nowait = $5;
$$ = (Node *)n;
}
;
...
...
@@ -4371,6 +4373,10 @@ lock_type: ACCESS SHARE { $$ = AccessShareLock; }
| ACCESS EXCLUSIVE { $$ = AccessExclusiveLock; }
;
opt_nowait: NOWAIT { $$ = TRUE; }
| /*EMPTY*/ { $$ = FALSE; }
;
/*****************************************************************************
*
...
...
@@ -7683,6 +7689,7 @@ reserved_keyword:
| LOCALTIMESTAMP
| NEW
| NOT
| NOWAIT
| NULL_P
| OFF
| OFFSET
...
...
src/backend/parser/keywords.c
浏览文件 @
0b86ade1
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.14
6 2004/03/09 05:05:41 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.14
7 2004/03/11 01:47:40 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -213,6 +213,7 @@ static const ScanKeyword ScanKeywords[] = {
{
"nothing"
,
NOTHING
},
{
"notify"
,
NOTIFY
},
{
"notnull"
,
NOTNULL
},
{
"nowait"
,
NOWAIT
},
{
"null"
,
NULL_P
},
{
"nullif"
,
NULLIF
},
{
"numeric"
,
NUMERIC
},
...
...
src/include/access/heapam.h
浏览文件 @
0b86ade1
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.8
6 2003/11/29 22:40:55 pgsql
Exp $
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.8
7 2004/03/11 01:47:41 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -129,6 +129,7 @@ extern Datum heap_getsysattr(HeapTuple tup, int attnum, bool *isnull);
/* heapam.c */
extern
Relation
relation_open
(
Oid
relationId
,
LOCKMODE
lockmode
);
extern
Relation
conditional_relation_open
(
Oid
relationId
,
LOCKMODE
lockmode
,
bool
nowait
);
extern
Relation
relation_openrv
(
const
RangeVar
*
relation
,
LOCKMODE
lockmode
);
extern
Relation
relation_openr
(
const
char
*
sysRelationName
,
LOCKMODE
lockmode
);
extern
void
relation_close
(
Relation
relation
,
LOCKMODE
lockmode
);
...
...
src/include/nodes/parsenodes.h
浏览文件 @
0b86ade1
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.25
3 2004/01/14 23:01:55 tgl
Exp $
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.25
4 2004/03/11 01:47:41 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1619,6 +1619,7 @@ typedef struct LockStmt
NodeTag
type
;
List
*
relations
;
/* relations to lock */
int
mode
;
/* lock mode */
bool
nowait
;
/* no wait mode */
}
LockStmt
;
/* ----------------------
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录