summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2000-11-08 22:10:03 +0000
committerTom Lane2000-11-08 22:10:03 +0000
commit3908473c809d5c24940faebfabdad673f4302178 (patch)
tree6a1989499ee61771c7764afd2b24d12ebd25b8fb /src/include
parentebe0b236909732c75d665c73363bd4ac7a7aa138 (diff)
Make DROP TABLE rollback-able: postpone physical file delete until commit.
(WAL logging for this is not done yet, however.) Clean up a number of really crufty things that are no longer needed now that DROP behaves nicely. Make temp table mapper do the right things when drop or rename affecting a temp table is rolled back. Also, remove "relation modified while in use" error check, in favor of locking tables at first reference and holding that lock throughout the statement.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/heap.h4
-rw-r--r--src/include/catalog/index.h6
-rw-r--r--src/include/parser/parse_clause.h3
-rw-r--r--src/include/parser/parse_node.h3
-rw-r--r--src/include/storage/buf_internals.h4
-rw-r--r--src/include/storage/bufmgr.h10
-rw-r--r--src/include/storage/smgr.h15
-rw-r--r--src/include/utils/inval.h4
-rw-r--r--src/include/utils/rel.h3
-rw-r--r--src/include/utils/temprel.h4
10 files changed, 29 insertions, 27 deletions
diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h
index 409e103f4d4..4cc317492f9 100644
--- a/src/include/catalog/heap.h
+++ b/src/include/catalog/heap.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: heap.h,v 1.31 2000/07/04 06:11:54 tgl Exp $
+ * $Id: heap.h,v 1.32 2000/11/08 22:10:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,7 +29,7 @@ extern Relation heap_create(char *relname, TupleDesc tupDesc,
bool istemp, bool storage_create,
bool allow_system_table_mods);
-extern bool heap_storage_create(Relation rel);
+extern void heap_storage_create(Relation rel);
extern Oid heap_create_with_catalog(char *relname, TupleDesc tupdesc,
char relkind, bool istemp,
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index e00b25e6f07..967bffb4aab 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: index.h,v 1.29 2000/07/14 22:17:56 tgl Exp $
+ * $Id: index.h,v 1.30 2000/11/08 22:10:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,9 +46,9 @@ extern void FormIndexDatum(IndexInfo *indexInfo,
Datum *datum,
char *nullv);
-extern void UpdateStats(Oid relid, long reltuples, bool inplace);
+extern void UpdateStats(Oid relid, long reltuples);
extern bool IndexesAreActive(Oid relid, bool comfirmCommitted);
-extern void setRelhasindexInplace(Oid relid, bool hasindex, bool immediate);
+extern void setRelhasindex(Oid relid, bool hasindex);
extern bool SetReindexProcessing(bool processing);
extern bool IsReindexProcessing(void);
diff --git a/src/include/parser/parse_clause.h b/src/include/parser/parse_clause.h
index fd1cfdb3604..421156ac210 100644
--- a/src/include/parser/parse_clause.h
+++ b/src/include/parser/parse_clause.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_clause.h,v 1.19 2000/09/12 21:07:12 tgl Exp $
+ * $Id: parse_clause.h,v 1.20 2000/11/08 22:10:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,6 +17,7 @@
#include "parser/parse_node.h"
extern void makeRangeTable(ParseState *pstate, List *frmList);
+extern void lockTargetTable(ParseState *pstate, char *relname);
extern void setTargetTable(ParseState *pstate, char *relname,
bool inh, bool inJoinSet);
extern Node *transformWhereClause(ParseState *pstate, Node *where);
diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h
index 22dd797c7fb..a0a41c3289a 100644
--- a/src/include/parser/parse_node.h
+++ b/src/include/parser/parse_node.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_node.h,v 1.22 2000/09/29 18:21:40 tgl Exp $
+ * $Id: parse_node.h,v 1.23 2000/11/08 22:10:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,6 +26,7 @@ typedef struct ParseState
List *p_joinlist; /* join items so far (will become
* FromExpr node's fromlist) */
int p_last_resno; /* last targetlist resno assigned */
+ List *p_forUpdate; /* FOR UPDATE clause, if any (see gram.y) */
bool p_hasAggs;
bool p_hasSubLinks;
bool p_is_insert;
diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h
index 80aca7c57e9..fc15e59859b 100644
--- a/src/include/storage/buf_internals.h
+++ b/src/include/storage/buf_internals.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: buf_internals.h,v 1.42 2000/10/28 16:21:00 vadim Exp $
+ * $Id: buf_internals.h,v 1.43 2000/11/08 22:10:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -200,7 +200,7 @@ extern int NLocBuffer;
extern BufferDesc *LocalBufferAlloc(Relation reln, BlockNumber blockNum,
bool *foundPtr);
extern int WriteLocalBuffer(Buffer buffer, bool release);
-extern int FlushLocalBuffer(Buffer buffer, bool release);
+extern int FlushLocalBuffer(Buffer buffer, bool sync, bool release);
extern void InitLocalBuffer(void);
extern void LocalBufferSync(void);
extern void ResetLocalBufferPool(void);
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h
index 0ed4837305d..22c0ccde7d5 100644
--- a/src/include/storage/bufmgr.h
+++ b/src/include/storage/bufmgr.h
@@ -7,15 +7,16 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: bufmgr.h,v 1.42 2000/10/28 16:21:00 vadim Exp $
+ * $Id: bufmgr.h,v 1.43 2000/11/08 22:10:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef BUFMGR_H
#define BUFMGR_H
-#include "storage/buf_internals.h"
#include "access/xlogdefs.h"
+#include "storage/buf_internals.h"
+#include "storage/relfilenode.h"
typedef void *Block;
@@ -151,7 +152,7 @@ extern int WriteBuffer(Buffer buffer);
extern int WriteNoReleaseBuffer(Buffer buffer);
extern Buffer ReleaseAndReadBuffer(Buffer buffer, Relation relation,
BlockNumber blockNum);
-extern int FlushBuffer(Buffer buffer, bool release);
+extern int FlushBuffer(Buffer buffer, bool sync, bool release);
extern void InitBufferPool(IPCKey key);
extern void PrintBufferUsage(FILE *statfp);
@@ -162,7 +163,8 @@ extern void FlushBufferPool(void);
extern BlockNumber BufferGetBlockNumber(Buffer buffer);
extern BlockNumber RelationGetNumberOfBlocks(Relation relation);
extern int FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock);
-extern void ReleaseRelationBuffers(Relation rel);
+extern void DropRelationBuffers(Relation rel);
+extern void DropRelFileNodeBuffers(RelFileNode rnode);
extern void DropBuffers(Oid dbid);
extern void PrintPinnedBufs(void);
extern int BufferShmemSize(void);
diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h
index 49a2e3e5e92..99eed75fe61 100644
--- a/src/include/storage/smgr.h
+++ b/src/include/storage/smgr.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: smgr.h,v 1.23 2000/10/28 16:21:00 vadim Exp $
+ * $Id: smgr.h,v 1.24 2000/11/08 22:10:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,7 +28,7 @@ extern int smgrinit(void);
extern int smgrcreate(int16 which, Relation reln);
extern int smgrunlink(int16 which, Relation reln);
extern int smgrextend(int16 which, Relation reln, char *buffer);
-extern int smgropen(int16 which, Relation reln);
+extern int smgropen(int16 which, Relation reln, bool failOK);
extern int smgrclose(int16 which, Relation reln);
extern int smgrread(int16 which, Relation reln, BlockNumber blocknum,
char *buffer);
@@ -43,6 +43,7 @@ extern int smgrblindmarkdirty(int16 which, RelFileNode rnode,
extern int smgrmarkdirty(int16 which, Relation reln, BlockNumber blkno);
extern int smgrnblocks(int16 which, Relation reln);
extern int smgrtruncate(int16 which, Relation reln, int nblocks);
+extern int smgrDoPendingDeletes(bool isCommit);
extern int smgrcommit(void);
extern int smgrabort(void);
@@ -56,7 +57,7 @@ extern int smgrsync(void);
/* in md.c */
extern int mdinit(void);
extern int mdcreate(Relation reln);
-extern int mdunlink(Relation reln);
+extern int mdunlink(RelFileNode rnode);
extern int mdextend(Relation reln, char *buffer);
extern int mdopen(Relation reln);
extern int mdclose(Relation reln);
@@ -64,9 +65,9 @@ extern int mdread(Relation reln, BlockNumber blocknum, char *buffer);
extern int mdwrite(Relation reln, BlockNumber blocknum, char *buffer);
extern int mdflush(Relation reln, BlockNumber blocknum, char *buffer);
extern int mdmarkdirty(Relation reln, BlockNumber blkno);
-extern int mdblindwrt(RelFileNode rnode, BlockNumber blkno,
- char *buffer, bool dofsync);
-extern int mdblindmarkdirty(RelFileNode rnode, BlockNumber blkno);
+extern int mdblindwrt(RelFileNode rnode, BlockNumber blkno,
+ char *buffer, bool dofsync);
+extern int mdblindmarkdirty(RelFileNode rnode, BlockNumber blkno);
extern int mdnblocks(Relation reln);
extern int mdtruncate(Relation reln, int nblocks);
extern int mdcommit(void);
@@ -81,7 +82,7 @@ extern SPINLOCK MMCacheLock;
extern int mminit(void);
extern int mmcreate(Relation reln);
-extern int mmunlink(Relation reln);
+extern int mmunlink(RelFileNode rnode);
extern int mmextend(Relation reln, char *buffer);
extern int mmopen(Relation reln);
extern int mmclose(Relation reln);
diff --git a/src/include/utils/inval.h b/src/include/utils/inval.h
index a585152555b..b2ccee3adff 100644
--- a/src/include/utils/inval.h
+++ b/src/include/utils/inval.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: inval.h,v 1.17 2000/06/08 19:51:06 momjian Exp $
+ * $Id: inval.h,v 1.18 2000/11/08 22:10:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,6 +26,4 @@ extern void RelationInvalidateHeapTuple(Relation relation, HeapTuple tuple);
extern void RelationMark4RollbackHeapTuple(Relation relation, HeapTuple tuple);
-extern void ImmediateInvalidateSharedHeapTuple(Relation relation, HeapTuple tuple);
-
#endif /* INVAL_H */
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 4deec0618a8..fd4012b0ddf 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: rel.h,v 1.41 2000/09/07 09:58:38 vadim Exp $
+ * $Id: rel.h,v 1.42 2000/11/08 22:10:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -92,7 +92,6 @@ typedef struct RelationData
uint16 rd_refcnt; /* reference count */
bool rd_myxactonly; /* rel uses the local buffer mgr */
bool rd_isnailed; /* rel is nailed in cache */
- bool rd_unlinked; /* rel already unlinked or not created yet */
bool rd_indexfound; /* true if rd_indexlist is valid */
bool rd_uniqueindex; /* true if rel is a UNIQUE index */
Form_pg_am rd_am; /* AM tuple */
diff --git a/src/include/utils/temprel.h b/src/include/utils/temprel.h
index a99839ac266..789d5058789 100644
--- a/src/include/utils/temprel.h
+++ b/src/include/utils/temprel.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: temprel.h,v 1.11 2000/10/11 21:28:19 momjian Exp $
+ * $Id: temprel.h,v 1.12 2000/11/08 22:10:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,7 +23,7 @@ extern bool rename_temp_relation(const char *oldname,
const char *newname);
extern void remove_all_temp_relations(void);
-extern void remove_temp_rel_in_myxid(void);
+extern void AtEOXact_temp_relations(bool isCommit);
extern char *get_temp_rel_by_username(const char *user_relname);
extern char *get_temp_rel_by_physicalname(const char *relname);