diff --git a/HISTORY b/HISTORY index 4a7e8efc..fd9e4aea 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,7 @@ 4.1.0 2018-??-?? repmgr: add "--missing-slots" check to "repmgr node check" (Ian) repmgr: improve command line error handling; GitHub #464 (Ian) + repmgr: fix "standby register --wait-sync" when no timeout provided (Ian) repmgrd: create a PID file by default; GitHub #457 (Ian) repmgrd: daemonize process by default; GitHub #458 (Ian) diff --git a/doc/appendix-release-notes.sgml b/doc/appendix-release-notes.sgml index 591fea39..79006a56 100644 --- a/doc/appendix-release-notes.sgml +++ b/doc/appendix-release-notes.sgml @@ -67,6 +67,23 @@ + + + + Bug fixes + + + + + + repmgr: fix repmgr standby register--wait-sync + when no timeout provided. + + + + + + diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 1931115f..31dd2874 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -1708,11 +1708,15 @@ do_standby_register(void) termPQExpBuffer(&details); - /* if --wait-sync option set, wait for the records to synchronise */ + /* + * if --wait-sync option set, wait for the records to synchronise + * (unless 0 seconds provided, which disables it, which is the same as + * not providing the option) + */ if (PQstatus(conn) == CONNECTION_OK && runtime_options.wait_register_sync == true && - runtime_options.wait_register_sync_seconds > 0) + runtime_options.wait_register_sync_seconds != 0) { bool sync_ok = false; int timer = 0; @@ -1736,7 +1740,11 @@ do_standby_register(void) { bool records_match = true; - if (runtime_options.wait_register_sync_seconds && runtime_options.wait_register_sync_seconds == timer) + /* + * If timeout set to a positive value, check if we've reached it and + * exit the loop + */ + if (runtime_options.wait_register_sync_seconds > 0 && runtime_options.wait_register_sync_seconds == timer) break; node_record_status = get_node_record(conn, diff --git a/repmgr-client-global.h b/repmgr-client-global.h index fd6f73c8..767d7ec4 100644 --- a/repmgr-client-global.h +++ b/repmgr-client-global.h @@ -153,7 +153,7 @@ typedef struct /* "standby clone"/"standby follow" options */ \ NO_UPSTREAM_NODE, \ /* "standby register" options */ \ - false, 0, DEFAULT_WAIT_START, \ + false, -1, DEFAULT_WAIT_START, \ /* "standby switchover" options */ \ false, false, "", false, \ /* "node status" options */ \