1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-06-20 01:17:49 +02:00

Allow connections to PostgreSQL on abstract domain sockets.

Currently the pg-socket-path option is required to be a valid absolute path but this precludes the use of abstract domain sockets.

Set the option type to string so abstract domain sockets are allowed. This removes some validation but libpq will report if the path is invalid and we don't use it for any other purpose.
This commit is contained in:
David Steele
2025-04-09 14:50:16 -05:00
committed by GitHub
parent 20bfd14b73
commit 68f22aea66
4 changed files with 20 additions and 5 deletions
+14
View File
@@ -92,6 +92,20 @@
<p>Add support for S3/GCS requester pays.</p>
</release-item>
<release-item>
<github-issue id="2529"/>
<github-pull-request id="2535"/>
<release-item-contributor-list>
<release-item-ideator id="chris.bandy"/>
<release-item-contributor id="david.steele"/>
<!-- Actually tester, but we don't have a tag for that yet -->
<release-item-reviewer id="chris.bandy"/>
</release-item-contributor-list>
<p>Allow connections to <postgres/> on abstract domain sockets.</p>
</release-item>
<release-item>
<github-issue id="2410"/>
<github-pull-request id="2526"/>
+2 -1
View File
@@ -1626,10 +1626,11 @@ option:
db-port: {}
db?-port: {}
# Despite the name this option needs to be string type rather than path to allow abstract sockets beginning with @
pg-socket-path:
section: stanza
group: pg
type: path
type: string
required: false
command: pg-database
depend: pg-database
+1 -1
View File
@@ -4407,7 +4407,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] =
PARSE_RULE_OPTION // opt/pg-socket-path
( // opt/pg-socket-path
PARSE_RULE_OPTION_NAME("pg-socket-path"), // opt/pg-socket-path
PARSE_RULE_OPTION_TYPE(Path), // opt/pg-socket-path
PARSE_RULE_OPTION_TYPE(String), // opt/pg-socket-path
PARSE_RULE_OPTION_RESET(true), // opt/pg-socket-path
PARSE_RULE_OPTION_REQUIRED(false), // opt/pg-socket-path
PARSE_RULE_OPTION_SECTION(Stanza), // opt/pg-socket-path
+3 -3
View File
@@ -1823,7 +1823,7 @@ testRun(void)
setenv("PGBACKREST_ONLINE", "y", true);
setenv("PGBACKREST_DELTA", "y", true);
setenv("PGBACKREST_START_FAST", "n", true);
setenv("PGBACKREST_PG1_SOCKET_PATH", "/path/to/socket", true);
setenv("PGBACKREST_PG1_SOCKET_PATH", "@socket", true);
storagePutP(
storageNewWriteP(storageTestWrite, configFile),
@@ -1907,7 +1907,7 @@ testRun(void)
cfgOptionDisplayVar(VARUINT64(STRID5("incr", 0x90dc90)), cfgOptTypeStringId), "incr", "check type display");
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptLockPath), "/", "lock-path is set");
TEST_RESULT_INT(cfgOptionSource(cfgOptLockPath), cfgSourceConfig, "lock-path is source config");
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgSocketPath, 0), "/path/to/socket", "pg1-socket-path is set");
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgSocketPath, 0), "@socket", "pg1-socket-path is set");
TEST_RESULT_INT(cfgOptionIdxSource(cfgOptPgSocketPath, 0), cfgSourceConfig, "pg1-socket-path is config param");
TEST_RESULT_BOOL(cfgOptionBool(cfgOptOnline), false, "online not is set");
TEST_RESULT_STR_Z(cfgOptionDisplay(cfgOptOnline), "false", "online display is false");
@@ -1956,7 +1956,7 @@ testRun(void)
TEST_RESULT_STR_Z(cfgOptionDefault(cfgOptDbTimeout), "30m", "db-timeout default is 30m");
TEST_RESULT_VOID(cfgOptionDefaultSet(cfgOptPgSocketPath, VARSTRDEF("/default")), "set pg-socket-path default");
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgSocketPath, 0), "/path/to/socket", "pg1-socket-path unchanged");
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgSocketPath, 0), "@socket", "pg1-socket-path unchanged");
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgSocketPath, 1), "/default", "pg2-socket-path is new default");
TEST_RESULT_STR_Z(cfgOptionIdxDisplay(cfgOptPgSocketPath, 1), "/default", "pg2-socket-path display");