Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
fb7548f4
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,发现更多精彩内容 >>
提交
fb7548f4
编写于
9月 04, 1999
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Invalidate temp entries for aborted transactions.
上级
b4a607c9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
76 addition
and
22 deletion
+76
-22
src/backend/access/transam/xact.c
src/backend/access/transam/xact.c
+3
-1
src/backend/catalog/indexing.c
src/backend/catalog/indexing.c
+5
-4
src/backend/utils/cache/temprel.c
src/backend/utils/cache/temprel.c
+65
-15
src/include/utils/temprel.h
src/include/utils/temprel.h
+3
-2
未找到文件。
src/backend/access/transam/xact.c
浏览文件 @
fb7548f4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.4
8 1999/09/04 18:42:15 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.4
9 1999/09/04 19:55:48 momjian
Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
...
...
@@ -151,6 +151,7 @@
#include "commands/vacuum.h"
#include "libpq/be-fsstubs.h"
#include "storage/proc.h"
#include "utils/temprel.h"
#include "utils/inval.h"
#include "utils/portal.h"
#include "utils/relcache.h"
...
...
@@ -1022,6 +1023,7 @@ AbortTransaction()
RecordTransactionAbort
();
RelationPurgeLocalRelation
(
false
);
DestroyNoNameRels
();
invalidate_temp_relations
();
AtEOXact_nbtree
();
AtAbort_Cache
();
AtAbort_Locks
();
...
...
src/backend/catalog/indexing.c
浏览文件 @
fb7548f4
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.4
2 1999/07/20 17:14:06
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.4
3 1999/09/04 19:55:49
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -449,13 +449,14 @@ ClassNameIndexScan(Relation heapRelation, char *relName)
Relation
idesc
;
ScanKeyData
skey
[
1
];
HeapTuple
tuple
;
char
*
hold_rel
;
/*
* we have to do this before looking in system tables because temp
* table namespace takes precedence
*/
if
((
tuple
=
get_temp_rel_by_name
(
relName
))
!=
NULL
)
re
turn
heap_copytuple
(
tuple
)
;
if
((
hold_rel
=
get_temp_rel_by_name
(
relName
))
!=
NULL
)
re
lName
=
hold_rel
;
ScanKeyEntryInitialize
(
&
skey
[
0
],
(
bits16
)
0x0
,
...
...
src/backend/utils/cache/temprel.c
浏览文件 @
fb7548f4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.1
0 1999/07/17 20:18:02
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.1
1 1999/09/04 19:55:50
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -18,13 +18,13 @@
* When a temp table is created, a linked list of temp table tuples is
* stored here. When a relname cache lookup is done, references to user-named
* temp tables are converted to the internal temp table names.
*
*/
#include <sys/types.h>
#include "postgres.h"
#include "access/heapam.h"
#include "access/xact.h"
#include "catalog/heap.h"
#include "catalog/index.h"
#include "utils/temprel.h"
...
...
@@ -41,7 +41,10 @@ static List *temp_rels = NIL;
typedef
struct
TempTable
{
char
*
user_relname
;
HeapTuple
pg_class_tuple
;
char
*
relname
;
Oid
relid
;
char
relkind
;
TransactionId
xid
;
}
TempTable
;
...
...
@@ -55,11 +58,15 @@ create_temp_relation(char *relname, HeapTuple pg_class_tuple)
temp_rel
=
palloc
(
sizeof
(
TempTable
));
temp_rel
->
user_relname
=
palloc
(
NAMEDATALEN
);
temp_rel
->
relname
=
palloc
(
NAMEDATALEN
);
/* save user-supplied name */
strcpy
(
temp_rel
->
user_relname
,
relname
);
temp_rel
->
pg_class_tuple
=
heap_copytuple
(
pg_class_tuple
);
StrNCpy
(
temp_rel
->
relname
,
((
Form_pg_class
)
GETSTRUCT
(
pg_class_tuple
))
->
relname
.
data
,
NAMEDATALEN
);
temp_rel
->
relid
=
pg_class_tuple
->
t_data
->
t_oid
;
temp_rel
->
relkind
=
((
Form_pg_class
)
GETSTRUCT
(
pg_class_tuple
))
->
relkind
;
temp_rel
->
xid
=
GetCurrentTransactionId
();
temp_rels
=
lcons
(
temp_rel
,
temp_rels
);
...
...
@@ -79,22 +86,19 @@ remove_all_temp_relations(void)
while
(
l
!=
NIL
)
{
TempTable
*
temp_rel
=
lfirst
(
l
);
Form_pg_class
classtuple
;
classtuple
=
(
Form_pg_class
)
GETSTRUCT
(
temp_rel
->
pg_class_tuple
);
next
=
lnext
(
l
);
/* do this first, l is deallocated */
if
(
classtuple
->
relkind
!=
RELKIND_INDEX
)
if
(
temp_rel
->
relkind
!=
RELKIND_INDEX
)
{
char
relname
[
NAMEDATALEN
];
char
relname
[
NAMEDATALEN
];
/* safe from deallocation */
strcpy
(
relname
,
temp_rel
->
user_relname
);
heap_destroy_with_catalog
(
relname
);
}
else
index_destroy
(
temp_rel
->
pg_class_tuple
->
t_data
->
t_o
id
);
index_destroy
(
temp_rel
->
rel
id
);
l
=
next
;
}
...
...
@@ -118,10 +122,56 @@ remove_temp_relation(Oid relid)
{
TempTable
*
temp_rel
=
lfirst
(
l
);
if
(
temp_rel
->
pg_class_tuple
->
t_data
->
t_oid
==
relid
)
if
(
temp_rel
->
relid
==
relid
)
{
pfree
(
temp_rel
->
user_relname
);
pfree
(
temp_rel
->
relname
);
pfree
(
temp_rel
);
/* remove from linked list */
if
(
prev
!=
NIL
)
{
lnext
(
prev
)
=
lnext
(
l
);
pfree
(
l
);
l
=
lnext
(
prev
);
}
else
{
temp_rels
=
lnext
(
l
);
pfree
(
l
);
l
=
temp_rels
;
}
}
else
{
prev
=
l
;
l
=
lnext
(
l
);
}
}
MemoryContextSwitchTo
(
oldcxt
);
}
/* remove entries from aborted transactions */
void
invalidate_temp_relations
(
void
)
{
MemoryContext
oldcxt
;
List
*
l
,
*
prev
;
oldcxt
=
MemoryContextSwitchTo
((
MemoryContext
)
CacheCxt
);
prev
=
NIL
;
l
=
temp_rels
;
while
(
l
!=
NIL
)
{
TempTable
*
temp_rel
=
lfirst
(
l
);
if
(
temp_rel
->
xid
==
GetCurrentTransactionId
())
{
pfree
(
temp_rel
->
user_relname
);
pfree
(
temp_rel
->
pg_class_tupl
e
);
pfree
(
temp_rel
->
relnam
e
);
pfree
(
temp_rel
);
/* remove from linked list */
if
(
prev
!=
NIL
)
...
...
@@ -148,7 +198,7 @@ remove_temp_relation(Oid relid)
MemoryContextSwitchTo
(
oldcxt
);
}
HeapTuple
char
*
get_temp_rel_by_name
(
char
*
user_relname
)
{
List
*
l
;
...
...
@@ -158,7 +208,7 @@ get_temp_rel_by_name(char *user_relname)
TempTable
*
temp_rel
=
lfirst
(
l
);
if
(
strcmp
(
temp_rel
->
user_relname
,
user_relname
)
==
0
)
return
temp_rel
->
pg_class_tupl
e
;
return
temp_rel
->
relnam
e
;
}
return
NULL
;
}
src/include/utils/temprel.h
浏览文件 @
fb7548f4
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: temprel.h,v 1.
4 1999/07/15 15:21:43
momjian Exp $
* $Id: temprel.h,v 1.
5 1999/09/04 19:55:50
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -17,7 +17,8 @@
void
create_temp_relation
(
char
*
relname
,
HeapTuple
pg_class_tuple
);
void
remove_all_temp_relations
(
void
);
void
invalidate_temp_relations
(
void
);
void
remove_temp_relation
(
Oid
relid
);
HeapTuple
get_temp_rel_by_name
(
char
*
user_relname
);
char
*
get_temp_rel_by_name
(
char
*
user_relname
);
#endif
/* TEMPREL_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录