summaryrefslogtreecommitdiff
path: root/src/backend/access/transam
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-11-08 22:10:03 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-11-08 22:10:03 +0000
commit3908473c809d5c24940faebfabdad673f4302178 (patch)
tree6a1989499ee61771c7764afd2b24d12ebd25b8fb /src/backend/access/transam
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/backend/access/transam')
-rw-r--r--src/backend/access/transam/varsup.c4
-rw-r--r--src/backend/access/transam/xact.c11
-rw-r--r--src/backend/access/transam/xlogutils.c7
3 files changed, 14 insertions, 8 deletions
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index f29b41d749c..8c7d98ca707 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.31 2000/11/03 11:39:35 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.32 2000/11/08 22:09:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -130,7 +130,7 @@ VariableRelationPutNextXid(TransactionId xid)
TransactionIdStore(xid, &(var->nextXidData));
- FlushBuffer(buf, TRUE);
+ FlushBuffer(buf, true, true);
}
/* --------------------------------
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index cc4209fa51f..97ff91fc440 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.80 2000/11/05 22:50:19 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.81 2000/11/08 22:09:55 tgl Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
@@ -167,6 +167,7 @@
#include "miscadmin.h"
#include "storage/proc.h"
#include "storage/sinval.h"
+#include "storage/smgr.h"
#include "utils/inval.h"
#include "utils/memutils.h"
#include "utils/portal.h"
@@ -1105,6 +1106,9 @@ CommitTransaction(void)
}
RelationPurgeLocalRelation(true);
+ AtEOXact_temp_relations(true);
+ smgrDoPendingDeletes(true);
+
AtEOXact_SPI();
AtEOXact_nbtree();
AtCommit_Cache();
@@ -1181,8 +1185,11 @@ AbortTransaction(void)
CloseSequences();
AtEOXact_portals();
RecordTransactionAbort();
+
RelationPurgeLocalRelation(false);
- remove_temp_rel_in_myxid();
+ AtEOXact_temp_relations(false);
+ smgrDoPendingDeletes(false);
+
AtEOXact_SPI();
AtEOXact_nbtree();
AtAbort_Cache();
diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c
index 1fdc7e83fb5..b6442787334 100644
--- a/src/backend/access/transam/xlogutils.c
+++ b/src/backend/access/transam/xlogutils.c
@@ -171,9 +171,8 @@ XLogOpenLogRelation(void)
sprintf(RelationGetPhysicalRelationName(logRelation), "pg_log");
logRelation->rd_node.tblNode = InvalidOid;
logRelation->rd_node.relNode = RelOid_pg_log;
- logRelation->rd_unlinked = false; /* must exists */
logRelation->rd_fd = -1;
- logRelation->rd_fd = smgropen(DEFAULT_SMGR, logRelation);
+ logRelation->rd_fd = smgropen(DEFAULT_SMGR, logRelation, false);
if (logRelation->rd_fd < 0)
elog(STOP, "XLogOpenLogRelation: failed to open pg_log");
LogRelation = logRelation;
@@ -384,9 +383,9 @@ XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode)
hentry->rdesc = res;
- res->reldata.rd_unlinked = true; /* look smgropen */
res->reldata.rd_fd = -1;
- res->reldata.rd_fd = smgropen(DEFAULT_SMGR, &(res->reldata));
+ res->reldata.rd_fd = smgropen(DEFAULT_SMGR, &(res->reldata),
+ true /* allow failure */);
}
res->moreRecently = &(_xlrelarr[0]);