Rename 'bdr' reserved db to 'bdr_supervisordb'
authorCraig Ringer <craig@2ndquadrant.com>
Tue, 21 Apr 2015 10:52:08 +0000 (18:52 +0800)
committerCraig Ringer <craig@2ndquadrant.com>
Tue, 21 Apr 2015 10:52:08 +0000 (18:52 +0800)
bdr.h
bdr_supervisor.c

diff --git a/bdr.h b/bdr.h
index 76e9b1b3850fc70580f2021f55030572cff30711..4f37d3fd1b5d023aedb4cffe63ab9181e084c0a1 100644 (file)
--- a/bdr.h
+++ b/bdr.h
@@ -51,6 +51,7 @@
 #define BDR_DUMP_CMD "pg_dump"
 #endif
 
+#define BDR_SUPERVISOR_DBNAME "bdr_supervisordb"
 
 /*
  * Don't include libpq here, msvc infrastructure requires linking to libpq
index 6c1a119970709c60366fd422a839596768db0f49..25cce638eb56c069180d6de9f18fe8c9a26e46c4 100644 (file)
@@ -263,7 +263,7 @@ bdr_supervisor_createdb()
    StartTransactionCommand();
 
    /* If the DB already exists, no need to create it */
-   dboid = get_database_oid("bdr", true);
+   dboid = get_database_oid(BDR_SUPERVISOR_DBNAME, true);
 
    if (dboid == InvalidOid)
    {
@@ -279,21 +279,21 @@ bdr_supervisor_createdb()
        de_template.type = T_Integer;
        de_connlimit.arg = (Node*) makeInteger(1);
 
-       stmt.dbname = "bdr";
+       stmt.dbname = BDR_SUPERVISOR_DBNAME;
        stmt.options = list_make2(&de_template, &de_connlimit);
 
        dboid = createdb(&stmt);
 
        if (dboid == InvalidOid)
-           elog(ERROR, "Failed to create 'bdr' DB");
+           elog(ERROR, "Failed to create "BDR_SUPERVISOR_DBNAME" DB");
 
        /* TODO DYNCONF: Add a comment to the db, and/or a dummy table */
 
-       elog(LOG, "Created database 'bdr' (oid=%i) during BDR startup", dboid);
+       elog(LOG, "Created database "BDR_SUPERVISOR_DBNAME" (oid=%i) during BDR startup", dboid);
    }
    else
    {
-       elog(DEBUG3, "Database 'bdr' (oid=%i) already exists, not creating", dboid);
+       elog(DEBUG3, "Database "BDR_SUPERVISOR_DBNAME" (oid=%i) already exists, not creating", dboid);
    }
 
    CommitTransactionCommand();
@@ -331,8 +331,10 @@ bdr_supervisor_worker_main(Datum main_arg)
     * can be accessed before being connected to a database - and
     * pg_shseclabel is not one of those.
     *
-    * Instead we have a database "bdr" that's supposed to be empty which we
-    * just use to read pg_shseclabel. Not pretty, but it works.
+    * Instead we have a database BDR_SUPERVISOR_DBNAME that's supposed to
+    * be empty which we just use to read pg_shseclabel. Not pretty, but it
+    * works. (The need for this goes away in 9.5 with the new oid-based
+    * alternative bgworker api).
     *
     * Without copying significant parts of InitPostgres() we can't even read
     * pg_database without connecting to a database.  As we can't connect to
@@ -353,13 +355,13 @@ bdr_supervisor_worker_main(Datum main_arg)
        proc_exit(1);
    }
 
-   BackgroundWorkerInitializeConnection("bdr", NULL);
+   BackgroundWorkerInitializeConnection(BDR_SUPERVISOR_DBNAME, NULL);
 
    LWLockAcquire(BdrWorkerCtl->lock, LW_EXCLUSIVE);
    BdrWorkerCtl->supervisor_latch = &MyProc->procLatch;
    LWLockRelease(BdrWorkerCtl->lock);
 
-   elog(DEBUG1, "BDR supervisor connected to DB 'bdr'");
+   elog(DEBUG1, "BDR supervisor connected to DB "BDR_SUPERVISOR_DBNAME);
 
    SetConfigOption("application_name", "bdr supervisor", PGC_USERSET, PGC_S_SESSION);