]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
crush: fix name map encoding
authorSage Weil <sage@inktank.com>
Sat, 21 Jul 2012 16:15:06 +0000 (09:15 -0700)
committerSage Weil <sage@inktank.com>
Sat, 21 Jul 2012 16:15:06 +0000 (09:15 -0700)
commit2d7e2cbf264c5aab196918e6deae547636efa668
treeed7e79782f168cd246a29495606adc17bc1325d4
parentb497bdacf5d5732285d280772ab9ce6ae88f59e8
crush: fix name map encoding

We screwed up and encoded using the name 'int' type instead of int32_t.
That means people have systems encoding this as both 32 and 64 bit,
depending on their architecture.  This could be worse: x86_64 still has a
32-bit int (at least in my environment).

In any case, mixing both word sizes in their clusters is broken as a
result, with the exception of the kernel code, which doesn't decode this
part of the map and will tolerate differently-sized servers.

Fix this by:

 * encoding using int32_t now
 * decoding either 32-bit or 64-bit values, by assuming that the strings
   will always be non-empty.  This appears to be the case.

However:

 * any cluster with 64-bit ints must upgrade all at once, or else the new
   code will start encoding 32-bit values and the old code will be
   confused.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/crush/CrushWrapper.cc
src/crush/CrushWrapper.h