1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

READONLY: only send a control to schedule fast-vacuuming from child context iff we have a connection open to the main daemon

there are some child processes where we do not create a connection to the main daemon (switch_from_server_to_client()) because it is expensive to set up and we normally might not need to talk to the daemon at all via a domainsocket.
but we might want to still call to ctdb_ltdb_store() from such chil processes.

(This used to be ctdb commit 9e372a08c40087e6b5335aa298e94d88273566a5)
This commit is contained in:
Ronnie Sahlberg 2012-02-21 07:03:44 +11:00
parent cdc232f2dd
commit 42e477b14e
4 changed files with 16 additions and 2 deletions

View File

@ -4123,7 +4123,9 @@ int switch_from_server_to_client(struct ctdb_context *ctdb, const char *fmt, ...
return -1;
}
return 0;
ctdb->can_send_controls = true;
return 0;
}
/*

View File

@ -346,6 +346,7 @@ pid_t ctdb_fork(struct ctdb_context *ctdb)
if (ctdb->do_setsched) {
ctdb_restore_scheduler(ctdb);
}
ctdb->can_send_controls = false;
}
return pid;
}

View File

@ -483,6 +483,9 @@ struct ctdb_context {
/* Used to defer db attach requests while in recovery mode */
struct ctdb_deferred_attach_context *deferred_attach;
/* if we are a child process, do we have a domain socket to send controls on */
bool can_send_controls;
};
struct ctdb_db_context {

View File

@ -1560,8 +1560,16 @@ int32_t ctdb_local_schedule_for_deletion(struct ctdb_db_context *ctdb_db,
return ret;
}
/* child process: send the main daemon a control */
/* if we dont have a connection to the daemon we can not send
a control. For example sometimes from update_record control child
process.
*/
if (!ctdb_db->ctdb->can_send_controls) {
return -1;
}
/* child process: send the main daemon a control */
indata.dsize = offsetof(struct ctdb_control_schedule_for_deletion, key) + key.dsize;
indata.dptr = talloc_zero_array(ctdb_db, uint8_t, indata.dsize);
if (indata.dptr == NULL) {