mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 00:46:29 +00:00
Allow repmgr to obtain tablespace's locations from pg 9.2 and later
in which we no longer have a spclocation column in pg_tablespaces
This commit is contained in:
1
HISTORY
1
HISTORY
@@ -41,3 +41,4 @@
|
|||||||
Add CLUSTER SHOW command (Carlo Ascani)
|
Add CLUSTER SHOW command (Carlo Ascani)
|
||||||
Add CLUSTER CLEANUP command (Jaime)
|
Add CLUSTER CLEANUP command (Jaime)
|
||||||
Add function write_primary_conninfo (Marco Nenciarini)
|
Add function write_primary_conninfo (Marco Nenciarini)
|
||||||
|
Teach repmgr how to get tablespace's location in different pg version (Jaime Casanova)
|
||||||
|
|||||||
30
repmgr.c
30
repmgr.c
@@ -940,10 +940,17 @@ do_standby_clone(void)
|
|||||||
* Check if the tablespace locations exists and that we can write to
|
* Check if the tablespace locations exists and that we can write to
|
||||||
* them.
|
* them.
|
||||||
*/
|
*/
|
||||||
sqlquery_snprintf(sqlquery,
|
if (strcmp(master_version, "9.0") == 0 || strcmp(master_version, "9.1") == 0)
|
||||||
"SELECT spclocation "
|
sqlquery_snprintf(sqlquery,
|
||||||
" FROM pg_tablespace "
|
"SELECT spclocation "
|
||||||
"WHERE spcname NOT IN ('pg_default', 'pg_global')");
|
" FROM pg_tablespace "
|
||||||
|
"WHERE spcname NOT IN ('pg_default', 'pg_global')");
|
||||||
|
else
|
||||||
|
sqlquery_snprintf(sqlquery,
|
||||||
|
"SELECT pg_tablespace_location(oid) spclocation "
|
||||||
|
" FROM pg_tablespace "
|
||||||
|
"WHERE spcname NOT IN ('pg_default', 'pg_global')");
|
||||||
|
|
||||||
log_debug("standby clone: %s\n", sqlquery);
|
log_debug("standby clone: %s\n", sqlquery);
|
||||||
|
|
||||||
res = PQexec(conn, sqlquery);
|
res = PQexec(conn, sqlquery);
|
||||||
@@ -1149,10 +1156,17 @@ do_standby_clone(void)
|
|||||||
* find and appropiate rsync option but besides we could someday make all
|
* find and appropiate rsync option but besides we could someday make all
|
||||||
* these rsync happen concurrently
|
* these rsync happen concurrently
|
||||||
*/
|
*/
|
||||||
sqlquery_snprintf(sqlquery,
|
if (strcmp(master_version, "9.0") == 0 || strcmp(master_version, "9.1") == 0)
|
||||||
"SELECT spclocation "
|
sqlquery_snprintf(sqlquery,
|
||||||
" FROM pg_tablespace "
|
"SELECT spclocation "
|
||||||
" WHERE spcname NOT IN ('pg_default', 'pg_global')");
|
" FROM pg_tablespace "
|
||||||
|
" WHERE spcname NOT IN ('pg_default', 'pg_global')");
|
||||||
|
else
|
||||||
|
sqlquery_snprintf(sqlquery,
|
||||||
|
"SELECT pg_tablespace_location(oid) spclocation "
|
||||||
|
" FROM pg_tablespace "
|
||||||
|
" WHERE spcname NOT IN ('pg_default', 'pg_global')");
|
||||||
|
|
||||||
log_debug("standby clone: %s\n", sqlquery);
|
log_debug("standby clone: %s\n", sqlquery);
|
||||||
res = PQexec(conn, sqlquery);
|
res = PQexec(conn, sqlquery);
|
||||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||||
|
|||||||
Reference in New Issue
Block a user