r20896: make the maximum lacount configurable in smb.conf
authorAndrew Tridgell <tridge@samba.org>
Fri, 19 Jan 2007 04:32:04 +0000 (04:32 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:43:48 +0000 (14:43 -0500)
at the moment the brlock_ctdb backend will sometimes fail after
dmaster migrations. So to pass tests this needs to be set high. Thats
a priority to fix.
(This used to be commit 45f5c272f366f6a793941d97c9522c5b2b0cb639)

source4/cluster/ctdb/common/ctdb.c
source4/cluster/ctdb/common/ctdb_call.c
source4/cluster/ctdb/ctdb_cluster.c
source4/cluster/ctdb/include/ctdb.h
source4/cluster/ctdb/include/ctdb_private.h

index ad0345b3c716577d938984646defad3d1c16e251..dd9a6db770c0fcbf88332335483c772c914f1ae2 100644 (file)
@@ -48,6 +48,13 @@ void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags)
        ctdb->flags |= flags;
 }
 
+/*
+  set max acess count before a dmaster migration
+*/
+void ctdb_set_max_lacount(struct ctdb_context *ctdb, unsigned count)
+{
+       ctdb->max_lacount = count;
+}
 
 /*
   add a node to the list of active nodes
@@ -281,6 +288,7 @@ struct ctdb_context *ctdb_init(struct event_context *ev)
        ctdb->ev = ev;
        ctdb->upcalls = &ctdb_upcalls;
        ctdb->idr = idr_init(ctdb);
+       ctdb->max_lacount = CTDB_DEFAULT_MAX_LACOUNT;
 
        return ctdb;
 }
index 2bedccc86a8cfa4c95d8fbd54a65b08a8a7a8439..5c0a00c6e953f1da34a6773a3733a76afb1fb42b 100644 (file)
@@ -345,7 +345,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
        /* if this nodes has done enough consecutive calls on the same record
           then give them the record */
        if (header.laccessor == c->hdr.srcnode &&
-           header.lacount >= CTDB_MAX_LACOUNT) {
+           header.lacount >= ctdb->max_lacount) {
                ctdb_call_send_dmaster(ctdb, c, &header, &key, &data);
                talloc_free(data.dptr);
                return;
index 49a61ff4947e5bea0e7310e28a300301567d6ce9..183d5c18313e91a9b509034e67378b497c9241e3 100644 (file)
@@ -68,7 +68,7 @@ void cluster_ctdb_init(struct event_context *ev)
        const char *address;
        const char *transport;
        struct cluster_state *state;
-       int ret;
+       int ret, lacount;
 
        nlist = lp_parm_string(-1, "ctdb", "nlist");
        if (nlist == NULL) return;
@@ -101,6 +101,11 @@ void cluster_ctdb_init(struct event_context *ev)
                ctdb_set_flags(state->ctdb, CTDB_FLAG_SELF_CONNECT);
        }
 
+       lacount = lp_parm_int(-1, "ctdb", "maxlacount", -1);
+       if (lacount != -1) {
+               ctdb_set_max_lacount(state->ctdb, lacount);
+       }
+
        /* tell ctdb what address to listen on */
         ret = ctdb_set_address(state->ctdb, address);
         if (ret == -1) {
index 21b9b5d1ceb205de973896a4ed06dc3d8c4f8144..f2f4bcef84da83e82106002bcf4683cafdeaec6c 100644 (file)
@@ -58,6 +58,11 @@ int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport);
 */
 void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags);
 
+/*
+  set max acess count before a dmaster migration
+*/
+void ctdb_set_max_lacount(struct ctdb_context *ctdb, unsigned count);
+
 /*
   tell ctdb what address to listen on, in transport specific format
 */
index d373e3af32587a00fe3931d79c4f26cd69a2ad5d..89643eff0f91249ae4d4803253ee4a6aa56c66d1 100644 (file)
@@ -93,6 +93,7 @@ struct ctdb_context {
        const struct ctdb_methods *methods; /* transport methods */
        const struct ctdb_upcalls *upcalls; /* transport upcalls */
        void *private; /* private to transport */
+       unsigned max_lacount;
 };
 
 #define CTDB_NO_MEMORY(ctdb, p) do { if (!(p)) { \
@@ -115,7 +116,7 @@ struct ctdb_context {
 
 /* number of consecutive calls from the same node before we give them
    the record */
-#define CTDB_MAX_LACOUNT 7000
+#define CTDB_DEFAULT_MAX_LACOUNT 7
 
 /*
   the extended header for records in the ltdb