mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
add a new tunable : DeterministicIPs that makes the allocation of
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)
This commit is contained in:
parent
25d3a031d0
commit
056aac6e0c
@ -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;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -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.
|
||||
|
@ -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) },
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user