repmgr: fix return code output for repmgr node check --action=...

Addresses GitHub #340
This commit is contained in:
Ian Barwick
2017-11-23 10:33:39 +09:00
parent 2e42226f68
commit 81beec54aa
6 changed files with 75 additions and 17 deletions

View File

@@ -1,6 +1,12 @@
4.0.1 2017-11-
repmgr: ensure "repmgr node check --action=" returns appropriate return
code (Ian)
repmgr: add missing schema qualification in get_all_node_records_with_upstream()
query (Martín)
4.0.0 2017-11-21
Complete rewrite with many changes; for details see the repmgr 4.0.0 release
notes at: https://repmgr.org/docs/4.0/release-4.0.html
notes at: https://repmgr.org/docs/4.0/release-4.0.0.html
3.3.2 2017-06-01
Add support for PostgreSQL 10 (Ian)

View File

@@ -4050,7 +4050,7 @@ is_active_bdr_node(PGconn *conn, const char *node_name)
appendPQExpBuffer(&query,
" SELECT COALESCE(s.active, TRUE) AS active"
" FROM bdr.bdr_nodes n "
" LEFT JOIN pg_replication_slots s "
" LEFT JOIN pg_catalog.pg_replication_slots s "
" ON slot_name=bdr.bdr_format_slot_name(n.node_sysid, n.node_timeline, n.node_dboid, (SELECT oid FROM pg_database WHERE datname = current_database())) "
" WHERE node_name='%s' ",
node_name);

View File

@@ -16,6 +16,40 @@
See also: <xref linkend="upgrading-repmgr">
</para>
<sect1 id="release-4.0.1">
<title>Release 4.0.1</title>
<para><emphasis>2017</emphasis></para>
<para>
repmgr 4.0.1 is a bugfix release.
</para>
<sect2>
<title>Bug fixes</title>
<para>
<itemizedlist>
<listitem>
<para>
ensure correct return codes are returned for
<command><link linkend="repmgr-node-check">repmgr node check --action=</link></command> operations
(GitHub #340)
</para>
</listitem>
<listitem>
<para>
Fix <xref linkend="repmgr-cluster-show"> when <literal>repmgr</literal> schema not set in search path
(GitHub #341)
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
</sect1>
<sect1 id="release-4.0.0">
<title>Release 4.0.0</title>

View File

@@ -559,6 +559,7 @@ do_node_check(void)
t_node_info node_info = T_NODE_INFO_INITIALIZER;
CheckStatus return_code;
CheckStatusList status_list = {NULL, NULL};
CheckStatusListCell *cell = NULL;
@@ -585,38 +586,51 @@ do_node_check(void)
*/
if (runtime_options.archive_ready == true)
{
(void) do_node_check_archive_ready(conn, runtime_options.output_mode, NULL);
return_code = do_node_check_archive_ready(conn,
runtime_options.output_mode,
NULL);
PQfinish(conn);
return;
exit(return_code);
}
if (runtime_options.downstream == true)
{
(void) do_node_check_downstream(conn, runtime_options.output_mode, NULL);
return_code = do_node_check_downstream(conn,
runtime_options.output_mode,
NULL);
PQfinish(conn);
return;
exit(return_code);
}
if (runtime_options.replication_lag == true)
{
(void) do_node_check_replication_lag(conn, runtime_options.output_mode, &node_info, NULL);
return_code = do_node_check_replication_lag(conn,
runtime_options.output_mode,
&node_info,
NULL);
PQfinish(conn);
return;
exit(return_code);
}
if (runtime_options.role == true)
{
(void) do_node_check_role(conn, runtime_options.output_mode, &node_info, NULL);
return_code = do_node_check_role(conn,
runtime_options.output_mode,
&node_info,
NULL);
PQfinish(conn);
return;
exit(return_code);
}
if (runtime_options.slots == true)
{
(void) do_node_check_slots(conn, runtime_options.output_mode, &node_info, NULL);
return_code = do_node_check_slots(conn,
runtime_options.output_mode,
&node_info,
NULL);
PQfinish(conn);
return;
exit(return_code);
}
if (runtime_options.output_mode == OM_NAGIOS)

View File

@@ -22,7 +22,6 @@
extern void do_node_status(void);
extern void do_node_check(void);
extern void do_node_rejoin(void);
extern void do_node_service(void);

View File

@@ -33,12 +33,17 @@
#define MAXLEN_STR STR(MAXLEN)
/*
* These values must match the Nagios return codes defined here:
*
* https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/pluginapi.html
*/
typedef enum
{
CHECK_STATUS_OK = 0,
CHECK_STATUS_WARNING,
CHECK_STATUS_CRITICAL,
CHECK_STATUS_UNKNOWN
CHECK_STATUS_WARNING = 1,
CHECK_STATUS_CRITICAL = 2,
CHECK_STATUS_UNKNOWN = 3
} CheckStatus;
typedef enum