diff options
author | Michael Paquier <michael@paquier.xyz> | 2024-08-30 15:25:12 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2024-08-30 15:25:12 +0900 |
commit | c39afc38cfec7c34b883095062a89a63b221521a (patch) | |
tree | 1784942625e22136eaa9d22802fadc4d9561d452 /src/backend/access/heap | |
parent | 2065ddf5e34ce098f549c4279ee3ab33c188a764 (diff) | |
download | postgresql-c39afc38cfec7c34b883095062a89a63b221521a.tar.gz postgresql-c39afc38cfec7c34b883095062a89a63b221521a.zip |
Define PG_LOGICAL_DIR for path pg_logical/ in data folder
This is similar to 2065ddf5e34c, but this time for pg_logical/ itself
and its contents, like the paths for snapshots, mappings or origin
checkpoints.
Author: Bertrand Drouvot
Reviewed-by: Ashutosh Bapat, Yugo Nagata, Michael Paquier
Discussion: https://postgr.es/m/ZryVvjqS9SnV1GPP@ip-10-97-1-34.eu-west-3.compute.internal
Diffstat (limited to 'src/backend/access/heap')
-rw-r--r-- | src/backend/access/heap/rewriteheap.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c index 473f3aa9bef..09ef2204497 100644 --- a/src/backend/access/heap/rewriteheap.c +++ b/src/backend/access/heap/rewriteheap.c @@ -961,8 +961,8 @@ logical_rewrite_log_mapping(RewriteState state, TransactionId xid, dboid = MyDatabaseId; snprintf(path, MAXPGPATH, - "pg_logical/mappings/" LOGICAL_REWRITE_FORMAT, - dboid, relid, + "%s/" LOGICAL_REWRITE_FORMAT, + PG_LOGICAL_MAPPINGS_DIR, dboid, relid, LSN_FORMAT_ARGS(state->rs_begin_lsn), xid, GetCurrentTransactionId()); @@ -1081,8 +1081,8 @@ heap_xlog_logical_rewrite(XLogReaderState *r) xlrec = (xl_heap_rewrite_mapping *) XLogRecGetData(r); snprintf(path, MAXPGPATH, - "pg_logical/mappings/" LOGICAL_REWRITE_FORMAT, - xlrec->mapped_db, xlrec->mapped_rel, + "%s/" LOGICAL_REWRITE_FORMAT, + PG_LOGICAL_MAPPINGS_DIR, xlrec->mapped_db, xlrec->mapped_rel, LSN_FORMAT_ARGS(xlrec->start_lsn), xlrec->mapped_xid, XLogRecGetXid(r)); @@ -1158,7 +1158,7 @@ CheckPointLogicalRewriteHeap(void) XLogRecPtr redo; DIR *mappings_dir; struct dirent *mapping_de; - char path[MAXPGPATH + 20]; + char path[MAXPGPATH + sizeof(PG_LOGICAL_MAPPINGS_DIR)]; /* * We start of with a minimum of the last redo pointer. No new decoding @@ -1173,8 +1173,8 @@ CheckPointLogicalRewriteHeap(void) if (cutoff != InvalidXLogRecPtr && redo < cutoff) cutoff = redo; - mappings_dir = AllocateDir("pg_logical/mappings"); - while ((mapping_de = ReadDir(mappings_dir, "pg_logical/mappings")) != NULL) + mappings_dir = AllocateDir(PG_LOGICAL_MAPPINGS_DIR); + while ((mapping_de = ReadDir(mappings_dir, PG_LOGICAL_MAPPINGS_DIR)) != NULL) { Oid dboid; Oid relid; @@ -1189,7 +1189,7 @@ CheckPointLogicalRewriteHeap(void) strcmp(mapping_de->d_name, "..") == 0) continue; - snprintf(path, sizeof(path), "pg_logical/mappings/%s", mapping_de->d_name); + snprintf(path, sizeof(path), "%s/%s", PG_LOGICAL_MAPPINGS_DIR, mapping_de->d_name); de_type = get_dirent_type(path, mapping_de, false, DEBUG1); if (de_type != PGFILETYPE_ERROR && de_type != PGFILETYPE_REG) @@ -1249,5 +1249,5 @@ CheckPointLogicalRewriteHeap(void) FreeDir(mappings_dir); /* persist directory entries to disk */ - fsync_fname("pg_logical/mappings", true); + fsync_fname(PG_LOGICAL_MAPPINGS_DIR, true); } |