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:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user