1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

more DEBUG() calls

(This used to be ctdb commit 79f3d63eec5652d87f13875c76e90ead81a26ad9)
This commit is contained in:
Andrew Tridgell 2007-04-17 22:27:17 +10:00
parent 1e2d91c761
commit 8a7b573320
4 changed files with 25 additions and 21 deletions

View File

@ -36,7 +36,7 @@ static void ctdb_main_loop(struct ctdb_context *ctdb)
/* go into a wait loop to allow other nodes to complete */ /* go into a wait loop to allow other nodes to complete */
event_loop_wait(ctdb->ev); event_loop_wait(ctdb->ev);
printf("event_loop_wait() returned. this should not happen\n"); DEBUG(0,("event_loop_wait() returned. this should not happen\n"));
exit(1); exit(1);
} }
@ -118,7 +118,8 @@ static void daemon_request_register_message_handler(struct ctdb_client *client,
c->srvid, daemon_message_handler, c->srvid, daemon_message_handler,
client); client);
if (res != 0) { if (res != 0) {
printf("Failed to register handler %u in daemon\n", c->srvid); DEBUG(0,(__location__ " Failed to register handler %u in daemon\n",
c->srvid));
} }
} }
@ -168,7 +169,7 @@ static void daemon_fetch_lock_complete(struct ctdb_call_state *state)
length = offsetof(struct ctdb_reply_fetch_lock, data) + state->call.reply_data.dsize; length = offsetof(struct ctdb_reply_fetch_lock, data) + state->call.reply_data.dsize;
r = ctdbd_allocate_pkt(client->ctdb, length); r = ctdbd_allocate_pkt(client->ctdb, length);
if (r == NULL) { if (r == NULL) {
printf("Failed to allocate reply_call in ctdb daemon\n"); DEBUG(0,(__location__ " Failed to allocate reply_call in ctdb daemon\n"));
return; return;
} }
memset(r, 0, offsetof(struct ctdb_reply_fetch_lock, data)); memset(r, 0, offsetof(struct ctdb_reply_fetch_lock, data));
@ -183,7 +184,7 @@ static void daemon_fetch_lock_complete(struct ctdb_call_state *state)
res = ctdb_queue_send(client->queue, (uint8_t *)&r->hdr, r->hdr.length); res = ctdb_queue_send(client->queue, (uint8_t *)&r->hdr, r->hdr.length);
if (res != 0) { if (res != 0) {
printf("Failed to queue packet from daemon to client\n"); DEBUG(0,(__location__ " Failed to queue packet from daemon to client\n"));
} }
talloc_free(r); talloc_free(r);
} }
@ -260,7 +261,7 @@ static void daemon_request_connect_wait(struct ctdb_client *client,
res = ctdb_queue_send(client->queue, (uint8_t *)&r.hdr, r.hdr.length); res = ctdb_queue_send(client->queue, (uint8_t *)&r.hdr, r.hdr.length);
if (res != 0) { if (res != 0) {
printf("Failed to queue a connect wait response\n"); DEBUG(0,(__location__ " Failed to queue a connect wait response\n"));
return; return;
} }
} }
@ -298,8 +299,8 @@ static void daemon_request_message_from_client(struct ctdb_client *client,
res = ctdb_daemon_send_message(client->ctdb, c->hdr.destnode, res = ctdb_daemon_send_message(client->ctdb, c->hdr.destnode,
c->srvid, data); c->srvid, data);
if (res != 0) { if (res != 0) {
printf("Failed to send message to remote node %u\n", DEBUG(0,(__location__ " Failed to send message to remote node %u\n",
c->hdr.destnode); c->hdr.destnode));
} }
} }
@ -319,7 +320,8 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
ctdb_db = find_ctdb_db(client->ctdb, c->db_id); ctdb_db = find_ctdb_db(client->ctdb, c->db_id);
if (!ctdb_db) { if (!ctdb_db) {
printf("Unknown database in request. db_id==0x%08x",c->db_id); DEBUG(0, (__location__ " Unknown database in request. db_id==0x%08x",
c->db_id));
return; return;
} }
@ -337,14 +339,14 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
/* XXX this must be converted to fully async */ /* XXX this must be converted to fully async */
res = ctdb_daemon_call_recv(state, &call); res = ctdb_daemon_call_recv(state, &call);
if (res != 0) { if (res != 0) {
printf("ctdbd_call_recv() returned error\n"); DEBUG(0, (__location__ " ctdbd_call_recv() returned error\n"));
exit(1); exit(1);
} }
length = offsetof(struct ctdb_reply_call, data) + call.reply_data.dsize; length = offsetof(struct ctdb_reply_call, data) + call.reply_data.dsize;
r = ctdbd_allocate_pkt(client->ctdb, length); r = ctdbd_allocate_pkt(client->ctdb, length);
if (r == NULL) { if (r == NULL) {
printf("Failed to allocate reply_call in ctdb daemon\n"); DEBUG(0, (__location__ " Failed to allocate reply_call in ctdb daemon\n"));
return; return;
} }
memset(r, 0, offsetof(struct ctdb_reply_call, data)); memset(r, 0, offsetof(struct ctdb_reply_call, data));
@ -358,7 +360,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
res = ctdb_queue_send(client->queue, (uint8_t *)&r->hdr, r->hdr.length); res = ctdb_queue_send(client->queue, (uint8_t *)&r->hdr, r->hdr.length);
if (res != 0) { if (res != 0) {
printf("Failed to queue packet from daemon to client\n"); DEBUG(0, (__location__ "Failed to queue packet from daemon to client\n"));
} }
talloc_free(r); talloc_free(r);
} }
@ -399,7 +401,8 @@ static void daemon_incoming_packet(struct ctdb_client *client, void *data, size_
daemon_request_fetch_lock(client, (struct ctdb_req_fetch_lock *)hdr); daemon_request_fetch_lock(client, (struct ctdb_req_fetch_lock *)hdr);
break; break;
default: default:
printf("daemon: unrecognized operation:%d\n",hdr->operation); DEBUG(0,(__location__ " daemon: unrecognized operation %d\n",
hdr->operation));
} }
done: done:
@ -481,10 +484,10 @@ static void ctdb_read_from_parent(struct event_context *ev, struct fd_event *fde
/* XXX this is a good place to try doing some cleaning up before exiting */ /* XXX this is a good place to try doing some cleaning up before exiting */
cnt = read(*fd, &buf, 1); cnt = read(*fd, &buf, 1);
if (cnt==0) { if (cnt==0) {
printf("parent process exited. filedescriptor dissappeared\n"); DEBUG(0,(__location__ " parent process exited. filedescriptor dissappeared\n"));
exit(1); exit(1);
} else { } else {
printf("ctdb: did not expect data from parent process\n"); DEBUG(0,(__location__ " ctdb: did not expect data from parent process\n"));
exit(1); exit(1);
} }
} }
@ -549,18 +552,18 @@ int ctdb_start(struct ctdb_context *ctdb)
/* create a unix domain stream socket to listen to */ /* create a unix domain stream socket to listen to */
res = ux_socket_bind(ctdb); res = ux_socket_bind(ctdb);
if (res!=0) { if (res!=0) {
printf("Failed to open CTDB unix domain socket\n"); DEBUG(0,(__location__ " Failed to open CTDB unix domain socket\n"));
exit(10); exit(10);
} }
res = pipe(&fd[0]); res = pipe(&fd[0]);
if (res) { if (res) {
printf("Failed to open pipe for CTDB\n"); DEBUG(0,(__location__ " Failed to open pipe for CTDB\n"));
exit(1); exit(1);
} }
pid = fork(); pid = fork();
if (pid==-1) { if (pid==-1) {
printf("Failed to fork CTDB daemon\n"); DEBUG(0,(__location__ " Failed to fork CTDB daemon\n"));
exit(1); exit(1);
} }

View File

@ -227,7 +227,7 @@ static void lock_fetch_callback(void *p)
struct ctdb_req_header *hdr = p; struct ctdb_req_header *hdr = p;
struct ctdb_context *ctdb = talloc_find_parent_bytype(p, struct ctdb_context); struct ctdb_context *ctdb = talloc_find_parent_bytype(p, struct ctdb_context);
ctdb_recv_pkt(ctdb, (uint8_t *)hdr, hdr->length); ctdb_recv_pkt(ctdb, (uint8_t *)hdr, hdr->length);
printf("PACKET REQUEUED\n"); DEBUG(0,(__location__ " PACKET REQUEUED\n"));
} }
/* /*

View File

@ -42,7 +42,8 @@ static int ctdb_dispatch_message(struct ctdb_context *ctdb, uint32_t srvid, TDB_
if (ml->srvid == srvid || ml->srvid == CTDB_SRVID_ALL) break; if (ml->srvid == srvid || ml->srvid == CTDB_SRVID_ALL) break;
} }
if (ml == NULL) { if (ml == NULL) {
printf("daemon vnn:%d no msg handler for srvid=%u\n", ctdb_get_vnn(ctdb), srvid); DEBUG(0,(__location__ " daemon vnn:%d no msg handler for srvid=%u\n",
ctdb_get_vnn(ctdb), srvid));
/* no registered message handler */ /* no registered message handler */
return -1; return -1;
} }
@ -86,7 +87,7 @@ static void ctdb_local_message_trigger(struct event_context *ev, struct timed_ev
res = ctdb_dispatch_message(m->ctdb, m->srvid, m->data); res = ctdb_dispatch_message(m->ctdb, m->srvid, m->data);
if (res != 0) { if (res != 0) {
printf("Failed to dispatch message for srvid=%u\n", m->srvid); DEBUG(0, (__location__ " Failed to dispatch message for srvid=%u\n", m->srvid));
} }
talloc_free(m); talloc_free(m);
} }

View File

@ -130,7 +130,7 @@ int main(int argc, const char *argv[])
for (j=0;j<num_clients;j++) { for (j=0;j<num_clients;j++) {
printf("sending message to %d:%d\n", i, j); printf("sending message to %d:%d\n", i, j);
sprintf(buf,"Message from %d to vnn:%d srvid:%d",ctdb_get_vnn(ctdb),i,j); sprintf(buf,"Message from %d to vnn:%d srvid:%d",ctdb_get_vnn(ctdb),i,j);
data.dptr=buf; data.dptr = (unsigned char *)buf;
data.dsize=strlen(buf)+1; data.dsize=strlen(buf)+1;
ctdb_send_message(ctdb, i, j, data); ctdb_send_message(ctdb, i, j, data);
} }