Move xlog-related stuff from dbcommands.h into dbcommands_xlog.h
authorHeikki Linnakangas <[email protected]>
Fri, 9 Jan 2015 14:34:08 +0000 (16:34 +0200)
committerHeikki Linnakangas <[email protected]>
Fri, 16 Jan 2015 11:46:57 +0000 (13:46 +0200)
dbcommands_xlog.h can be #included in frontend programs.

contrib/pg_xlogdump/rmgrdesc.c
src/backend/access/rmgrdesc/dbasedesc.c
src/backend/access/transam/rmgr.c
src/backend/commands/dbcommands.c
src/bin/pg_rewind/parsexlog.c
src/include/commands/dbcommands.h
src/include/commands/dbcommands_xlog.h [new file with mode: 0644]

index 180818d68b5e82d8e76ad723e6612833f5f809cb..bd3344ccd6d801d58bc7f7280709b91aa8937a8f 100644 (file)
@@ -22,7 +22,7 @@
 #include "access/xact.h"
 #include "access/xlog_internal.h"
 #include "catalog/storage_xlog.h"
-#include "commands/dbcommands.h"
+#include "commands/dbcommands_xlog.h"
 #include "commands/sequence.h"
 #include "commands/tablespace.h"
 #include "rmgrdesc.h"
index de199a3bbdffb411ad7becd1ac2e868b15a59fc3..2220afc5cb245dfb14fea4cdeb41a30d799cde11 100644 (file)
@@ -14,7 +14,7 @@
  */
 #include "postgres.h"
 
-#include "commands/dbcommands.h"
+#include "commands/dbcommands_xlog.h"
 #include "lib/stringinfo.h"
 
 
index dcf423bdd73b7f3c238872d6454f1e73a9d81017..acd825fad4f7707989ba6be0d767f4fb4af3f3a1 100644 (file)
@@ -20,7 +20,7 @@
 #include "access/xact.h"
 #include "access/xlog_internal.h"
 #include "catalog/storage_xlog.h"
-#include "commands/dbcommands.h"
+#include "commands/dbcommands_xlog.h"
 #include "commands/sequence.h"
 #include "commands/tablespace.h"
 #include "storage/standby.h"
index 5e669619bab591547c162b8fa5add12d279773ea..6193f6952bd9522fc098bf0a09a8c8f583275250 100644 (file)
@@ -40,6 +40,7 @@
 #include "catalog/pg_tablespace.h"
 #include "commands/comment.h"
 #include "commands/dbcommands.h"
+#include "commands/dbcommands_xlog.h"
 #include "commands/defrem.h"
 #include "commands/seclabel.h"
 #include "commands/tablespace.h"
index 045e1f2172699a68d6df899015ab056f8391a5e7..ec762d27a6ea8916c457d53c7e7fbbbb7c5cc109 100644 (file)
@@ -9,10 +9,7 @@
  *-------------------------------------------------------------------------
  */
 
-#define FRONTEND 1
-#include "c.h"
-#undef FRONTEND
-#include "postgres.h"
+#include "postgres_fe.h"
 
 #include <unistd.h>
 
@@ -25,7 +22,7 @@
 #include "access/xlogreader.h"
 #include "catalog/pg_control.h"
 #include "catalog/storage_xlog.h"
-#include "commands/dbcommands.h"
+#include "commands/dbcommands_xlog.h"
 
 
 /*
index cb7cc0e228a4278d6e611e0fb39cbc8742ba811c..6d34c8971a49943625f5bf48d9133a0a9539c74d 100644 (file)
 #ifndef DBCOMMANDS_H
 #define DBCOMMANDS_H
 
-#include "access/xlogreader.h"
-#include "lib/stringinfo.h"
 #include "nodes/parsenodes.h"
 
-/* XLOG stuff */
-#define XLOG_DBASE_CREATE              0x00
-#define XLOG_DBASE_DROP                        0x10
-
-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;
-       Oid                     tablespace_id;
-} xl_dbase_drop_rec;
-
 extern Oid     createdb(const CreatedbStmt *stmt);
 extern void dropdb(const char *dbname, bool missing_ok);
 extern Oid     RenameDatabase(const char *oldname, const char *newname);
@@ -63,10 +26,6 @@ extern Oid   AlterDatabaseOwner(const char *dbname, Oid newOwnerId);
 extern Oid     get_database_oid(const char *dbname, bool missingok);
 extern char *get_database_name(Oid dbid);
 
-extern void dbase_redo(XLogReaderState *rptr);
-extern void dbase_desc(StringInfo buf, XLogReaderState *rptr);
-extern const char *dbase_identify(uint8 info);
-
 extern void check_encoding_locale_matches(int encoding, const char *collate, const char *ctype);
 
 #endif   /* DBCOMMANDS_H */
diff --git a/src/include/commands/dbcommands_xlog.h b/src/include/commands/dbcommands_xlog.h
new file mode 100644 (file)
index 0000000..66d4b7f
--- /dev/null
@@ -0,0 +1,59 @@
+/*-------------------------------------------------------------------------
+ *
+ * dbcommands_xlog.h
+ *             Database resource manager XLOG definitions (create/drop database).
+ *
+ *
+ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/commands/dbcommands_xlog.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef DBCOMMANDS_XLOG_H
+#define DBCOMMANDS_XLOG_H
+
+#include "access/xlogreader.h"
+#include "lib/stringinfo.h"
+
+/* record types */
+#define XLOG_DBASE_CREATE              0x00
+#define XLOG_DBASE_DROP                        0x10
+
+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;
+       Oid                     tablespace_id;
+} xl_dbase_drop_rec;
+
+extern void dbase_redo(XLogReaderState *rptr);
+extern void dbase_desc(StringInfo buf, XLogReaderState *rptr);
+extern const char *dbase_identify(uint8 info);
+
+#endif   /* DBCOMMANDS_XLOG_H */