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,
- TUNINGDBNAME, ctdb_db->ctdb->pnn);
+ ctdb_db->ctdb->db_directory_state,
+ TUNINGDBNAME, ctdb_db->ctdb->pnn);
if (vac_dbname == NULL) {
DEBUG(DEBUG_CRIT,(__location__ " Out of memory error while allocating '%s'\n", vac_dbname));
talloc_free(tmp_ctx);
return -1;
}
+ flags = ctdb_db->ctdb->valgrinding ? TDB_NOMMAP : 0;
+ flags |= TDB_DISALLOW_NESTING;
tune_tdb = tdb_open(vac_dbname, 0,
- TDB_DISALLOW_NESTING,
- O_RDWR|O_CREAT, 0644);
+ flags,
+ O_RDWR|O_CREAT, 0600);
if (tune_tdb == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Failed to create/open %s\n", TUNINGDBNAME));
talloc_free(tmp_ctx);
tdata.new_interval > ctdb_db->ctdb->tunable.vacuum_max_interval) {
tdata.new_interval = ctdb_db->ctdb->tunable.vacuum_min_interval;
}
- DEBUG(DEBUG_ERR,("Decreasing vacuum interval %u -> %u for %s\n",
+ DEBUG(DEBUG_INFO,("Decreasing vacuum interval %u -> %u for %s\n",
tdata.last_interval, tdata.new_interval, ctdb_db->db_name));
}
tdata.last_interval = tdata.new_interval;
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) {
return interval;
}
+ flags = ctdb_db->ctdb->valgrinding ? TDB_NOMMAP : 0;
+ flags |= TDB_DISALLOW_NESTING;
tdb = tdb_open(vac_dbname, 0,
- TDB_DISALLOW_NESTING,
- O_RDWR|O_CREAT, 0644);
+ flags,
+ O_RDWR|O_CREAT, 0600);
if (!tdb) {
DEBUG(DEBUG_ERR,("Unable to open/create database %s using default interval\n", vac_dbname));
talloc_free(tmp_ctx);
DEBUG(DEBUG_INFO,("Vacuuming child process %d for db %s started\n", getpid(), ctdb_db->db_name));
- if (switch_from_server_to_client(ctdb) != 0) {
+ if (switch_from_server_to_client(ctdb, "vacuum-%s", ctdb_db->db_name) != 0) {
DEBUG(DEBUG_CRIT, (__location__ "ERROR: failed to switch vacuum daemon into client mode. Shutting down.\n"));
_exit(1);
}
timeval_current_ofs(ctdb->tunable.vacuum_max_run_time, 0),
vacuum_child_timeout, child_ctx);
- DEBUG(DEBUG_INFO, (__location__ " Created PIPE FD:%d to child vacuum process\n", child_ctx->fd[0]));
+ DEBUG(DEBUG_DEBUG, (__location__ " Created PIPE FD:%d to child vacuum process\n", child_ctx->fd[0]));
event_add_fd(ctdb->ev, child_ctx, child_ctx->fd[0],
EVENT_FD_READ|EVENT_FD_AUTOCLOSE,