Rename logical decoding's pg_llog directory to pg_logical.
authorAndres Freund <andres@anarazel.de>
Wed, 2 Jul 2014 19:07:47 +0000 (21:07 +0200)
committerAndres Freund <andres@anarazel.de>
Wed, 9 Jul 2014 11:25:25 +0000 (13:25 +0200)
The old name wasn't very descriptive as of actual contents of the
directory, which are historical snapshots in the snapshots/
subdirectory and mappingdata for rewritten tuples in
mappings/. There's been a fair amount of discussion what would be a
good name. I'm settling for pg_logical because it's likely that
further data around logical decoding and replication will need saving
in the future.

Also add the missing entry for the directory into storage.sgml's list
of PGDATA contents.

Bumps catversion as the data directories won't be compatible.

Backpatch to 9.4, which I missed to do as Michael Paquier luckily
noticed. As there already has been a catversion bump after 9.4beta1,
there's no reasons for having 9.4 diverge from master.

doc/src/sgml/storage.sgml
src/backend/access/heap/rewriteheap.c
src/backend/replication/logical/reorderbuffer.c
src/backend/replication/logical/snapbuild.c
src/bin/initdb/initdb.c
src/include/catalog/catversion.h

index 330e385aa3c625d768fa5ec9d1b6ac623b7ed10c..4c7fb6c6fa51d9a362e4916e856122a73ee5150a 100644 (file)
@@ -77,6 +77,11 @@ Item
   subsystem</entry>
 </row>
 
+<row>
+ <entry><filename>pg_logical</></entry>
+ <entry>Subdirectory containing status data for logical decoding</entry>
+</row>
+
 <row>
  <entry><filename>pg_multixact</></entry>
  <entry>Subdirectory containing multitransaction status data
index 687e76e6db670b74cc1c9302a821cf609f2aa2eb..0fc9266e8bde7647a81d2d65d3f8e45b727ef2f4 100644 (file)
@@ -1009,7 +1009,7 @@ logical_rewrite_log_mapping(RewriteState state, TransactionId xid,
                        dboid = MyDatabaseId;
 
                snprintf(path, MAXPGPATH,
-                                "pg_llog/mappings/" LOGICAL_REWRITE_FORMAT,
+                                "pg_logical/mappings/" LOGICAL_REWRITE_FORMAT,
                                 dboid, relid,
                                 (uint32) (state->rs_begin_lsn >> 32),
                                 (uint32) state->rs_begin_lsn,
@@ -1133,7 +1133,7 @@ heap_xlog_logical_rewrite(XLogRecPtr lsn, XLogRecord *r)
        xlrec = (xl_heap_rewrite_mapping *) XLogRecGetData(r);
 
        snprintf(path, MAXPGPATH,
-                        "pg_llog/mappings/" LOGICAL_REWRITE_FORMAT,
+                        "pg_logical/mappings/" LOGICAL_REWRITE_FORMAT,
                         xlrec->mapped_db, xlrec->mapped_rel,
                         (uint32) (xlrec->start_lsn >> 32),
                         (uint32) xlrec->start_lsn,
@@ -1219,8 +1219,8 @@ CheckPointLogicalRewriteHeap(void)
        if (cutoff != InvalidXLogRecPtr && redo < cutoff)
                cutoff = redo;
 
-       mappings_dir = AllocateDir("pg_llog/mappings");
-       while ((mapping_de = ReadDir(mappings_dir, "pg_llog/mappings")) != NULL)
+       mappings_dir = AllocateDir("pg_logical/mappings");
+       while ((mapping_de = ReadDir(mappings_dir, "pg_logical/mappings")) != NULL)
        {
                struct stat statbuf;
                Oid                     dboid;
@@ -1235,7 +1235,7 @@ CheckPointLogicalRewriteHeap(void)
                        strcmp(mapping_de->d_name, "..") == 0)
                        continue;
 
-               snprintf(path, MAXPGPATH, "pg_llog/mappings/%s", mapping_de->d_name);
+               snprintf(path, MAXPGPATH, "pg_logical/mappings/%s", mapping_de->d_name);
                if (lstat(path, &statbuf) == 0 && !S_ISREG(statbuf.st_mode))
                        continue;
 
index fc1ab1b0ee5232e75425264fb6521e5951e81bac..2b0929cb78bd8c19a6632fd3742f507814e94a67 100644 (file)
@@ -2795,7 +2795,7 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname)
        int                     readBytes;
        LogicalRewriteMappingData map;
 
-       sprintf(path, "pg_llog/mappings/%s", fname);
+       sprintf(path, "pg_logical/mappings/%s", fname);
        fd = OpenTransientFile(path, O_RDONLY | PG_BINARY, 0);
        if (fd < 0)
                ereport(ERROR,
@@ -2915,8 +2915,8 @@ UpdateLogicalMappings(HTAB *tuplecid_data, Oid relid, Snapshot snapshot)
        size_t          off;
        Oid                     dboid = IsSharedRelation(relid) ? InvalidOid : MyDatabaseId;
 
-       mapping_dir = AllocateDir("pg_llog/mappings");
-       while ((mapping_de = ReadDir(mapping_dir, "pg_llog/mappings")) != NULL)
+       mapping_dir = AllocateDir("pg_logical/mappings");
+       while ((mapping_de = ReadDir(mapping_dir, "pg_logical/mappings")) != NULL)
        {
                Oid                     f_dboid;
                Oid                     f_relid;
index 196c1880337b08d80f337844f659364bd41cfe30..3319497603f00eaced657a99b3ae7cc191e8c5ac 100644 (file)
@@ -1452,7 +1452,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
         * unless the user used pg_resetxlog or similar. If a user did so, there's
         * no hope continuing to decode anyway.
         */
-       sprintf(path, "pg_llog/snapshots/%X-%X.snap",
+       sprintf(path, "pg_logical/snapshots/%X-%X.snap",
                        (uint32) (lsn >> 32), (uint32) lsn);
 
        /*
@@ -1478,7 +1478,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
                 * be safely on disk.
                 */
                fsync_fname(path, false);
-               fsync_fname("pg_llog/snapshots", true);
+               fsync_fname("pg_logical/snapshots", true);
 
                builder->last_serialized_snapshot = lsn;
                goto out;
@@ -1494,7 +1494,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
        elog(DEBUG1, "serializing snapshot to %s", path);
 
        /* to make sure only we will write to this tempfile, include pid */
-       sprintf(tmppath, "pg_llog/snapshots/%X-%X.snap.%u.tmp",
+       sprintf(tmppath, "pg_logical/snapshots/%X-%X.snap.%u.tmp",
                        (uint32) (lsn >> 32), (uint32) lsn, MyProcPid);
 
        /*
@@ -1580,7 +1580,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
        }
        CloseTransientFile(fd);
 
-       fsync_fname("pg_llog/snapshots", true);
+       fsync_fname("pg_logical/snapshots", true);
 
        /*
         * We may overwrite the work from some other backend, but that's ok, our
@@ -1596,7 +1596,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
 
        /* make sure we persist */
        fsync_fname(path, false);
-       fsync_fname("pg_llog/snapshots", true);
+       fsync_fname("pg_logical/snapshots", true);
 
        /*
         * Now there's no way we can loose the dumped state anymore, remember this
@@ -1627,7 +1627,7 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
        if (builder->state == SNAPBUILD_CONSISTENT)
                return false;
 
-       sprintf(path, "pg_llog/snapshots/%X-%X.snap",
+       sprintf(path, "pg_logical/snapshots/%X-%X.snap",
                        (uint32) (lsn >> 32), (uint32) lsn);
 
        fd = OpenTransientFile(path, O_RDONLY | PG_BINARY, 0);
@@ -1648,7 +1648,7 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
         * ----
         */
        fsync_fname(path, false);
-       fsync_fname("pg_llog/snapshots", true);
+       fsync_fname("pg_logical/snapshots", true);
 
 
        /* read statically sized portion of snapshot */
@@ -1825,8 +1825,8 @@ CheckPointSnapBuild(void)
        if (redo < cutoff)
                cutoff = redo;
 
-       snap_dir = AllocateDir("pg_llog/snapshots");
-       while ((snap_de = ReadDir(snap_dir, "pg_llog/snapshots")) != NULL)
+       snap_dir = AllocateDir("pg_logical/snapshots");
+       while ((snap_de = ReadDir(snap_dir, "pg_logical/snapshots")) != NULL)
        {
                uint32          hi;
                uint32          lo;
@@ -1837,7 +1837,7 @@ CheckPointSnapBuild(void)
                        strcmp(snap_de->d_name, "..") == 0)
                        continue;
 
-               snprintf(path, MAXPGPATH, "pg_llog/snapshots/%s", snap_de->d_name);
+               snprintf(path, MAXPGPATH, "pg_logical/snapshots/%s", snap_de->d_name);
 
                if (lstat(path, &statbuf) == 0 && !S_ISREG(statbuf.st_mode))
                {
index 5228f1342224efe830e309ec60633ec2c4b1c57f..a3db0d2ef4ee33e0d784600d734d7ab07b64dfad 100644 (file)
@@ -199,9 +199,9 @@ static const char *subdirs[] = {
        "pg_tblspc",
        "pg_stat",
        "pg_stat_tmp",
-       "pg_llog",
-       "pg_llog/snapshots",
-       "pg_llog/mappings"
+       "pg_logical",
+       "pg_logical/snapshots",
+       "pg_logical/mappings"
 };
 
 
index 302c5fc19046666b54fba090114c8cd68a3f2612..55e315f981d039df69db2aa0967805bad8e59a3a 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     201406291
+#define CATALOG_VERSION_NO     201407091
 
 #endif