ctdb-recoverd: No need for database detach handler
authorAmitay Isaacs <amitay@gmail.com>
Fri, 16 Feb 2018 06:17:38 +0000 (17:17 +1100)
committerAmitay Isaacs <amitay@samba.org>
Thu, 24 Oct 2019 04:06:43 +0000 (04:06 +0000)
The only reason for recoverd attaching to databases was to migrate
records to the local node as part of vacuuming.  Recovery daemon does
not take part in database vacuuming any more.

The actual database recovery is handled via the recovery_helper and
recovery daemon should not need to attach to the databases any more.

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

index 1ccf60832e1448733bd5bc70f698043e16901858..970eb54b00b87edfe2ae93c9e0c655a251e4560f 100644 (file)
@@ -1266,14 +1266,6 @@ int32_t ctdb_control_db_detach(struct ctdb_context *ctdb, TDB_DATA indata,
                return -1;
        }
 
-       /* Detach database from recoverd */
-       if (ctdb_daemon_send_message(ctdb, ctdb->pnn,
-                                    CTDB_SRVID_DETACH_DATABASE,
-                                    indata) != 0) {
-               DEBUG(DEBUG_ERR, ("Unable to detach DB from recoverd\n"));
-               return -1;
-       }
-
        /* Disable vacuuming and drop all vacuuming data */
        talloc_free(ctdb_db->vacuum_handle);
        talloc_free(ctdb_db->delete_queue);
index ad969def87f202aed29267f25da9dbf7fcb0843d..6fddb44a0145ac101b69a7a998e23aaef6a0643d 100644 (file)
@@ -574,36 +574,6 @@ static int update_flags_on_all_nodes(struct ctdb_context *ctdb, struct ctdb_node
        return 0;
 }
 
-/*
- * handler for database detach
- */
-static void detach_database_handler(uint64_t srvid, TDB_DATA data,
-                                   void *private_data)
-{
-       struct ctdb_recoverd *rec = talloc_get_type(
-               private_data, struct ctdb_recoverd);
-       struct ctdb_context *ctdb = rec->ctdb;
-       uint32_t db_id;
-       struct ctdb_db_context *ctdb_db;
-
-       if (data.dsize != sizeof(db_id)) {
-               return;
-       }
-       db_id = *(uint32_t *)data.dptr;
-
-       ctdb_db = find_ctdb_db(ctdb, db_id);
-       if (ctdb_db == NULL) {
-               /* database is not attached */
-               return;
-       }
-
-       DLIST_REMOVE(ctdb->db_list, ctdb_db);
-
-       DEBUG(DEBUG_NOTICE, ("Detached from database '%s'\n",
-                            ctdb_db->db_name));
-       talloc_free(ctdb_db);
-}
-
 /*
   called when ctdb_wait_timeout should finish
  */
@@ -3143,11 +3113,6 @@ static void monitor_cluster(struct ctdb_context *ctdb)
                                        CTDB_SRVID_DISABLE_RECOVERIES,
                                        disable_recoveries_handler, rec);
 
-       /* register a message port for detaching database */
-       ctdb_client_set_message_handler(ctdb,
-                                       CTDB_SRVID_DETACH_DATABASE,
-                                       detach_database_handler, rec);
-
        for (;;) {
                TALLOC_CTX *mem_ctx = talloc_new(ctdb);
                struct timeval start;