*/
#include "includes.h"
-#include "lib/events/events.h"
+#include "lib/tevent/tevent.h"
#include "system/filesys.h"
#include "system/wait.h"
#include "db_wrap.h"
struct ctdb_rec_data *d;
struct ctdb_ltdb_header *hdr;
-
hdr = (struct ctdb_ltdb_header *)data.dptr;
if (h->ctdb_db->persistent == 0) {
if (h->child == 0) {
/* start the traverse in the child */
close(h->fd[0]);
+ debug_extra = talloc_asprintf(NULL, "traverse_local-%s:",
+ ctdb_db->db_name);
tdb_traverse_read(ctdb_db->ltdb->tdb, ctdb_traverse_local_fn, h);
_exit(0);
}
close(h->fd[1]);
+ set_close_on_exec(h->fd[0]);
+
talloc_set_destructor(h, traverse_local_destructor);
DLIST_ADD(ctdb_db->traverse, h);
setup a packet queue between the child and the parent. This
copes with all the async and packet boundary issues
*/
- h->queue = ctdb_queue_setup(ctdb_db->ctdb, h, h->fd[0], 0, ctdb_traverse_local_handler, h);
+ DEBUG(DEBUG_DEBUG, (__location__ " Created PIPE FD:%d to child traverse\n", h->fd[0]));
+
+ h->queue = ctdb_queue_setup(ctdb_db->ctdb, h, h->fd[0], 0, ctdb_traverse_local_handler, h,
+ "to-ctdbd");
if (h->queue == NULL) {
talloc_free(h);
return NULL;
{
struct ctdb_traverse_all_handle *state = talloc_get_type(private_data, struct ctdb_traverse_all_handle);
- state->ctdb->statistics.timeouts.traverse++;
+ DEBUG(DEBUG_ERR,(__location__ " Traverse all timeout on database:%s\n", state->ctdb_db->db_name));
+ CTDB_INCREMENT_STAT(state->ctdb, timeouts.traverse);
state->callback(state->private_data, tdb_null, tdb_null);
- talloc_free(state);
}
struct ctdb_traverse_all r;
uint32_t destination;
- state = talloc(ctdb_db, struct ctdb_traverse_all_handle);
+ state = talloc(start_state, struct ctdb_traverse_all_handle);
if (state == NULL) {
return NULL;
}
return -1;
}
+ if (ctdb_db->unhealthy_reason) {
+ if (ctdb->tunable.allow_unhealthy_db_read == 0) {
+ DEBUG(DEBUG_ERR,("db(%s) unhealty in ctdb_control_traverse_all: %s\n",
+ ctdb_db->db_name, ctdb_db->unhealthy_reason));
+ return -1;
+ }
+ DEBUG(DEBUG_WARNING,("warn: db(%s) unhealty in ctdb_control_traverse_all: %s\n",
+ ctdb_db->db_name, ctdb_db->unhealthy_reason));
+ }
+
state = talloc(ctdb_db, struct traverse_all_state);
if (state == NULL) {
return -1;
private_data = state->private_data;
callback(private_data, key, data);
- if (key.dsize == 0 && data.dsize == 0) {
- /* we've received all of the null replies, so all
- nodes are finished */
- talloc_free(state);
- }
return 0;
}
struct ctdb_traverse_start r;
TDB_DATA data;
+ DEBUG(DEBUG_ERR,(__location__ " Traverse cancelled by client disconnect for database:0x%08x\n", state->db_id));
r.db_id = state->db_id;
r.reqid = state->reqid;
r.srvid = state->srvid;
return -1;
}
+ if (ctdb_db->unhealthy_reason) {
+ if (ctdb->tunable.allow_unhealthy_db_read == 0) {
+ DEBUG(DEBUG_ERR,("db(%s) unhealty in ctdb_control_traverse_start: %s\n",
+ ctdb_db->db_name, ctdb_db->unhealthy_reason));
+ return -1;
+ }
+ DEBUG(DEBUG_WARNING,("warn: db(%s) unhealty in ctdb_control_traverse_start: %s\n",
+ ctdb_db->db_name, ctdb_db->unhealthy_reason));
+ }
+
state = talloc(client, struct traverse_start_state);
if (state == NULL) {
return -1;