All of lore.kernel.org
 help / color / mirror / Atom feed
From: Loic Dachary <loic@dachary.org>
To: Ma Jianpeng <majianpeng@gmail.com>,
	"Chen, Xiaoxi" <xiaoxi.chen@intel.com>
Cc: Ceph Development <ceph-devel@vger.kernel.org>
Subject: Resolving the ruleno / ruleset confusion
Date: Fri, 08 Aug 2014 15:38:13 +0200	[thread overview]
Message-ID: <53E4D2C5.8050600@dachary.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1579 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

             reply	other threads:[~2014-08-08 13:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 13:38 Loic Dachary [this message]
2014-08-08 14:12 ` Resolving the ruleno / ruleset confusion Sage Weil
2014-08-08 14:34   ` Loic Dachary
2014-08-08 14:54     ` Chen, Xiaoxi
2014-08-08 15:10       ` Loic Dachary
2014-08-08 15:35         ` Chen, Xiaoxi
2014-08-08 16:08           ` Sage Weil
2014-08-08 16:48             ` Chen, Xiaoxi
2014-08-08 17:30               ` Sage Weil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53E4D2C5.8050600@dachary.org \
    --to=loic@dachary.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=majianpeng@gmail.com \
    --cc=xiaoxi.chen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.