mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 15:16: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:
7
HISTORY
7
HISTORY
@@ -35,3 +35,10 @@
|
||||
Add --ignore-rsync-warning (Cédric)
|
||||
Add strnlen for compatibility with OS X (Greg)
|
||||
Improve performance of the repl_status view (Jaime)
|
||||
|
||||
1.2.0 2012-06-15
|
||||
Test ssh connection before trying to rsync (Cédric)
|
||||
Add CLUSTER SHOW command (Carlo Ascani)
|
||||
Add CLUSTER CLEANUP command (Jaime)
|
||||
Add function write_primary_conninfo (Marco Nenciarini)
|
||||
Teach repmgr how to get tablespace's location in different pg version (Jaime Casanova)
|
||||
|
||||
35
repmgr.c
35
repmgr.c
@@ -790,11 +790,18 @@ do_standby_clone(void)
|
||||
* Check if the tablespace locations exists and that we can write to
|
||||
* them.
|
||||
*/
|
||||
sqlquery_snprintf(sqlquery,
|
||||
"SELECT spclocation "
|
||||
" FROM pg_tablespace "
|
||||
"WHERE spcname NOT IN ('pg_default', 'pg_global')");
|
||||
log_debug(_("standby clone: %s\n"), sqlquery);
|
||||
if (strcmp(master_version, "9.0") == 0 || strcmp(master_version, "9.1") == 0)
|
||||
sqlquery_snprintf(sqlquery,
|
||||
"SELECT spclocation "
|
||||
" 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);
|
||||
|
||||
res = PQexec(conn, sqlquery);
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||
@@ -1009,11 +1016,19 @@ do_standby_clone(void)
|
||||
* XXX We may not do that if we are in test_mode but it does not hurt too much
|
||||
* (except if a tablespace is created during the test)
|
||||
*/
|
||||
sqlquery_snprintf(sqlquery,
|
||||
"SELECT spclocation "
|
||||
" FROM pg_tablespace "
|
||||
" WHERE spcname NOT IN ('pg_default', 'pg_global')");
|
||||
log_debug(_("standby clone: %s\n"), sqlquery);
|
||||
if (strcmp(master_version, "9.0") == 0 || strcmp(master_version, "9.1") == 0)
|
||||
sqlquery_snprintf(sqlquery,
|
||||
"SELECT spclocation "
|
||||
" 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);
|
||||
|
||||
res = PQexec(conn, sqlquery);
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user