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

ctdb-config: Switch tunable TDBMutexEnabled to a config option

Use the "database:tdb mutexes" option instead.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2018-08-20 15:01:50 +10:00 committed by Amitay Isaacs
parent 8ddfc26d79
commit f42486e891
13 changed files with 52 additions and 20 deletions

View File

@ -145,7 +145,7 @@ static struct {
offsetof(struct ctdb_tunable_list, no_ip_host_on_all_disabled) },
{ "Samba3AvoidDeadlocks", 0, true,
offsetof(struct ctdb_tunable_list, samba3_hack) },
{ "TDBMutexEnabled", 1, false,
{ "TDBMutexEnabled", 1, true,
offsetof(struct ctdb_tunable_list, mutex_enabled) },
{ "LockProcessesPerDB", 200, false,
offsetof(struct ctdb_tunable_list, lock_processes_per_db) },

View File

@ -54,6 +54,22 @@ static bool check_static_string_change(const char *key,
return true;
}
static bool check_static_boolean_change(const char *key,
bool old_value,
bool new_value,
enum conf_update_mode mode)
{
if (mode == CONF_MODE_RELOAD || CONF_MODE_API) {
if (old_value != new_value) {
D_WARNING("Ignoring update of [%s] -> %s\n",
DATABASE_CONF_SECTION,
key);
}
}
return true;
}
static bool database_conf_validate_lock_debug_script(const char *key,
const char *old_script,
const char *new_script,
@ -141,4 +157,9 @@ void database_conf_init(struct conf_context *conf)
DATABASE_CONF_LOCK_DEBUG_SCRIPT,
NULL,
database_conf_validate_lock_debug_script);
conf_define_boolean(conf,
DATABASE_CONF_SECTION,
DATABASE_CONF_TDB_MUTEXES,
true,
check_static_boolean_change);
}

View File

@ -27,7 +27,8 @@
#define DATABASE_CONF_VOLATILE_DB_DIR "volatile database directory"
#define DATABASE_CONF_PERSISTENT_DB_DIR "persistent database directory"
#define DATABASE_CONF_STATE_DB_DIR "state database directory"
#define DATABASE_CONF_LOCK_DEBUG_SCRIPT "lock debug script"
#define DATABASE_CONF_LOCK_DEBUG_SCRIPT "lock debug script"
#define DATABASE_CONF_TDB_MUTEXES "tdb mutexes"
void database_conf_init(struct conf_context *conf);

View File

@ -660,17 +660,6 @@ MonitorInterval=20
</para>
</refsect2>
<refsect2>
<title>TDBMutexEnabled</title>
<para>Default: 1</para>
<para>
This parameter enables TDB_MUTEX_LOCKING feature on volatile
databases if the robust mutexes are supported. This optimizes the
record locking using robust mutexes and is much more efficient
that using posix locks.
</para>
</refsect2>
<refsect2>
<title>TickleUpdateInterval</title>
<para>Default: 20</para>

View File

@ -828,7 +828,6 @@ DBRecordCountWarn = 100000
DBRecordSizeWarn = 10000000
DBSizeWarn = 100000000
PullDBPreallocation = 10485760
TDBMutexEnabled = 1
LockProcessesPerDB = 200
RecBufferSizeLimit = 1000000
QueueBufferSize = 1024

View File

@ -304,6 +304,23 @@
</listitem>
</varlistentry>
<varlistentry>
<term>tdb mutexes = true|false</term>
<listitem>
<para>
This parameter enables TDB_MUTEX_LOCKING feature on
volatile databases if the robust mutexes are
supported. This optimizes the record locking using robust
mutexes and is much more efficient that using posix locks.
</para>
<para>
If robust mutexes are unreliable on the platform being
used then they can be disabled by setting this to
<literal>false</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>lock debug script = <parameter>FILENAME</parameter></term>
<listitem>

View File

@ -73,6 +73,10 @@ static void setup_config_pointers(struct conf_context *conf)
DATABASE_CONF_SECTION,
DATABASE_CONF_LOCK_DEBUG_SCRIPT,
&ctdb_config.lock_debug_script);
conf_assign_boolean_pointer(conf,
DATABASE_CONF_SECTION,
DATABASE_CONF_TDB_MUTEXES,
&ctdb_config.tdb_mutexes);
/*
* Event

View File

@ -33,6 +33,7 @@ struct ctdb_config {
const char *dbdir_persistent;
const char *dbdir_state;
const char *lock_debug_script;
bool tdb_mutexes;
/* Event */
const char *event_debug_script;

View File

@ -41,6 +41,8 @@
#include "common/common.h"
#include "common/logging.h"
#include "server/ctdb_config.h"
#define PERSISTENT_HEALTH_TDB "persistent_health.tdb"
/**
@ -846,8 +848,9 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name,
ctdb->db_directory,
db_name, ctdb->pnn);
tdb_flags = ctdb_db_tdb_flags(db_flags, ctdb->valgrinding,
ctdb->tunable.mutex_enabled);
tdb_flags = ctdb_db_tdb_flags(db_flags,
ctdb->valgrinding,
ctdb_config.tdb_mutexes);
again:
ctdb_db->ltdb = tdb_wrap_open(ctdb_db, ctdb_db->db_path,

View File

@ -40,6 +40,7 @@ ok <<EOF
# persistent database directory = ${database_persistent_dbdir}
# state database directory = ${database_state_dbdir}
# lock debug script =
# tdb mutexes = true
[event]
# debug script =
[legacy]

View File

@ -8,12 +8,10 @@ setup
setup_tunable_config <<EOF
MonitorInterval=5
TDBMutexEnabled=0
EOF
required_result 0 <<EOF
Set MonitorInterval to 5
Set TDBMutexEnabled to 0
EOF
simple_test

View File

@ -8,7 +8,6 @@ setup ()
export FAKE_CTDB_TUNABLES_OK="
MonitorInterval
TDBMutexEnabled
DatabaseHashSize
"
export FAKE_CTDB_TUNABLES_OBSOLETE="

View File

@ -58,7 +58,6 @@ DBRecordCountWarn = 100000
DBRecordSizeWarn = 10000000
DBSizeWarn = 100000000
PullDBPreallocation = 10485760
TDBMutexEnabled = 1
LockProcessesPerDB = 200
RecBufferSizeLimit = 1000000
QueueBufferSize = 1024