dCache/dcache — pull request #499 by gbehrmann (2014-04-22 08:31:31+00:00)
Title: poolmanager,pool: Fix precision underflow in WASS

Fixes a problem in which a large number of writers on a pool (such as what you
would see on a tape read pool) would cause the scale of a double to underflow,
causing the weigthed acailable space to become zero. If all pools have such
high load, no pool would be availble for selection and pool manager would
report that no pool is available for staging.

The fix uses the fact that only the relative weighted available space is
relevant. Since the weighted space is calculated by dividing unweighted space
with two to the power of the load, we can subtract a constant from the load of
all pools and maintain the relative available space of each pool. The patch
first finds the lowest load of all non-full pools in the selection and
subtracts that from the load of all pools, thus normalizing the calculation.

Other pools may have even high load, still causing the precision of a double to
be insufficient, however the likelihood of selection such a pool is virtuallt
zero anyway, so this barely affects the write distribution. The normalization
does however ensure that at least one pool does not underflow (assuming
non-full pools exist at all) and thus that a pool can be selected.

Target: trunk
Request: 2.9
Request: 2.8
Request: 2.7
Request: 2.6
Acked-by: Dmitry Litvtinsev
Acked-by: Tigran Mkrtchyan
Ticket: http://rt.dcache.org/Ticket/Display.html?id=7993
(cherry picked from commit 80ade65b1a6399b443512fc5c12f929c276eb630)