MXS-1777 Turn server weights to their inverses, and make them doubles.

The math becomes simpler when the weight is inverted, i.e. a simple multiplication
to get the (inverse) score. Inverse weights are normalized to the range [0..1] where a lower
number is a higher weight,
The enum select_criteria_t is used to provide a std::function that takes the backends
as vector  (rather than the prior pairwise compares) and returns the best backend.
This commit is contained in:
Niclas Antti
2018-08-28 11:01:11 +03:00
parent 105bd7195f
commit 91acbc0994
7 changed files with 278 additions and 289 deletions

View File

@ -307,7 +307,7 @@ void RWSplit::diagnostics(DCB *dcb)
for (SERVER_REF *ref = service()->dbref; ref; ref = ref->next)
{
dcb_printf(dcb, "\t\t%-20s %3.1f%% %-6d %-6d %d\n",
ref->server->name, (float)ref->weight / 10,
ref->server->name, (1.0 - ref->inv_weight) * 100,
ref->server->stats.n_current, ref->connections,
ref->server->stats.n_current_ops);
}