protocol design and packet details
*/
#include "includes.h"
-#include "lib/events/events.h"
+#include "lib/tevent/tevent.h"
#include "lib/tdb/include/tdb.h"
#include "lib/util/dlinklist.h"
#include "system/network.h"
int msglen, len;
if (ctdb->methods == NULL) {
- DEBUG(DEBUG_ERR,(__location__ " Failed to send error. Transport is DOWN\n"));
+ DEBUG(DEBUG_INFO,(__location__ " Failed to send error. Transport is DOWN\n"));
return;
}
return;
}
- ctdb_call_local(ctdb_db, state->call, &header, state, &data, ctdb->pnn);
+ ctdb_call_local(ctdb_db, state->call, &header, state, &data);
ret = ctdb_ltdb_unlock(ctdb_db, state->call->key);
if (ret != 0) {
(unsigned long long)c->rsn, (unsigned long long)header.rsn, c->hdr.reqid,
(key.dsize >= 4)?(*(uint32_t *)key.dptr):0));
if (header.rsn != 0 || header.dmaster != ctdb->pnn) {
- ctdb_fatal(ctdb, "ctdb_req_dmaster from non-master");
+ DEBUG(DEBUG_ERR,("ctdb_req_dmaster from non-master. Force a recovery.\n"));
+
+ ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;
return;
}
}
struct ctdb_db_context *ctdb_db;
if (ctdb->methods == NULL) {
- DEBUG(DEBUG_ERR,(__location__ " Failed ctdb_request_call. Transport is DOWN\n"));
+ DEBUG(DEBUG_INFO,(__location__ " Failed ctdb_request_call. Transport is DOWN\n"));
return;
}
return;
}
- if (c->hopcount > ctdb->statistics.max_hop_count) {
- ctdb->statistics.max_hop_count = c->hopcount;
- }
+ CTDB_UPDATE_STAT(ctdb, max_hop_count, c->hopcount);
- /* if this nodes has done enough consecutive calls on the same record
- then give them the record
- or if the node requested an immediate migration
- */
- if ( c->hdr.srcnode != ctdb->pnn &&
- ((header.laccessor == c->hdr.srcnode
- && header.lacount >= ctdb->tunable.max_lacount)
- || (c->flags & CTDB_IMMEDIATE_MIGRATION)) ) {
+ /* Try if possible to migrate the record off to the caller node.
+ * From the clients perspective a fetch of the data is just as
+ * expensive as a migration.
+ */
+ if (c->hdr.srcnode != ctdb->pnn) {
if (ctdb_db->transaction_active) {
DEBUG(DEBUG_INFO, (__location__ " refusing migration"
" of key %s while transaction is active\n",
}
}
- ctdb_call_local(ctdb_db, call, &header, hdr, &data, c->hdr.srcnode);
+ ctdb_call_local(ctdb_db, call, &header, hdr, &data);
ret = ctdb_ltdb_unlock(ctdb_db, call->key);
if (ret != 0) {
*(state->call) = *call;
state->ctdb_db = ctdb_db;
- ret = ctdb_call_local(ctdb_db, state->call, header, state, data, ctdb->pnn);
+ ret = ctdb_call_local(ctdb_db, state->call, header, state, data);
event_add_timed(ctdb->ev, state, timeval_zero(), call_local_trigger, state);
struct ctdb_context *ctdb = ctdb_db->ctdb;
if (ctdb->methods == NULL) {
- DEBUG(DEBUG_ERR,(__location__ " Failed send packet. Transport is down\n"));
+ DEBUG(DEBUG_INFO,(__location__ " Failed send packet. Transport is down\n"));
return NULL;
}
struct ctdb_req_keepalive *r;
if (ctdb->methods == NULL) {
- DEBUG(DEBUG_ERR,(__location__ " Failed to send keepalive. Transport is DOWN\n"));
+ DEBUG(DEBUG_INFO,(__location__ " Failed to send keepalive. Transport is DOWN\n"));
return;
}
r->hdr.destnode = destnode;
r->hdr.reqid = 0;
- ctdb->statistics.keepalive_packets_sent++;
+ CTDB_INCREMENT_STAT(ctdb, keepalive_packets_sent);
ctdb_queue_packet(ctdb, &r->hdr);