ctdb-locking: Add new tunable LockProcessesPerDB
authorAmitay Isaacs <amitay@gmail.com>
Tue, 15 Jul 2014 02:13:53 +0000 (12:13 +1000)
committerVolker Lendecke <vl@samba.org>
Mon, 4 Aug 2014 15:59:52 +0000 (17:59 +0200)
This allows to change the maximum number of lock processes that can
be active.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
ctdb/include/ctdb_private.h
ctdb/server/ctdb_lock.c
ctdb/server/ctdb_tunables.c

index e94d2c84f67b01a5013786f68c9427a67a7fe51f..459e96d4ea018c2251bf0a2c5a0d719cef64f700 100644 (file)
@@ -127,6 +127,7 @@ struct ctdb_tunable {
        uint32_t no_ip_host_on_all_disabled;
        uint32_t samba3_hack;
        uint32_t mutex_enabled;
+       uint32_t lock_processes_per_db;
 };
 
 /*
index 4cdad18e500f9802366d19dd13aff85886cce508..3de85188b5086fc55d84e99211e5b9604ed0c4dd 100644 (file)
@@ -43,9 +43,6 @@
  *  auto_mark              - whether to mark/unmark DBs in before/after callback
  */
 
-/* FIXME: Add a tunable max_lock_processes_per_db */
-#define MAX_LOCK_PROCESSES_PER_DB              (100)
-
 enum lock_type {
        LOCK_RECORD,
        LOCK_DB,
@@ -700,7 +697,7 @@ static void ctdb_lock_schedule(struct ctdb_context *ctdb)
                        talloc_free(lock_ctx);
                } else {
                        if (lock_ctx->ctdb_db == NULL ||
-                           lock_ctx->ctdb_db->lock_num_current < MAX_LOCK_PROCESSES_PER_DB) {
+                           lock_ctx->ctdb_db->lock_num_current < ctdb->tunable.lock_processes_per_db) {
                                /* Found a lock context with lock requests */
                                break;
                        }
index 4a252b61adadc9656b72f427c0090f52c3827d82..38e0bb2a63e8137a43cecfb1709738d426842199 100644 (file)
@@ -83,6 +83,7 @@ static const struct {
        { "NoIPHostOnAllDisabled",    0,  offsetof(struct ctdb_tunable, no_ip_host_on_all_disabled), false },
        { "Samba3AvoidDeadlocks", 0, offsetof(struct ctdb_tunable, samba3_hack), false },
        { "TDBMutexEnabled", 0, offsetof(struct ctdb_tunable, mutex_enabled), false },
+       { "LockProcessesPerDB", 100, offsetof(struct ctdb_tunable, lock_processes_per_db), false },
 };
 
 /*