Skip to content

Commit da33a38

Browse files
committed
Revert exporting of internal GUC variable "data_directory".
This undoes a poorly-thought-out choice in commit 970a186, namely to export guc.c's internal variable data_directory. The authoritative variable so far as C code is concerned is DataDir; there is no reason for anything except specific bits of GUC code to look at the GUC variable. After yesterday's commits fixing the fsync-on-restart patch, the only remaining misuse of data_directory was in AlterSystemSetConfigFile(), which would be much better off just using a relative path anyhow: it's less code and it doesn't break if the DBA moves the data directory of a running system, which is a case we've taken some pains over in the past. This is mostly cosmetic, so no need for a back-patch (and I'd be hesitant to remove a global variable in stable branches anyway).
1 parent d8179b0 commit da33a38

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/backend/utils/misc/guc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,6 @@ int temp_file_limit = -1;
435435
int num_temp_buffers = 1024;
436436

437437
char *cluster_name = "";
438-
char *data_directory;
439438
char *ConfigFileName;
440439
char *HbaFileName;
441440
char *IdentFileName;
@@ -476,6 +475,7 @@ static char *timezone_string;
476475
static char *log_timezone_string;
477476
static char *timezone_abbreviations_string;
478477
static char *XactIsoLevel_string;
478+
static char *data_directory;
479479
static char *session_authorization_string;
480480
static int max_function_args;
481481
static int max_index_keys;
@@ -6895,11 +6895,11 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
68956895
}
68966896

68976897
/*
6898-
* Use data directory as reference path for PG_AUTOCONF_FILENAME and its
6899-
* corresponding temporary file.
6898+
* PG_AUTOCONF_FILENAME and its corresponding temporary file are always in
6899+
* the data directory, so we can reference them by simple relative paths.
69006900
*/
6901-
join_path_components(AutoConfFileName, data_directory, PG_AUTOCONF_FILENAME);
6902-
canonicalize_path(AutoConfFileName);
6901+
snprintf(AutoConfFileName, sizeof(AutoConfFileName), "%s",
6902+
PG_AUTOCONF_FILENAME);
69036903
snprintf(AutoConfTmpFileName, sizeof(AutoConfTmpFileName), "%s.%s",
69046904
AutoConfFileName,
69056905
"tmp");

src/include/utils/guc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ extern int temp_file_limit;
247247
extern int num_temp_buffers;
248248

249249
extern char *cluster_name;
250-
extern char *data_directory;
251250
extern char *ConfigFileName;
252251
extern char *HbaFileName;
253252
extern char *IdentFileName;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy