]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
add a new tunable : DeterministicIPs that makes the allocation of
authorRonnie Sahlberg <sahlberg@ronnie>
Tue, 16 Oct 2007 02:15:02 +0000 (12:15 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Tue, 16 Oct 2007 02:15:02 +0000 (12:15 +1000)
public addresses to nodes deterministic.

Activate it by adding CTDB_SET_DeterministicIPs=1 in /etc/sysconfig/ctdb

When this is set,    the first entry in /etc/ctdb/public_addresses will
always be hosted by node 0, when that node is available, the second
entry by node1 and so on.

This tunable allows the allocation of addresses to become very
unbalanced and is only for debugging/testing use.
Beware, this feature requires that /etc/ctdb/public_addresses are
identical on all the nodes in the cluster.

(This used to be ctdb commit f0ca221f235731542090d8a6c86f2b7cd2ce2f96)

ctdb/include/ctdb_private.h
ctdb/server/ctdb_takeover.c
ctdb/server/ctdb_tunables.c

index e834f9631fe3b6f2f04ae99b389b8ddbad241f36..3298106d6298a98a70493faeeb82c9a96b94f978 100644 (file)
@@ -88,6 +88,7 @@ struct ctdb_tunable {
        uint32_t database_hash_size;
        uint32_t rerecovery_timeout;
        uint32_t enable_bans;
+       uint32_t deterministic_public_ips;
 };
 
 /*
index 9986714a17be4b85f129327607b74608e39b4e90..ec3455e4c0489a1c6be7f63c5565702ffbec6c12 100644 (file)
@@ -675,6 +675,17 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap)
        */
        all_ips = create_merged_ip_list(ctdb, tmp_ctx);
 
+       /* If we want deterministic ip allocations, i.e. that the ip addresses
+          will always be allocated the same way for a specific set of
+          available/unavailable nodes.
+       */
+       if (1 == ctdb->tunable.deterministic_public_ips) {              
+               DEBUG(0,("Deterministic IPs enabled. Resetting all ip allocations\n"));
+               for (i=0,tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next,i++) {
+                       tmp_ip->pnn = i%nodemap->num;
+               }
+       }
+
 
        /* mark all public addresses with a masked node as being served by
           node -1
@@ -759,6 +770,13 @@ try_again:
                        continue;
                }
 
+               /* If we want deterministic IPs then dont try to reallocate 
+                  them to spread out the load.
+               */
+               if (1 == ctdb->tunable.deterministic_public_ips) {
+                       continue;
+               }
+
                /* if the spread between the smallest and largest coverage by
                   a node is >=2 we steal one of the ips from the node with
                   most coverage to even things out a bit.
index 7c5aac980070bd7c4910cd7ee54f00e5ec7451fb..da1f6e6ba77a4e1460f537db2ab38505cc28f205 100644 (file)
@@ -44,6 +44,7 @@ static const struct {
        { "DatabaseHashSize", 10000,  offsetof(struct ctdb_tunable, database_hash_size) },
        { "RerecoveryTimeout",   10,  offsetof(struct ctdb_tunable, rerecovery_timeout) },
        { "EnableBans",           1,  offsetof(struct ctdb_tunable, enable_bans) },
+       { "DeterministicIPs",     0,  offsetof(struct ctdb_tunable, deterministic_public_ips) },
 };
 
 /*