Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6fe2440

Browse files
committed
Rename logical decoding's pg_llog directory to pg_logical.
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.
1 parent 8adb476 commit 6fe2440

File tree

6 files changed

+27
-22
lines changed

6 files changed

+27
-22
lines changed

doc/src/sgml/storage.sgml

+5
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ Item
7777
subsystem</entry>
7878
</row>
7979

80+
<row>
81+
<entry><filename>pg_logical</></entry>
82+
<entry>Subdirectory containing status data for logical decoding</entry>
83+
</row>
84+
8085
<row>
8186
<entry><filename>pg_multixact</></entry>
8287
<entry>Subdirectory containing multitransaction status data

src/backend/access/heap/rewriteheap.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ logical_rewrite_log_mapping(RewriteState state, TransactionId xid,
10091009
dboid = MyDatabaseId;
10101010

10111011
snprintf(path, MAXPGPATH,
1012-
"pg_llog/mappings/" LOGICAL_REWRITE_FORMAT,
1012+
"pg_logical/mappings/" LOGICAL_REWRITE_FORMAT,
10131013
dboid, relid,
10141014
(uint32) (state->rs_begin_lsn >> 32),
10151015
(uint32) state->rs_begin_lsn,
@@ -1133,7 +1133,7 @@ heap_xlog_logical_rewrite(XLogRecPtr lsn, XLogRecord *r)
11331133
xlrec = (xl_heap_rewrite_mapping *) XLogRecGetData(r);
11341134

11351135
snprintf(path, MAXPGPATH,
1136-
"pg_llog/mappings/" LOGICAL_REWRITE_FORMAT,
1136+
"pg_logical/mappings/" LOGICAL_REWRITE_FORMAT,
11371137
xlrec->mapped_db, xlrec->mapped_rel,
11381138
(uint32) (xlrec->start_lsn >> 32),
11391139
(uint32) xlrec->start_lsn,
@@ -1219,8 +1219,8 @@ CheckPointLogicalRewriteHeap(void)
12191219
if (cutoff != InvalidXLogRecPtr && redo < cutoff)
12201220
cutoff = redo;
12211221

1222-
mappings_dir = AllocateDir("pg_llog/mappings");
1223-
while ((mapping_de = ReadDir(mappings_dir, "pg_llog/mappings")) != NULL)
1222+
mappings_dir = AllocateDir("pg_logical/mappings");
1223+
while ((mapping_de = ReadDir(mappings_dir, "pg_logical/mappings")) != NULL)
12241224
{
12251225
struct stat statbuf;
12261226
Oid dboid;
@@ -1235,7 +1235,7 @@ CheckPointLogicalRewriteHeap(void)
12351235
strcmp(mapping_de->d_name, "..") == 0)
12361236
continue;
12371237

1238-
snprintf(path, MAXPGPATH, "pg_llog/mappings/%s", mapping_de->d_name);
1238+
snprintf(path, MAXPGPATH, "pg_logical/mappings/%s", mapping_de->d_name);
12391239
if (lstat(path, &statbuf) == 0 && !S_ISREG(statbuf.st_mode))
12401240
continue;
12411241

src/backend/replication/logical/reorderbuffer.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -2795,7 +2795,7 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname)
27952795
int readBytes;
27962796
LogicalRewriteMappingData map;
27972797

2798-
sprintf(path, "pg_llog/mappings/%s", fname);
2798+
sprintf(path, "pg_logical/mappings/%s", fname);
27992799
fd = OpenTransientFile(path, O_RDONLY | PG_BINARY, 0);
28002800
if (fd < 0)
28012801
ereport(ERROR,
@@ -2915,8 +2915,8 @@ UpdateLogicalMappings(HTAB *tuplecid_data, Oid relid, Snapshot snapshot)
29152915
size_t off;
29162916
Oid dboid = IsSharedRelation(relid) ? InvalidOid : MyDatabaseId;
29172917

2918-
mapping_dir = AllocateDir("pg_llog/mappings");
2919-
while ((mapping_de = ReadDir(mapping_dir, "pg_llog/mappings")) != NULL)
2918+
mapping_dir = AllocateDir("pg_logical/mappings");
2919+
while ((mapping_de = ReadDir(mapping_dir, "pg_logical/mappings")) != NULL)
29202920
{
29212921
Oid f_dboid;
29222922
Oid f_relid;

src/backend/replication/logical/snapbuild.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
14521452
* unless the user used pg_resetxlog or similar. If a user did so, there's
14531453
* no hope continuing to decode anyway.
14541454
*/
1455-
sprintf(path, "pg_llog/snapshots/%X-%X.snap",
1455+
sprintf(path, "pg_logical/snapshots/%X-%X.snap",
14561456
(uint32) (lsn >> 32), (uint32) lsn);
14571457

14581458
/*
@@ -1478,7 +1478,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
14781478
* be safely on disk.
14791479
*/
14801480
fsync_fname(path, false);
1481-
fsync_fname("pg_llog/snapshots", true);
1481+
fsync_fname("pg_logical/snapshots", true);
14821482

14831483
builder->last_serialized_snapshot = lsn;
14841484
goto out;
@@ -1494,7 +1494,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
14941494
elog(DEBUG1, "serializing snapshot to %s", path);
14951495

14961496
/* to make sure only we will write to this tempfile, include pid */
1497-
sprintf(tmppath, "pg_llog/snapshots/%X-%X.snap.%u.tmp",
1497+
sprintf(tmppath, "pg_logical/snapshots/%X-%X.snap.%u.tmp",
14981498
(uint32) (lsn >> 32), (uint32) lsn, MyProcPid);
14991499

15001500
/*
@@ -1580,7 +1580,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
15801580
}
15811581
CloseTransientFile(fd);
15821582

1583-
fsync_fname("pg_llog/snapshots", true);
1583+
fsync_fname("pg_logical/snapshots", true);
15841584

15851585
/*
15861586
* We may overwrite the work from some other backend, but that's ok, our
@@ -1596,7 +1596,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
15961596

15971597
/* make sure we persist */
15981598
fsync_fname(path, false);
1599-
fsync_fname("pg_llog/snapshots", true);
1599+
fsync_fname("pg_logical/snapshots", true);
16001600

16011601
/*
16021602
* Now there's no way we can loose the dumped state anymore, remember this
@@ -1627,7 +1627,7 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
16271627
if (builder->state == SNAPBUILD_CONSISTENT)
16281628
return false;
16291629

1630-
sprintf(path, "pg_llog/snapshots/%X-%X.snap",
1630+
sprintf(path, "pg_logical/snapshots/%X-%X.snap",
16311631
(uint32) (lsn >> 32), (uint32) lsn);
16321632

16331633
fd = OpenTransientFile(path, O_RDONLY | PG_BINARY, 0);
@@ -1648,7 +1648,7 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
16481648
* ----
16491649
*/
16501650
fsync_fname(path, false);
1651-
fsync_fname("pg_llog/snapshots", true);
1651+
fsync_fname("pg_logical/snapshots", true);
16521652

16531653

16541654
/* read statically sized portion of snapshot */
@@ -1825,8 +1825,8 @@ CheckPointSnapBuild(void)
18251825
if (redo < cutoff)
18261826
cutoff = redo;
18271827

1828-
snap_dir = AllocateDir("pg_llog/snapshots");
1829-
while ((snap_de = ReadDir(snap_dir, "pg_llog/snapshots")) != NULL)
1828+
snap_dir = AllocateDir("pg_logical/snapshots");
1829+
while ((snap_de = ReadDir(snap_dir, "pg_logical/snapshots")) != NULL)
18301830
{
18311831
uint32 hi;
18321832
uint32 lo;
@@ -1837,7 +1837,7 @@ CheckPointSnapBuild(void)
18371837
strcmp(snap_de->d_name, "..") == 0)
18381838
continue;
18391839

1840-
snprintf(path, MAXPGPATH, "pg_llog/snapshots/%s", snap_de->d_name);
1840+
snprintf(path, MAXPGPATH, "pg_logical/snapshots/%s", snap_de->d_name);
18411841

18421842
if (lstat(path, &statbuf) == 0 && !S_ISREG(statbuf.st_mode))
18431843
{

src/bin/initdb/initdb.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ static const char *subdirs[] = {
199199
"pg_tblspc",
200200
"pg_stat",
201201
"pg_stat_tmp",
202-
"pg_llog",
203-
"pg_llog/snapshots",
204-
"pg_llog/mappings"
202+
"pg_logical",
203+
"pg_logical/snapshots",
204+
"pg_logical/mappings"
205205
};
206206

207207

src/include/catalog/catversion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 201406291
56+
#define CATALOG_VERSION_NO 201407091
5757

5858
#endif

0 commit comments

Comments
 (0)