mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
standby clone: don't error out if unable to determine cluster size
The cluster size check is purely informative, and is not in any way essential for the standby clone operation. As it's possible the query may fail if the repmgr user does not have sufficient privileges to query all databases in the cluster, we can simply ignore any failure. Note that the code comment indicated the query also served to sanity- check that queries can actually be executed. While this was the case historically, the preceding server version check now serves the same purpose and will not have the same risk of failure due to missing permissions.
This commit is contained in:
1
HISTORY
1
HISTORY
@@ -1,5 +1,6 @@
|
|||||||
5.3.1 2022-??-??
|
5.3.1 2022-??-??
|
||||||
repmgrd: fixes for potential connection leaks (hslightdb)
|
repmgrd: fixes for potential connection leaks (hslightdb)
|
||||||
|
standby clone: don't error out if unable to determine cluster size (Ian)
|
||||||
|
|
||||||
5.3.0 2021-10-12
|
5.3.0 2021-10-12
|
||||||
standby switchover: improve handling of node rejoin failure (Ian)
|
standby switchover: improve handling of node rejoin failure (Ian)
|
||||||
|
|||||||
@@ -1291,21 +1291,16 @@ get_cluster_size(PGconn *conn, char *size)
|
|||||||
initPQExpBuffer(&query);
|
initPQExpBuffer(&query);
|
||||||
appendPQExpBufferStr(&query,
|
appendPQExpBufferStr(&query,
|
||||||
"SELECT pg_catalog.pg_size_pretty(pg_catalog.sum(pg_catalog.pg_database_size(oid))::bigint) "
|
"SELECT pg_catalog.pg_size_pretty(pg_catalog.sum(pg_catalog.pg_database_size(oid))::bigint) "
|
||||||
" FROM pg_catalog.pg_database ");
|
" FROM pg_catalog.pg_database ");
|
||||||
|
|
||||||
log_verbose(LOG_DEBUG, "get_cluster_size():\n%s", query.data);
|
log_verbose(LOG_DEBUG, "get_cluster_size():\n%s", query.data);
|
||||||
|
|
||||||
res = PQexec(conn, query.data);
|
res = PQexec(conn, query.data);
|
||||||
|
|
||||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||||
{
|
|
||||||
log_db_error(conn, query.data, _("get_cluster_size(): unable to execute query"));
|
|
||||||
success = false;
|
success = false;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
snprintf(size, MAXLEN, "%s", PQgetvalue(res, 0, 0));
|
snprintf(size, MAXLEN, "%s", PQgetvalue(res, 0, 0));
|
||||||
}
|
|
||||||
|
|
||||||
termPQExpBuffer(&query);
|
termPQExpBuffer(&query);
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
|||||||
@@ -14,10 +14,35 @@
|
|||||||
<para>
|
<para>
|
||||||
See also: <xref linkend="upgrading-repmgr"/>
|
See also: <xref linkend="upgrading-repmgr"/>
|
||||||
</para>
|
</para>
|
||||||
|
<sect1 id="release-5.3.2">
|
||||||
|
<title id="release-current">Release 5.3.2</title>
|
||||||
|
<para><emphasis>??? ??? ???, 2022</emphasis></para>
|
||||||
|
<para>
|
||||||
|
&repmgr; 5.3.2 is a minor release.
|
||||||
|
</para>
|
||||||
|
<sect2>
|
||||||
|
<title>Bug fixes</title>
|
||||||
|
<para>
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
<command><link linkend="repmgr-standby-clone">repmgr standby clone</link></command>:
|
||||||
|
don't treat inability to determine the cluster size as a fatal error.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
The cluster size is displayed for informational purposes and is not essential
|
||||||
|
for execution of the clone operation. As the &repmgr; user may not have permissions
|
||||||
|
for all databases in the cluster, ignore the cluster size query if it fails.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</itemizedlist>
|
||||||
|
</para>
|
||||||
|
</sect2>
|
||||||
|
</sect1>
|
||||||
|
|
||||||
<!-- remember to update the release date in ../repmgr_version.h.in -->
|
<!-- remember to update the release date in ../repmgr_version.h.in -->
|
||||||
<sect1 id="release-5.3.1">
|
<sect1 id="release-5.3.1">
|
||||||
<title id="release-current">Release 5.3.1</title>
|
<title>Release 5.3.1</title>
|
||||||
<para><emphasis>Tue 15 February, 2022</emphasis></para>
|
<para><emphasis>Tue 15 February, 2022</emphasis></para>
|
||||||
<para>
|
<para>
|
||||||
&repmgr; 5.3.1 is a minor release.
|
&repmgr; 5.3.1 is a minor release.
|
||||||
|
|||||||
@@ -5783,20 +5783,18 @@ check_source_server()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If a connection was established, perform some sanity checks on the
|
* The server version check will also serve as a sanity-check that we can
|
||||||
* provided upstream connection.
|
* actually execute queries on this connection.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
source_server_version_num = check_server_version(source_conn, "primary", true, NULL);
|
source_server_version_num = check_server_version(source_conn, "primary", true, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It's not essential to know the cluster size, but useful to sanity-check
|
* The cluster size is nice to have, but not essential to know, so only display
|
||||||
* we can actually run a query before going any further.
|
* something if the user has sufficient permissions to retrieve the size of
|
||||||
|
* all databases.
|
||||||
*/
|
*/
|
||||||
if (get_cluster_size(source_conn, cluster_size) == false)
|
if (get_cluster_size(source_conn, cluster_size) == true)
|
||||||
exit(ERR_DB_QUERY);
|
log_detail(_("current installation size is %s"),
|
||||||
|
|
||||||
log_detail(_("current installation size is %s"),
|
|
||||||
cluster_size);
|
cluster_size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user