]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
crush: fix crush_calc_straw() scalers when there are duplicate weights
authorSage Weil <sage@redhat.com>
Wed, 3 Dec 2014 00:33:11 +0000 (16:33 -0800)
committerSage Weil <sage@redhat.com>
Fri, 13 Feb 2015 16:30:45 +0000 (08:30 -0800)
commit884414c5788bac9a269f01b26cbc0c55850c34f6
tree0410295b0186c5d76cee46dc7761aa7a94d83cdd
parentbf677093302f475a23de541471ddde6a7c7153b6
crush: fix crush_calc_straw() scalers when there are duplicate weights

The straw bucket was originally tested with uniform weights and with a
few more complicated patterns, like a stair step (1,2,3,4,5,6,7,8,9).  And
it worked!

However, it does not behave with a pattern like
 1, 2, 2, 3, 3, 4, 4

Strangely, it does behave with
 1, 1, 2, 2, 3, 3, 4, 4

and more usefully it does behave with
 1, 2, 2.001, 3, 3.001, 4, 4.001

That is, the logic that explicitly copes with weights that are duplicates
is broken.

The fix is to simply remove the special handling for duplicate weights --
it isn't necessary and doesn't work correctly anyway.

Add a test that compares the mapping result of  [1, 2, 2, 3, 3, ...] with
[1, 2, 2.001, 3, 3.001, ...] and verifies that the difference is small.
With the fix, we get .00012, whereas the original implementation gets
.015.

Note that this changes the straw bucket scalar *precalculated* values that
are encoded with the map, and only when the admin opts into the new behavior.

Backport: giant, firefly
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 43d5c7caa7ce478477bde1bbd4f0649b5159cdcf)
src/crush/CrushWrapper.h
src/crush/builder.c
src/test/crush/TestCrushWrapper.cc