diff options
author | Amitay Isaacs <amitay@gmail.com> | 2018-02-16 17:13:35 +1100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2020-03-30 10:08:23 +0000 |
commit | 0a2428cf9f34bde07e700f56ddeb5767a180973f (patch) | |
tree | 5730a3f9fad90929de733645d5e9bcca78caa2b8 /ctdb | |
parent | 9aa7e66651d4549a73dc5761a3ff55b2e2d4d373 (diff) | |
download | samba-0a2428cf9f34bde07e700f56ddeb5767a180973f.tar.gz |
ctdb-recoverd: Drop VACUUM_FETCH message handling
This is now implemented in the ctdb daemon using VACUMM_FETCH control.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit fc81729dd2d8eddea1e60e22b183894d6541c7dc)
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/server/ctdb_recoverd.c | 149 |
1 files changed, 0 insertions, 149 deletions
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index 3d5b727715a..bbaf1270558 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -575,152 +575,6 @@ static int update_flags_on_all_nodes(struct ctdb_context *ctdb, struct ctdb_node } /* - called when a vacuum fetch has completed - just free it and do the next one - */ -static void vacuum_fetch_callback(struct ctdb_client_call_state *state) -{ - talloc_free(state); -} - - -/** - * Process one elements of the vacuum fetch list: - * Migrate it over to us with the special flag - * CTDB_CALL_FLAG_VACUUM_MIGRATION. - */ -static bool vacuum_fetch_process_one(struct ctdb_db_context *ctdb_db, - uint32_t pnn, - struct ctdb_rec_data_old *r) -{ - struct ctdb_client_call_state *state; - TDB_DATA data; - struct ctdb_ltdb_header *hdr; - struct ctdb_call call; - - ZERO_STRUCT(call); - call.call_id = CTDB_NULL_FUNC; - call.flags = CTDB_IMMEDIATE_MIGRATION; - call.flags |= CTDB_CALL_FLAG_VACUUM_MIGRATION; - - call.key.dptr = &r->data[0]; - call.key.dsize = r->keylen; - - /* ensure we don't block this daemon - just skip a record if we can't get - the chainlock */ - if (tdb_chainlock_nonblock(ctdb_db->ltdb->tdb, call.key) != 0) { - return true; - } - - data = tdb_fetch(ctdb_db->ltdb->tdb, call.key); - if (data.dptr == NULL) { - tdb_chainunlock(ctdb_db->ltdb->tdb, call.key); - return true; - } - - if (data.dsize < sizeof(struct ctdb_ltdb_header)) { - free(data.dptr); - tdb_chainunlock(ctdb_db->ltdb->tdb, call.key); - return true; - } - - hdr = (struct ctdb_ltdb_header *)data.dptr; - if (hdr->dmaster == pnn) { - /* its already local */ - free(data.dptr); - tdb_chainunlock(ctdb_db->ltdb->tdb, call.key); - return true; - } - - free(data.dptr); - - state = ctdb_call_send(ctdb_db, &call); - tdb_chainunlock(ctdb_db->ltdb->tdb, call.key); - if (state == NULL) { - DEBUG(DEBUG_ERR,(__location__ " Failed to setup vacuum fetch call\n")); - return false; - } - state->async.fn = vacuum_fetch_callback; - state->async.private_data = NULL; - - return true; -} - - -/* - handler for vacuum fetch -*/ -static void vacuum_fetch_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; - struct ctdb_marshall_buffer *recs; - unsigned int i; - int ret; - TALLOC_CTX *tmp_ctx = talloc_new(ctdb); - const char *name; - struct ctdb_dbid_map_old *dbmap=NULL; - uint8_t db_flags = 0; - struct ctdb_db_context *ctdb_db; - struct ctdb_rec_data_old *r; - - recs = (struct ctdb_marshall_buffer *)data.dptr; - - if (recs->count == 0) { - goto done; - } - - /* work out if the database is persistent */ - ret = ctdb_ctrl_getdbmap(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, tmp_ctx, &dbmap); - if (ret != 0) { - DEBUG(DEBUG_ERR, (__location__ " Unable to get dbids from local node\n")); - goto done; - } - - for (i=0;i<dbmap->num;i++) { - if (dbmap->dbs[i].db_id == recs->db_id) { - db_flags = dbmap->dbs[i].flags; - break; - } - } - if (i == dbmap->num) { - DEBUG(DEBUG_ERR, (__location__ " Unable to find db_id 0x%x on local node\n", recs->db_id)); - goto done; - } - - /* find the name of this database */ - if (ctdb_ctrl_getdbname(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, recs->db_id, tmp_ctx, &name) != 0) { - DEBUG(DEBUG_ERR,(__location__ " Failed to get name of db 0x%x\n", recs->db_id)); - goto done; - } - - /* attach to it */ - ctdb_db = ctdb_attach(ctdb, CONTROL_TIMEOUT(), name, db_flags); - if (ctdb_db == NULL) { - DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name)); - goto done; - } - - r = (struct ctdb_rec_data_old *)&recs->data[0]; - while (recs->count) { - bool ok; - - ok = vacuum_fetch_process_one(ctdb_db, rec->ctdb->pnn, r); - if (!ok) { - break; - } - - r = (struct ctdb_rec_data_old *)(r->length + (uint8_t *)r); - recs->count--; - } - -done: - talloc_free(tmp_ctx); -} - - -/* * handler for database detach */ static void detach_database_handler(uint64_t srvid, TDB_DATA data, @@ -3147,9 +3001,6 @@ static void monitor_cluster(struct ctdb_context *ctdb) /* when we are asked to puch out a flag change */ ctdb_client_set_message_handler(ctdb, CTDB_SRVID_PUSH_NODE_FLAGS, push_flags_handler, rec); - /* register a message port for vacuum fetch */ - ctdb_client_set_message_handler(ctdb, CTDB_SRVID_VACUUM_FETCH, vacuum_fetch_handler, rec); - /* register a message port for reloadnodes */ ctdb_client_set_message_handler(ctdb, CTDB_SRVID_RELOAD_NODES, reload_nodes_handler, rec); |