From c7cd2d6ed082a4638172acece33ed6f36da96263 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Tue, 3 Sep 2024 09:11:54 +0900 Subject: Define PG_TBLSPC_DIR for path pg_tblspc/ in data folder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similarly to 2065ddf5e34c, this introduces a define for "pg_tblspc". This makes the style more consistent with the existing PG_STAT_TMP_DIR, for example. There is a difference with the other cases with the introduction of PG_TBLSPC_DIR_SLASH, required in two places for recovery and backups. Author: Bertrand Drouvot Reviewed-by: Ashutosh Bapat, Álvaro Herrera, Yugo Nagata, Michael Paquier Discussion: https://postgr.es/m/ZryVvjqS9SnV1GPP@ip-10-97-1-34.eu-west-3.compute.internal --- src/backend/storage/file/reinit.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/backend/storage/file/reinit.c') diff --git a/src/backend/storage/file/reinit.c b/src/backend/storage/file/reinit.c index f1cd1a38d95..01e267abf9b 100644 --- a/src/backend/storage/file/reinit.c +++ b/src/backend/storage/file/reinit.c @@ -46,7 +46,7 @@ typedef struct void ResetUnloggedRelations(int op) { - char temp_path[MAXPGPATH + 10 + sizeof(TABLESPACE_VERSION_DIRECTORY)]; + char temp_path[MAXPGPATH + sizeof(PG_TBLSPC_DIR) + sizeof(TABLESPACE_VERSION_DIRECTORY)]; DIR *spc_dir; struct dirent *spc_de; MemoryContext tmpctx, @@ -77,16 +77,16 @@ ResetUnloggedRelations(int op) /* * Cycle through directories for all non-default tablespaces. */ - spc_dir = AllocateDir("pg_tblspc"); + spc_dir = AllocateDir(PG_TBLSPC_DIR); - while ((spc_de = ReadDir(spc_dir, "pg_tblspc")) != NULL) + while ((spc_de = ReadDir(spc_dir, PG_TBLSPC_DIR)) != NULL) { if (strcmp(spc_de->d_name, ".") == 0 || strcmp(spc_de->d_name, "..") == 0) continue; - snprintf(temp_path, sizeof(temp_path), "pg_tblspc/%s/%s", - spc_de->d_name, TABLESPACE_VERSION_DIRECTORY); + snprintf(temp_path, sizeof(temp_path), "%s/%s/%s", + PG_TBLSPC_DIR, spc_de->d_name, TABLESPACE_VERSION_DIRECTORY); ResetUnloggedRelationsInTablespaceDir(temp_path, op); } -- cgit v1.2.3