The branch, master has been updated via 0f92de8 ctdb-daemon: Fix the usage for lock helper via 57310f8 ctdb-recoverd: If obtaining recovery lock fails, try again from f1e281c ctdb-scripts: Fix the regular expresssion for parsing /proc/locks
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 0f92de8463b71a2d7e9acdd27454be7859713436 Author: Amitay Isaacs <ami...@gmail.com> Date: Thu Sep 25 17:55:15 2014 +1000 ctdb-daemon: Fix the usage for lock helper Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> Autobuild-User(master): Martin Schwenke <mart...@samba.org> Autobuild-Date(master): Thu Sep 25 17:16:31 CEST 2014 on sn-devel-104 commit 57310f80c9b8146a0978d912f73b0a64fde7697e Author: Amitay Isaacs <ami...@gmail.com> Date: Thu Sep 25 17:17:04 2014 +1000 ctdb-recoverd: If obtaining recovery lock fails, try again When ctdb daemon starts up, it considers itself the recovery master and tries to do first recovery. However, it's possible that there is already a recovery master and the current node has not yet heard from it. So do not ban ourselves immediately if ctdb_recovery_lock() fails when doing first recovery. Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> ----------------------------------------------------------------------- Summary of changes: ctdb/server/ctdb_lock_helper.c | 4 ++-- ctdb/server/ctdb_recoverd.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) Changeset truncated at 500 lines: diff --git a/ctdb/server/ctdb_lock_helper.c b/ctdb/server/ctdb_lock_helper.c index 49c317e..2161a9a 100644 --- a/ctdb/server/ctdb_lock_helper.c +++ b/ctdb/server/ctdb_lock_helper.c @@ -36,9 +36,9 @@ static void send_result(int fd, char result) static void usage(void) { fprintf(stderr, "\n"); - fprintf(stderr, "Usage: %s <ctdbd-pid> <output-fd> RECORD <db-path> <db-key>\n", + fprintf(stderr, "Usage: %s <log-fd> <ctdbd-pid> <output-fd> RECORD <db-path> <db-key>\n", progname); - fprintf(stderr, " %s <ctdbd-pid> <output-fd> DB <db1-path> [<db2-path> ...]\n", + fprintf(stderr, " %s <log-fd> <ctdbd-pid> <output-fd> DB <db1-path> [<db2-path> ...]\n", progname); } diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index 14e6ea8..945b01c 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -1815,6 +1815,16 @@ static int do_recovery(struct ctdb_recoverd *rec, DEBUG(DEBUG_ERR,("Taking out recovery lock from recovery daemon\n")); start_time = timeval_current(); if (!ctdb_recovery_lock(ctdb, true)) { + if (ctdb->runstate == CTDB_RUNSTATE_FIRST_RECOVERY) { + /* If ctdb is trying first recovery, it's + * possible that current node does not know yet + * who the recmaster is. + */ + DEBUG(DEBUG_ERR, ("Unable to get recovery lock" + " - retrying recovery\n")); + return -1; + } + DEBUG(DEBUG_ERR,("Unable to get recovery lock - aborting recovery " "and ban ourself for %u seconds\n", ctdb->tunable.recovery_ban_period)); @@ -3593,6 +3603,14 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec, return; } + /* get runstate */ + ret = ctdb_ctrl_get_runstate(ctdb, CONTROL_TIMEOUT(), + CTDB_CURRENT_NODE, &ctdb->runstate); + if (ret != 0) { + DEBUG(DEBUG_ERR, ("Failed to get runstate - retrying\n")); + return; + } + /* get the current recovery lock file from the server */ if (update_recovery_lock_file(ctdb) != 0) { DEBUG(DEBUG_ERR,("Failed to update the recovery lock file\n")); -- Samba Shared Repository