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);
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
*/
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;