mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
Add --valgringing flag instead of --nosetsched
The do_setsched was being tested for whether to mmap tdbs: let's make it explicit. We can also happily move the kill-child eventscript hack under this flag. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 2ee86cc1f311d7b7504c7b14d142b9c4f6f4b469)
This commit is contained in:
parent
640c48c844
commit
f148735928
@ -1683,7 +1683,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name,
|
||||
}
|
||||
|
||||
tdb_flags = persistent?TDB_DEFAULT:TDB_NOSYNC;
|
||||
if (!ctdb->do_setsched) {
|
||||
if (ctdb->valgrinding) {
|
||||
tdb_flags |= TDB_NOMMAP;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ start() {
|
||||
case $init_style in
|
||||
valgrind)
|
||||
valgrind -q --log-file=/var/log/ctdb_valgrind \
|
||||
$ctdbd --nosetsched $CTDB_OPTIONS
|
||||
$ctdbd --valgrinding $CTDB_OPTIONS
|
||||
RETVAL=$?
|
||||
echo
|
||||
;;
|
||||
|
@ -447,6 +447,7 @@ struct ctdb_context {
|
||||
struct ctdb_log_state *log;
|
||||
int start_as_disabled;
|
||||
int start_as_stopped;
|
||||
bool valgrinding;
|
||||
uint32_t event_script_timeouts; /* counting how many consecutive times an eventscript has timedout */
|
||||
uint32_t *recd_ping_count;
|
||||
TALLOC_CTX *release_ips_ctx; /* a context used to automatically drop all IPs if we fail to recover the node */
|
||||
|
@ -248,7 +248,7 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
|
||||
db_name, ctdb->pnn);
|
||||
|
||||
tdb_flags = persistent? TDB_DEFAULT : TDB_CLEAR_IF_FIRST | TDB_NOSYNC;
|
||||
if (!ctdb->do_setsched) {
|
||||
if (ctdb->valgrinding) {
|
||||
tdb_flags |= TDB_NOMMAP;
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1017,7 @@ static struct tdb_wrap *create_recdb(struct ctdb_context *ctdb, TALLOC_CTX *mem_
|
||||
unlink(name);
|
||||
|
||||
tdb_flags = TDB_NOLOCK;
|
||||
if (!ctdb->do_setsched) {
|
||||
if (ctdb->valgrinding) {
|
||||
tdb_flags |= TDB_NOMMAP;
|
||||
}
|
||||
|
||||
|
@ -514,6 +514,7 @@ static int update_tuning_db(struct ctdb_db_context *ctdb_db, struct vacuum_data
|
||||
struct vacuum_tuning_data tdata;
|
||||
struct vacuum_tuning_data *tptr;
|
||||
char *vac_dbname;
|
||||
int flags;
|
||||
|
||||
vac_dbname = talloc_asprintf(tmp_ctx, "%s/%s.%u",
|
||||
ctdb_db->ctdb->db_directory,
|
||||
@ -524,7 +525,8 @@ static int update_tuning_db(struct ctdb_db_context *ctdb_db, struct vacuum_data
|
||||
return -1;
|
||||
}
|
||||
|
||||
tune_tdb = tdb_open(vac_dbname, 0, 0, O_RDWR|O_CREAT, 0644);
|
||||
flags = ctdb_db->ctdb->valgrinding ? TDB_NOMMAP : 0;
|
||||
tune_tdb = tdb_open(vac_dbname, 0, flags, O_RDWR|O_CREAT, 0644);
|
||||
if (tune_tdb == NULL) {
|
||||
DEBUG(DEBUG_ERR,(__location__ " Failed to create/open %s\n", TUNINGDBNAME));
|
||||
talloc_free(tmp_ctx);
|
||||
@ -677,6 +679,7 @@ static int get_vacuum_interval(struct ctdb_db_context *ctdb_db)
|
||||
char *vac_dbname;
|
||||
uint interval = ctdb_db->ctdb->tunable.vacuum_default_interval;
|
||||
struct ctdb_context *ctdb = ctdb_db->ctdb;
|
||||
int flags;
|
||||
|
||||
vac_dbname = talloc_asprintf(tmp_ctx, "%s/%s.%u", ctdb->db_directory, TUNINGDBNAME, ctdb->pnn);
|
||||
if (vac_dbname == NULL) {
|
||||
@ -685,7 +688,8 @@ static int get_vacuum_interval(struct ctdb_db_context *ctdb_db)
|
||||
return interval;
|
||||
}
|
||||
|
||||
tdb = tdb_open(vac_dbname, 0, 0, O_RDWR|O_CREAT, 0644);
|
||||
flags = ctdb_db->ctdb->valgrinding ? TDB_NOMMAP : 0;
|
||||
tdb = tdb_open(vac_dbname, 0, flags, O_RDWR|O_CREAT, 0644);
|
||||
if (!tdb) {
|
||||
DEBUG(DEBUG_ERR,("Unable to open/create database %s using default interval\n", vac_dbname));
|
||||
talloc_free(tmp_ctx);
|
||||
|
@ -41,7 +41,7 @@ static struct {
|
||||
const char *public_interface;
|
||||
const char *single_public_ip;
|
||||
const char *node_ip;
|
||||
int no_setsched;
|
||||
int valgrinding;
|
||||
int use_syslog;
|
||||
int start_as_disabled;
|
||||
int start_as_stopped;
|
||||
@ -127,7 +127,7 @@ int main(int argc, const char *argv[])
|
||||
{ "dbdir", 0, POPT_ARG_STRING, &options.db_dir, 0, "directory for the tdb files", NULL },
|
||||
{ "dbdir-persistent", 0, POPT_ARG_STRING, &options.db_dir_persistent, 0, "directory for persistent tdb files", NULL },
|
||||
{ "reclock", 0, POPT_ARG_STRING, &options.recovery_lock_file, 0, "location of recovery lock file", "filename" },
|
||||
{ "nosetsched", 0, POPT_ARG_NONE, &options.no_setsched, 0, "disable setscheduler SCHED_FIFO call", NULL },
|
||||
{ "valgrinding", 0, POPT_ARG_NONE, &options.valgrinding, 0, "disable setscheduler SCHED_FIFO call, use mmap for tdbs", NULL },
|
||||
{ "syslog", 0, POPT_ARG_NONE, &options.use_syslog, 0, "log messages to syslog", NULL },
|
||||
{ "start-as-disabled", 0, POPT_ARG_NONE, &options.start_as_disabled, 0, "Node starts in disabled state", NULL },
|
||||
{ "start-as-stopped", 0, POPT_ARG_NONE, &options.start_as_stopped, 0, "Node starts in stopped state", NULL },
|
||||
@ -311,7 +311,8 @@ int main(int argc, const char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
ctdb->do_setsched = !options.no_setsched;
|
||||
ctdb->valgrinding = options.valgrinding;
|
||||
ctdb->do_setsched = !ctdb->valgrinding;
|
||||
|
||||
ctdb->do_checkpublicip = !options.no_publicipcheck;
|
||||
|
||||
|
@ -452,7 +452,10 @@ static void ctdb_event_script_handler(struct event_context *ev, struct fd_event
|
||||
|
||||
/* valgrind gets overloaded if we run next script as it's still doing
|
||||
* post-execution analysis, so kill finished child here. */
|
||||
kill(state->child, SIGKILL);
|
||||
if (ctdb->valgrinding) {
|
||||
kill(state->child, SIGKILL);
|
||||
}
|
||||
|
||||
state->child = 0;
|
||||
|
||||
/* Aborted or finished all scripts? We're done. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user