1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

WAL must log CREATE and DROP DATABASE operations *without* using any

explicit paths, so that the log can be replayed in a data directory
with a different absolute path than the original had.  To avoid forcing
initdb in the 8.0 branch, continue to accept the old WAL log record
types; they will never again be generated however, and the code can be
dropped after the next forced initdb.  Per report from Oleg Bartunov.
We still need to think about what it really means to WAL-log CREATE
TABLESPACE commands: we more or less have to put the absolute path
into those, but how to replay in a different context??
This commit is contained in:
Tom Lane
2005-03-23 00:03:37 +00:00
parent bd9b4a9d46
commit cad86e253b
2 changed files with 142 additions and 31 deletions

View File

@ -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.36 2004/12/31 22:03:28 pgsql Exp $
* $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.37 2005/03/23 00:03:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -18,22 +18,47 @@
#include "nodes/parsenodes.h"
/* XLOG stuff */
#define XLOG_DBASE_CREATE 0x00
#define XLOG_DBASE_DROP 0x10
#define XLOG_DBASE_CREATE_OLD 0x00
#define XLOG_DBASE_DROP_OLD 0x10
#define XLOG_DBASE_CREATE 0x20
#define XLOG_DBASE_DROP 0x30
typedef struct xl_dbase_create_rec
/*
* 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.
*/
typedef struct xl_dbase_create_rec_old
{
/* Records copying of a single subdirectory incl. contents */
Oid db_id;
char src_path[1]; /* VARIABLE LENGTH STRING */
/* dst_path follows src_path */
} xl_dbase_create_rec_old;
typedef struct xl_dbase_drop_rec_old
{
/* Records dropping of a single subdirectory incl. contents */
Oid db_id;
char dir_path[1]; /* VARIABLE LENGTH STRING */
} xl_dbase_drop_rec_old;
typedef struct xl_dbase_create_rec
{
/* Records copying of a single subdirectory incl. contents */
Oid db_id;
Oid tablespace_id;
Oid src_db_id;
Oid src_tablespace_id;
} xl_dbase_create_rec;
typedef struct xl_dbase_drop_rec
{
/* Records dropping of a single subdirectory incl. contents */
Oid db_id;
char dir_path[1]; /* VARIABLE LENGTH STRING */
Oid tablespace_id;
} xl_dbase_drop_rec;
extern void createdb(const CreatedbStmt *stmt);