Hi, As you noticed, there are places where ruleset and ruleno / ruleid are used interchangeably although they are not. This is a source of subtle bugs that can be hard to trace. By default ruleid and ruleset are the same, but dumping a crush map including
rule data {
ruleset 0
type replicated
min_size 1
max_size 10
step take default
step chooseleaf firstn 0 type host
step emit
}
rule metadata {
ruleset 1
type replicated
min_size 1
max_size 10
step take default
step chooseleaf firstn 0 type host
step emit
}
and swapping the rules as follows
rule metadata {
ruleset 1
type replicated
min_size 1
max_size 10
step take default
step chooseleaf firstn 0 type host
step emit
}
rule data {
ruleset 0
type replicated
min_size 1
max_size 10
step take default
step chooseleaf firstn 0 type host
step emit
}
will have ruleset 1 with rule id 0 and ruleset 0 with rule id 1
Since the ruleset is the only reliable number, from the user point of view, we
could simply change CrushWrapper.h to never return the rule id and assume only
ruleset are given in argument, even where it currently claims to be a rule id.
The downside is that looking up the ruleset implies iterating over all the
rules, but that's probably not an issue.
What do you think ?
Cheers
--
Loïc Dachary, Artisan Logiciel Libre
signature.asc
Description: OpenPGP digital signature
