ctdb-daemon: Don't pull any records if records are invalidated
authorAmitay Isaacs <amitay@gmail.com>
Wed, 14 Feb 2018 03:27:32 +0000 (14:27 +1100)
committerAmitay Isaacs <amitay@samba.org>
Mon, 8 Oct 2018 00:46:20 +0000 (02:46 +0200)
This avoids unnecessary work during recovery to pull records from nodes
that were INACTIVE just before the recovery.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/server/ctdb_recover.c

index fc64037b95f7ef4d0c6b902f276a1016ba3d2ca1..77c614df6433430c5d4fe5d6e841e12cb72aea7c 100644 (file)
@@ -279,6 +279,11 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
                                     ctdb_db->db_name, ctdb_db->unhealthy_reason));
        }
 
+       /* If the records are invalid, we are done */
+       if (ctdb_db->invalid_records) {
+               goto done;
+       }
+
        if (ctdb_lockdb_mark(ctdb_db) != 0) {
                DEBUG(DEBUG_ERR,(__location__ " Failed to get lock on entire db - failing\n"));
                return -1;
@@ -293,6 +298,7 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
 
        ctdb_lockdb_unmark(ctdb_db);
 
+done:
        outdata->dptr = (uint8_t *)params.pulldata;
        outdata->dsize = params.len;
 
@@ -388,6 +394,11 @@ int32_t ctdb_control_db_pull(struct ctdb_context *ctdb,
        state.srvid = pulldb_ext->srvid;
        state.num_records = 0;
 
+       /* If the records are invalid, we are done */
+       if (ctdb_db->invalid_records) {
+               goto done;
+       }
+
        if (ctdb_lockdb_mark(ctdb_db) != 0) {
                DEBUG(DEBUG_ERR,
                      (__location__ " Failed to get lock on entire db - failing\n"));
@@ -422,6 +433,7 @@ int32_t ctdb_control_db_pull(struct ctdb_context *ctdb,
 
        ctdb_lockdb_unmark(ctdb_db);
 
+done:
        outdata->dptr = talloc_size(outdata, sizeof(uint32_t));
        if (outdata->dptr == NULL) {
                DEBUG(DEBUG_ERR, (__location__ " Memory allocation error\n"));