hdr = (struct ctdb_req_header *)talloc_size(mem_ctx, size);
if (hdr == NULL) {
- DEBUG(0,("Unable to allocate packet for operation %u of length %u\n",
+ DEBUG(DEBUG_ERR,("Unable to allocate packet for operation %u of length %u\n",
operation, (unsigned)length));
return NULL;
}
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_client_call_state);
if (state == NULL) {
- DEBUG(0,(__location__ " reqid %u not found\n", hdr->reqid));
+ DEBUG(DEBUG_ERR,(__location__ " reqid %u not found\n", hdr->reqid));
return;
}
if (hdr->reqid != state->reqid) {
/* we found a record but it was the wrong one */
- DEBUG(0, ("Dropped client call reply with reqid:%u\n",hdr->reqid));
+ DEBUG(DEBUG_ERR, ("Dropped client call reply with reqid:%u\n",hdr->reqid));
return;
}
}
if (cnt < sizeof(*hdr)) {
- DEBUG(0,("Bad packet length %u in client\n", (unsigned)cnt));
+ DEBUG(DEBUG_CRIT,("Bad packet length %u in client\n", (unsigned)cnt));
goto done;
}
if (cnt != hdr->length) {
break;
default:
- DEBUG(0,("bogus operation code:%u\n",hdr->operation));
+ DEBUG(DEBUG_CRIT,("bogus operation code:%u\n",hdr->operation));
}
done:
event_loop_once(state->ctdb_db->ctdb->ev);
}
if (state->state != CTDB_CALL_DONE) {
- DEBUG(0,(__location__ " ctdb_call_recv failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_call_recv failed\n"));
talloc_free(state);
return -1;
}
ret = ctdb_ltdb_lock(ctdb_db, call->key);
if (ret != 0) {
- DEBUG(0,(__location__ " Failed to get chainlock\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to get chainlock\n"));
return NULL;
}
state = talloc_zero(ctdb_db, struct ctdb_client_call_state);
if (state == NULL) {
- DEBUG(0, (__location__ " failed to allocate state\n"));
+ DEBUG(DEBUG_ERR, (__location__ " failed to allocate state\n"));
return NULL;
}
len = offsetof(struct ctdb_req_call, data) + call->key.dsize + call->call_data.dsize;
c = ctdbd_allocate_pkt(ctdb, state, CTDB_REQ_CALL, len, struct ctdb_req_call);
if (c == NULL) {
- DEBUG(0, (__location__ " failed to allocate packet\n"));
+ DEBUG(DEBUG_ERR, (__location__ " failed to allocate packet\n"));
return NULL;
}
res = ctdb_control(ctdb, CTDB_CURRENT_NODE, srvid, CTDB_CONTROL_REGISTER_SRVID, 0,
tdb_null, NULL, NULL, &status, NULL, NULL);
if (res != 0 || status != 0) {
- DEBUG(0,("Failed to register srvid %llu\n", (unsigned long long)srvid));
+ DEBUG(DEBUG_ERR,("Failed to register srvid %llu\n", (unsigned long long)srvid));
return -1;
}
res = ctdb_control(ctdb, CTDB_CURRENT_NODE, srvid, CTDB_CONTROL_DEREGISTER_SRVID, 0,
tdb_null, NULL, NULL, &status, NULL, NULL);
if (res != 0 || status != 0) {
- DEBUG(0,("Failed to deregister srvid %llu\n", (unsigned long long)srvid));
+ DEBUG(DEBUG_ERR,("Failed to deregister srvid %llu\n", (unsigned long long)srvid));
return -1;
}
/* step 1 - get the chain lock */
ret = ctdb_ltdb_lock(ctdb_db, key);
if (ret != 0) {
- DEBUG(0, (__location__ " failed to lock ltdb record\n"));
+ DEBUG(DEBUG_ERR, (__location__ " failed to lock ltdb record\n"));
talloc_free(h);
return NULL;
}
rec = ctdb_marshall_record(h, h->ctdb_db->db_id, h->key, &h->header, data);
if (rec == NULL) {
- DEBUG(0,("Unable to marshall record in ctdb_record_store\n"));
+ DEBUG(DEBUG_ERR,("Unable to marshall record in ctdb_record_store\n"));
return -1;
}
talloc_free(rec);
if (ret != 0 || status != 0) {
- DEBUG(0,("Failed persistent store in ctdb_record_store\n"));
+ DEBUG(DEBUG_ERR,("Failed persistent store in ctdb_record_store\n"));
return -1;
}
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_client_control_state);
if (state == NULL) {
- DEBUG(0,(__location__ " reqid %u not found\n", hdr->reqid));
+ DEBUG(DEBUG_ERR,(__location__ " reqid %u not found\n", hdr->reqid));
return;
}
if (hdr->reqid != state->reqid) {
/* we found a record but it was the wrong one */
- DEBUG(0, ("Dropped orphaned reply control with reqid:%u\n",hdr->reqid));
+ DEBUG(DEBUG_ERR, ("Dropped orphaned reply control with reqid:%u\n",hdr->reqid));
return;
}
{
struct ctdb_client_control_state *state = talloc_get_type(private_data, struct ctdb_client_control_state);
- DEBUG(0,("control timed out. reqid:%d opcode:%d dstnode:%d\n", state->reqid, state->c->opcode, state->c->hdr.destnode));
+ DEBUG(DEBUG_ERR,("control timed out. reqid:%d opcode:%d dstnode:%d\n", state->reqid, state->c->opcode, state->c->hdr.destnode));
state->state = CTDB_CONTROL_TIMEOUT;
}
if (state->state != CTDB_CONTROL_DONE) {
- DEBUG(0,(__location__ " ctdb_control_recv failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control_recv failed\n"));
if (state->async.fn) {
state->async.fn(state);
}
}
if (state->errormsg) {
- DEBUG(0,("ctdb_control error: '%s'\n", state->errormsg));
+ DEBUG(DEBUG_ERR,("ctdb_control error: '%s'\n", state->errormsg));
if (errormsg) {
(*errormsg) = talloc_move(mem_ctx, &state->errormsg);
}
CTDB_CONTROL_PROCESS_EXISTS, 0, data,
NULL, NULL, &status, NULL, NULL);
if (ret != 0) {
- DEBUG(0,(__location__ " ctdb_control for process_exists failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for process_exists failed\n"));
return -1;
}
CTDB_CONTROL_STATISTICS, 0, tdb_null,
ctdb, &data, &res, NULL, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for statistics failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for statistics failed\n"));
return -1;
}
if (data.dsize != sizeof(struct ctdb_statistics)) {
- DEBUG(0,(__location__ " Wrong statistics size %u - expected %u\n",
+ DEBUG(DEBUG_ERR,(__location__ " Wrong statistics size %u - expected %u\n",
(unsigned)data.dsize, (unsigned)sizeof(struct ctdb_statistics)));
return -1;
}
CTDB_CONTROL_SHUTDOWN, 0, tdb_null,
NULL, &timeout, NULL);
if (state == NULL) {
- DEBUG(0,(__location__ " ctdb_control for shutdown failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for shutdown failed\n"));
return -1;
}
CTDB_CONTROL_GETVNNMAP, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for getvnnmap failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getvnnmap failed\n"));
return -1;
}
map = (struct ctdb_vnn_map_wire *)outdata.dptr;
if (outdata.dsize < offsetof(struct ctdb_vnn_map_wire, map) ||
outdata.dsize != map->size*sizeof(uint32_t) + offsetof(struct ctdb_vnn_map_wire, map)) {
- DEBUG(0,("Bad vnn map size received in ctdb_ctrl_getvnnmap\n"));
+ DEBUG(DEBUG_ERR,("Bad vnn map size received in ctdb_ctrl_getvnnmap\n"));
return -1;
}
ret = ctdb_control_recv(ctdb, state, mem_ctx, NULL, &res, NULL);
if (ret != 0) {
- DEBUG(0,(__location__ " ctdb_ctrl_getrecmode_recv failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_getrecmode_recv failed\n"));
return -1;
}
CTDB_CONTROL_SET_RECMODE, 0, data,
NULL, NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for setrecmode failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for setrecmode failed\n"));
return -1;
}
ret = ctdb_control_recv(ctdb, state, mem_ctx, NULL, &res, NULL);
if (ret != 0) {
- DEBUG(0,(__location__ " ctdb_ctrl_getrecmaster_recv failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_getrecmaster_recv failed\n"));
return -1;
}
CTDB_CONTROL_SET_RECMASTER, 0, data,
NULL, NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for setrecmaster failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for setrecmaster failed\n"));
return -1;
}
CTDB_CONTROL_GET_DBMAP, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for getdbmap failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getdbmap failed\n"));
return -1;
}
CTDB_CONTROL_GET_NODEMAP, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
if (ret != 0 || res != 0 || outdata.dsize == 0) {
- DEBUG(0,(__location__ " ctdb_control for getnodes failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed\n"));
return -1;
}
CTDB_CONTROL_SETVNNMAP, 0, data,
NULL, NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for setvnnmap failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for setvnnmap failed\n"));
return -1;
}
ret = ctdb_control_recv(ctdb, state, mem_ctx, outdata, &res, NULL);
if ( (ret != 0) || (res != 0) ){
- DEBUG(0,(__location__ " ctdb_ctrl_pulldb_recv failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_pulldb_recv failed\n"));
return -1;
}
CTDB_CONTROL_SET_DMASTER, 0, indata,
NULL, NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for setdmaster failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for setdmaster failed\n"));
return -1;
}
return -1;
}
if (data.dsize != sizeof(uint32_t)) {
- DEBUG(0,("Bad control reply size in ctdb_get_debuglevel (got %u)\n",
+ DEBUG(DEBUG_ERR,("Bad control reply size in ctdb_get_debuglevel (got %u)\n",
(unsigned)data.dsize));
return -1;
}
CTDB_CONTROL_STATISTICS_RESET, 0, tdb_null,
NULL, NULL, &res, NULL, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for reset statistics failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for reset statistics failed\n"));
return -1;
}
return 0;
persistent?CTDB_CONTROL_DB_ATTACH_PERSISTENT:CTDB_CONTROL_DB_ATTACH,
0, data, ctdb_db, &data, &res, NULL, NULL);
if (ret != 0 || res != 0 || data.dsize != sizeof(uint32_t)) {
- DEBUG(0,("Failed to attach to database '%s'\n", name));
+ DEBUG(DEBUG_ERR,("Failed to attach to database '%s'\n", name));
talloc_free(ctdb_db);
return NULL;
}
ret = ctdb_ctrl_getdbpath(ctdb, timeval_current_ofs(2, 0), CTDB_CURRENT_NODE, ctdb_db->db_id, ctdb_db, &ctdb_db->db_path);
if (ret != 0) {
- DEBUG(0,("Failed to get dbpath for database '%s'\n", name));
+ DEBUG(DEBUG_ERR,("Failed to get dbpath for database '%s'\n", name));
talloc_free(ctdb_db);
return NULL;
}
ret = ctdb_control(ctdb_db->ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_SET_CALL, 0,
data, NULL, NULL, &status, NULL, NULL);
if (ret != 0 || status != 0) {
- DEBUG(0,("ctdb_set_call failed for call %u\n", id));
+ DEBUG(DEBUG_ERR,("ctdb_set_call failed for call %u\n", id));
return -1;
}
#endif
if (data.dsize < sizeof(uint32_t) ||
d->length != data.dsize) {
- DEBUG(0,("Bad data size %u in traverse_handler\n", (unsigned)data.dsize));
+ DEBUG(DEBUG_ERR,("Bad data size %u in traverse_handler\n", (unsigned)data.dsize));
state->done = True;
return;
}
ret = ctdb_set_message_handler(ctdb_db->ctdb, srvid, traverse_handler, &state);
if (ret != 0) {
- DEBUG(0,("Failed to setup traverse handler\n"));
+ DEBUG(DEBUG_ERR,("Failed to setup traverse handler\n"));
return -1;
}
ret = ctdb_control(ctdb_db->ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_TRAVERSE_START, 0,
data, NULL, NULL, &status, NULL, NULL);
if (ret != 0 || status != 0) {
- DEBUG(0,("ctdb_traverse_all failed\n"));
+ DEBUG(DEBUG_ERR,("ctdb_traverse_all failed\n"));
ctdb_remove_message_handler(ctdb_db->ctdb, srvid, &state);
return -1;
}
ret = ctdb_remove_message_handler(ctdb_db->ctdb, srvid, &state);
if (ret != 0) {
- DEBUG(0,("Failed to remove ctdb_traverse handler\n"));
+ DEBUG(DEBUG_ERR,("Failed to remove ctdb_traverse handler\n"));
return -1;
}
CTDB_CONTROL_GET_PID, 0, tdb_null,
NULL, NULL, &res, &timeout, NULL);
if (ret != 0) {
- DEBUG(0,(__location__ " ctdb_control for getpid failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpid failed\n"));
return -1;
}
ret = ctdb_control_recv(ctdb, state, mem_ctx, NULL, &res, NULL);
if ( (ret != 0) || (res != 0) ){
- DEBUG(0,(__location__ " ctdb_ctrl_freeze_recv failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_freeze_recv failed\n"));
return -1;
}
CTDB_CONTROL_THAW, 0, tdb_null,
NULL, NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control thaw failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control thaw failed\n"));
return -1;
}
CTDB_CONTROL_GET_PNN, 0, tdb_null,
NULL, NULL, &res, &timeout, NULL);
if (ret != 0) {
- DEBUG(0,(__location__ " ctdb_control for getpnn failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpnn failed\n"));
return -1;
}
CTDB_CONTROL_GET_MONMODE, 0, tdb_null,
NULL, NULL, &res, &timeout, NULL);
if (ret != 0) {
- DEBUG(0,(__location__ " ctdb_control for getrecmode failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getrecmode failed\n"));
return -1;
}
NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for takeover_ip failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for takeover_ip failed\n"));
return -1;
}
NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for release_ip failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for release_ip failed\n"));
return -1;
}
&outdata, &res, &timeout, NULL);
talloc_free(data.dptr);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for get_tunable failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get_tunable failed\n"));
return -1;
}
if (outdata.dsize != sizeof(uint32_t)) {
- DEBUG(0,("Invalid return data in get_tunable\n"));
+ DEBUG(DEBUG_ERR,("Invalid return data in get_tunable\n"));
talloc_free(outdata.dptr);
return -1;
}
NULL, &res, &timeout, NULL);
talloc_free(data.dptr);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for set_tunable failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for set_tunable failed\n"));
return -1;
}
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_LIST_TUNABLES, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for list_tunables failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for list_tunables failed\n"));
return -1;
}
t = (struct ctdb_control_list_tunable *)outdata.dptr;
if (outdata.dsize < offsetof(struct ctdb_control_list_tunable, data) ||
t->length > outdata.dsize-offsetof(struct ctdb_control_list_tunable, data)) {
- DEBUG(0,("Invalid data in list_tunables reply\n"));
+ DEBUG(DEBUG_ERR,("Invalid data in list_tunables reply\n"));
talloc_free(outdata.dptr);
return -1;
}
CTDB_CONTROL_GET_PUBLIC_IPS, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for getpublicips failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpublicips failed\n"));
return -1;
}
CTDB_CONTROL_MODIFY_FLAGS, 0, data,
NULL, NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for modflags failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for modflags failed\n"));
return -1;
}
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_GET_ALL_TUNABLES, 0, tdb_null, ctdb,
&outdata, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for get all tunables failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get all tunables failed\n"));
return -1;
}
if (outdata.dsize != sizeof(*tunables)) {
- DEBUG(0,(__location__ " bad data size %u in ctdb_ctrl_get_all_tunables should be %u\n",
+ DEBUG(DEBUG_ERR,(__location__ " bad data size %u in ctdb_ctrl_get_all_tunables should be %u\n",
(unsigned)outdata.dsize, (unsigned)sizeof(*tunables)));
return -1;
}
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_KILL_TCP, 0, data, NULL,
NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for killtcp failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for killtcp failed\n"));
return -1;
}
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_SEND_GRATIOUS_ARP, 0, data, NULL,
NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for gratious_arp failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for gratious_arp failed\n"));
talloc_free(tmp_ctx);
return -1;
}
CTDB_CONTROL_GET_TCP_TICKLE_LIST, 0, data,
mem_ctx, &outdata, &status, NULL, NULL);
if (ret != 0) {
- DEBUG(0,(__location__ " ctdb_control for get tcp tickles failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get tcp tickles failed\n"));
return -1;
}
0, data, NULL,
NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for register server id failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for register server id failed\n"));
return -1;
}
0, data, NULL,
NULL, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for unregister server id failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for unregister server id failed\n"));
return -1;
}
0, data, NULL,
NULL, &res, &timeout, NULL);
if (ret != 0) {
- DEBUG(0,(__location__ " ctdb_control for check server id failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for check server id failed\n"));
return -1;
}
CTDB_CONTROL_GET_SERVER_ID_LIST, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_control for get_server_id_list failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get_server_id_list failed\n"));
return -1;
}
ret = ctdb_control_recv(ctdb, state, mem_ctx, &outdata, &res, NULL);
if (ret != 0 || res != 0) {
- DEBUG(0,(__location__ " ctdb_ctrl_uptime_recv failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_ctrl_uptime_recv failed\n"));
return -1;
}
CTDB_CONTROL_END_RECOVERY, 0, tdb_null,
NULL, NULL, &status, &timeout, NULL);
if (ret != 0 || status != 0) {
- DEBUG(0,(__location__ " ctdb_control for end_recovery failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for end_recovery failed\n"));
return -1;
}
*/
if (state->state != CTDB_CONTROL_DONE) {
if ( !data->dont_log_errors) {
- DEBUG(0,("Async operation failed with state %d\n", state->state));
+ DEBUG(DEBUG_ERR,("Async operation failed with state %d\n", state->state));
}
data->fail_count++;
return;
ret = ctdb_control_recv(state->ctdb, state, data, NULL, &res, NULL);
if ((ret != 0) || (res != 0)) {
if ( !data->dont_log_errors) {
- DEBUG(0,("Async operation failed with ret=%d res=%d\n", ret, (int)res));
+ DEBUG(DEBUG_ERR,("Async operation failed with ret=%d res=%d\n", ret, (int)res));
}
data->fail_count++;
}
}
if (data->fail_count != 0) {
if (!data->dont_log_errors) {
- DEBUG(0,("Async wait failed - fail_count=%u\n",
+ DEBUG(DEBUG_ERR,("Async wait failed - fail_count=%u\n",
data->fail_count));
}
return -1;
state = ctdb_control_send(ctdb, pnn, 0, opcode,
0, data, async_data, &timeout, NULL);
if (state == NULL) {
- DEBUG(0,(__location__ " Failed to call async control %u\n", (unsigned)opcode));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to call async control %u\n", (unsigned)opcode));
talloc_free(async_data);
return -1;
}
/* get our pnn */
ctdb->pnn = ctdb_ctrl_getpnn(ctdb, timeval_current_ofs(3, 0), CTDB_CURRENT_NODE);
if (ctdb->pnn == (uint32_t)-1) {
- DEBUG(0,(__location__ " Failed to get ctdb pnn\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " Failed to get ctdb pnn\n"));
talloc_free(ctdb);
return NULL;
}
num_ready + queue->partial.length);
if (queue->partial.data == NULL) {
- DEBUG(0,("read error alloc failed for %u\n",
+ DEBUG(DEBUG_ERR,("read error alloc failed for %u\n",
num_ready + queue->partial.length));
goto failed;
}
nread = read(queue->fd, queue->partial.data + queue->partial.length, num_ready);
if (nread <= 0) {
- DEBUG(0,("read error nread=%d\n", (int)nread));
+ DEBUG(DEBUG_ERR,("read error nread=%d\n", (int)nread));
goto failed;
}
len = *(uint32_t *)data;
if (len == 0) {
/* bad packet! treat as EOF */
- DEBUG(0,("Invalid packet of length 0\n"));
+ DEBUG(DEBUG_CRIT,("Invalid packet of length 0\n"));
goto failed;
}
d2 = talloc_memdup(queue, data, len);
if (d2 == NULL) {
- DEBUG(0,("read error memdup failed for %u\n", len));
+ DEBUG(DEBUG_ERR,("read error memdup failed for %u\n", len));
/* sigh */
goto failed;
}
} else {
queue->partial.data = talloc_memdup(queue, data, nread);
if (queue->partial.data == NULL) {
- DEBUG(0,("read error memdup partial failed for %u\n",
+ DEBUG(DEBUG_ERR,("read error memdup partial failed for %u\n",
(unsigned)nread));
goto failed;
}
rec = tdb_fetch(ctdb_db->ltdb->tdb, key);
h2 = (struct ctdb_ltdb_header *)rec.dptr;
if (rec.dptr && rec.dsize >= sizeof(h2) && h2->rsn > header->rsn) {
- DEBUG(0,("RSN regression! %llu %llu\n",
+ DEBUG(DEBUG_CRIT,("RSN regression! %llu %llu\n",
(unsigned long long)h2->rsn, (unsigned long long)header->rsn));
}
if (rec.dptr) free(rec.dptr);
{
int ret = tdb_chainunlock(ctdb_db->ltdb->tdb, key);
if (ret != 0) {
- DEBUG(0,("tdb_chainunlock failed\n"));
+ DEBUG(DEBUG_ERR,("tdb_chainunlock failed\n"));
}
return ret;
}
talloc_free(ctdb->err_msg);
va_start(ap, fmt);
ctdb->err_msg = talloc_vasprintf(ctdb, fmt, ap);
- DEBUG(0,("ctdb error: %s\n", ctdb->err_msg));
+ DEBUG(DEBUG_ERR,("ctdb error: %s\n", ctdb->err_msg));
va_end(ap);
}
{
void *p = idr_find(idp, id);
if (p && talloc_check_name(p, type) == NULL) {
- DEBUG(0,("%s idr_find_type expected type %s but got %s\n",
+ DEBUG(DEBUG_ERR,("%s idr_find_type expected type %s but got %s\n",
location, type, talloc_get_name(p)));
return NULL;
}
p = _idr_find_type(ctdb->idr, (reqid>>16)&0xFFFF, type, location);
if (p == NULL) {
- DEBUG(0, ("Could not find idr:%u\n",reqid));
+ DEBUG(DEBUG_ERR, ("Could not find idr:%u\n",reqid));
}
return p;
ret = idr_remove(ctdb->idr, (reqid>>16)&0xFFFF);
if (ret != 0) {
- DEBUG(0, ("Removing idr that does not exist\n"));
+ DEBUG(DEBUG_ERR, ("Removing idr that does not exist\n"));
}
}
}
if (sched_getparam(0, (struct sched_param *)ctdb->saved_scheduler_param) == -1) {
- DEBUG(0,("Unable to get old scheduler params\n"));
+ DEBUG(DEBUG_ERR,("Unable to get old scheduler params\n"));
return;
}
p.sched_priority = 1;
if (sched_setscheduler(0, SCHED_FIFO, &p) == -1) {
- DEBUG(0,("Unable to set scheduler to SCHED_FIFO (%s)\n",
+ DEBUG(DEBUG_CRIT,("Unable to set scheduler to SCHED_FIFO (%s)\n",
strerror(errno)));
} else {
DEBUG(DEBUG_NOTICE,("Set scheduler to SCHED_FIFO\n"));
#include "rb_tree.h"
#define NO_MEMORY_FATAL(p) do { if (!(p)) { \
- DEBUG(0,("Out of memory for %s at %s\n", #p, __location__)); \
+ DEBUG(DEBUG_CRIT,("Out of memory for %s at %s\n", #p, __location__)); \
exit(10); \
}} while (0)
s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
if (s == -1) {
- DEBUG(0,(" failed to open raw socket (%s)\n",
+ DEBUG(DEBUG_CRIT,(" failed to open raw socket (%s)\n",
strerror(errno)));
return -1;
}
ret = setsockopt(s, IPPROTO_IP, IP_HDRINCL, &one, sizeof(one));
if (ret != 0) {
- DEBUG(0,(" failed to setup IP headers (%s)\n",
+ DEBUG(DEBUG_CRIT, (" failed to setup IP headers (%s)\n",
strerror(errno)));
close(s);
return -1;
/* for now, we only handle AF_INET addresses */
if (src->sin_family != AF_INET || dest->sin_family != AF_INET) {
- DEBUG(0,(__location__ " not an ipv4 address\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " not an ipv4 address\n"));
return -1;
}
ret = sendto(s, &pkt, sizeof(pkt), 0, (struct sockaddr *)dest, sizeof(*dest));
if (ret != sizeof(pkt)) {
- DEBUG(0,(__location__ " failed sendto (%s)\n", strerror(errno)));
+ DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno)));
return -1;
}
pt=pcap_open_live(iface, 100, 0, 0, NULL);
if (pt == NULL) {
- DEBUG(0,("Failed to open capture device %s\n", iface));
+ DEBUG(DEBUG_CRIT,("Failed to open capture device %s\n", iface));
return -1;
}
*((pcap_t **)private_data) = pt;
/* for now, we only handle AF_INET addresses */
if (saddr->sin_family != AF_INET) {
- DEBUG(0,(__location__ " not an ipv4 address (family is %u)\n", saddr->sin_family));
+ DEBUG(DEBUG_CRIT,(__location__ " not an ipv4 address (family is %u)\n", saddr->sin_family));
return -1;
}
s = socket(AF_INET, SOCK_PACKET, htons(ETHERTYPE_ARP));
if (s == -1){
- DEBUG(0,(__location__ " failed to open raw socket\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
return -1;
}
ret = ioctl(s, SIOCGIFHWADDR, &if_hwaddr);
if ( ret < 0 ) {
close(s);
- DEBUG(0,(__location__ " ioctl failed\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " ioctl failed\n"));
return -1;
}
if (ARPHRD_LOOPBACK == if_hwaddr.ifr_hwaddr.sa_family) {
if (if_hwaddr.ifr_hwaddr.sa_family != AF_LOCAL) {
close(s);
errno = EINVAL;
- DEBUG(0,(__location__ " not an ethernet address family (0x%x)\n",
+ DEBUG(DEBUG_CRIT,(__location__ " not an ethernet address family (0x%x)\n",
if_hwaddr.ifr_hwaddr.sa_family));
return -1;
}
ret = sendto(s, buffer, 64, 0, &sa, sizeof(sa));
if (ret < 0 ){
close(s);
- DEBUG(0,(__location__ " failed sendto\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " failed sendto\n"));
return -1;
}
strncpy(sa.sa_data, iface, sizeof(sa.sa_data));
ret = sendto(s, buffer, 64, 0, &sa, sizeof(sa));
if (ret < 0 ){
- DEBUG(0,(__location__ " failed sendto\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " failed sendto\n"));
return -1;
}
/* for now, we only handle AF_INET addresses */
if (src->sin_family != AF_INET || dest->sin_family != AF_INET) {
- DEBUG(0,(__location__ " not an ipv4 address\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " not an ipv4 address\n"));
return -1;
}
ret = sendto(s, &pkt, sizeof(pkt), 0, dest, sizeof(*dest));
if (ret != sizeof(pkt)) {
- DEBUG(0,(__location__ " failed sendto (%s)\n", strerror(errno)));
+ DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno)));
return -1;
}
/* Open a socket to capture all traffic */
s = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (s == -1) {
- DEBUG(0,(__location__ " failed to open raw socket\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
return -1;
}
s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
if (s == -1) {
- DEBUG(0,(__location__ " failed to open raw socket (%s)\n",
+ DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket (%s)\n",
strerror(errno)));
return -1;
}
ret = setsockopt(s, SOL_IP, IP_HDRINCL, &one, sizeof(one));
if (ret != 0) {
- DEBUG(0,(__location__ " failed to setup IP headers (%s)\n",
+ DEBUG(DEBUG_CRIT,(__location__ " failed to setup IP headers (%s)\n",
strerror(errno)));
close(s);
return -1;
sock_out.sin_port = htons(node->address.port);
sock_out.sin_family = PF_INET;
if (ctdb_ibw_get_address(node->ctdb, node->address.address, &sock_out.sin_addr)) {
- DEBUG(0, ("ctdb_ibw_node_connect failed\n"));
+ DEBUG(DEBUG_ERR, ("ctdb_ibw_node_connect failed\n"));
return -1;
}
rc = ibw_connect(cn->conn, &sock_out, node);
if (rc) {
- DEBUG(0, ("ctdb_ibw_node_connect/ibw_connect failed - retrying...\n"));
+ DEBUG(DEBUG_ERR, ("ctdb_ibw_node_connect/ibw_connect failed - retrying...\n"));
/* try again once a second */
event_add_timed(node->ctdb->ev, node, timeval_current_ofs(1, 0),
ctdb_ibw_node_connect_event, node);
case IBWS_CONNECT_REQUEST: /* after [IBWS_READY + incoming request] */
/* => [(ibw_accept)IBWS_READY | (ibw_disconnect)STOPPED | ERROR] */
if (ibw_accept(ctx, conn, NULL)) {
- DEBUG(0, ("connstate_handler/ibw_accept failed\n"));
+ DEBUG(DEBUG_ERR, ("connstate_handler/ibw_accept failed\n"));
return -1;
} /* else continue in IBWC_CONNECTED */
break;
return -1;
if (ibw_bind(ictx, &my_addr)) {
- DEBUG(0, ("ctdb_ibw_listen: ibw_bind failed\n"));
+ DEBUG(DEBUG_CRIT, ("ctdb_ibw_listen: ibw_bind failed\n"));
return -1;
}
if (ibw_listen(ictx, backlog)) {
- DEBUG(0, ("ctdb_ibw_listen: ibw_listen failed\n"));
+ DEBUG(DEBUG_CRIT, ("ctdb_ibw_listen: ibw_listen failed\n"));
return -1;
}
for (i=0; i<ctdb->num_nodes; i++) {
if (ctdb_ibw_add_node(ctdb->nodes[i]) != 0) {
- DEBUG(0, ("methods->add_node failed at %d\n", i));
+ DEBUG(DEBUG_CRIT, ("methods->add_node failed at %d\n", i));
return -1;
}
}
void *buf, *key;
if (ibw_alloc_send_buf(conn, &buf, &key, length)) {
- DEBUG(0, ("queue_pkt/ibw_alloc_send_buf failed\n"));
+ DEBUG(DEBUG_ERR, ("queue_pkt/ibw_alloc_send_buf failed\n"));
return -1;
}
assert(cn!=NULL);
if (cn->conn==NULL) {
- DEBUG(0, ("ctdb_ibw_queue_pkt: conn is NULL\n"));
+ DEBUG(DEBUG_ERR, ("ctdb_ibw_queue_pkt: conn is NULL\n"));
return -1;
}
static void ctdb_ibw_restart(struct ctdb_node *node)
{
/* TODO: implement this method for IB */
- DEBUG(0,("WARNING: method restart is not yet implemented for IB\n"));
+ DEBUG(DEBUG_ALERT,("WARNING: method restart is not yet implemented for IB\n"));
}
/*
ctdb->ev);
if (ictx==NULL) {
- DEBUG(0, ("ctdb_ibw_init: ibw_init failed\n"));
+ DEBUG(DEBUG_CRIT, ("ctdb_ibw_init: ibw_init failed\n"));
return -1;
}
rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr);
if (rc) {
sprintf(ibw_lasterr, "refill/ibv_post_recv failed with %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return -2;
}
rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr);
if (rc) {
sprintf(ibw_lasterr, "fill/ibv_post_recv failed with %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return -2;
}
}
if (!pconn->is_accepted) {
rc = rdma_reject(cma_id, NULL, 0);
if (rc)
- DEBUG(0, ("rdma_reject failed with rc=%d\n", rc));
+ DEBUG(DEBUG_ERR, ("rdma_reject failed with rc=%d\n", rc));
talloc_free(conn);
DEBUG(DEBUG_DEBUG, ("pconn->cm_id %p wasn't accepted\n", pconn->cm_id));
}
if (conn) {
/* must be done BEFORE connstate */
if ((rc=rdma_ack_cm_event(event)))
- DEBUG(0, ("reject/rdma_ack_cm_event failed with %d\n", rc));
+ DEBUG(DEBUG_ERR, ("reject/rdma_ack_cm_event failed with %d\n", rc));
event = NULL; /* not to touch cma_id or conn */
conn->state = IBWC_ERROR;
/* it should free the conn */
case RDMA_CM_EVENT_DISCONNECTED:
DEBUG(DEBUG_DEBUG, ("RDMA_CM_EVENT_DISCONNECTED\n"));
if ((rc=rdma_ack_cm_event(event)))
- DEBUG(0, ("disc/rdma_ack_cm_event failed with %d\n", rc));
+ DEBUG(DEBUG_ERR, ("disc/rdma_ack_cm_event failed with %d\n", rc));
event = NULL; /* don't ack more */
if (cma_id!=pctx->cm_id) {
- DEBUG(0, ("client DISCONNECT event cm_id=%p\n", cma_id));
+ DEBUG(DEBUG_ERR, ("client DISCONNECT event cm_id=%p\n", cma_id));
conn = talloc_get_type(cma_id->context, struct ibw_conn);
conn->state = IBWC_DISCONNECTED;
pctx->connstate_func(NULL, conn);
return;
error:
- DEBUG(0, ("cm event handler: %s", ibw_lasterr));
+ DEBUG(DEBUG_ERR, ("cm event handler: %s", ibw_lasterr));
if (event!=NULL) {
if (cma_id!=NULL && cma_id!=pctx->cm_id) {
}
if ((rc=rdma_ack_cm_event(event))!=0) {
- DEBUG(0, ("rdma_ack_cm_event failed with %d\n", rc));
+ DEBUG(DEBUG_ERR, ("rdma_ack_cm_event failed with %d\n", rc));
}
}
error:
ibv_ack_cq_events(pconn->cq, 1);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
if (conn->state!=IBWC_ERROR) {
conn->state = IBWC_ERROR;
return 0;
error:
- DEBUG(0, ("ibw_wc_recv error: %s", ibw_lasterr));
+ DEBUG(DEBUG_ERR, ("ibw_wc_recv error: %s", ibw_lasterr));
return -1;
}
return ctx;
/* don't put code here */
cleanup:
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
if (ctx)
talloc_free(ctx);
rc = rdma_bind_addr(pctx->cm_id, (struct sockaddr *) my_addr);
if (rc) {
sprintf(ibw_lasterr, "rdma_bind_addr error %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return rc;
}
DEBUG(DEBUG_DEBUG, ("rdma_bind_addr successful\n"));
rc = rdma_listen(pctx->cm_id, backlog);
if (rc) {
sprintf(ibw_lasterr, "rdma_listen failed: %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return rc;
}
rc = rdma_accept(pconn->cm_id, &conn_param);
if (rc) {
sprintf(ibw_lasterr, "rdma_accept failed %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return -1;;
}
/* clean previous - probably half - initialization */
if (ibw_conn_priv_destruct(pconn)) {
- DEBUG(0, ("ibw_connect/ibw_pconn_destruct failed for cm_id=%p\n", pconn->cm_id));
+ DEBUG(DEBUG_ERR, ("ibw_connect/ibw_pconn_destruct failed for cm_id=%p\n", pconn->cm_id));
return -1;
}
rc = rdma_resolve_addr(pconn->cm_id, NULL, (struct sockaddr *) serv_addr, 2000);
if (rc) {
sprintf(ibw_lasterr, "rdma_resolve_addr error %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
talloc_free(conn);
return -1;
}
rc = rdma_disconnect(pconn->cm_id);
if (rc) {
sprintf(ibw_lasterr, "ibw_disconnect failed with %d\n", rc);
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return rc;
}
break;
pconn->extra_max++;
switch(pconn->extra_max) {
case 1: DEBUG(DEBUG_INFO, ("warning: queue performed\n")); break;
- case 10: DEBUG(0, ("warning: queue reached 10\n")); break;
- case 100: DEBUG(0, ("warning: queue reached 100\n")); break;
- case 1000: DEBUG(0, ("warning: queue reached 1000\n")); break;
+ case 10: DEBUG(DEBUG_INFO, ("warning: queue reached 10\n")); break;
+ case 100: DEBUG(DEBUG_INFO, ("warning: queue reached 100\n")); break;
+ case 1000: DEBUG(DEBUG_INFO, ("warning: queue reached 1000\n")); break;
default: break;
}
}
return 0;
error:
- DEBUG(0, ("ibw_alloc_send_buf error: %s", ibw_lasterr));
+ DEBUG(DEBUG_ERR, ("ibw_alloc_send_buf error: %s", ibw_lasterr));
return -1;
}
return 0;
error:
- DEBUG(0, (ibw_lasterr));
+ DEBUG(DEBUG_ERR, (ibw_lasterr));
return -1;
}
DEBUG(DEBUG_DEBUG, ("ibwtest_send_id\n"));
len = sizeof(uint32_t)+strlen(tcx->id)+2;
if (ibw_alloc_send_buf(conn, (void **)&buf, &key, len)) {
- DEBUG(0, ("send_id: ibw_alloc_send_buf failed\n"));
+ DEBUG(DEBUG_ERR, ("send_id: ibw_alloc_send_buf failed\n"));
return -1;
}
strcpy(buf+sizeof(uint32_t)+1, tcx->id);
if (ibw_send(conn, buf, key, len)) {
- DEBUG(0, ("send_id: ibw_send error\n"));
+ DEBUG(DEBUG_ERR, ("send_id: ibw_send error\n"));
return -1;
}
tcx->nsent++;
strcpy(p, msg);
if (ibw_send(conn, buf, key, len)) {
- DEBUG(0, ("send_test_msg: ibw_send error\n"));
+ DEBUG(DEBUG_ERR, ("send_test_msg: ibw_send error\n"));
return -1;
}
tcx->nsent++;
len = sizeof(uint32_t) + 1 + size + 1;
if (ibw_alloc_send_buf(conn, (void **)&buf, &key, len)) {
- DEBUG(0, ("varsize/ibw_alloc_send_buf failed\n"));
+ DEBUG(DEBUG_ERR, ("varsize/ibw_alloc_send_buf failed\n"));
return -1;
}
*((uint32_t *)buf) = len;
sum = ibwtest_fill_random(buf + sizeof(uint32_t) + 1, size);
buf[sizeof(uint32_t) + 1 + size] = sum;
if (ibw_send(conn, buf, key, len)) {
- DEBUG(0, ("varsize/ibw_send failed\n"));
+ DEBUG(DEBUG_ERR, ("varsize/ibw_send failed\n"));
return -1;
}
tcx->nsent++;
DEBUG(DEBUG_DEBUG, ("test IBWS_CONNECT_REQUEST\n"));
tconn = talloc_zero(conn, struct ibwtest_conn);
if (ibw_accept(ctx, conn, tconn)) {
- DEBUG(0, ("error accepting the connect request\n"));
+ DEBUG(DEBUG_ERR, ("error accepting the connect request\n"));
}
break;
case IBWS_STOPPED:
break;
case IBWC_CONNECTED:
if (gettimeofday(&tcx->start_time, NULL)) {
- DEBUG(0, ("gettimeofday error %d", errno));
+ DEBUG(DEBUG_ERR, ("gettimeofday error %d", errno));
return -1;
}
ibwtest_send_id(conn);
(uint32_t)sum,
tconn->id ? tconn->id : "NULL"));
if (sum!=((unsigned char *)buf)[n-1]) {
- DEBUG(0, ("ERROR: checksum mismatch %u!=%u\n",
+ DEBUG(DEBUG_ERR, ("ERROR: checksum mismatch %u!=%u\n",
(uint32_t)sum, (uint32_t)((unsigned char *)buf)[n-1]));
ibw_stop(tcx->ibwctx);
goto error;
void ibwtest_sigint_handler(int sig)
{
- DEBUG(0, ("got SIGINT\n"));
+ DEBUG(DEBUG_ERR, ("got SIGINT\n"));
if (testctx) {
if (testctx->ibwctx->state==IBWS_READY ||
testctx->ibwctx->state==IBWS_CONNECT_REQUEST ||
if (inet_pton(AF_INET, address, addr) <= 0) {
struct hostent *he = gethostbyname(address);
if (he == NULL || he->h_length > sizeof(*addr)) {
- DEBUG(0, ("invalid nework address '%s'\n", address));
+ DEBUG(DEBUG_ERR, ("invalid nework address '%s'\n", address));
return -1;
}
memcpy(addr, he->h_addr, he->h_length);
}
if (ibw_bind(tcx->ibwctx, &tcx->addrs[0])) {
- DEBUG(0, ("ERROR: ibw_bind failed\n"));
+ DEBUG(DEBUG_ERR, ("ERROR: ibw_bind failed\n"));
return -1;
}
if (ibw_listen(tcx->ibwctx, 1)) {
- DEBUG(0, ("ERROR: ibw_listen failed\n"));
+ DEBUG(DEBUG_ERR, ("ERROR: ibw_listen failed\n"));
return -1;
}
if (!tcx->is_server && tcx->nsent!=0 && !tcx->error) {
if (gettimeofday(&tcx->end_time, NULL)) {
- DEBUG(0, ("gettimeofday error %d\n", errno));
+ DEBUG(DEBUG_ERR, ("gettimeofday error %d\n", errno));
goto cleanup;
}
usec = (tcx->end_time.tv_sec - tcx->start_time.tv_sec) * 1000000 +
talloc_free(tcx);
if (ev)
talloc_free(ev);
- DEBUG(0, ("exited with code %d\n", result));
+ DEBUG(DEBUG_ERR, ("exited with code %d\n", result));
return result;
}
TALLOC_CTX *tmp_ctx;
if (ctdb->pnn != ctdb_lmaster(ctdb, &key)) {
- DEBUG(0,(__location__ " Caller is not lmaster!\n"));
+ DEBUG(DEBUG_ALERT,(__location__ " Caller is not lmaster!\n"));
return;
}
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
if (state == NULL) {
- DEBUG(0,("pnn %u Invalid reqid %u in ctdb_become_dmaster from node %u\n",
+ DEBUG(DEBUG_ERR,("pnn %u Invalid reqid %u in ctdb_become_dmaster from node %u\n",
ctdb->pnn, hdr->reqid, hdr->srcnode));
ctdb_ltdb_unlock(ctdb_db, key);
return;
if (hdr->reqid != state->reqid) {
/* we found a record but it was the wrong one */
- DEBUG(0, ("Dropped orphan in ctdb_become_dmaster with reqid:%u\n from node %u", hdr->reqid, hdr->srcnode));
+ DEBUG(DEBUG_ERR, ("Dropped orphan in ctdb_become_dmaster with reqid:%u\n from node %u", hdr->reqid, hdr->srcnode));
ctdb_ltdb_unlock(ctdb_db, key);
return;
}
}
if (ctdb_lmaster(ctdb, &key) != ctdb->pnn) {
- DEBUG(0,("pnn %u dmaster request to non-lmaster lmaster=%u gen=%u curgen=%u\n",
+ DEBUG(DEBUG_ALERT,("pnn %u dmaster request to non-lmaster lmaster=%u gen=%u curgen=%u\n",
ctdb->pnn, ctdb_lmaster(ctdb, &key),
hdr->generation, ctdb->vnn_map->generation));
ctdb_fatal(ctdb, "ctdb_req_dmaster to non-lmaster");
/* its a protocol error if the sending node is not the current dmaster */
if (header.dmaster != hdr->srcnode) {
- DEBUG(0,("pnn %u dmaster request for new-dmaster %u from non-master %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u keyval=0x%08x\n",
+ DEBUG(DEBUG_ALERT,("pnn %u dmaster request for new-dmaster %u from non-master %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u keyval=0x%08x\n",
ctdb->pnn, c->dmaster, hdr->srcnode, header.dmaster, ctdb_hash(&key),
ctdb_db->db_id, hdr->generation, ctdb->vnn_map->generation,
(unsigned long long)c->rsn, (unsigned long long)header.rsn, c->hdr.reqid,
}
if (header.rsn > c->rsn) {
- DEBUG(0,("pnn %u dmaster request with older RSN new-dmaster %u from %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u\n",
+ DEBUG(DEBUG_ALERT,("pnn %u dmaster request with older RSN new-dmaster %u from %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u\n",
ctdb->pnn, c->dmaster, hdr->srcnode, header.dmaster, ctdb_hash(&key),
ctdb_db->db_id, hdr->generation, ctdb->vnn_map->generation,
(unsigned long long)c->rsn, (unsigned long long)header.rsn, c->hdr.reqid));
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
if (state == NULL) {
- DEBUG(0, (__location__ " reqid %u not found\n", hdr->reqid));
+ DEBUG(DEBUG_ERR, (__location__ " reqid %u not found\n", hdr->reqid));
return;
}
if (hdr->reqid != state->reqid) {
/* we found a record but it was the wrong one */
- DEBUG(0, ("Dropped orphaned call reply with reqid:%u\n",hdr->reqid));
+ DEBUG(DEBUG_ERR, ("Dropped orphaned call reply with reqid:%u\n",hdr->reqid));
return;
}
ctdb_db = find_ctdb_db(ctdb, c->db_id);
if (ctdb_db == NULL) {
- DEBUG(0,("Unknown db_id 0x%x in ctdb_reply_dmaster\n", c->db_id));
+ DEBUG(DEBUG_ERR,("Unknown db_id 0x%x in ctdb_reply_dmaster\n", c->db_id));
return;
}
return;
}
if (ret != 0) {
- DEBUG(0,(__location__ " Failed to get lock in ctdb_reply_dmaster\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to get lock in ctdb_reply_dmaster\n"));
return;
}
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
if (state == NULL) {
- DEBUG(0,("pnn %u Invalid reqid %u in ctdb_reply_error\n",
+ DEBUG(DEBUG_ERR,("pnn %u Invalid reqid %u in ctdb_reply_error\n",
ctdb->pnn, hdr->reqid));
return;
}
if (hdr->reqid != state->reqid) {
/* we found a record but it was the wrong one */
- DEBUG(0, ("Dropped orphaned error reply with reqid:%u\n",hdr->reqid));
+ DEBUG(DEBUG_ERR, ("Dropped orphaned error reply with reqid:%u\n",hdr->reqid));
return;
}
state->c->hdr.destnode = ctdb->pnn;
ctdb_queue_packet(ctdb, &state->c->hdr);
- DEBUG(0,("resent ctdb_call\n"));
+ DEBUG(DEBUG_NOTICE,("resent ctdb_call\n"));
}
/*
long fsize;
f = tmpfile();
if (f == NULL) {
- DEBUG(0,(__location__ " Unable to open tmpfile - %s\n", strerror(errno)));
+ DEBUG(DEBUG_ERR,(__location__ " Unable to open tmpfile - %s\n", strerror(errno)));
return -1;
}
talloc_report_full(NULL, f);
outdata->dsize = fread(outdata->dptr, 1, fsize, f);
fclose(f);
if (outdata->dsize != fsize) {
- DEBUG(0,(__location__ " Unable to read tmpfile\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Unable to read tmpfile\n"));
return -1;
}
return 0;
case CTDB_CONTROL_SET_RECMASTER: {
CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t));
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
- DEBUG(0,("Attempt to set recmaster when not frozen\n"));
+ DEBUG(DEBUG_NOTICE,("Attempt to set recmaster when not frozen\n"));
return -1;
}
ctdb->recovery_master = ((uint32_t *)(&indata.dptr[0]))[0];
ctdb_release_all_ips(ctdb);
ctdb->methods->shutdown(ctdb);
ctdb_event_script(ctdb, "shutdown");
- DEBUG(0,("Received SHUTDOWN command. Stopping CTDB daemon.\n"));
+ DEBUG(DEBUG_NOTICE,("Received SHUTDOWN command. Stopping CTDB daemon.\n"));
exit(0);
case CTDB_CONTROL_TAKEOVER_IP:
case CTDB_CONTROL_END_RECOVERY:
return ctdb_control_end_recovery(ctdb, c, async_reply);
default:
- DEBUG(0,(__location__ " Unknown CTDB control opcode %u\n", opcode));
+ DEBUG(DEBUG_CRIT,(__location__ " Unknown CTDB control opcode %u\n", opcode));
return -1;
}
}
state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_control_state);
if (state == NULL) {
- DEBUG(0,("pnn %u Invalid reqid %u in ctdb_reply_control\n",
+ DEBUG(DEBUG_ERR,("pnn %u Invalid reqid %u in ctdb_reply_control\n",
ctdb->pnn, hdr->reqid));
return;
}
if (hdr->reqid != state->reqid) {
/* we found a record but it was the wrong one */
- DEBUG(0, ("Dropped orphaned control reply with reqid:%u\n", hdr->reqid));
+ DEBUG(DEBUG_ERR, ("Dropped orphaned control reply with reqid:%u\n", hdr->reqid));
return;
}
(destnode == CTDB_BROADCAST_ALL) ||
(destnode == CTDB_BROADCAST_CONNECTED)) &&
!(flags & CTDB_CTRL_FLAG_NOREPLY)) {
- DEBUG(0,("Attempt to broadcast control without NOREPLY\n"));
+ DEBUG(DEBUG_CRIT,("Attempt to broadcast control without NOREPLY\n"));
return -1;
}
struct ctdb_node_flag_change *c = (struct ctdb_node_flag_change *)data.dptr;
if (data.dsize != sizeof(*c) || !ctdb_validate_pnn(ctdb, c->pnn)) {
- DEBUG(0,(__location__ "Invalid data in ctdb_node_flag_change\n"));
+ DEBUG(DEBUG_CRIT,(__location__ "Invalid data in ctdb_node_flag_change\n"));
return;
}
if (!ctdb_validate_pnn(ctdb, c->pnn)) {
- DEBUG(0,("Bad pnn %u in flag_change_handler\n", c->pnn));
+ DEBUG(DEBUG_CRIT,("Bad pnn %u in flag_change_handler\n", c->pnn));
return;
}
static void print_exit_message(void)
{
- DEBUG(0,("CTDB daemon shutting down\n"));
+ DEBUG(DEBUG_NOTICE,("CTDB daemon shutting down\n"));
}
{
/* start the transport running */
if (ctdb->methods->start(ctdb) != 0) {
- DEBUG(0,("transport failed to start!\n"));
+ DEBUG(DEBUG_ALERT,("transport failed to start!\n"));
ctdb_fatal(ctdb, "transport failed to start");
}
/* start the recovery daemon process */
if (ctdb_start_recoverd(ctdb) != 0) {
- DEBUG(0,("Failed to start recovery daemon\n"));
+ DEBUG(DEBUG_ALERT,("Failed to start recovery daemon\n"));
exit(11);
}
struct ctdb_client *client = ctdb_reqid_find(ctdb, client_id, struct ctdb_client);
int res;
if (client == NULL) {
- DEBUG(0,("Bad client_id in daemon_request_register_message_handler\n"));
+ DEBUG(DEBUG_ERR,("Bad client_id in daemon_request_register_message_handler\n"));
return -1;
}
res = ctdb_register_message_handler(ctdb, client, srvid, daemon_message_handler, client);
if (res != 0) {
- DEBUG(0,(__location__ " Failed to register handler %llu in daemon\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to register handler %llu in daemon\n",
(unsigned long long)srvid));
} else {
DEBUG(DEBUG_INFO,(__location__ " Registered message handler for srvid=%llu\n",
{
struct ctdb_client *client = ctdb_reqid_find(ctdb, client_id, struct ctdb_client);
if (client == NULL) {
- DEBUG(0,("Bad client_id in daemon_request_deregister_message_handler\n"));
+ DEBUG(DEBUG_ERR,("Bad client_id in daemon_request_deregister_message_handler\n"));
return -1;
}
return ctdb_deregister_message_handler(ctdb, srvid, client);
res = ctdb_daemon_send_message(client->ctdb, c->hdr.destnode,
c->srvid, data);
if (res != 0) {
- DEBUG(0,(__location__ " Failed to send message to remote node %u\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to send message to remote node %u\n",
c->hdr.destnode));
}
}
res = ctdb_daemon_call_recv(state, dstate->call);
if (res != 0) {
- DEBUG(0, (__location__ " ctdbd_call_recv() returned error\n"));
+ DEBUG(DEBUG_ERR, (__location__ " ctdbd_call_recv() returned error\n"));
client->ctdb->statistics.pending_calls--;
ctdb_latency(&client->ctdb->statistics.max_call_latency, dstate->start_time);
return;
r = ctdbd_allocate_pkt(client->ctdb, dstate, CTDB_REPLY_CALL,
length, struct ctdb_reply_call);
if (r == NULL) {
- DEBUG(0, (__location__ " Failed to allocate reply_call in ctdb daemon\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Failed to allocate reply_call in ctdb daemon\n"));
client->ctdb->statistics.pending_calls--;
ctdb_latency(&client->ctdb->statistics.max_call_latency, dstate->start_time);
return;
res = daemon_queue_send(client, &r->hdr);
if (res != 0) {
- DEBUG(0, (__location__ " Failed to queue packet from daemon to client\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Failed to queue packet from daemon to client\n"));
}
ctdb_latency(&client->ctdb->statistics.max_call_latency, dstate->start_time);
talloc_free(dstate);
struct ctdb_daemon_packet_wrap *w = talloc_get_type(p,
struct ctdb_daemon_packet_wrap);
if (w == NULL) {
- DEBUG(0,(__location__ " Bad packet type '%s'\n", talloc_get_name(p)));
+ DEBUG(DEBUG_CRIT,(__location__ " Bad packet type '%s'\n", talloc_get_name(p)));
return;
}
client = ctdb_reqid_find(w->ctdb, w->client_id, struct ctdb_client);
if (client == NULL) {
- DEBUG(0,(__location__ " Packet for disconnected client %u\n",
+ DEBUG(DEBUG_ERR,(__location__ " Packet for disconnected client %u\n",
w->client_id));
talloc_free(w);
return;
ctdb_db = find_ctdb_db(client->ctdb, c->db_id);
if (!ctdb_db) {
- DEBUG(0, (__location__ " Unknown database in request. db_id==0x%08x",
+ DEBUG(DEBUG_ERR, (__location__ " Unknown database in request. db_id==0x%08x",
c->db_id));
ctdb->statistics.pending_calls--;
return;
talloc_free(w);
if (ret != 0) {
- DEBUG(0,(__location__ " Unable to fetch record\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Unable to fetch record\n"));
ctdb->statistics.pending_calls--;
return;
}
dstate = talloc(client, struct daemon_call_state);
if (dstate == NULL) {
ctdb_ltdb_unlock(ctdb_db, key);
- DEBUG(0,(__location__ " Unable to allocate dstate\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Unable to allocate dstate\n"));
ctdb->statistics.pending_calls--;
return;
}
call = dstate->call = talloc_zero(dstate, struct ctdb_call);
if (call == NULL) {
ctdb_ltdb_unlock(ctdb_db, key);
- DEBUG(0,(__location__ " Unable to allocate call\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Unable to allocate call\n"));
ctdb->statistics.pending_calls--;
ctdb_latency(&ctdb->statistics.max_call_latency, dstate->start_time);
return;
ctdb_ltdb_unlock(ctdb_db, key);
if (state == NULL) {
- DEBUG(0,(__location__ " Unable to setup call send\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Unable to setup call send\n"));
ctdb->statistics.pending_calls--;
ctdb_latency(&ctdb->statistics.max_call_latency, dstate->start_time);
return;
break;
default:
- DEBUG(0,(__location__ " daemon: unrecognized operation %u\n",
+ DEBUG(DEBUG_CRIT,(__location__ " daemon: unrecognized operation %u\n",
hdr->operation));
}
/* AIX doesn't like this :( */
if (fchown(ctdb->daemon.sd, geteuid(), getegid()) != 0 ||
fchmod(ctdb->daemon.sd, 0700) != 0) {
- DEBUG(0,("Unable to secure ctdb socket '%s', ctdb->daemon.name\n"));
+ DEBUG(DEBUG_CRIT,("Unable to secure ctdb socket '%s', ctdb->daemon.name\n"));
goto failed;
}
#endif
strncpy(addr.sun_path, ctdb->daemon.name, sizeof(addr.sun_path));
if (bind(ctdb->daemon.sd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
- DEBUG(0,("Unable to bind on ctdb socket '%s'\n", ctdb->daemon.name));
+ DEBUG(DEBUG_CRIT,("Unable to bind on ctdb socket '%s'\n", ctdb->daemon.name));
goto failed;
}
if (listen(ctdb->daemon.sd, 10) != 0) {
- DEBUG(0,("Unable to listen on ctdb socket '%s'\n", ctdb->daemon.name));
+ DEBUG(DEBUG_CRIT,("Unable to listen on ctdb socket '%s'\n", ctdb->daemon.name));
goto failed;
}
/* create a unix domain stream socket to listen to */
res = ux_socket_bind(ctdb);
if (res!=0) {
- DEBUG(0,(__location__ " Failed to open CTDB unix domain socket\n"));
+ DEBUG(DEBUG_ALERT,(__location__ " Failed to open CTDB unix domain socket\n"));
exit(10);
}
setsid();
close(0);
if (open("/dev/null", O_RDONLY) != 0) {
- DEBUG(0,(__location__ " Failed to setup stdin on /dev/null\n"));
+ DEBUG(DEBUG_ALERT,(__location__ " Failed to setup stdin on /dev/null\n"));
exit(11);
}
}
}
#endif
if (ret != 0) {
- DEBUG(0,("Failed to initialise transport '%s'\n", ctdb->transport));
+ DEBUG(DEBUG_ERR,("Failed to initialise transport '%s'\n", ctdb->transport));
return -1;
}
/* initialise the transport */
if (ctdb->methods->initialise(ctdb) != 0) {
- DEBUG(0,("transport failed to initialise!\n"));
ctdb_fatal(ctdb, "transport failed to initialise");
}
/* go into a wait loop to allow other nodes to complete */
event_loop_wait(ctdb->ev);
- DEBUG(0,("event_loop_wait() returned. this should not happen\n"));
+ DEBUG(DEBUG_CRIT,("event_loop_wait() returned. this should not happen\n"));
exit(1);
}
hdr = (struct ctdb_req_header *)ctdb->methods->allocate_pkt(mem_ctx, size);
if (hdr == NULL) {
- DEBUG(0,("Unable to allocate transport packet for operation %u of length %u\n",
+ DEBUG(DEBUG_ERR,("Unable to allocate transport packet for operation %u of length %u\n",
operation, (unsigned)length));
return NULL;
}
data, daemon_control_callback,
state);
if (res != 0) {
- DEBUG(0,(__location__ " Failed to send control to remote node %u\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to send control to remote node %u\n",
c->hdr.destnode));
}
res = ctdb_dispatch_message(m->ctdb, m->srvid, m->data);
if (res != 0) {
- DEBUG(0, (__location__ " Failed to dispatch message for srvid=%llu\n",
+ DEBUG(DEBUG_ERR, (__location__ " Failed to dispatch message for srvid=%llu\n",
(unsigned long long)m->srvid));
}
talloc_free(m);
struct ctdb_freeze_waiter *w;
if (h->ctdb->freeze_mode == CTDB_FREEZE_FROZEN) {
- DEBUG(0,("freeze child died - unfreezing\n"));
+ DEBUG(DEBUG_INFO,("freeze child died - unfreezing\n"));
talloc_free(h);
return;
}
if (read(h->fd, &status, sizeof(status)) != sizeof(status)) {
- DEBUG(0,("read error from freeze lock child\n"));
+ DEBUG(DEBUG_ERR,("read error from freeze lock child\n"));
status = -1;
}
if (status == -1) {
- DEBUG(0,("Failed to get locks in ctdb_freeze_child\n"));
+ DEBUG(DEBUG_ERR,("Failed to get locks in ctdb_freeze_child\n"));
/* we didn't get the locks - destroy the handle */
talloc_free(h);
return;
/* use socketpair() instead of pipe() so we have bi-directional fds */
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != 0) {
- DEBUG(0,("Failed to create pipe for ctdb_freeze_lock\n"));
+ DEBUG(DEBUG_ERR,("Failed to create pipe for ctdb_freeze_lock\n"));
talloc_free(h);
return NULL;
}
h->child = fork();
if (h->child == -1) {
- DEBUG(0,("Failed to fork child for ctdb_freeze_lock\n"));
+ DEBUG(DEBUG_ERR,("Failed to fork child for ctdb_freeze_lock\n"));
talloc_free(h);
return NULL;
}
fde = event_add_fd(ctdb->ev, h, h->fd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE,
ctdb_freeze_lock_handler, h);
if (fde == NULL) {
- DEBUG(0,("Failed to setup fd event for ctdb_freeze_lock\n"));
+ DEBUG(DEBUG_ERR,("Failed to setup fd event for ctdb_freeze_lock\n"));
close(fd[0]);
talloc_free(h);
return NULL;
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
tdb_add_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
if (tdb_transaction_cancel(ctdb_db->ltdb->tdb) != 0) {
- DEBUG(0,(__location__ " Failed to cancel transaction for db '%s'\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to cancel transaction for db '%s'\n",
ctdb_db->db_name));
}
tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
struct ctdb_db_context *ctdb_db;
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
- DEBUG(0,(__location__ " Failed transaction_start while not frozen\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed transaction_start while not frozen\n"));
return -1;
}
if (ctdb->freeze_handle->transaction_started) {
if (tdb_transaction_cancel(ctdb_db->ltdb->tdb) != 0) {
- DEBUG(0,(__location__ " Failed to cancel transaction for db '%s'\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to cancel transaction for db '%s'\n",
ctdb_db->db_name));
/* not a fatal error */
}
tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
if (ret != 0) {
- DEBUG(0,(__location__ " Failed to start transaction for db '%s'\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to start transaction for db '%s'\n",
ctdb_db->db_name));
return -1;
}
struct ctdb_db_context *ctdb_db;
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
- DEBUG(0,(__location__ " Failed transaction_start while not frozen\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed transaction_start while not frozen\n"));
return -1;
}
if (!ctdb->freeze_handle->transaction_started) {
- DEBUG(0,(__location__ " transaction not started\n"));
+ DEBUG(DEBUG_ERR,(__location__ " transaction not started\n"));
return -1;
}
if (id != ctdb->freeze_handle->transaction_id) {
- DEBUG(0,(__location__ " incorrect transaction id 0x%x in commit\n", id));
+ DEBUG(DEBUG_ERR,(__location__ " incorrect transaction id 0x%x in commit\n", id));
return -1;
}
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
tdb_add_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK);
if (tdb_transaction_commit(ctdb_db->ltdb->tdb) != 0) {
- DEBUG(0,(__location__ " Failed to commit transaction for db '%s'\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to commit transaction for db '%s'\n",
ctdb_db->db_name));
/* this has to be fatal to maintain integrity - it should only
happen if we run out of disk space */
struct ctdb_db_context *ctdb_db;
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
- DEBUG(0,(__location__ " Failed transaction_start while not frozen\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed transaction_start while not frozen\n"));
return -1;
}
if (!ctdb->freeze_handle->transaction_started) {
- DEBUG(0,(__location__ " transaction not started\n"));
+ DEBUG(DEBUG_ERR,(__location__ " transaction not started\n"));
return -1;
}
if (w.transaction_id != ctdb->freeze_handle->transaction_id) {
- DEBUG(0,(__location__ " incorrect transaction id 0x%x in commit\n", w.transaction_id));
+ DEBUG(DEBUG_ERR,(__location__ " incorrect transaction id 0x%x in commit\n", w.transaction_id));
return -1;
}
ctdb_db = find_ctdb_db(ctdb, w.db_id);
if (!ctdb_db) {
- DEBUG(0,(__location__ " Unknown db 0x%x\n", w.db_id));
+ DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%x\n", w.db_id));
return -1;
}
if (tdb_wipe_all(ctdb_db->ltdb->tdb) != 0) {
- DEBUG(0,(__location__ " Failed to wipe database for db '%s'\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to wipe database for db '%s'\n",
ctdb_db->db_name));
return -1;
}
node->rx_cnt = 0;
if (node->dead_count >= ctdb->tunable.keepalive_limit) {
- DEBUG(0,("dead count reached for node %u\n", node->pnn));
+ DEBUG(DEBUG_NOTICE,("dead count reached for node %u\n", node->pnn));
ctdb_node_dead(node);
ctdb_send_keepalive(ctdb, node->pnn);
/* maybe tell the transport layer to kill the
ctdb_check_for_dead_nodes, ctdb);
CTDB_NO_MEMORY_FATAL(ctdb, te);
- DEBUG(0,("Keepalive monitoring has been started\n"));
+ DEBUG(DEBUG_NOTICE,("Keepalive monitoring has been started\n"));
}
void ctdb_stop_keepalive(struct ctdb_context *ctdb)
/* setup a pipe to catch IO from subprocesses */
if (pipe(p) != 0) {
- DEBUG(0,(__location__ " Failed to setup for child logging pipe\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to setup for child logging pipe\n"));
return -1;
}
struct lock_fetch_state *state = talloc_get_type(p, struct lock_fetch_state);
if (!state->ignore_generation &&
state->generation != state->ctdb->vnn_map->generation) {
- DEBUG(0,("Discarding previous generation lockwait packet\n"));
+ DEBUG(DEBUG_NOTICE,("Discarding previous generation lockwait packet\n"));
talloc_free(state->hdr);
return;
}
struct tdb_context *tdb = ctdb_db->ltdb->tdb;
int count = tdb_traverse_read(tdb, NULL, NULL);
if (count != 0) {
- DEBUG(0,(__location__ " tdb '%s' not empty on attach! aborting\n",
+ DEBUG(DEBUG_ALERT,(__location__ " tdb '%s' not empty on attach! aborting\n",
ctdb_db->db_path));
ctdb_fatal(ctdb_db->ctdb, "database not empty on attach");
}
/* check for hash collisions */
for (tmp_db=ctdb->db_list;tmp_db;tmp_db=tmp_db->next) {
if (tmp_db->db_id == ctdb_db->db_id) {
- DEBUG(0,("db_id 0x%x hash collision. name1='%s' name2='%s'\n",
+ DEBUG(DEBUG_CRIT,("db_id 0x%x hash collision. name1='%s' name2='%s'\n",
tmp_db->db_id, db_name, tmp_db->db_name));
talloc_free(ctdb_db);
return -1;
/* make sure the db directory exists */
if (mkdir(ctdb->db_directory, 0700) == -1 && errno != EEXIST) {
- DEBUG(0,(__location__ " Unable to create ctdb directory '%s'\n",
+ DEBUG(DEBUG_CRIT,(__location__ " Unable to create ctdb directory '%s'\n",
ctdb->db_directory));
talloc_free(ctdb_db);
return -1;
}
if (persistent && mkdir(ctdb->db_directory_persistent, 0700) == -1 && errno != EEXIST) {
- DEBUG(0,(__location__ " Unable to create ctdb persistent directory '%s'\n",
+ DEBUG(DEBUG_CRIT,(__location__ " Unable to create ctdb persistent directory '%s'\n",
ctdb->db_directory_persistent));
talloc_free(ctdb_db);
return -1;
persistent? TDB_DEFAULT : TDB_CLEAR_IF_FIRST | TDB_NOSYNC,
O_CREAT|O_RDWR, 0666);
if (ctdb_db->ltdb == NULL) {
- DEBUG(0,("Failed to open tdb '%s'\n", ctdb_db->db_path));
+ DEBUG(DEBUG_CRIT,("Failed to open tdb '%s'\n", ctdb_db->db_path));
talloc_free(ctdb_db);
return -1;
}
*/
ret = ctdb_daemon_set_call(ctdb, ctdb_db->db_id, ctdb_null_func, CTDB_NULL_FUNC);
if (ret != 0) {
- DEBUG(0,("Failed to setup null function for '%s'\n", ctdb_db->db_name));
+ DEBUG(DEBUG_CRIT,("Failed to setup null function for '%s'\n", ctdb_db->db_name));
talloc_free(ctdb_db);
return -1;
}
*/
ret = ctdb_daemon_set_call(ctdb, ctdb_db->db_id, ctdb_fetch_func, CTDB_FETCH_FUNC);
if (ret != 0) {
- DEBUG(0,("Failed to setup fetch function for '%s'\n", ctdb_db->db_name));
+ DEBUG(DEBUG_CRIT,("Failed to setup fetch function for '%s'\n", ctdb_db->db_name));
talloc_free(ctdb_db);
return -1;
}
databases
*/
if (node->flags & NODE_FLAGS_INACTIVE) {
- DEBUG(0,("DB Attach to database %s refused since node is inactive (disconnected or banned)\n", db_name));
+ DEBUG(DEBUG_ERR,("DB Attach to database %s refused since node is inactive (disconnected or banned)\n", db_name));
return -1;
}
db = ctdb_db_handle(ctdb, db_name);
if (!db) {
- DEBUG(0,("Failed to find db handle for name '%s'\n", db_name));
+ DEBUG(DEBUG_ERR,("Failed to find db handle for name '%s'\n", db_name));
return -1;
}
p[4] = 0;
if (ctdb_local_attach(ctdb, s, true) != 0) {
- DEBUG(0,("Failed to attach to persistent database '%s'\n", de->d_name));
+ DEBUG(DEBUG_ERR,("Failed to attach to persistent database '%s'\n", de->d_name));
closedir(d);
talloc_free(s);
return -1;
}
- DEBUG(0,("Attached to persistent database %s\n", s));
+ DEBUG(DEBUG_NOTICE,("Attached to persistent database %s\n", s));
talloc_free(s);
}
ctdb_db = find_ctdb_db(ctdb, db_id);
if (!ctdb_db) {
- DEBUG(0,("Unknown db_id 0x%x in ctdb_ltdb_update_seqnum\n", db_id));
+ DEBUG(DEBUG_ERR,("Unknown db_id 0x%x in ctdb_ltdb_update_seqnum\n", db_id));
return -1;
}
struct ctdb_db_context *ctdb_db;
ctdb_db = find_ctdb_db(ctdb, db_id);
if (!ctdb_db) {
- DEBUG(0,("Unknown db_id 0x%x in ctdb_ltdb_enable_seqnum\n", db_id));
+ DEBUG(DEBUG_ERR,("Unknown db_id 0x%x in ctdb_ltdb_enable_seqnum\n", db_id));
return -1;
}
c.old_flags = node->flags;
if (status != 0 && !(node->flags & NODE_FLAGS_UNHEALTHY)) {
- DEBUG(0,("monitor event failed - disabling node\n"));
+ DEBUG(DEBUG_NOTICE,("monitor event failed - disabling node\n"));
node->flags |= NODE_FLAGS_UNHEALTHY;
ctdb->monitor->next_interval = 1;
} else if (status == 0 && (node->flags & NODE_FLAGS_UNHEALTHY)) {
static void ctdb_startup_callback(struct ctdb_context *ctdb, int status, void *p)
{
if (status != 0) {
- DEBUG(0,("startup event failed\n"));
+ DEBUG(DEBUG_ERR,("startup event failed\n"));
} else if (status == 0) {
- DEBUG(0,("startup event OK - enabling monitoring\n"));
+ DEBUG(DEBUG_NOTICE,("startup event OK - enabling monitoring\n"));
ctdb->done_startup = true;
ctdb->monitor->next_interval = 1;
}
}
if (ret != 0) {
- DEBUG(0,("Unable to launch monitor event script\n"));
+ DEBUG(DEBUG_ERR,("Unable to launch monitor event script\n"));
ctdb->monitor->next_interval = 1;
event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
timeval_current_ofs(1, 0),
ctdb->monitor->monitoring_mode = CTDB_MONITORING_DISABLED;
ctdb->monitor->next_interval = 1;
- DEBUG(0,("Monitoring has been stopped\n"));
+ DEBUG(DEBUG_NOTICE,("Monitoring has been stopped\n"));
}
/*
CTDB_NO_MEMORY_FATAL(ctdb, te);
ctdb->monitor->monitoring_mode = CTDB_MONITORING_ACTIVE;
- DEBUG(0,("Monitoring has been started\n"));
+ DEBUG(DEBUG_NOTICE,("Monitoring has been started\n"));
}
return 0;
}
- DEBUG(0, ("Control modflags on node %u - flags now 0x%x\n", ctdb->pnn, node->flags));
+ DEBUG(DEBUG_INFO, ("Control modflags on node %u - flags now 0x%x\n", ctdb->pnn, node->flags));
/* if we have been banned, go into recovery mode */
c.pnn = ctdb->pnn;
if ((node->flags & NODE_FLAGS_BANNED) && !(old_flags & NODE_FLAGS_BANNED)) {
/* make sure we are frozen */
- DEBUG(0,("This node has been banned - forcing freeze and recovery\n"));
+ DEBUG(DEBUG_NOTICE,("This node has been banned - forcing freeze and recovery\n"));
/* Reset the generation id to 1 to make us ignore any
REQ/REPLY CALL/DMASTER someone sends to us.
We are now banned so we shouldnt service database calls
struct ctdb_persistent_state);
if (status != 0) {
- DEBUG(0,("ctdb_persistent_callback failed with status %d (%s)\n",
+ DEBUG(DEBUG_ERR,("ctdb_persistent_callback failed with status %d (%s)\n",
status, errormsg));
state->status = status;
state->errormsg = errormsg;
c->client_id, 0, recdata,
ctdb_persistent_callback, state);
if (ret == -1) {
- DEBUG(0,("Unable to send CTDB_CONTROL_UPDATE_RECORD to pnn %u\n", node->pnn));
+ DEBUG(DEBUG_ERR,("Unable to send CTDB_CONTROL_UPDATE_RECORD to pnn %u\n", node->pnn));
talloc_free(state);
return -1;
}
/* fetch the old header and ensure the rsn is less than the new rsn */
ret = ctdb_ltdb_fetch(state->ctdb_db, state->key, &oldheader, NULL, NULL);
if (ret != 0) {
- DEBUG(0,("Failed to fetch old record for db_id 0x%08x in ctdb_persistent_store\n",
+ DEBUG(DEBUG_ERR,("Failed to fetch old record for db_id 0x%08x in ctdb_persistent_store\n",
state->ctdb_db->db_id));
return -1;
}
if (oldheader.rsn >= state->header->rsn) {
- DEBUG(0,("existing header for db_id 0x%08x has larger RSN %llu than new RSN %llu in ctdb_persistent_store\n",
+ DEBUG(DEBUG_CRIT,("existing header for db_id 0x%08x has larger RSN %llu than new RSN %llu in ctdb_persistent_store\n",
state->ctdb_db->db_id,
(unsigned long long)oldheader.rsn, (unsigned long long)state->header->rsn));
return -1;
ret = ctdb_ltdb_store(state->ctdb_db, state->key, state->header, state->data);
if (ret != 0) {
- DEBUG(0,("Failed to store record for db_id 0x%08x in ctdb_persistent_store\n",
+ DEBUG(DEBUG_CRIT,("Failed to store record for db_id 0x%08x in ctdb_persistent_store\n",
state->ctdb_db->db_id));
return -1;
}
ret = tdb_chainlock_mark(state->tdb, state->key);
if (ret != 0) {
- DEBUG(0,("Failed to mark lock in ctdb_persistent_lock_callback\n"));
+ DEBUG(DEBUG_ERR,("Failed to mark lock in ctdb_persistent_lock_callback\n"));
ctdb_request_control_reply(state->ctdb_db->ctdb, state->c, NULL, ret, NULL);
return;
}
struct ctdb_persistent_lock_state *state;
if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) {
- DEBUG(0,("rejecting ctdb_control_update_record when recovery active\n"));
+ DEBUG(DEBUG_DEBUG,("rejecting ctdb_control_update_record when recovery active\n"));
return -1;
}
ctdb_db = find_ctdb_db(ctdb, db_id);
if (ctdb_db == NULL) {
- DEBUG(0,("Unknown database 0x%08x in ctdb_control_update_record\n", db_id));
+ DEBUG(DEBUG_ERR,("Unknown database 0x%08x in ctdb_control_update_record\n", db_id));
return -1;
}
state->data.dsize = rec->datalen;
if (state->data.dsize < sizeof(struct ctdb_ltdb_header)) {
- DEBUG(0,("Invalid data size %u in ctdb_control_update_record\n",
+ DEBUG(DEBUG_CRIT,("Invalid data size %u in ctdb_control_update_record\n",
(unsigned)state->data.dsize));
return -1;
}
/* wait until we have a lock on this record */
handle = ctdb_lockwait(ctdb_db, state->key, ctdb_persistent_lock_callback, state);
if (handle == NULL) {
- DEBUG(0,("Failed to setup lockwait handler in ctdb_control_update_record\n"));
+ DEBUG(DEBUG_ERR,("Failed to setup lockwait handler in ctdb_control_update_record\n"));
return -1;
}
{
struct ctdb_db_context *ctdb_db;
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
- DEBUG(0,("Attempt to mark all databases locked when not frozen\n"));
+ DEBUG(DEBUG_ERR,("Attempt to mark all databases locked when not frozen\n"));
return -1;
}
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
{
struct ctdb_db_context *ctdb_db;
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
- DEBUG(0,("Attempt to unmark all databases locked when not frozen\n"));
+ DEBUG(DEBUG_ERR,("Attempt to unmark all databases locked when not frozen\n"));
return -1;
}
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
struct ctdb_vnn_map_wire *map = (struct ctdb_vnn_map_wire *)indata.dptr;
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
- DEBUG(0,("Attempt to set vnnmap when not frozen\n"));
+ DEBUG(DEBUG_ERR,("Attempt to set vnnmap when not frozen\n"));
return -1;
}
outdata->dsize = offsetof(struct ctdb_dbid_map, dbs) + sizeof(dbid_map->dbs[0])*len;
outdata->dptr = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
if (!outdata->dptr) {
- DEBUG(0, (__location__ " Failed to allocate dbmap array\n"));
+ DEBUG(DEBUG_ALERT, (__location__ " Failed to allocate dbmap array\n"));
exit(1);
}
outdata->dsize = offsetof(struct ctdb_node_map, nodes) + num_nodes*sizeof(struct ctdb_node_and_flags);
outdata->dptr = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
if (!outdata->dptr) {
- DEBUG(0, (__location__ " Failed to allocate nodemap array\n"));
+ DEBUG(DEBUG_ALERT, (__location__ " Failed to allocate nodemap array\n"));
exit(1);
}
}
params->pulldata = talloc_realloc_size(NULL, params->pulldata, rec->length + params->len);
if (params->pulldata == NULL) {
- DEBUG(0,(__location__ " Failed to expand pulldb_data to %u (%u records)\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to expand pulldb_data to %u (%u records)\n",
rec->length + params->len, params->pulldata->count));
params->failed = true;
return -1;
struct ctdb_control_pulldb_reply *reply;
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
- DEBUG(0,("rejecting ctdb_control_pull_db when not frozen\n"));
+ DEBUG(DEBUG_DEBUG,("rejecting ctdb_control_pull_db when not frozen\n"));
return -1;
}
ctdb_db = find_ctdb_db(ctdb, pull->db_id);
if (!ctdb_db) {
- DEBUG(0,(__location__ " Unknown db 0x%08x\n", pull->db_id));
+ DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%08x\n", pull->db_id));
return -1;
}
params.failed = false;
if (ctdb_lock_all_databases_mark(ctdb) != 0) {
- DEBUG(0,(__location__ " Failed to get lock on entired db - failing\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to get lock on entired db - failing\n"));
return -1;
}
if (tdb_traverse_read(ctdb_db->ltdb->tdb, traverse_pulldb, ¶ms) == -1) {
- DEBUG(0,(__location__ " Failed to get traverse db '%s'\n", ctdb_db->db_name));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to get traverse db '%s'\n", ctdb_db->db_name));
ctdb_lock_all_databases_unmark(ctdb);
talloc_free(params.pulldata);
return -1;
struct ctdb_rec_data *rec;
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
- DEBUG(0,("rejecting ctdb_control_push_db when not frozen\n"));
+ DEBUG(DEBUG_DEBUG,("rejecting ctdb_control_push_db when not frozen\n"));
return -1;
}
if (indata.dsize < offsetof(struct ctdb_control_pulldb_reply, data)) {
- DEBUG(0,(__location__ " invalid data in pulldb reply\n"));
+ DEBUG(DEBUG_ERR,(__location__ " invalid data in pulldb reply\n"));
return -1;
}
ctdb_db = find_ctdb_db(ctdb, reply->db_id);
if (!ctdb_db) {
- DEBUG(0,(__location__ " Unknown db 0x%08x\n", reply->db_id));
+ DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%08x\n", reply->db_id));
return -1;
}
if (ctdb_lock_all_databases_mark(ctdb) != 0) {
- DEBUG(0,(__location__ " Failed to get lock on entired db - failing\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to get lock on entired db - failing\n"));
return -1;
}
data.dsize = rec->datalen;
if (data.dsize < sizeof(struct ctdb_ltdb_header)) {
- DEBUG(0,(__location__ " bad ltdb record\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " bad ltdb record\n"));
goto failed;
}
hdr = (struct ctdb_ltdb_header *)data.dptr;
ret = ctdb_ltdb_store(ctdb_db, key, hdr, data);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to store record\n"));
+ DEBUG(DEBUG_CRIT, (__location__ " Unable to store record\n"));
goto failed;
}
ret = tdb_store(tdb, key, data, TDB_REPLACE);
if (ret) {
- DEBUG(0,(__location__ " failed to write tdb data back ret:%d\n",ret));
+ DEBUG(DEBUG_CRIT,(__location__ " failed to write tdb data back ret:%d\n",ret));
return ret;
}
struct ctdb_db_context *ctdb_db;
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
- DEBUG(0,("rejecting ctdb_control_set_dmaster when not frozen\n"));
+ DEBUG(DEBUG_DEBUG,("rejecting ctdb_control_set_dmaster when not frozen\n"));
return -1;
}
ctdb_db = find_ctdb_db(ctdb, p->db_id);
if (!ctdb_db) {
- DEBUG(0,(__location__ " Unknown db 0x%08x\n", p->db_id));
+ DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%08x\n", p->db_id));
return -1;
}
if (ctdb_lock_all_databases_mark(ctdb) != 0) {
- DEBUG(0,(__location__ " Failed to get lock on entired db - failing\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to get lock on entired db - failing\n"));
return -1;
}
pid_t parent = getpid();
if (ctdb->freeze_mode != CTDB_FREEZE_FROZEN) {
- DEBUG(0,("Attempt to change recovery mode to %u when not frozen\n",
+ DEBUG(DEBUG_ERR,("Attempt to change recovery mode to %u when not frozen\n",
recmode));
(*errormsg) = "Cannot change recovery mode while not frozen";
return -1;
}
if (recmode != ctdb->recovery_mode) {
- DEBUG(0,(__location__ " Recovery mode set to %s\n",
+ DEBUG(DEBUG_NOTICE,(__location__ " Recovery mode set to %s\n",
recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"ACTIVE"));
}
ret = pipe(state->fd);
if (ret != 0) {
talloc_free(state);
- DEBUG(0,(__location__ " Failed to open pipe for set_recmode child\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " Failed to open pipe for set_recmode child\n"));
return -1;
}
as it should be held by the recovery master
*/
if (ctdb_recovery_lock(ctdb, false)) {
- DEBUG(0,("ERROR: recovery lock file %s not locked when recovering!\n", ctdb->recovery_lock_file));
+ DEBUG(DEBUG_CRIT,("ERROR: recovery lock file %s not locked when recovering!\n", ctdb->recovery_lock_file));
cc = 1;
}
}
ctdb->recovery_lock_fd = open(ctdb->recovery_lock_file, O_RDWR|O_CREAT, 0600);
if (ctdb->recovery_lock_fd == -1) {
- DEBUG(0,("ctdb_recovery_lock: Unable to open %s - (%s)\n",
+ DEBUG(DEBUG_ERR,("ctdb_recovery_lock: Unable to open %s - (%s)\n",
ctdb->recovery_lock_file, strerror(errno)));
return false;
}
close(ctdb->recovery_lock_fd);
ctdb->recovery_lock_fd = -1;
if (keep) {
- DEBUG(0,("ctdb_recovery_lock: Failed to get recovery lock on '%s'\n", ctdb->recovery_lock_file));
+ DEBUG(DEBUG_CRIT,("ctdb_recovery_lock: Failed to get recovery lock on '%s'\n", ctdb->recovery_lock_file));
}
return false;
}
ctdb->recovery_lock_fd = -1;
}
- DEBUG(0,("ctdb_recovery_lock: Got recovery lock on '%s'\n", ctdb->recovery_lock_file));
+ DEBUG(DEBUG_NOTICE,("ctdb_recovery_lock: Got recovery lock on '%s'\n", ctdb->recovery_lock_file));
return true;
}
int tdb_unlock(struct tdb_context *tdb, int list, int ltype);
if (indata.dsize < sizeof(uint32_t) || indata.dsize != rec->length) {
- DEBUG(0,(__location__ " Bad record size in ctdb_control_delete_record\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Bad record size in ctdb_control_delete_record\n"));
return -1;
}
ctdb_db = find_ctdb_db(ctdb, rec->reqid);
if (!ctdb_db) {
- DEBUG(0,(__location__ " Unknown db 0x%08x\n", rec->reqid));
+ DEBUG(DEBUG_ERR,(__location__ " Unknown db 0x%08x\n", rec->reqid));
return -1;
}
}
if (data.dsize != sizeof(struct ctdb_ltdb_header)) {
- DEBUG(0,(__location__ " Bad record size\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Bad record size\n"));
return -1;
}
if (tdb_lock_nonblock(ctdb_db->ltdb->tdb, -1, F_WRLCK) == 0) {
tdb_delete(ctdb_db->ltdb->tdb, key);
tdb_unlock(ctdb_db->ltdb->tdb, -1, F_WRLCK);
- DEBUG(0,(__location__ " Deleted corrupt record\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " Deleted corrupt record\n"));
}
tdb_chainunlock(ctdb_db->ltdb->tdb, key);
free(data.dptr);
ctdb_enable_monitoring(ctdb);
if (status != 0) {
- DEBUG(0,(__location__ " recovered event script failed (status %d)\n", status));
+ DEBUG(DEBUG_ERR,(__location__ " recovered event script failed (status %d)\n", status));
}
ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
int ret;
struct recovery_callback_state *state;
- DEBUG(0,("Recovery has finished\n"));
+ DEBUG(DEBUG_NOTICE,("Recovery has finished\n"));
state = talloc(ctdb, struct recovery_callback_state);
CTDB_NO_MEMORY(ctdb, state);
if (ret != 0) {
ctdb_enable_monitoring(ctdb);
- DEBUG(0,(__location__ " Failed to end recovery\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to end recovery\n"));
talloc_free(state);
return -1;
}
ctdb_enable_monitoring(ctdb);
if (status != 0) {
- DEBUG(0,(__location__ " startrecovery event script failed (status %d)\n", status));
+ DEBUG(DEBUG_ERR,(__location__ " startrecovery event script failed (status %d)\n", status));
}
ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
int ret;
struct recovery_callback_state *state;
- DEBUG(0,("Recovery has started\n"));
+ DEBUG(DEBUG_NOTICE,("Recovery has started\n"));
state = talloc(ctdb, struct recovery_callback_state);
CTDB_NO_MEMORY(ctdb, state);
if (ret != 0) {
ctdb_enable_monitoring(ctdb);
- DEBUG(0,(__location__ " Failed to start recovery\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to start recovery\n"));
talloc_free(state);
return -1;
}
{
struct ctdb_context *ctdb = rec->ctdb;
- DEBUG(0,("Unbanning node %u\n", pnn));
+ DEBUG(DEBUG_NOTICE,("Unbanning node %u\n", pnn));
if (!ctdb_validate_pnn(ctdb, pnn)) {
- DEBUG(0,("Bad pnn %u in ctdb_unban_node\n", pnn));
+ DEBUG(DEBUG_ERR,("Bad pnn %u in ctdb_unban_node\n", pnn));
return;
}
TDB_DATA data;
int ret;
- DEBUG(0,("Unanning remote node %u. Passing the ban request on to the remote node.\n", pnn));
+ DEBUG(DEBUG_NOTICE,("Unanning remote node %u. Passing the ban request on to the remote node.\n", pnn));
data.dptr = (uint8_t *)&pnn;
data.dsize = sizeof(uint32_t);
ret = ctdb_send_message(ctdb, pnn, CTDB_SRVID_UNBAN_NODE, data);
if (ret != 0) {
- DEBUG(0,("Failed to unban node %u\n", pnn));
+ DEBUG(DEBUG_ERR,("Failed to unban node %u\n", pnn));
return;
}
there is an election */
rec->node_flags &= ~NODE_FLAGS_BANNED;
- DEBUG(0,("Clearing ban flag on node %u\n", pnn));
+ DEBUG(DEBUG_INFO,("Clearing ban flag on node %u\n", pnn));
ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), pnn, 0, NODE_FLAGS_BANNED);
if (rec->banned_nodes[pnn] == NULL) {
- DEBUG(0,("No ban recorded for this node. ctdb_unban_node() request ignored\n"));
+ DEBUG(DEBUG_INFO,("No ban recorded for this node. ctdb_unban_node() request ignored\n"));
return;
}
struct ctdb_recoverd *rec = state->rec;
uint32_t pnn = state->banned_node;
- DEBUG(0,("Ban timeout. Node %u is now unbanned\n", pnn));
+ DEBUG(DEBUG_NOTICE,("Ban timeout. Node %u is now unbanned\n", pnn));
ctdb_unban_node(rec, pnn);
}
{
struct ctdb_context *ctdb = rec->ctdb;
- DEBUG(0,("Banning node %u for %u seconds\n", pnn, ban_time));
+ DEBUG(DEBUG_NOTICE,("Banning node %u for %u seconds\n", pnn, ban_time));
if (!ctdb_validate_pnn(ctdb, pnn)) {
- DEBUG(0,("Bad pnn %u in ctdb_ban_node\n", pnn));
+ DEBUG(DEBUG_ERR,("Bad pnn %u in ctdb_ban_node\n", pnn));
return;
}
if (0 == ctdb->tunable.enable_bans) {
- DEBUG(0,("Bans are disabled - ignoring ban of node %u\n", pnn));
+ DEBUG(DEBUG_INFO,("Bans are disabled - ignoring ban of node %u\n", pnn));
return;
}
TDB_DATA data;
int ret;
- DEBUG(0,("Banning remote node %u for %u seconds. Passing the ban request on to the remote node.\n", pnn, ban_time));
+ DEBUG(DEBUG_NOTICE,("Banning remote node %u for %u seconds. Passing the ban request on to the remote node.\n", pnn, ban_time));
b.pnn = pnn;
b.ban_time = ban_time;
ret = ctdb_send_message(ctdb, pnn, CTDB_SRVID_BAN_NODE, data);
if (ret != 0) {
- DEBUG(0,("Failed to ban node %u\n", pnn));
+ DEBUG(DEBUG_ERR,("Failed to ban node %u\n", pnn));
return;
}
return;
}
- DEBUG(0,("self ban - lowering our election priority\n"));
+ DEBUG(DEBUG_NOTICE,("self ban - lowering our election priority\n"));
ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), pnn, NODE_FLAGS_BANNED, 0);
/* banning ourselves - lower our election priority */
rec->node_flags |= NODE_FLAGS_BANNED;
if (rec->banned_nodes[pnn] != NULL) {
- DEBUG(0,("Re-banning an already banned node. Remove previous ban and set a new ban.\n"));
+ DEBUG(DEBUG_NOTICE,("Re-banning an already banned node. Remove previous ban and set a new ban.\n"));
talloc_free(rec->banned_nodes[pnn]);
rec->banned_nodes[pnn] = NULL;
}
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_END_RECOVERY,
list_of_active_nodes(ctdb, nodemap, tmp_ctx, true),
CONTROL_TIMEOUT(), false, tdb_null) != 0) {
- DEBUG(0, (__location__ " Unable to run the 'recovered' event. Recovery failed.\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to run the 'recovered' event. Recovery failed.\n"));
talloc_free(tmp_ctx);
return -1;
}
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_START_RECOVERY,
list_of_active_nodes(ctdb, nodemap, tmp_ctx, true),
CONTROL_TIMEOUT(), false, tdb_null) != 0) {
- DEBUG(0, (__location__ " Unable to run the 'startrecovery' event. Recovery failed.\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to run the 'startrecovery' event. Recovery failed.\n"));
talloc_free(tmp_ctx);
return -1;
}
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_FREEZE,
nodes, CONTROL_TIMEOUT(),
false, tdb_null) != 0) {
- DEBUG(0, (__location__ " Unable to freeze nodes. Recovery failed.\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to freeze nodes. Recovery failed.\n"));
talloc_free(tmp_ctx);
return -1;
}
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_SET_RECMODE,
nodes, CONTROL_TIMEOUT(),
false, data) != 0) {
- DEBUG(0, (__location__ " Unable to set recovery mode. Recovery failed.\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode. Recovery failed.\n"));
talloc_free(tmp_ctx);
return -1;
}
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_THAW,
nodes, CONTROL_TIMEOUT(),
false, tdb_null) != 0) {
- DEBUG(0, (__location__ " Unable to thaw nodes. Recovery failed.\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to thaw nodes. Recovery failed.\n"));
talloc_free(tmp_ctx);
return -1;
}
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_SET_RECMASTER,
list_of_active_nodes(ctdb, nodemap, tmp_ctx, true),
CONTROL_TIMEOUT(), false, data) != 0) {
- DEBUG(0, (__location__ " Unable to set recmaster. Recovery failed.\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to set recmaster. Recovery failed.\n"));
talloc_free(tmp_ctx);
return -1;
}
ret = ctdb_ctrl_getdbmap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn,
mem_ctx, &remote_dbmap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to get dbids from node %u\n", pnn));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to get dbids from node %u\n", pnn));
return -1;
}
ctdb_ctrl_getdbname(ctdb, CONTROL_TIMEOUT(), pnn, dbmap->dbs[db].dbid,
mem_ctx, &name);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to get dbname from node %u\n", pnn));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to get dbname from node %u\n", pnn));
return -1;
}
ctdb_ctrl_createdb(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn,
mem_ctx, name, dbmap->dbs[db].persistent);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to create remote db:%s\n", name));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to create remote db:%s\n", name));
return -1;
}
}
ret = ctdb_ctrl_getdbmap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn,
mem_ctx, &remote_dbmap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to get dbids from node %u\n", pnn));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to get dbids from node %u\n", pnn));
return -1;
}
ctdb_ctrl_getdbname(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn,
remote_dbmap->dbs[db].dbid, mem_ctx, &name);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to get dbname from node %u\n",
+ DEBUG(DEBUG_ERR, (__location__ " Unable to get dbname from node %u\n",
nodemap->nodes[j].pnn));
return -1;
}
ctdb_ctrl_createdb(ctdb, CONTROL_TIMEOUT(), pnn, mem_ctx, name,
remote_dbmap->dbs[db].persistent);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to create local db:%s\n", name));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to create local db:%s\n", name));
return -1;
}
ret = ctdb_ctrl_getdbmap(ctdb, CONTROL_TIMEOUT(), pnn, mem_ctx, dbmap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to reread dbmap on node %u\n", pnn));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to reread dbmap on node %u\n", pnn));
return -1;
}
}
ret = ctdb_ctrl_pulldb(ctdb, srcnode, dbid, CTDB_LMASTER_ANY, tmp_ctx,
CONTROL_TIMEOUT(), &outdata);
if (ret != 0) {
- DEBUG(0,(__location__ " Unable to copy db from node %u\n", srcnode));
+ DEBUG(DEBUG_ERR,(__location__ " Unable to copy db from node %u\n", srcnode));
talloc_free(tmp_ctx);
return -1;
}
reply = (struct ctdb_control_pulldb_reply *)outdata.dptr;
if (outdata.dsize < offsetof(struct ctdb_control_pulldb_reply, data)) {
- DEBUG(0,(__location__ " invalid data in pulldb reply\n"));
+ DEBUG(DEBUG_ERR,(__location__ " invalid data in pulldb reply\n"));
talloc_free(tmp_ctx);
return -1;
}
hdr = (struct ctdb_ltdb_header *)data.dptr;
if (data.dsize < sizeof(struct ctdb_ltdb_header)) {
- DEBUG(0,(__location__ " bad ltdb record\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " bad ltdb record\n"));
talloc_free(tmp_ctx);
return -1;
}
if (existing.dptr != NULL) {
struct ctdb_ltdb_header header;
if (existing.dsize < sizeof(struct ctdb_ltdb_header)) {
- DEBUG(0,(__location__ " Bad record size %u from node %u\n",
+ DEBUG(DEBUG_CRIT,(__location__ " Bad record size %u from node %u\n",
(unsigned)existing.dsize, srcnode));
free(existing.dptr);
talloc_free(tmp_ctx);
}
if (tdb_store(recdb->tdb, key, data, TDB_REPLACE) != 0) {
- DEBUG(0,(__location__ " Failed to store record\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " Failed to store record\n"));
talloc_free(tmp_ctx);
return -1;
}
continue;
}
if (pull_one_remote_database(ctdb, nodemap->nodes[j].pnn, recdb, dbid) != 0) {
- DEBUG(0,(__location__ " Failed to pull remote database from node %u\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to pull remote database from node %u\n",
nodemap->nodes[j].pnn));
return -1;
}
ret = ctdb_ctrl_setvnnmap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, mem_ctx, vnnmap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to set vnnmap for node %u\n", pnn));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to set vnnmap for node %u\n", pnn));
return -1;
}
}
TALLOC_CTX *mem_ctx = talloc_new(ctdb);
if (data.dsize != sizeof(*b)) {
- DEBUG(0,("Bad data in ban_handler\n"));
+ DEBUG(DEBUG_ERR,("Bad data in ban_handler\n"));
talloc_free(mem_ctx);
return;
}
if (b->pnn != ctdb->pnn) {
- DEBUG(0,("Got a ban request for pnn:%u but our pnn is %u. Ignoring ban request\n", b->pnn, ctdb->pnn));
+ DEBUG(DEBUG_ERR,("Got a ban request for pnn:%u but our pnn is %u. Ignoring ban request\n", b->pnn, ctdb->pnn));
return;
}
- DEBUG(0,("Node %u has been banned for %u seconds\n",
+ DEBUG(DEBUG_NOTICE,("Node %u has been banned for %u seconds\n",
b->pnn, b->ban_time));
ctdb_ban_node(rec, b->pnn, b->ban_time);
uint32_t pnn;
if (data.dsize != sizeof(uint32_t)) {
- DEBUG(0,("Bad data in unban_handler\n"));
+ DEBUG(DEBUG_ERR,("Bad data in unban_handler\n"));
talloc_free(mem_ctx);
return;
}
pnn = *(uint32_t *)data.dptr;
if (pnn != ctdb->pnn) {
- DEBUG(0,("Got an unban request for pnn:%u but our pnn is %u. Ignoring unban request\n", pnn, ctdb->pnn));
+ DEBUG(DEBUG_ERR,("Got an unban request for pnn:%u but our pnn is %u. Ignoring unban request\n", pnn, ctdb->pnn));
return;
}
- DEBUG(0,("Node %u has been unbanned.\n", pnn));
+ DEBUG(DEBUG_NOTICE,("Node %u has been unbanned.\n", pnn));
ctdb_unban_node(rec, pnn);
talloc_free(mem_ctx);
}
state = ctdb_call_send(v->ctdb_db, &call);
tdb_chainunlock(v->ctdb_db->ltdb->tdb, call.key);
if (state == NULL) {
- DEBUG(0,(__location__ " Failed to setup vacuum fetch call\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to setup vacuum fetch call\n"));
talloc_free(v);
return;
}
/* work out if the database is persistent */
ret = ctdb_ctrl_getdbmap(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, tmp_ctx, &dbmap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to get dbids from local node\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to get dbids from local node\n"));
talloc_free(tmp_ctx);
return;
}
}
}
if (i == dbmap->num) {
- DEBUG(0, (__location__ " Unable to find db_id 0x%x on local node\n", recs->db_id));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to find db_id 0x%x on local node\n", recs->db_id));
talloc_free(tmp_ctx);
return;
}
/* find the name of this database */
if (ctdb_ctrl_getdbname(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, recs->db_id, tmp_ctx, &name) != 0) {
- DEBUG(0,(__location__ " Failed to get name of db 0x%x\n", recs->db_id));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to get name of db 0x%x\n", recs->db_id));
talloc_free(tmp_ctx);
return;
}
/* attach to it */
ctdb_db = ctdb_attach(ctdb, name, persistent);
if (ctdb_db == NULL) {
- DEBUG(0,(__location__ " Failed to attach to database '%s'\n", name));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name));
talloc_free(tmp_ctx);
return;
}
v = talloc_zero(rec, struct vacuum_info);
if (v == NULL) {
- DEBUG(0,(__location__ " Out of memory\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " Out of memory\n"));
return;
}
v->ctdb_db = ctdb_db;
v->recs = talloc_memdup(v, recs, data.dsize);
if (v->recs == NULL) {
- DEBUG(0,(__location__ " Out of memory\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " Out of memory\n"));
talloc_free(v);
return;
}
ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn,
mem_ctx, &remote_nodemap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to get nodemap from remote node %u\n",
+ DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from remote node %u\n",
nodemap->nodes[j].pnn));
ctdb_set_culprit(rec, nodemap->nodes[j].pnn);
talloc_free(mem_ctx);
/* Update our local copy of the flags in the recovery
daemon.
*/
- DEBUG(0,("Remote node %u had flags 0x%x, local had 0x%x - updating local\n",
+ DEBUG(DEBUG_NOTICE,("Remote node %u had flags 0x%x, local had 0x%x - updating local\n",
nodemap->nodes[j].pnn, remote_nodemap->nodes[j].flags,
nodemap->nodes[j].flags));
nodemap->nodes[j].flags = remote_nodemap->nodes[j].flags;
this is a good reason to do a new election.
*/
if ((c.old_flags ^ c.new_flags) & NODE_FLAGS_BANNED) {
- DEBUG(0,("Remote node %u had different BANNED flags 0x%x, local had 0x%x - trigger a re-election\n",
+ DEBUG(DEBUG_NOTICE,("Remote node %u had different BANNED flags 0x%x, local had 0x%x - trigger a re-election\n",
nodemap->nodes[j].pnn, c.new_flags,
c.old_flags));
talloc_free(mem_ctx);
recdb = tdb_wrap_open(mem_ctx, name, ctdb->tunable.database_hash_size,
TDB_NOLOCK, O_RDWR|O_CREAT|O_EXCL, 0600);
if (recdb == NULL) {
- DEBUG(0,(__location__ " Failed to create temp recovery database '%s'\n", name));
+ DEBUG(DEBUG_CRIT,(__location__ " Failed to create temp recovery database '%s'\n", name));
}
talloc_free(name);
}
params->recdata = talloc_realloc_size(NULL, params->recdata, rec->length + params->len);
if (params->recdata == NULL) {
- DEBUG(0,(__location__ " Failed to expand recdata to %u (%u records)\n",
+ DEBUG(DEBUG_CRIT,(__location__ " Failed to expand recdata to %u (%u records)\n",
rec->length + params->len, params->recdata->count));
params->failed = true;
return -1;
params.failed = false;
if (tdb_traverse_read(recdb->tdb, traverse_recdb, ¶ms) == -1) {
- DEBUG(0,(__location__ " Failed to traverse recdb database\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to traverse recdb database\n"));
talloc_free(params.recdata);
talloc_free(tmp_ctx);
return -1;
}
if (params.failed) {
- DEBUG(0,(__location__ " Failed to traverse recdb database\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to traverse recdb database\n"));
talloc_free(params.recdata);
talloc_free(tmp_ctx);
return -1;
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_PUSH_DB,
list_of_active_nodes(ctdb, nodemap, tmp_ctx, true),
CONTROL_TIMEOUT(), false, outdata) != 0) {
- DEBUG(0,(__location__ " Failed to push recdb records to nodes for db 0x%x\n", dbid));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to push recdb records to nodes for db 0x%x\n", dbid));
talloc_free(recdata);
talloc_free(tmp_ctx);
return -1;
/* pull all remote databases onto the recdb */
ret = pull_remote_database(ctdb, nodemap, recdb, dbid);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to pull remote database 0x%x\n", dbid));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to pull remote database 0x%x\n", dbid));
return -1;
}
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_WIPE_DATABASE,
list_of_active_nodes(ctdb, nodemap, recdb, true),
CONTROL_TIMEOUT(), false, data) != 0) {
- DEBUG(0, (__location__ " Unable to wipe database. Recovery failed.\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to wipe database. Recovery failed.\n"));
talloc_free(recdb);
return -1;
}
ctdb_set_culprit(rec, culprit);
if (rec->culprit_counter > 2*nodemap->num) {
- DEBUG(0,("Node %u has caused %u recoveries in %.0f seconds - banning it for %u seconds\n",
+ DEBUG(DEBUG_NOTICE,("Node %u has caused %u recoveries in %.0f seconds - banning it for %u seconds\n",
culprit, rec->culprit_counter, timeval_elapsed(&rec->first_recover_time),
ctdb->tunable.recovery_ban_period));
ctdb_ban_node(rec, culprit, ctdb->tunable.recovery_ban_period);
if (!ctdb_recovery_lock(ctdb, true)) {
ctdb_set_culprit(rec, pnn);
- DEBUG(0,("Unable to get recovery lock - aborting recovery\n"));
+ DEBUG(DEBUG_ERR,("Unable to get recovery lock - aborting recovery\n"));
return -1;
}
/* get a list of all databases */
ret = ctdb_ctrl_getdbmap(ctdb, CONTROL_TIMEOUT(), pnn, mem_ctx, &dbmap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to get dbids from node :%u\n", pnn));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to get dbids from node :%u\n", pnn));
return -1;
}
/* verify that we have all the databases any other node has */
ret = create_missing_local_databases(ctdb, nodemap, pnn, &dbmap, mem_ctx);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to create missing local databases\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to create missing local databases\n"));
return -1;
}
/* verify that all other nodes have all our databases */
ret = create_missing_remote_databases(ctdb, nodemap, pnn, dbmap, mem_ctx);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to create missing remote databases\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to create missing remote databases\n"));
return -1;
}
/* set recovery mode to active on all nodes */
ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_ACTIVE);
if (ret!=0) {
- DEBUG(0, (__location__ " Unable to set recovery mode to active on cluster\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode to active on cluster\n"));
return -1;
}
/* execute the "startrecovery" event script on all nodes */
ret = run_startrecovery_eventscript(ctdb, nodemap);
if (ret!=0) {
- DEBUG(0, (__location__ " Unable to run the 'startrecovery' event on cluster\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to run the 'startrecovery' event on cluster\n"));
return -1;
}
vnnmap->generation = generation;
ret = ctdb_ctrl_setvnnmap(ctdb, CONTROL_TIMEOUT(), pnn, mem_ctx, vnnmap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to set vnnmap for node %u\n", pnn));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to set vnnmap for node %u\n", pnn));
return -1;
}
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_TRANSACTION_START,
list_of_active_nodes(ctdb, nodemap, mem_ctx, true),
CONTROL_TIMEOUT(), false, data) != 0) {
- DEBUG(0, (__location__ " Unable to start transactions. Recovery failed.\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to start transactions. Recovery failed.\n"));
return -1;
}
for (i=0;i<dbmap->num;i++) {
if (recover_database(rec, mem_ctx, dbmap->dbs[i].dbid, pnn, nodemap, generation) != 0) {
- DEBUG(0, (__location__ " Failed to recover database 0x%x\n", dbmap->dbs[i].dbid));
+ DEBUG(DEBUG_ERR, (__location__ " Failed to recover database 0x%x\n", dbmap->dbs[i].dbid));
return -1;
}
}
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_TRANSACTION_COMMIT,
list_of_active_nodes(ctdb, nodemap, mem_ctx, true),
CONTROL_TIMEOUT(), false, data) != 0) {
- DEBUG(0, (__location__ " Unable to commit recovery changes. Recovery failed.\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to commit recovery changes. Recovery failed.\n"));
return -1;
}
/* update to the new vnnmap on all nodes */
ret = update_vnnmap_on_all_nodes(ctdb, nodemap, pnn, vnnmap, mem_ctx);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to update vnnmap on all nodes\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to update vnnmap on all nodes\n"));
return -1;
}
/* update recmaster to point to us for all nodes */
ret = set_recovery_master(ctdb, nodemap, pnn);
if (ret!=0) {
- DEBUG(0, (__location__ " Unable to set recovery master\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery master\n"));
return -1;
}
*/
ret = update_flags_on_all_nodes(ctdb, nodemap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to update flags on all nodes\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to update flags on all nodes\n"));
return -1;
}
rec->need_takeover_run = false;
ret = ctdb_takeover_run(ctdb, nodemap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to setup public takeover addresses\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to setup public takeover addresses\n"));
return -1;
}
DEBUG(DEBUG_INFO, (__location__ " Recovery - done takeover\n"));
/* execute the "recovered" event script on all nodes */
ret = run_recovered_eventscript(ctdb, nodemap);
if (ret!=0) {
- DEBUG(0, (__location__ " Unable to run the 'recovered' event on cluster\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to run the 'recovered' event on cluster\n"));
return -1;
}
/* disable recovery mode */
ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_NORMAL);
if (ret!=0) {
- DEBUG(0, (__location__ " Unable to set recovery mode to normal on cluster\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode to normal on cluster\n"));
return -1;
}
ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, rec, &nodemap);
if (ret != 0) {
- DEBUG(0,(__location__ " unable to get election data\n"));
+ DEBUG(DEBUG_ERR,(__location__ " unable to get election data\n"));
return;
}
*/
ret = ctdb_ctrl_setrecmaster(ctdb, CONTROL_TIMEOUT(), pnn, pnn);
if (ret != 0) {
- DEBUG(0, (__location__ " failed to send recmaster election request\n"));
+ DEBUG(DEBUG_ERR, (__location__ " failed to send recmaster election request\n"));
return -1;
}
ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, tmp_ctx, &nodemap);
if (ret != 0) {
- DEBUG(0,(__location__ " failed to get nodemap to unban all nodes\n"));
+ DEBUG(DEBUG_ERR,(__location__ " failed to get nodemap to unban all nodes\n"));
return;
}
ret = send_election_request(rec, ctdb_get_pnn(rec->ctdb));
if (ret != 0) {
- DEBUG(0,("Failed to send election request!\n"));
+ DEBUG(DEBUG_ERR,("Failed to send election request!\n"));
}
talloc_free(rec->send_election_te);
/* ok, let that guy become recmaster then */
ret = ctdb_ctrl_setrecmaster(ctdb, CONTROL_TIMEOUT(), ctdb_get_pnn(ctdb), em->pnn);
if (ret != 0) {
- DEBUG(0, (__location__ " failed to send recmaster election request"));
+ DEBUG(DEBUG_ERR, (__location__ " failed to send recmaster election request"));
talloc_free(mem_ctx);
return;
}
/* set all nodes to recovery mode to stop all internode traffic */
ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_ACTIVE);
if (ret!=0) {
- DEBUG(0, (__location__ " Unable to set recovery mode to active on cluster\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to set recovery mode to active on cluster\n"));
return;
}
ret = send_election_request(rec, pnn);
if (ret!=0) {
- DEBUG(0, (__location__ " failed to initiate recmaster election"));
+ DEBUG(DEBUG_ERR, (__location__ " failed to initiate recmaster election"));
return;
}
struct ctdb_recoverd *rec = talloc_get_type(private_data, struct ctdb_recoverd);
if (data.dsize != sizeof(*c)) {
- DEBUG(0,(__location__ "Invalid data in ctdb_node_flag_change\n"));
+ DEBUG(DEBUG_ERR,(__location__ "Invalid data in ctdb_node_flag_change\n"));
return;
}
ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, tmp_ctx, &nodemap);
if (ret != 0) {
- DEBUG(0,(__location__ "ctdb_ctrl_getnodemap failed in monitor_handler\n"));
+ DEBUG(DEBUG_ERR,(__location__ "ctdb_ctrl_getnodemap failed in monitor_handler\n"));
talloc_free(tmp_ctx);
return;
}
}
if (i == nodemap->num) {
- DEBUG(0,(__location__ "Flag change for non-existant node %u\n", c->pnn));
+ DEBUG(DEBUG_CRIT,(__location__ "Flag change for non-existant node %u\n", c->pnn));
talloc_free(tmp_ctx);
return;
}
}
if (nodemap->nodes[i].flags != c->new_flags) {
- DEBUG(0,("Node %u has changed flags - now 0x%x was 0x%x\n", c->pnn, c->new_flags, c->old_flags));
+ DEBUG(DEBUG_NOTICE,("Node %u has changed flags - now 0x%x was 0x%x\n", c->pnn, c->new_flags, c->old_flags));
}
nodemap->nodes[i].flags = c->new_flags;
status field
*/
if (state->status != CTDB_RECOVERY_NORMAL) {
- DEBUG(0, (__location__ " Node:%u was in recovery mode. Restart recovery process\n", state->c->hdr.destnode));
+ DEBUG(DEBUG_NOTICE, (__location__ " Node:%u was in recovery mode. Restart recovery process\n", state->c->hdr.destnode));
rmdata->status = MONITOR_RECOVERY_NEEDED;
}
/* we failed to send the control, treat this as
an error and try again next iteration
*/
- DEBUG(0,("Failed to call ctdb_ctrl_getrecmode_send during monitoring\n"));
+ DEBUG(DEBUG_ERR,("Failed to call ctdb_ctrl_getrecmode_send during monitoring\n"));
talloc_free(mem_ctx);
return MONITOR_FAILED;
}
status field
*/
if (state->status != rmdata->pnn) {
- DEBUG(0,("Node %d does not agree we are the recmaster. Need a new recmaster election\n", state->c->hdr.destnode));
+ DEBUG(DEBUG_ERR,("Node %d does not agree we are the recmaster. Need a new recmaster election\n", state->c->hdr.destnode));
rmdata->status = MONITOR_ELECTION_NEEDED;
}
/* we failed to send the control, treat this as
an error and try again next iteration
*/
- DEBUG(0,("Failed to call ctdb_ctrl_getrecmaster_send during monitoring\n"));
+ DEBUG(DEBUG_ERR,("Failed to call ctdb_ctrl_getrecmaster_send during monitoring\n"));
talloc_free(mem_ctx);
return MONITOR_FAILED;
}
struct ctdb_all_public_ips *ips;
char c;
- DEBUG(0,("monitor_cluster starting\n"));
+ DEBUG(DEBUG_NOTICE,("monitor_cluster starting\n"));
rec = talloc_zero(ctdb, struct ctdb_recoverd);
CTDB_NO_MEMORY_FATAL(ctdb, rec);
}
mem_ctx = talloc_new(ctdb);
if (!mem_ctx) {
- DEBUG(0,("Failed to create temporary context\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " Failed to create temporary context\n"));
exit(-1);
}
/* verify that the main daemon is still running */
if (kill(ctdb->ctdbd_pid, 0) != 0) {
- DEBUG(0,("CTDB daemon is no longer available. Shutting down recovery daemon\n"));
+ DEBUG(DEBUG_CRIT,("CTDB daemon is no longer available. Shutting down recovery daemon\n"));
exit(-1);
}
map from the local node. thats why we have the hardcoded value 20
*/
if (rec->culprit_counter > 20) {
- DEBUG(0,("Node %u has caused %u failures in %.0f seconds - banning it for %u seconds\n",
+ DEBUG(DEBUG_NOTICE,("Node %u has caused %u failures in %.0f seconds - banning it for %u seconds\n",
rec->last_culprit, rec->culprit_counter, timeval_elapsed(&rec->first_recover_time),
ctdb->tunable.recovery_ban_period));
ctdb_ban_node(rec, rec->last_culprit, ctdb->tunable.recovery_ban_period);
/* get relevant tunables */
ret = ctdb_ctrl_get_all_tunables(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, &ctdb->tunable);
if (ret != 0) {
- DEBUG(0,("Failed to get tunables - retrying\n"));
+ DEBUG(DEBUG_ERR,("Failed to get tunables - retrying\n"));
goto again;
}
pnn = ctdb_ctrl_getpnn(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE);
if (pnn == (uint32_t)-1) {
- DEBUG(0,("Failed to get local pnn - retrying\n"));
+ DEBUG(DEBUG_ERR,("Failed to get local pnn - retrying\n"));
goto again;
}
/* get the vnnmap */
ret = ctdb_ctrl_getvnnmap(ctdb, CONTROL_TIMEOUT(), pnn, mem_ctx, &vnnmap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to get vnnmap from node %u\n", pnn));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to get vnnmap from node %u\n", pnn));
goto again;
}
/* get number of nodes */
ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), pnn, mem_ctx, &nodemap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to get nodemap from node %u\n", pnn));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from node %u\n", pnn));
goto again;
}
/* check which node is the recovery master */
ret = ctdb_ctrl_getrecmaster(ctdb, mem_ctx, CONTROL_TIMEOUT(), pnn, &recmaster);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to get recmaster from node %u\n", pnn));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to get recmaster from node %u\n", pnn));
goto again;
}
if (recmaster == (uint32_t)-1) {
- DEBUG(0,(__location__ " Initial recovery master set - forcing election\n"));
+ DEBUG(DEBUG_NOTICE,(__location__ " Initial recovery master set - forcing election\n"));
force_election(rec, mem_ctx, pnn, nodemap);
goto again;
}
if (nodemap->nodes[pnn].flags & NODE_FLAGS_BANNED) {
if (rec->banned_nodes[pnn] == NULL) {
if (recmaster == pnn) {
- DEBUG(0,("Local ctdb daemon on recmaster thinks this node is BANNED but the recovery master disagrees. Unbanning the node\n"));
+ DEBUG(DEBUG_NOTICE,("Local ctdb daemon on recmaster thinks this node is BANNED but the recovery master disagrees. Unbanning the node\n"));
ctdb_unban_node(rec, pnn);
} else {
- DEBUG(0,("Local ctdb daemon on non-recmaster thinks this node is BANNED but the recovery master disagrees. Re-banning the node\n"));
+ DEBUG(DEBUG_NOTICE,("Local ctdb daemon on non-recmaster thinks this node is BANNED but the recovery master disagrees. Re-banning the node\n"));
ctdb_ban_node(rec, pnn, ctdb->tunable.recovery_ban_period);
ctdb_set_culprit(rec, pnn);
}
} else {
if (rec->banned_nodes[pnn] != NULL) {
if (recmaster == pnn) {
- DEBUG(0,("Local ctdb daemon on recmaster does not think this node is BANNED but the recovery master disagrees. Unbanning the node\n"));
+ DEBUG(DEBUG_NOTICE,("Local ctdb daemon on recmaster does not think this node is BANNED but the recovery master disagrees. Unbanning the node\n"));
ctdb_unban_node(rec, pnn);
} else {
- DEBUG(0,("Local ctdb daemon on non-recmaster does not think this node is BANNED but the recovery master disagrees. Re-banning the node\n"));
+ DEBUG(DEBUG_NOTICE,("Local ctdb daemon on non-recmaster does not think this node is BANNED but the recovery master disagrees. Re-banning the node\n"));
ctdb_ban_node(rec, pnn, ctdb->tunable.recovery_ban_period);
ctdb_set_culprit(rec, pnn);
}
if (j == nodemap->num) {
- DEBUG(0, ("Recmaster node %u not in list. Force reelection\n", recmaster));
+ DEBUG(DEBUG_ERR, ("Recmaster node %u not in list. Force reelection\n", recmaster));
force_election(rec, mem_ctx, pnn, nodemap);
goto again;
}
/* if recovery master is disconnected we must elect a new recmaster */
if (nodemap->nodes[j].flags & NODE_FLAGS_DISCONNECTED) {
- DEBUG(0, ("Recmaster node %u is disconnected. Force reelection\n", nodemap->nodes[j].pnn));
+ DEBUG(DEBUG_NOTICE, ("Recmaster node %u is disconnected. Force reelection\n", nodemap->nodes[j].pnn));
force_election(rec, mem_ctx, pnn, nodemap);
goto again;
}
ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn,
mem_ctx, &remote_nodemap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to get nodemap from recovery master %u\n",
+ DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from recovery master %u\n",
nodemap->nodes[j].pnn));
goto again;
}
if (remote_nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) {
- DEBUG(0, ("Recmaster node %u no longer available. Force reelection\n", nodemap->nodes[j].pnn));
+ DEBUG(DEBUG_NOTICE, ("Recmaster node %u no longer available. Force reelection\n", nodemap->nodes[j].pnn));
force_election(rec, mem_ctx, pnn, nodemap);
goto again;
}
if (ctdb->vnn != NULL) {
ret = ctdb_ctrl_get_public_ips(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, mem_ctx, &ips);
if (ret != 0) {
- DEBUG(0, ("Unable to get public ips from node %u\n", i));
+ DEBUG(DEBUG_ERR, ("Unable to get public ips from node %u\n", i));
goto again;
}
for (j=0; j<ips->num; j++) {
*/
if (ips->ips[j].pnn == pnn) {
if (!ctdb_sys_have_ip(ips->ips[j].sin)) {
- DEBUG(0,("Public address '%s' is missing and we should serve this ip\n", inet_ntoa(ips->ips[j].sin.sin_addr)));
+ DEBUG(DEBUG_CRIT,("Public address '%s' is missing and we should serve this ip\n", inet_ntoa(ips->ips[j].sin.sin_addr)));
ret = ctdb_ctrl_freeze(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE);
if (ret != 0) {
- DEBUG(0,(__location__ " Failed to freeze node due to public ip address mismatches\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to freeze node due to public ip address mismatches\n"));
goto again;
}
ret = ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, CTDB_RECOVERY_ACTIVE);
if (ret != 0) {
- DEBUG(0,(__location__ " Failed to activate recovery mode due to public ip address mismatches\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to activate recovery mode due to public ip address mismatches\n"));
goto again;
}
}
} else {
if (ctdb_sys_have_ip(ips->ips[j].sin)) {
- DEBUG(0,("We are still serving a public address '%s' that we should not be serving.\n", inet_ntoa(ips->ips[j].sin.sin_addr)));
+ DEBUG(DEBUG_CRIT,("We are still serving a public address '%s' that we should not be serving.\n", inet_ntoa(ips->ips[j].sin.sin_addr)));
ret = ctdb_ctrl_freeze(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE);
if (ret != 0) {
- DEBUG(0,(__location__ " Failed to freeze node due to public ip address mismatches\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to freeze node due to public ip address mismatches\n"));
goto again;
}
ret = ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, CTDB_RECOVERY_ACTIVE);
if (ret != 0) {
- DEBUG(0,(__location__ " Failed to activate recovery mode due to public ip address mismatches\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to activate recovery mode due to public ip address mismatches\n"));
goto again;
}
}
/* ensure our local copies of flags are right */
ret = update_local_flags(rec, nodemap);
if (ret == MONITOR_ELECTION_NEEDED) {
- DEBUG(0,("update_local_flags() called for a re-election.\n"));
+ DEBUG(DEBUG_NOTICE,("update_local_flags() called for a re-election.\n"));
force_election(rec, mem_ctx, pnn, nodemap);
goto again;
}
if (ret != MONITOR_OK) {
- DEBUG(0,("Unable to update local flags\n"));
+ DEBUG(DEBUG_ERR,("Unable to update local flags\n"));
goto again;
}
ctdb->nodes[j]->pnn,
ctdb->nodes,
&ctdb->nodes[j]->public_ips)) {
- DEBUG(0,("Failed to read public ips from node : %u\n",
+ DEBUG(DEBUG_ERR,("Failed to read public ips from node : %u\n",
ctdb->nodes[j]->pnn));
goto again;
}
/* we should have the reclock - check its not stale */
if (ctdb->recovery_lock_fd == -1) {
- DEBUG(0,("recovery master doesn't have the recovery lock\n"));
+ DEBUG(DEBUG_CRIT,("recovery master doesn't have the recovery lock\n"));
do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, ctdb->pnn);
goto again;
}
if (read(ctdb->recovery_lock_fd, &c, 1) == -1) {
- DEBUG(0,("failed read from recovery_lock_fd - %s\n", strerror(errno)));
+ DEBUG(DEBUG_CRIT,("failed read from recovery_lock_fd - %s\n", strerror(errno)));
close(ctdb->recovery_lock_fd);
ctdb->recovery_lock_fd = -1;
do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, ctdb->pnn);
ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn,
mem_ctx, &remote_nodemap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to get nodemap from remote node %u\n",
+ DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from remote node %u\n",
nodemap->nodes[j].pnn));
goto again;
}
then this is a good reason to try recovery
*/
if (remote_nodemap->num != nodemap->num) {
- DEBUG(0, (__location__ " Remote node:%u has different node count. %u vs %u of the local node\n",
+ DEBUG(DEBUG_ERR, (__location__ " Remote node:%u has different node count. %u vs %u of the local node\n",
nodemap->nodes[j].pnn, remote_nodemap->num, nodemap->num));
do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, nodemap->nodes[j].pnn);
goto again;
*/
for (i=0;i<nodemap->num;i++) {
if (remote_nodemap->nodes[i].pnn != nodemap->nodes[i].pnn) {
- DEBUG(0, (__location__ " Remote node:%u has different nodemap pnn for %d (%u vs %u).\n",
+ DEBUG(DEBUG_ERR, (__location__ " Remote node:%u has different nodemap pnn for %d (%u vs %u).\n",
nodemap->nodes[j].pnn, i,
remote_nodemap->nodes[i].pnn, nodemap->nodes[i].pnn));
do_recovery(rec, mem_ctx, pnn, num_active, nodemap,
}
if ((remote_nodemap->nodes[i].flags & NODE_FLAGS_INACTIVE) !=
(nodemap->nodes[i].flags & NODE_FLAGS_INACTIVE)) {
- DEBUG(0, (__location__ " Remote node:%u has different nodemap flag for %d (0x%x vs 0x%x)\n",
+ DEBUG(DEBUG_ERR, (__location__ " Remote node:%u has different nodemap flag for %d (0x%x vs 0x%x)\n",
nodemap->nodes[j].pnn, i,
remote_nodemap->nodes[i].flags, nodemap->nodes[i].flags));
do_recovery(rec, mem_ctx, pnn, num_active, nodemap,
as there are active nodes or we will have to do a recovery
*/
if (vnnmap->size != num_active) {
- DEBUG(0, (__location__ " The vnnmap count is different from the number of active nodes. %u vs %u\n",
+ DEBUG(DEBUG_ERR, (__location__ " The vnnmap count is different from the number of active nodes. %u vs %u\n",
vnnmap->size, num_active));
do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, ctdb->pnn);
goto again;
}
}
if (i == vnnmap->size) {
- DEBUG(0, (__location__ " Node %u is active in the nodemap but did not exist in the vnnmap\n",
+ DEBUG(DEBUG_ERR, (__location__ " Node %u is active in the nodemap but did not exist in the vnnmap\n",
nodemap->nodes[j].pnn));
do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, nodemap->nodes[j].pnn);
goto again;
ret = ctdb_ctrl_getvnnmap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn,
mem_ctx, &remote_vnnmap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to get vnnmap from remote node %u\n",
+ DEBUG(DEBUG_ERR, (__location__ " Unable to get vnnmap from remote node %u\n",
nodemap->nodes[j].pnn));
goto again;
}
/* verify the vnnmap generation is the same */
if (vnnmap->generation != remote_vnnmap->generation) {
- DEBUG(0, (__location__ " Remote node %u has different generation of vnnmap. %u vs %u (ours)\n",
+ DEBUG(DEBUG_ERR, (__location__ " Remote node %u has different generation of vnnmap. %u vs %u (ours)\n",
nodemap->nodes[j].pnn, remote_vnnmap->generation, vnnmap->generation));
do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, nodemap->nodes[j].pnn);
goto again;
/* verify the vnnmap size is the same */
if (vnnmap->size != remote_vnnmap->size) {
- DEBUG(0, (__location__ " Remote node %u has different size of vnnmap. %u vs %u (ours)\n",
+ DEBUG(DEBUG_ERR, (__location__ " Remote node %u has different size of vnnmap. %u vs %u (ours)\n",
nodemap->nodes[j].pnn, remote_vnnmap->size, vnnmap->size));
do_recovery(rec, mem_ctx, pnn, num_active, nodemap, vnnmap, nodemap->nodes[j].pnn);
goto again;
/* verify the vnnmap is the same */
for (i=0;i<vnnmap->size;i++) {
if (remote_vnnmap->map[i] != vnnmap->map[i]) {
- DEBUG(0, (__location__ " Remote node %u has different vnnmap.\n",
+ DEBUG(DEBUG_ERR, (__location__ " Remote node %u has different vnnmap.\n",
nodemap->nodes[j].pnn));
do_recovery(rec, mem_ctx, pnn, num_active, nodemap,
vnnmap, nodemap->nodes[j].pnn);
/* execute the "startrecovery" event script on all nodes */
ret = run_startrecovery_eventscript(ctdb, nodemap);
if (ret!=0) {
- DEBUG(0, (__location__ " Unable to run the 'startrecovery' event on cluster\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to run the 'startrecovery' event on cluster\n"));
do_recovery(rec, mem_ctx, pnn, num_active, nodemap,
vnnmap, ctdb->pnn);
}
ret = ctdb_takeover_run(ctdb, nodemap);
if (ret != 0) {
- DEBUG(0, (__location__ " Unable to setup public takeover addresses - starting recovery\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to setup public takeover addresses - starting recovery\n"));
do_recovery(rec, mem_ctx, pnn, num_active, nodemap,
vnnmap, ctdb->pnn);
}
/* execute the "recovered" event script on all nodes */
ret = run_recovered_eventscript(ctdb, nodemap);
if (ret!=0) {
- DEBUG(0, (__location__ " Unable to run the 'recovered' event on cluster\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Unable to run the 'recovered' event on cluster\n"));
do_recovery(rec, mem_ctx, pnn, num_active, nodemap,
vnnmap, ctdb->pnn);
}
static void ctdb_recoverd_parent(struct event_context *ev, struct fd_event *fde,
uint16_t flags, void *private_data)
{
- DEBUG(0,("recovery daemon parent died - exiting\n"));
+ DEBUG(DEBUG_ALERT,("recovery daemon parent died - exiting\n"));
_exit(1);
}
/* initialise ctdb */
ret = ctdb_socket_connect(ctdb);
if (ret != 0) {
- DEBUG(0, (__location__ " Failed to init ctdb\n"));
+ DEBUG(DEBUG_ALERT, (__location__ " Failed to init ctdb\n"));
exit(1);
}
monitor_cluster(ctdb);
- DEBUG(0,("ERROR: ctdb_recoverd finished!?\n"));
+ DEBUG(DEBUG_ALERT,("ERROR: ctdb_recoverd finished!?\n"));
return -1;
}
return;
}
- DEBUG(0,("Shutting down recovery daemon\n"));
+ DEBUG(DEBUG_NOTICE,("Shutting down recovery daemon\n"));
kill(ctdb->recoverd_pid, SIGTERM);
}
case CTDB_REPLY_DMASTER:
/* we dont allow these calls when banned */
if (ctdb->nodes[ctdb->pnn]->flags & NODE_FLAGS_BANNED) {
- DEBUG(0,(__location__ " ctdb operation %u"
+ DEBUG(DEBUG_DEBUG,(__location__ " ctdb operation %u"
" request %u"
" length %u from node %u to %u while node"
" is banned\n",
same generation instance as this node
*/
if (ctdb->vnn_map->generation != hdr->generation) {
- DEBUG(0,(__location__ " ctdb operation %u"
+ DEBUG(DEBUG_DEBUG,(__location__ " ctdb operation %u"
" request %u"
" length %u from node %u to %u had an"
" invalid generation id:%u while our"
break;
default:
- DEBUG(0,("%s: Packet with unknown operation %u\n",
+ DEBUG(DEBUG_CRIT,("%s: Packet with unknown operation %u\n",
__location__, hdr->operation));
break;
}
node->rx_cnt = 0;
node->dead_count = 0;
- DEBUG(0,("%s: node %s is dead: %u connected\n",
+ DEBUG(DEBUG_NOTICE,("%s: node %s is dead: %u connected\n",
node->ctdb->name, node->name, node->ctdb->num_connected));
ctdb_daemon_cancel_controls(node->ctdb, node);
struct queue_next *q;
q = talloc(ctdb, struct queue_next);
if (q == NULL) {
- DEBUG(0,(__location__ " Failed to allocate deferred packet\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to allocate deferred packet\n"));
return;
}
q->ctdb = ctdb;
q->hdr = talloc_memdup(ctdb, hdr, hdr->length);
if (q->hdr == NULL) {
- DEBUG(0,("Error copying deferred packet to self\n"));
+ DEBUG(DEBUG_ERR,("Error copying deferred packet to self\n"));
return;
}
#if 0
ctdb->statistics.node_packets_sent++;
if (!ctdb_validate_pnn(ctdb, hdr->destnode)) {
- DEBUG(0,(__location__ " cant send to node %u that does not exist\n",
+ DEBUG(DEBUG_CRIT,(__location__ " cant send to node %u that does not exist\n",
hdr->destnode));
return;
}
if (client == NULL) {
- DEBUG(0,(__location__ " Could not find client parent structure. You can not send this control to a remote node\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Could not find client parent structure. You can not send this control to a remote node\n"));
return 1;
}
struct count_server_ids);
if (svid == NULL) {
- DEBUG(0, (__location__ " Got null pointer for svid\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Got null pointer for svid\n"));
return;
}
struct ctdb_server_id);
if (svid == NULL) {
- DEBUG(0, (__location__ " Got null pointer for svid\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Got null pointer for svid\n"));
return;
}
if (svid->count >= svid->list->num) {
- DEBUG(0, (__location__ " size of server id tree changed during traverse\n"));
+ DEBUG(DEBUG_ERR, (__location__ " size of server id tree changed during traverse\n"));
return;
}
ret = ctdb_sys_send_arp(&arp->sin, arp->vnn->iface);
if (ret != 0) {
- DEBUG(0,(__location__ " sending of arp failed (%s)\n", strerror(errno)));
+ DEBUG(DEBUG_CRIT,(__location__ " sending of arp failed (%s)\n", strerror(errno)));
}
s = ctdb_sys_open_sending_socket();
if (s == -1) {
- DEBUG(0,(__location__ " failed to open raw socket for sending tickles\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket for sending tickles\n"));
return;
}
ret = ctdb_sys_send_tcp(s, &tcparray->connections[i].saddr,
&tcparray->connections[i].daddr, 0, 0, 0);
if (ret != 0) {
- DEBUG(0,(__location__ " Failed to send tcp tickle ack for %s\n",
+ DEBUG(DEBUG_CRIT,(__location__ " Failed to send tcp tickle ack for %s\n",
inet_ntoa(tcparray->connections[i].saddr.sin_addr)));
}
}
ctdb_enable_monitoring(ctdb);
if (status != 0) {
- DEBUG(0,(__location__ " Failed to takeover IP %s on interface %s\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to takeover IP %s on interface %s\n",
ip, state->vnn->iface));
ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
talloc_free(state);
/* update out vnn list */
vnn = find_public_ip_vnn(ctdb, pip->sin);
if (vnn == NULL) {
- DEBUG(0,("takeoverip called for an ip '%s' that is not a public address\n",
+ DEBUG(DEBUG_ERR,("takeoverip called for an ip '%s' that is not a public address\n",
inet_ntoa(pip->sin.sin_addr)));
return 0;
}
state->vnn = vnn;
- DEBUG(0,("Takeover of IP %s/%u on interface %s\n",
+ DEBUG(DEBUG_NOTICE,("Takeover of IP %s/%u on interface %s\n",
inet_ntoa(pip->sin.sin_addr), vnn->public_netmask_bits,
vnn->iface));
if (ret != 0) {
ctdb_enable_monitoring(ctdb);
- DEBUG(0,(__location__ " Failed to takeover IP %s on interface %s\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to takeover IP %s on interface %s\n",
inet_ntoa(pip->sin.sin_addr), vnn->iface));
talloc_free(state);
return -1;
DEBUG(DEBUG_INFO,("matched client %u with IP %s and pid %u\n",
ip->client_id, inet_ntoa(ip->ip.sin_addr), client->pid));
if (client->pid != 0) {
- DEBUG(0,(__location__ " Killing client pid %u for IP %s on client_id %u\n",
+ DEBUG(DEBUG_INFO,(__location__ " Killing client pid %u for IP %s on client_id %u\n",
(unsigned)client->pid, inet_ntoa(in.sin_addr),
ip->client_id));
kill(client->pid, SIGKILL);
/* update our vnn list */
vnn = find_public_ip_vnn(ctdb, pip->sin);
if (vnn == NULL) {
- DEBUG(0,("releaseip called for an ip '%s' that is not a public address\n",
+ DEBUG(DEBUG_ERR,("releaseip called for an ip '%s' that is not a public address\n",
inet_ntoa(pip->sin.sin_addr)));
return 0;
}
return 0;
}
- DEBUG(0,("Release of IP %s/%u on interface %s\n",
+ DEBUG(DEBUG_NOTICE,("Release of IP %s/%u on interface %s\n",
inet_ntoa(pip->sin.sin_addr), vnn->public_netmask_bits,
vnn->iface));
if (ret != 0) {
ctdb_enable_monitoring(ctdb);
- DEBUG(0,(__location__ " Failed to release IP %s on interface %s\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to release IP %s on interface %s\n",
inet_ntoa(pip->sin.sin_addr), vnn->iface));
talloc_free(state);
return -1;
/* Verify that we dont have an entry for this ip yet */
for (vnn=ctdb->vnn;vnn;vnn=vnn->next) {
if (ctdb_same_sockaddr(&addr, &vnn->public_address)) {
- DEBUG(0,("Same ip '%s' specified multiple times in the public address list \n",
+ DEBUG(DEBUG_CRIT,("Same ip '%s' specified multiple times in the public address list \n",
inet_ntoa(addr.sin_addr)));
exit(1);
}
tok = strtok(lines[i], " \t");
if (!tok || !parse_ip_mask(tok, &addr, &mask)) {
- DEBUG(0,("Badly formed line %u in public address list\n", i+1));
+ DEBUG(DEBUG_CRIT,("Badly formed line %u in public address list\n", i+1));
talloc_free(lines);
return -1;
}
tok = strtok(NULL, " \t");
if (tok == NULL) {
if (NULL == ctdb->default_public_interface) {
- DEBUG(0,("No default public interface and no interface specified at line %u of public address list\n",
+ DEBUG(DEBUG_CRIT,("No default public interface and no interface specified at line %u of public address list\n",
i+1));
talloc_free(lines);
return -1;
}
if (add_public_address(ctdb, addr, mask, iface)) {
- DEBUG(0,("Failed to add line %u to the public address list\n", i+1));
+ DEBUG(DEBUG_CRIT,("Failed to add line %u to the public address list\n", i+1));
talloc_free(lines);
return -1;
}
}
}
if (pnn == -1) {
- DEBUG(0,(__location__ " Could not find node to take over public address '%s'\n", inet_ntoa(ip->sin.sin_addr)));
+ DEBUG(DEBUG_WARNING,(__location__ " Could not find node to take over public address '%s'\n", inet_ntoa(ip->sin.sin_addr)));
return -1;
}
available/unavailable nodes.
*/
if (1 == ctdb->tunable.deterministic_public_ips) {
- DEBUG(0,("Deterministic IPs enabled. Resetting all ip allocations\n"));
+ DEBUG(DEBUG_NOTICE,("Deterministic IPs enabled. Resetting all ip allocations\n"));
for (i=0,tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next,i++) {
tmp_ip->pnn = i%nodemap->num;
}
for (tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next) {
if (tmp_ip->pnn == -1) {
if (find_takeover_node(ctdb, nodemap, mask, tmp_ip, all_ips)) {
- DEBUG(0,("Failed to find node to cover ip %s\n", inet_ntoa(tmp_ip->sin.sin_addr)));
+ DEBUG(DEBUG_WARNING,("Failed to find node to cover ip %s\n", inet_ntoa(tmp_ip->sin.sin_addr)));
}
}
}
}
}
if (maxnode == -1) {
- DEBUG(0,(__location__ " Could not find maxnode. May not be able to serve ip '%s'\n", inet_ntoa(tmp_ip->sin.sin_addr)));
+ DEBUG(DEBUG_WARNING,(__location__ " Could not find maxnode. May not be able to serve ip '%s'\n", inet_ntoa(tmp_ip->sin.sin_addr)));
continue;
}
data, async_data,
&timeout, NULL);
if (state == NULL) {
- DEBUG(0,(__location__ " Failed to call async control CTDB_CONTROL_RELEASE_IP to node %u\n", nodemap->nodes[i].pnn));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to call async control CTDB_CONTROL_RELEASE_IP to node %u\n", nodemap->nodes[i].pnn));
talloc_free(tmp_ctx);
return -1;
}
}
}
if (ctdb_client_async_wait(ctdb, async_data) != 0) {
- DEBUG(0,(__location__ " Async control CTDB_CONTROL_RELEASE_IP failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Async control CTDB_CONTROL_RELEASE_IP failed\n"));
talloc_free(tmp_ctx);
return -1;
}
data, async_data,
&timeout, NULL);
if (state == NULL) {
- DEBUG(0,(__location__ " Failed to call async control CTDB_CONTROL_TAKEOVER_IP to node %u\n", tmp_ip->pnn));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to call async control CTDB_CONTROL_TAKEOVER_IP to node %u\n", tmp_ip->pnn));
talloc_free(tmp_ctx);
return -1;
}
ctdb_client_async_add(async_data, state);
}
if (ctdb_client_async_wait(ctdb, async_data) != 0) {
- DEBUG(0,(__location__ " Async control CTDB_CONTROL_TAKEOVER_IP failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Async control CTDB_CONTROL_TAKEOVER_IP failed\n"));
talloc_free(tmp_ctx);
return -1;
}
vnn = find_public_ip_vnn(ctdb, p->dest);
if (vnn == NULL) {
if (ntohl(p->dest.sin_addr.s_addr) != INADDR_LOOPBACK) {
- DEBUG(0,("Could not add client IP %s. This is not a public address.\n",
+ DEBUG(DEBUG_ERR,("Could not add client IP %s. This is not a public address.\n",
inet_ntoa(p->dest.sin_addr)));
}
return 0;
}
if (vnn->pnn != ctdb->pnn) {
- DEBUG(0,("Attempt to register tcp client for IP %s we don't hold - failing (client_id %u pid %u)\n",
+ DEBUG(DEBUG_ERR,("Attempt to register tcp client for IP %s we don't hold - failing (client_id %u pid %u)\n",
inet_ntoa(p->dest.sin_addr),
client_id, client->pid));
/* failing this call will tell smbd to die */
CTDB_CONTROL_TCP_ADD,
0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
if (ret != 0) {
- DEBUG(0,(__location__ " Failed to send CTDB_CONTROL_TCP_ADD\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to send CTDB_CONTROL_TCP_ADD\n"));
return -1;
}
vnn = find_public_ip_vnn(ctdb, p->dest);
if (vnn == NULL) {
- DEBUG(0,(__location__ " got TCP_ADD control for an address which is not a public address '%s'\n",
+ DEBUG(DEBUG_ERR,(__location__ " got TCP_ADD control for an address which is not a public address '%s'\n",
inet_ntoa(p->dest.sin_addr)));
return -1;
}
struct ctdb_vnn *vnn = find_public_ip_vnn(ctdb, conn->daddr);
if (vnn == NULL) {
- DEBUG(0,(__location__ " unable to find public address %s\n", inet_ntoa(conn->daddr.sin_addr)));
+ DEBUG(DEBUG_ERR,(__location__ " unable to find public address %s\n", inet_ntoa(conn->daddr.sin_addr)));
return;
}
}
}
if (vnn == NULL) {
- DEBUG(0,(__location__ " Could not killtcp, not a public address\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Could not killtcp, not a public address\n"));
return -1;
}
if (killtcp->sending_fd == -1) {
killtcp->sending_fd = ctdb_sys_open_sending_socket();
if (killtcp->sending_fd == -1) {
- DEBUG(0,(__location__ " Failed to open sending socket for killtcp\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " Failed to open sending socket for killtcp\n"));
goto failed;
}
}
if (killtcp->capture_fd == -1) {
killtcp->capture_fd = ctdb_sys_open_capture_socket(vnn->iface, &killtcp->private_data);
if (killtcp->capture_fd == -1) {
- DEBUG(0,(__location__ " Failed to open capturing socket for killtcp\n"));
+ DEBUG(DEBUG_CRIT,(__location__ " Failed to open capturing socket for killtcp\n"));
goto failed;
}
}
*/
if (indata.dsize < offsetof(struct ctdb_control_tcp_tickle_list,
tickles.connections)) {
- DEBUG(0,("Bad indata in ctdb_control_set_tcp_tickle_list. Not enough data for the tickle.num field\n"));
+ DEBUG(DEBUG_ERR,("Bad indata in ctdb_control_set_tcp_tickle_list. Not enough data for the tickle.num field\n"));
return -1;
}
tickles.connections)
+ sizeof(struct ctdb_tcp_connection)
* list->tickles.num) {
- DEBUG(0,("Bad indata in ctdb_control_set_tcp_tickle_list\n"));
+ DEBUG(DEBUG_ERR,("Bad indata in ctdb_control_set_tcp_tickle_list\n"));
return -1;
}
vnn = find_public_ip_vnn(ctdb, list->ip);
if (vnn == NULL) {
- DEBUG(0,(__location__ " Could not set tcp tickle list, '%s' is not a public address\n",
+ DEBUG(DEBUG_ERR,(__location__ " Could not set tcp tickle list, '%s' is not a public address\n",
inet_ntoa(list->ip.sin_addr)));
return 1;
}
vnn = find_public_ip_vnn(ctdb, *ip);
if (vnn == NULL) {
- DEBUG(0,(__location__ " Could not get tcp tickle list, '%s' is not a public address\n",
+ DEBUG(DEBUG_ERR,(__location__ " Could not get tcp tickle list, '%s' is not a public address\n",
inet_ntoa(ip->sin_addr)));
return 1;
}
CTDB_CONTROL_SET_TCP_TICKLE_LIST,
0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
if (ret != 0) {
- DEBUG(0,(__location__ " ctdb_control for set tcp tickles failed\n"));
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_control for set tcp tickles failed\n"));
return -1;
}
&vnn->public_address,
vnn->tcp_array);
if (ret != 0) {
- DEBUG(0,("Failed to send the tickle update for public address %s\n",
+ DEBUG(DEBUG_ERR,("Failed to send the tickle update for public address %s\n",
inet_ntoa(vnn->public_address.sin_addr)));
}
}
ret = ctdb_sys_send_arp(&arp->sin, arp->iface);
if (ret != 0) {
- DEBUG(0,(__location__ " sending of gratious arp failed (%s)\n", strerror(errno)));
+ DEBUG(DEBUG_ERR,(__location__ " sending of gratious arp failed (%s)\n", strerror(errno)));
}
/* verify the size of indata */
if (indata.dsize < offsetof(struct ctdb_control_gratious_arp, iface)) {
- DEBUG(0,(__location__ " Too small indata to hold a ctdb_control_gratious_arp structure\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Too small indata to hold a ctdb_control_gratious_arp structure\n"));
return -1;
}
if (indata.dsize !=
( offsetof(struct ctdb_control_gratious_arp, iface)
+ gratious_arp->len ) ){
- DEBUG(0,(__location__ " Wrong size of indata. Was %u bytes "
+ DEBUG(DEBUG_ERR,(__location__ " Wrong size of indata. Was %u bytes "
"but should be %u bytes\n",
(unsigned)indata.dsize,
(unsigned)(offsetof(struct ctdb_control_gratious_arp, iface)+gratious_arp->len)));
d = ctdb_marshall_record(state, state->reqid, key, NULL, data);
if (d == NULL) {
/* darn .... */
- DEBUG(0,("Out of memory in traverse_all_callback\n"));
+ DEBUG(DEBUG_ERR,("Out of memory in traverse_all_callback\n"));
return;
}
ret = ctdb_daemon_send_control(state->ctdb, state->srcnode, 0, CTDB_CONTROL_TRAVERSE_DATA,
0, CTDB_CTRL_FLAG_NOREPLY, cdata, NULL, NULL);
if (ret != 0) {
- DEBUG(0,("Failed to send traverse data\n"));
+ DEBUG(DEBUG_ERR,("Failed to send traverse data\n"));
}
if (key.dsize == 0 && data.dsize == 0) {
struct ctdb_db_context *ctdb_db;
if (data.dsize != sizeof(struct ctdb_traverse_all)) {
- DEBUG(0,("Invalid size in ctdb_control_traverse_all\n"));
+ DEBUG(DEBUG_ERR,("Invalid size in ctdb_control_traverse_all\n"));
return -1;
}
void *private_data;
if (data.dsize < sizeof(uint32_t) || data.dsize != d->length) {
- DEBUG(0,("Bad record size in ctdb_control_traverse_data\n"));
+ DEBUG(DEBUG_ERR,("Bad record size in ctdb_control_traverse_data\n"));
return -1;
}
struct ctdb_db_context *ctdb_db;
if (data.dsize != sizeof(*d)) {
- DEBUG(0,("Bad record size in ctdb_control_traverse_start\n"));
+ DEBUG(DEBUG_ERR,("Bad record size in ctdb_control_traverse_start\n"));
return -1;
}
if (indata.dsize < sizeof(*t) ||
t->length > indata.dsize - offsetof(struct ctdb_control_get_tunable, name)) {
- DEBUG(0,("Bad indata in ctdb_control_get_tunable\n"));
+ DEBUG(DEBUG_ERR,("Bad indata in ctdb_control_get_tunable\n"));
return -1;
}
if (indata.dsize < sizeof(*t) ||
t->length > indata.dsize - offsetof(struct ctdb_control_set_tunable, name)) {
- DEBUG(0,("Bad indata in ctdb_control_set_tunable\n"));
+ DEBUG(DEBUG_ERR,("Bad indata in ctdb_control_set_tunable\n"));
return -1;
}
}
if (!options.recovery_lock_file) {
- DEBUG(0,("You must specifiy the location of a recovery lock file with --reclock\n"));
+ DEBUG(DEBUG_ALERT,("You must specifiy the location of a recovery lock file with --reclock\n"));
exit(1);
}
exit(1);
}
- DEBUG(0,("Starting CTDB daemon\n"));
+ DEBUG(DEBUG_NOTICE,("Starting CTDB daemon\n"));
gettimeofday(&ctdb->ctdbd_start_time, NULL);
gettimeofday(&ctdb->last_recovery_time, NULL);
ctdb->recovery_mode = CTDB_RECOVERY_NORMAL;
ret = ctdb_set_recovery_lock_file(ctdb, options.recovery_lock_file);
if (ret == -1) {
- DEBUG(0,("ctdb_set_recovery_lock_file failed - %s\n", ctdb_errstr(ctdb)));
+ DEBUG(DEBUG_ALERT,("ctdb_set_recovery_lock_file failed - %s\n", ctdb_errstr(ctdb)));
exit(1);
}
ret = ctdb_set_transport(ctdb, options.transport);
if (ret == -1) {
- DEBUG(0,("ctdb_set_transport failed - %s\n", ctdb_errstr(ctdb)));
+ DEBUG(DEBUG_ALERT,("ctdb_set_transport failed - %s\n", ctdb_errstr(ctdb)));
exit(1);
}
if (options.myaddress) {
ret = ctdb_set_address(ctdb, options.myaddress);
if (ret == -1) {
- DEBUG(0,("ctdb_set_address failed - %s\n", ctdb_errstr(ctdb)));
+ DEBUG(DEBUG_ALERT,("ctdb_set_address failed - %s\n", ctdb_errstr(ctdb)));
exit(1);
}
}
/* tell ctdb what nodes are available */
ret = ctdb_set_nlist(ctdb, options.nlist);
if (ret == -1) {
- DEBUG(0,("ctdb_set_nlist failed - %s\n", ctdb_errstr(ctdb)));
+ DEBUG(DEBUG_ALERT,("ctdb_set_nlist failed - %s\n", ctdb_errstr(ctdb)));
exit(1);
}
nodes file
*/
if (options.node_ip != NULL) {
- DEBUG(0,("IP for this node is %s\n", options.node_ip));
+ DEBUG(DEBUG_NOTICE,("IP for this node is %s\n", options.node_ip));
ret = ctdb_ip_to_nodeid(ctdb, options.node_ip);
if (ret == -1) {
- DEBUG(0,("The specified node-ip:%s is not a valid node address. Exiting.\n", options.node_ip));
+ DEBUG(DEBUG_ALERT,("The specified node-ip:%s is not a valid node address. Exiting.\n", options.node_ip));
exit(1);
}
ctdb->node_ip = options.node_ip;
- DEBUG(0,("This is node %d\n", ret));
+ DEBUG(DEBUG_NOTICE,("This is node %d\n", ret));
}
if (options.db_dir) {
ret = ctdb_set_tdb_dir(ctdb, options.db_dir);
if (ret == -1) {
- DEBUG(0,("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(ctdb)));
+ DEBUG(DEBUG_ALERT,("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(ctdb)));
exit(1);
}
}
if (options.db_dir_persistent) {
ret = ctdb_set_tdb_dir_persistent(ctdb, options.db_dir_persistent);
if (ret == -1) {
- DEBUG(0,("ctdb_set_tdb_dir_persistent failed - %s\n", ctdb_errstr(ctdb)));
+ DEBUG(DEBUG_ALERT,("ctdb_set_tdb_dir_persistent failed - %s\n", ctdb_errstr(ctdb)));
exit(1);
}
}
struct ctdb_vnn *svnn;
if (options.public_interface == NULL) {
- DEBUG(0,("--single_public_ip used but --public_interface is not specified. You must specify the public interface when using single public ip. Exiting\n"));
+ DEBUG(DEBUG_ALERT,("--single_public_ip used but --public_interface is not specified. You must specify the public interface when using single public ip. Exiting\n"));
exit(10);
}
if (inet_aton(options.single_public_ip,
&svnn->public_address.sin_addr) == 0) {
- DEBUG(0,("Invalid --single-public-ip argument : %s . This is not a valid ip address. Exiting.\n", options.single_public_ip));
+ DEBUG(DEBUG_ALERT,("Invalid --single-public-ip argument : %s . This is not a valid ip address. Exiting.\n", options.single_public_ip));
exit(10);
}
svnn->public_address.sin_family = AF_INET;
if (options.public_address_list) {
ret = ctdb_set_public_addresses(ctdb, options.public_address_list);
if (ret == -1) {
- DEBUG(0,("Unable to setup public address list\n"));
+ DEBUG(DEBUG_ALERT,("Unable to setup public address list\n"));
exit(1);
}
}
ret = ctdb_set_event_script_dir(ctdb, options.event_script_dir);
if (ret == -1) {
- DEBUG(0,("Unable to setup event script directory\n"));
+ DEBUG(DEBUG_ALERT,("Unable to setup event script directory\n"));
exit(1);
}
*/
static void sigterm(int sig)
{
- DEBUG(0,("Timed out running script '%s' after %.1f seconds\n",
+ DEBUG(DEBUG_ERR,("Timed out running script '%s' after %.1f seconds\n",
child_state.script_running, timeval_elapsed(&child_state.start)));
/* all the child processes will be running in the same process group */
kill(-getpgrp(), SIGKILL);
char *script;
if (setpgid(0,0) != 0) {
- DEBUG(0,("Failed to create process group for event scripts - %s\n",
+ DEBUG(DEBUG_ERR,("Failed to create process group for event scripts - %s\n",
strerror(errno)));
talloc_free(tmp_ctx);
return -1;
*/
if (stat(ctdb->event_script_dir, &st) != 0 &&
errno == ENOENT) {
- DEBUG(0,("No event script directory found at '%s'\n", ctdb->event_script_dir));
+ DEBUG(DEBUG_CRIT,("No event script directory found at '%s'\n", ctdb->event_script_dir));
talloc_free(tmp_ctx);
return -1;
}
*/
dir = opendir(ctdb->event_script_dir);
if (dir == NULL) {
- DEBUG(0,("Failed to open event script directory '%s'\n", ctdb->event_script_dir));
+ DEBUG(DEBUG_CRIT,("Failed to open event script directory '%s'\n", ctdb->event_script_dir));
talloc_free(tmp_ctx);
return -1;
}
/* Make sure the event script is executable */
str = talloc_asprintf(tree, "%s/%s", ctdb->event_script_dir, de->d_name);
if (stat(str, &st) != 0) {
- DEBUG(0,("Could not stat event script %s. Ignoring this event script\n", str));
+ DEBUG(DEBUG_ERR,("Could not stat event script %s. Ignoring this event script\n", str));
continue;
}
if (!(st.st_mode & S_IXUSR)) {
- DEBUG(0,("Event script %s is not executable. Ignoring this event script\n", str));
+ DEBUG(DEBUG_ERR,("Event script %s is not executable. Ignoring this event script\n", str));
continue;
}
/* store the event script in the tree */
script = trbt_insert32(tree, num, talloc_strdup(tree, de->d_name));
if (script != NULL) {
- DEBUG(0,("CONFIG ERROR: Multiple event scripts with the same prefix : '%s' and '%s'. Each event script MUST have a unique prefix\n", script, de->d_name));
+ DEBUG(DEBUG_CRIT,("CONFIG ERROR: Multiple event scripts with the same prefix : '%s' and '%s'. Each event script MUST have a unique prefix\n", script, de->d_name));
talloc_free(tmp_ctx);
closedir(dir);
return -1;
}
/* return an error if the script failed */
if (ret != 0) {
- DEBUG(0,("Event script %s failed with error %d\n", cmdstr, ret));
+ DEBUG(DEBUG_ERR,("Event script %s failed with error %d\n", cmdstr, ret));
talloc_free(tmp_ctx);
return ret;
}
void *private_data = state->private_data;
struct ctdb_context *ctdb = state->ctdb;
- DEBUG(0,("event script timed out\n"));
+ DEBUG(DEBUG_ERR,("event script timed out\n"));
talloc_free(state);
callback(ctdb, -1, private_data);
}
*/
static int event_script_destructor(struct ctdb_event_script_state *state)
{
- DEBUG(0,(__location__ " Sending SIGTERM to child pid:%d\n", state->child));
+ DEBUG(DEBUG_ERR,(__location__ " Sending SIGTERM to child pid:%d\n", state->child));
kill(state->child, SIGTERM);
waitpid(state->child, NULL, 0);
return 0;
nodeid = ctdb_ip_to_nodeid(ctdb, incoming_node);
if (nodeid == -1) {
- DEBUG(0, ("Refused connection from unknown node %s\n", incoming_node));
+ DEBUG(DEBUG_WARNING, ("Refused connection from unknown node %s\n", incoming_node));
close(fd);
return;
}
binds if the first socket is in LISTEN state */
lock_fd = open(lock_path, O_RDWR|O_CREAT, 0666);
if (lock_fd == -1) {
- DEBUG(0,("Unable to open %s\n", lock_path));
+ DEBUG(DEBUG_CRIT,("Unable to open %s\n", lock_path));
return -1;
}
lock.l_pid = 0;
if (fcntl(lock_fd, F_SETLKW, &lock) != 0) {
- DEBUG(0,("Unable to lock %s\n", lock_path));
+ DEBUG(DEBUG_CRIT,("Unable to lock %s\n", lock_path));
close(lock_fd);
return -1;
}
}
if (i == ctdb->num_nodes) {
- DEBUG(0,("Unable to bind to any of the node addresses - giving up\n"));
+ DEBUG(DEBUG_CRIT,("Unable to bind to any of the node addresses - giving up\n"));
goto failed;
}
ctdb->address = ctdb->nodes[i]->address;
for (i=0; i<ctdb->num_nodes; i++) {
if (ctdb_tcp_add_node(ctdb->nodes[i]) != 0) {
- DEBUG(0, ("methods->add_node failed at %d\n", i));
+ DEBUG(DEBUG_CRIT, ("methods->add_node failed at %d\n", i));
return -1;
}
}
struct ctdb_tcp_node *tnode = talloc_get_type(
node->private_data, struct ctdb_tcp_node);
- DEBUG(0,("Tearing down connection to dead node :%d\n", node->pnn));
+ DEBUG(DEBUG_NOTICE,("Tearing down connection to dead node :%d\n", node->pnn));
ctdb_tcp_stop_connection(node);
}
if (cnt < sizeof(*hdr)) {
- DEBUG(0,(__location__ " Bad packet length %u\n", (unsigned)cnt));
+ DEBUG(DEBUG_ALERT,(__location__ " Bad packet length %u\n", (unsigned)cnt));
goto failed;
}
if (cnt & (CTDB_TCP_ALIGNMENT-1)) {
- DEBUG(0,(__location__ " Length 0x%x not multiple of alignment\n",
+ DEBUG(DEBUG_ALERT,(__location__ " Length 0x%x not multiple of alignment\n",
(unsigned)cnt));
goto failed;
}
if (cnt != hdr->length) {
- DEBUG(0,(__location__ " Bad header length %u expected %u\n",
+ DEBUG(DEBUG_ALERT,(__location__ " Bad header length %u expected %u\n",
(unsigned)hdr->length, (unsigned)cnt));
goto failed;
}
if (hdr->ctdb_magic != CTDB_MAGIC) {
- DEBUG(0,(__location__ " Non CTDB packet 0x%x rejected\n",
+ DEBUG(DEBUG_ALERT,(__location__ " Non CTDB packet 0x%x rejected\n",
hdr->ctdb_magic));
goto failed;
}
if (hdr->ctdb_version != CTDB_VERSION) {
- DEBUG(0, (__location__ " Bad CTDB version 0x%x rejected\n",
+ DEBUG(DEBUG_ALERT, (__location__ " Bad CTDB version 0x%x rejected\n",
hdr->ctdb_version));
goto failed;
}
ret = ctdb_record_store(h, data);
if (ret != 0) {
- DEBUG(0,("Failed to store record\n"));
+ DEBUG(DEBUG_ERR,("Failed to store record\n"));
exit(1);
}
talloc_free(h);
}
if (sscanf(argv[0], "%u:%u", &pnn, &pid) != 2) {
- DEBUG(0, ("Badly formed pnn:pid\n"));
+ DEBUG(DEBUG_ERR, ("Badly formed pnn:pid\n"));
return -1;
}
offsetof(struct ctdb_statistics, __last_counter) / sizeof(uint32_t);
ret = ctdb_ctrl_statistics(ctdb, nodes[i], &s1);
if (ret != 0) {
- DEBUG(0, ("Unable to get statistics from node %u\n", nodes[i]));
+ DEBUG(DEBUG_ERR, ("Unable to get statistics from node %u\n", nodes[i]));
return ret;
}
for (j=0;j<num_ints;j++) {
ret = ctdb_ctrl_statistics(ctdb, options.pnn, &statistics);
if (ret != 0) {
- DEBUG(0, ("Unable to get statistics from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to get statistics from node %u\n", options.pnn));
return ret;
}
show_statistics(&statistics);
ret = ctdb_statistics_reset(ctdb, options.pnn);
if (ret != 0) {
- DEBUG(0, ("Unable to reset statistics on node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to reset statistics on node %u\n", options.pnn));
return ret;
}
return 0;
ret = ctdb_ctrl_uptime(ctdb, ctdb, TIMELIMIT(), options.pnn, &uptime);
if (ret != 0) {
- DEBUG(0, ("Unable to get uptime from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to get uptime from node %u\n", options.pnn));
return ret;
}
ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.pnn, ctdb, &nodemap);
if (ret != 0) {
- DEBUG(0, ("Unable to get nodemap from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to get nodemap from node %u\n", options.pnn));
return ret;
}
ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), options.pnn, ctdb, &vnnmap);
if (ret != 0) {
- DEBUG(0, ("Unable to get vnnmap from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to get vnnmap from node %u\n", options.pnn));
return ret;
}
if (vnnmap->generation == INVALID_GENERATION) {
ret = ctdb_ctrl_getrecmode(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmode);
if (ret != 0) {
- DEBUG(0, ("Unable to get recmode from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to get recmode from node %u\n", options.pnn));
return ret;
}
printf("Recovery mode:%s (%d)\n",recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"RECOVERY",recmode);
ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmaster);
if (ret != 0) {
- DEBUG(0, ("Unable to get recmaster from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to get recmaster from node %u\n", options.pnn));
return ret;
}
printf("Recovery master:%d\n",recmaster);
ip.sin_family = AF_INET;
if (inet_aton(argv[0], &ip.sin_addr) == 0) {
- DEBUG(0,("Wrongly formed ip address '%s'\n", argv[0]));
+ DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
return -1;
}
ret = ctdb_ctrl_get_tcp_tickles(ctdb, TIMELIMIT(), options.pnn, ctdb, &ip, &list);
if (ret == -1) {
- DEBUG(0, ("Unable to list tickles\n"));
+ DEBUG(DEBUG_ERR, ("Unable to list tickles\n"));
return -1;
}
}
if (!parse_ip_port(argv[0], &killtcp.src)) {
- DEBUG(0, ("Bad IP:port '%s'\n", argv[0]));
+ DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[0]));
return -1;
}
if (!parse_ip_port(argv[1], &killtcp.dst)) {
- DEBUG(0, ("Bad IP:port '%s'\n", argv[1]));
+ DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[1]));
return -1;
}
ret = ctdb_ctrl_killtcp(ctdb, TIMELIMIT(), options.pnn, &killtcp);
if (ret != 0) {
- DEBUG(0, ("Unable to killtcp from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to killtcp from node %u\n", options.pnn));
return ret;
}
sin.sin_family = AF_INET;
if (inet_aton(argv[0], &sin.sin_addr) == 0) {
- DEBUG(0,("Wrongly formed ip address '%s'\n", argv[0]));
+ DEBUG(DEBUG_ERR,("Wrongly formed ip address '%s'\n", argv[0]));
return -1;
}
ret = ctdb_ctrl_gratious_arp(ctdb, TIMELIMIT(), options.pnn, &sin, argv[1]);
if (ret != 0) {
- DEBUG(0, ("Unable to send gratious_arp from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to send gratious_arp from node %u\n", options.pnn));
return ret;
}
ret = ctdb_ctrl_register_server_id(ctdb, TIMELIMIT(), &server_id);
if (ret != 0) {
- DEBUG(0, ("Unable to register server_id from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to register server_id from node %u\n", options.pnn));
return ret;
}
return -1;
ret = ctdb_ctrl_unregister_server_id(ctdb, TIMELIMIT(), &server_id);
if (ret != 0) {
- DEBUG(0, ("Unable to unregister server_id from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to unregister server_id from node %u\n", options.pnn));
return ret;
}
return -1;
ret = ctdb_ctrl_check_server_id(ctdb, TIMELIMIT(), options.pnn, &server_id, &status);
if (ret != 0) {
- DEBUG(0, ("Unable to check server_id from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to check server_id from node %u\n", options.pnn));
return ret;
}
ret = ctdb_ctrl_get_server_id_list(ctdb, ctdb, TIMELIMIT(), options.pnn, &server_ids);
if (ret != 0) {
- DEBUG(0, ("Unable to get server_id list from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to get server_id list from node %u\n", options.pnn));
return ret;
}
}
if (!parse_ip_port(argv[0], &src)) {
- DEBUG(0, ("Bad IP:port '%s'\n", argv[0]));
+ DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[0]));
return -1;
}
if (!parse_ip_port(argv[1], &dst)) {
- DEBUG(0, ("Bad IP:port '%s'\n", argv[1]));
+ DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[1]));
return -1;
}
s = ctdb_sys_open_sending_socket();
if (s == -1) {
- DEBUG(0, ("Failed to open socket for sending tickle\n"));
+ DEBUG(DEBUG_ERR, ("Failed to open socket for sending tickle\n"));
return 0;
}
if (ret==0) {
return 0;
}
- DEBUG(0, ("Error while sending tickle ack\n"));
+ DEBUG(DEBUG_ERR, ("Error while sending tickle ack\n"));
return -1;
}
/* read the public ip list from this node */
ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), options.pnn, tmp_ctx, &ips);
if (ret != 0) {
- DEBUG(0, ("Unable to get public ips from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to get public ips from node %u\n", options.pnn));
talloc_free(tmp_ctx);
return ret;
}
ret = ctdb_ctrl_getpid(ctdb, TIMELIMIT(), options.pnn, &pid);
if (ret != 0) {
- DEBUG(0, ("Unable to get daemon pid from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to get daemon pid from node %u\n", options.pnn));
return ret;
}
printf("Pid:%d\n", pid);
ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, NODE_FLAGS_PERMANENTLY_DISABLED, 0);
if (ret != 0) {
- DEBUG(0, ("Unable to disable node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to disable node %u\n", options.pnn));
return ret;
}
ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, 0, NODE_FLAGS_PERMANENTLY_DISABLED);
if (ret != 0) {
- DEBUG(0, ("Unable to enable node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to enable node %u\n", options.pnn));
return ret;
}
ret = ctdb_send_message(ctdb, options.pnn, CTDB_SRVID_BAN_NODE, data);
if (ret != 0) {
- DEBUG(0,("Failed to ban node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR,("Failed to ban node %u\n", options.pnn));
return -1;
}
ret = ctdb_send_message(ctdb, options.pnn, CTDB_SRVID_UNBAN_NODE, data);
if (ret != 0) {
- DEBUG(0,("Failed to to unban node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR,("Failed to to unban node %u\n", options.pnn));
return -1;
}
ret = ctdb_ctrl_shutdown(ctdb, TIMELIMIT(), options.pnn);
if (ret != 0) {
- DEBUG(0, ("Unable to shutdown node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to shutdown node %u\n", options.pnn));
return ret;
}
ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.pnn);
if (ret != 0) {
- DEBUG(0, ("Unable to freeze node\n"));
+ DEBUG(DEBUG_ERR, ("Unable to freeze node\n"));
return ret;
}
ret = ctdb_ctrl_setrecmode(ctdb, TIMELIMIT(), options.pnn, CTDB_RECOVERY_ACTIVE);
if (ret != 0) {
- DEBUG(0, ("Unable to set recovery mode\n"));
+ DEBUG(DEBUG_ERR, ("Unable to set recovery mode\n"));
return ret;
}
ret = ctdb_ctrl_getmonmode(ctdb, TIMELIMIT(), options.pnn, &monmode);
if (ret != 0) {
- DEBUG(0, ("Unable to get monmode from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to get monmode from node %u\n", options.pnn));
return ret;
}
printf("Monitoring mode:%s (%d)\n",monmode==CTDB_MONITORING_ACTIVE?"ACTIVE":"DISABLED",monmode);
ctdb_db = ctdb_attach(ctdb, db_name, false);
if (ctdb_db == NULL) {
- DEBUG(0,("Unable to attach to database '%s'\n", db_name));
+ DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
return -1;
}
/* traverse and dump the cluster tdb */
ret = ctdb_dump_db(ctdb_db, stdout);
if (ret == -1) {
- DEBUG(0, ("Unable to dump database\n"));
+ DEBUG(DEBUG_ERR, ("Unable to dump database\n"));
return -1;
}
talloc_free(ctdb_db);
ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), options.pnn, ctdb, &dbmap);
if (ret != 0) {
- DEBUG(0, ("Unable to get dbids from node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to get dbids from node %u\n", options.pnn));
return ret;
}
name = argv[0];
ret = ctdb_ctrl_get_tunable(ctdb, TIMELIMIT(), options.pnn, name, &value);
if (ret == -1) {
- DEBUG(0, ("Unable to get tunable variable '%s'\n", name));
+ DEBUG(DEBUG_ERR, ("Unable to get tunable variable '%s'\n", name));
return -1;
}
ret = ctdb_ctrl_set_tunable(ctdb, TIMELIMIT(), options.pnn, name, value);
if (ret == -1) {
- DEBUG(0, ("Unable to set tunable variable '%s'\n", name));
+ DEBUG(DEBUG_ERR, ("Unable to set tunable variable '%s'\n", name));
return -1;
}
return 0;
ret = ctdb_ctrl_list_tunables(ctdb, TIMELIMIT(), options.pnn, ctdb, &list, &count);
if (ret == -1) {
- DEBUG(0, ("Unable to list tunable variables\n"));
+ DEBUG(DEBUG_ERR, ("Unable to list tunable variables\n"));
return -1;
}
ret = ctdb_ctrl_get_debuglevel(ctdb, options.pnn, &level);
if (ret != 0) {
- DEBUG(0, ("Unable to get debuglevel response from node %u\n",
+ DEBUG(DEBUG_ERR, ("Unable to get debuglevel response from node %u\n",
options.pnn));
} else {
printf("Node %u is at debug level %u\n", options.pnn, level);
ret = ctdb_ctrl_set_debuglevel(ctdb, options.pnn, level);
if (ret != 0) {
- DEBUG(0, ("Unable to set debug level on node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to set debug level on node %u\n", options.pnn));
}
return 0;
}
ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.pnn);
if (ret != 0) {
- DEBUG(0, ("Unable to freeze node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to freeze node %u\n", options.pnn));
}
return 0;
}
ret = ctdb_ctrl_thaw(ctdb, TIMELIMIT(), options.pnn);
if (ret != 0) {
- DEBUG(0, ("Unable to thaw node %u\n", options.pnn));
+ DEBUG(DEBUG_ERR, ("Unable to thaw node %u\n", options.pnn));
}
return 0;
}
ctdb_db = ctdb_attach(ctdb, db_name, false);
if (ctdb_db == NULL) {
- DEBUG(0,("Unable to attach to database '%s'\n", db_name));
+ DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
return -1;
}
ret = ctdb_control(ctdb, options.pnn, 0, CTDB_CONTROL_DUMP_MEMORY,
0, tdb_null, tmp_ctx, &data, &res, NULL, &errmsg);
if (ret != 0 || res != 0) {
- DEBUG(0,("Failed to dump memory - %s\n", errmsg));
+ DEBUG(DEBUG_ERR,("Failed to dump memory - %s\n", errmsg));
talloc_free(tmp_ctx);
return -1;
}
while ((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
default:
- DEBUG(0, ("Invalid option %s: %s\n",
+ DEBUG(DEBUG_ERR, ("Invalid option %s: %s\n",
poptBadOption(pc, 0), poptStrerror(opt)));
exit(1);
}
/* initialise ctdb */
ctdb = ctdb_cmdline_client(ev);
if (ctdb == NULL) {
- DEBUG(0, ("Failed to init ctdb\n"));
+ DEBUG(DEBUG_ERR, ("Failed to init ctdb\n"));
exit(1);
}
}
if (i == ARRAY_SIZE(ctdb_commands)) {
- DEBUG(0, ("Unknown control '%s'\n", control));
+ DEBUG(DEBUG_ERR, ("Unknown control '%s'\n", control));
exit(1);
}
/* add the record to the blob ready to send to the nodes */
rec = ctdb_marshall_record(vdata->list[lmaster], vdata->ctdb->pnn, key, NULL, tdb_null);
if (rec == NULL) {
- DEBUG(0,(__location__ " Out of memory\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
vdata->traverse_error = true;
return -1;
}
vdata->list[lmaster] = talloc_realloc_size(NULL, vdata->list[lmaster],
old_size + rec->length);
if (vdata->list[lmaster] == NULL) {
- DEBUG(0,(__location__ " Failed to expand\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to expand\n"));
vdata->traverse_error = true;
return -1;
}
vdata = talloc_zero(ctdb, struct vacuum_data);
if (vdata == NULL) {
- DEBUG(0,(__location__ " Out of memory\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
return -1;
}
vdata->vacuum_limit = vacuum_limit;
if (ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, db_id, vdata, &name) != 0) {
- DEBUG(0,(__location__ " Failed to get name of db 0x%x\n", db_id));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to get name of db 0x%x\n", db_id));
talloc_free(vdata);
return -1;
}
ctdb_db = ctdb_attach(ctdb, name, persistent);
if (ctdb_db == NULL) {
- DEBUG(0,(__location__ " Failed to attach to database '%s'\n", name));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name));
talloc_free(vdata);
return -1;
}
/* the list needs to be of length num_nodes */
vdata->list = talloc_array(vdata, struct ctdb_control_pulldb_reply *, ctdb->vnn_map->size);
if (vdata->list == NULL) {
- DEBUG(0,(__location__ " Out of memory\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
talloc_free(vdata);
return -1;
}
talloc_zero_size(vdata->list,
offsetof(struct ctdb_control_pulldb_reply, data));
if (vdata->list[i] == NULL) {
- DEBUG(0,(__location__ " Out of memory\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
talloc_free(vdata);
return -1;
}
/* traverse, looking for records that might be able to be vacuumed */
if (tdb_traverse_read(ctdb_db->ltdb->tdb, vacuum_traverse, vdata) == -1 ||
vdata->traverse_error) {
- DEBUG(0,(__location__ " Traverse error in vacuuming '%s'\n", name));
+ DEBUG(DEBUG_ERR,(__location__ " Traverse error in vacuuming '%s'\n", name));
talloc_free(vdata);
return -1;
}
data.dsize = talloc_get_size(vdata->list[i]);
data.dptr = (void *)vdata->list[i];
if (ctdb_send_message(ctdb, ctdb->vnn_map->map[i], CTDB_SRVID_VACUUM_FETCH, data) != 0) {
- DEBUG(0,(__location__ " Failed to send vacuum fetch message to %u\n",
+ DEBUG(DEBUG_ERR,(__location__ " Failed to send vacuum fetch message to %u\n",
ctdb->vnn_map->map[i]));
talloc_free(vdata);
return -1;
/* for records where we are the lmaster, we can try to delete them */
if (ctdb_vacuum_local(ctdb, vdata->list[i], ctdb_db, &count) != 0) {
- DEBUG(0,(__location__ " Deletion error in vacuuming '%s'\n", name));
+ DEBUG(DEBUG_ERR,(__location__ " Deletion error in vacuuming '%s'\n", name));
talloc_free(vdata);
return -1;
}
ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &dbmap);
if (ret != 0) {
- DEBUG(0, ("Unable to get dbids from local node\n"));
+ DEBUG(DEBUG_ERR, ("Unable to get dbids from local node\n"));
return ret;
}
ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &nodemap);
if (ret != 0) {
- DEBUG(0, ("Unable to get nodemap from local node\n"));
+ DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n"));
return ret;
}
ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &ctdb->vnn_map);
if (ret != 0) {
- DEBUG(0, ("Unable to get vnnmap from local node\n"));
+ DEBUG(DEBUG_ERR, ("Unable to get vnnmap from local node\n"));
return ret;
}
pnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE);
if (pnn == -1) {
- DEBUG(0, ("Unable to get pnn from local node\n"));
+ DEBUG(DEBUG_ERR, ("Unable to get pnn from local node\n"));
return -1;
}
ctdb->pnn = pnn;
for (i=0;i<dbmap->num;i++) {
if (ctdb_vacuum_db(ctdb, dbmap->dbs[i].dbid, nodemap,
dbmap->dbs[i].persistent, vacuum_limit) != 0) {
- DEBUG(0,("Failed to vacuum db 0x%x\n", dbmap->dbs[i].dbid));
+ DEBUG(DEBUG_ERR,("Failed to vacuum db 0x%x\n", dbmap->dbs[i].dbid));
return -1;
}
}
struct traverse_state state;
if (tdb_transaction_start(tdb) != 0) {
- DEBUG(0,(__location__ " Failed to start transaction\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to start transaction\n"));
return -1;
}
tmp_db = tdb_open("tmpdb", tdb_hash_size(tdb), TDB_INTERNAL, O_RDWR|O_CREAT, 0);
if (tmp_db == NULL) {
- DEBUG(0,(__location__ " Failed to create tmp_db\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to create tmp_db\n"));
tdb_transaction_cancel(tdb);
return -1;
}
state.dest_db = tmp_db;
if (tdb_traverse_read(tdb, repack_traverse, &state) == -1) {
- DEBUG(0,(__location__ " Failed to traverse copying out\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to traverse copying out\n"));
tdb_transaction_cancel(tdb);
tdb_close(tmp_db);
return -1;
}
if (state.error) {
- DEBUG(0,(__location__ " Error during traversal\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Error during traversal\n"));
tdb_transaction_cancel(tdb);
tdb_close(tmp_db);
return -1;
}
if (tdb_wipe_all(tdb) != 0) {
- DEBUG(0,(__location__ " Failed to wipe database\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to wipe database\n"));
tdb_transaction_cancel(tdb);
tdb_close(tmp_db);
return -1;
state.dest_db = tdb;
if (tdb_traverse_read(tmp_db, repack_traverse, &state) == -1) {
- DEBUG(0,(__location__ " Failed to traverse copying back\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to traverse copying back\n"));
tdb_transaction_cancel(tdb);
tdb_close(tmp_db);
return -1;
}
if (state.error) {
- DEBUG(0,(__location__ " Error during second traversal\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Error during second traversal\n"));
tdb_transaction_cancel(tdb);
tdb_close(tmp_db);
return -1;
tdb_close(tmp_db);
if (tdb_transaction_commit(tdb) != 0) {
- DEBUG(0,(__location__ " Failed to commit\n"));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to commit\n"));
return -1;
}
int size;
if (ctdb_ctrl_getdbname(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, db_id, ctdb, &name) != 0) {
- DEBUG(0,(__location__ " Failed to get name of db 0x%x\n", db_id));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to get name of db 0x%x\n", db_id));
return -1;
}
ctdb_db = ctdb_attach(ctdb, name, persistent);
if (ctdb_db == NULL) {
- DEBUG(0,(__location__ " Failed to attach to database '%s'\n", name));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name));
return -1;
}
size = tdb_freelist_size(ctdb_db->ltdb->tdb);
if (size == -1) {
- DEBUG(0,(__location__ " Failed to get freelist size for '%s'\n", name));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to get freelist size for '%s'\n", name));
return -1;
}
printf("Repacking %s with %u freelist entries\n", name, size);
if (ctdb_repack_tdb(ctdb_db->ltdb->tdb) != 0) {
- DEBUG(0,(__location__ " Failed to repack '%s'\n", name));
+ DEBUG(DEBUG_ERR,(__location__ " Failed to repack '%s'\n", name));
return -1;
}
ret = ctdb_ctrl_getdbmap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &dbmap);
if (ret != 0) {
- DEBUG(0, ("Unable to get dbids from local node\n"));
+ DEBUG(DEBUG_ERR, ("Unable to get dbids from local node\n"));
return ret;
}
for (i=0;i<dbmap->num;i++) {
if (ctdb_repack_db(ctdb, dbmap->dbs[i].dbid,
dbmap->dbs[i].persistent, repack_limit) != 0) {
- DEBUG(0,("Failed to repack db 0x%x\n", dbmap->dbs[i].dbid));
+ DEBUG(DEBUG_ERR,("Failed to repack db 0x%x\n", dbmap->dbs[i].dbid));
return -1;
}
}