aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2005-07-08 04:12:27 +0000
committerNeil Conway <neilc@samurai.com>2005-07-08 04:12:27 +0000
commit40ffa1a14c3623e960af08ac57de404b1dc8ff5c (patch)
tree8393aa416501bbc684b8c4117c5fb6c03820bc27
parentd7207cfc6bc070660a2e51d2c892dd4d93f5b636 (diff)
downloadpostgresql-40ffa1a14c3623e960af08ac57de404b1dc8ff5c.tar.gz
postgresql-40ffa1a14c3623e960af08ac57de404b1dc8ff5c.zip
Remove some dead code for handling XLOG_DBASE_CREATE_OLD and
XLOG_DBASE_DROP_OLD WAL records -- these records are no longer created in current sources. Adjust numbering of XLOG_DBASE_CREATE and XLOG_DBASE_DROP and bump the catversion. Patch from Gavin Sherry, adjusted by Neil Conway.
-rw-r--r--src/backend/commands/dbcommands.c90
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/commands/dbcommands.h15
3 files changed, 6 insertions, 103 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 486afb2e21f..7f6791abfd3 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.165 2005/07/07 20:39:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.166 2005/07/08 04:12:24 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1305,79 +1305,6 @@ dbase_redo(XLogRecPtr lsn, XLogRecord *record)
(errmsg("could not remove database directory \"%s\"",
dst_path)));
}
- else if (info == XLOG_DBASE_CREATE_OLD)
- {
- xl_dbase_create_rec_old *xlrec = (xl_dbase_create_rec_old *) XLogRecGetData(record);
- char *dst_path = xlrec->src_path + strlen(xlrec->src_path) + 1;
- struct stat st;
-
-#ifndef WIN32
- char buf[2 * MAXPGPATH + 100];
-#endif
-
- /*
- * Our theory for replaying a CREATE is to forcibly drop the
- * target subdirectory if present, then re-copy the source data.
- * This may be more work than needed, but it is simple to
- * implement.
- */
- if (stat(dst_path, &st) == 0 && S_ISDIR(st.st_mode))
- {
- if (!rmtree(dst_path, true))
- ereport(WARNING,
- (errmsg("could not remove database directory \"%s\"",
- dst_path)));
- }
-
- /*
- * Force dirty buffers out to disk, to ensure source database is
- * up-to-date for the copy. (We really only need to flush buffers for
- * the source database, but bufmgr.c provides no API for that.)
- */
- BufferSync();
-
-#ifndef WIN32
-
- /*
- * Copy this subdirectory to the new location
- *
- * XXX use of cp really makes this code pretty grotty, particularly
- * with respect to lack of ability to report errors well. Someday
- * rewrite to do it for ourselves.
- */
-
- /* We might need to use cp -R one day for portability */
- snprintf(buf, sizeof(buf), "cp -r '%s' '%s'",
- xlrec->src_path, dst_path);
- if (system(buf) != 0)
- ereport(ERROR,
- (errmsg("could not initialize database directory"),
- errdetail("Failing system command was: %s", buf),
- errhint("Look in the postmaster's stderr log for more information.")));
-#else /* WIN32 */
- if (copydir(xlrec->src_path, dst_path) != 0)
- {
- /* copydir should already have given details of its troubles */
- ereport(ERROR,
- (errmsg("could not initialize database directory")));
- }
-#endif /* WIN32 */
- }
- else if (info == XLOG_DBASE_DROP_OLD)
- {
- xl_dbase_drop_rec_old *xlrec = (xl_dbase_drop_rec_old *) XLogRecGetData(record);
-
- /*
- * Drop pages for this database that are in the shared buffer
- * cache
- */
- DropBuffers(xlrec->db_id);
-
- if (!rmtree(xlrec->dir_path, true))
- ereport(WARNING,
- (errmsg("could not remove database directory \"%s\"",
- xlrec->dir_path)));
- }
else
elog(PANIC, "dbase_redo: unknown op code %u", info);
}
@@ -1402,21 +1329,6 @@ dbase_desc(char *buf, uint8 xl_info, char *rec)
sprintf(buf + strlen(buf), "drop db: dir %u/%u",
xlrec->db_id, xlrec->tablespace_id);
}
- else if (info == XLOG_DBASE_CREATE_OLD)
- {
- xl_dbase_create_rec_old *xlrec = (xl_dbase_create_rec_old *) rec;
- char *dst_path = xlrec->src_path + strlen(xlrec->src_path) + 1;
-
- sprintf(buf + strlen(buf), "create db: %u copy \"%s\" to \"%s\"",
- xlrec->db_id, xlrec->src_path, dst_path);
- }
- else if (info == XLOG_DBASE_DROP_OLD)
- {
- xl_dbase_drop_rec_old *xlrec = (xl_dbase_drop_rec_old *) rec;
-
- sprintf(buf + strlen(buf), "drop db: %u directory: \"%s\"",
- xlrec->db_id, xlrec->dir_path);
- }
else
strcat(buf, "UNKNOWN");
}
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 9a9266ff41d..5dc1b21a107 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.285 2005/07/07 20:39:59 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.286 2005/07/08 04:12:26 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200507071
+#define CATALOG_VERSION_NO 200507081
#endif
diff --git a/src/include/commands/dbcommands.h b/src/include/commands/dbcommands.h
index 1a4fd5123c2..8020fc7e4e8 100644
--- a/src/include/commands/dbcommands.h
+++ b/src/include/commands/dbcommands.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.39 2005/06/28 05:09:12 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.40 2005/07/08 04:12:27 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,17 +18,8 @@
#include "nodes/parsenodes.h"
/* XLOG stuff */
-#define XLOG_DBASE_CREATE_OLD 0x00
-#define XLOG_DBASE_DROP_OLD 0x10
-#define XLOG_DBASE_CREATE 0x20
-#define XLOG_DBASE_DROP 0x30
-
-/*
- * Note: "old" versions are deprecated and need not be supported beyond 8.0.
- * Not only are they relatively bulky, but they do the Wrong Thing when a
- * WAL log is replayed in a data area that's at a different absolute path
- * than the original.
- */
+#define XLOG_DBASE_CREATE 0x00
+#define XLOG_DBASE_DROP 0x10
typedef struct xl_dbase_create_rec_old
{