ctdb-recoverd: Basic cleanups for get_remote_nodemaps()
authorMartin Schwenke <martin@meltin.net>
Thu, 18 Jan 2018 05:19:36 +0000 (16:19 +1100)
committerStefan Metzmacher <metze@samba.org>
Thu, 27 Aug 2020 10:48:08 +0000 (10:48 +0000)
Don't log an error on failure - let the caller can do this.  Apart
from this: fix up coding style and modernise the remaining error
message.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 52f520d39cd92e1cf2413fd7e0dd362debd6f463)

ctdb/server/ctdb_recoverd.c

index 3f72619127aee463d24dff0c1390f76e06c0b894..41f029e6bca5ce7b10c46c608b29dac817853a96 100644 (file)
@@ -2223,38 +2223,45 @@ done:
 }
 
 
-static void async_getnodemap_callback(struct ctdb_context *ctdb, uint32_t node_pnn, int32_t res, TDB_DATA outdata, void *callback_data)
+static void async_getnodemap_callback(struct ctdb_context *ctdb,
+                                     uint32_t node_pnn,
+                                     int32_t res,
+                                     TDB_DATA outdata,
+                                     void *callback_data)
 {
        struct ctdb_node_map_old **remote_nodemaps = callback_data;
 
        if (node_pnn >= ctdb->num_nodes) {
-               DEBUG(DEBUG_ERR,(__location__ " pnn from invalid node\n"));
+               DBG_ERR("Invalid PNN\n");
                return;
        }
 
-       remote_nodemaps[node_pnn] = (struct ctdb_node_map_old *)talloc_steal(remote_nodemaps, outdata.dptr);
+       remote_nodemaps[node_pnn] = (struct ctdb_node_map_old *)talloc_steal(
+                                       remote_nodemaps, outdata.dptr);
 
 }
 
-static int get_remote_nodemaps(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
-       struct ctdb_node_map_old *nodemap,
-       struct ctdb_node_map_old **remote_nodemaps)
+static int get_remote_nodemaps(struct ctdb_context *ctdb,
+                              TALLOC_CTX *mem_ctx,
+                              struct ctdb_node_map_old *nodemap,
+                              struct ctdb_node_map_old **remote_nodemaps)
 {
        uint32_t *nodes;
+       int ret;
 
        nodes = list_of_active_nodes(ctdb, nodemap, mem_ctx, true);
-       if (ctdb_client_async_control(ctdb, CTDB_CONTROL_GET_NODEMAP,
-                                       nodes, 0,
-                                       CONTROL_TIMEOUT(), false, tdb_null,
+
+       ret = ctdb_client_async_control(ctdb,
+                                       CTDB_CONTROL_GET_NODEMAP,
+                                       nodes,
+                                       0,
+                                       CONTROL_TIMEOUT(),
+                                       false,
+                                       tdb_null,
                                        async_getnodemap_callback,
                                        NULL,
-                                       remote_nodemaps) != 0) {
-               DEBUG(DEBUG_ERR, (__location__ " Unable to pull all remote nodemaps\n"));
-
-               return -1;
-       }
-
-       return 0;
+                                       remote_nodemaps);
+       return ret;
 }
 
 static bool validate_recovery_master(struct ctdb_recoverd *rec,