All of lore.kernel.org
 help / color / mirror / Atom feed
* How does crush selects different osds using hash(pg) in diferent iterations
@ 2015-03-21 17:46 shylesh kumar
  2015-03-23 14:09 ` [ceph-users] " Gregory Farnum
  0 siblings, 1 reply; 2+ messages in thread
From: shylesh kumar @ 2015-03-21 17:46 UTC (permalink / raw)
  To: ceph-devel-u79uwXL29TY76Z2rM5mHXA, ceph-users-idqoXFIVOFJgJs9I8MT0rw


[-- Attachment #1.1: Type: text/plain, Size: 851 bytes --]

Hi ,

I was going through this simplified crush algorithm given in ceph website.

def crush(pg):
   all_osds = ['osd.0', 'osd.1', 'osd.2', ...]
   result = []
   # size is the number of copies; primary+replicas
   while len(result) < size:
   --> *r = hash(pg)*
       chosen = all_osds[ r % len(all_osds) ]
       if chosen in result:
           # OSD can be picked only once
           continue
       result.append(chosen)
   return result

10:24 PM (51 minutes ago)
In the line where *r = hash(pg)* , will it gives the same hash value in
every iteration ?
if that is the case we always endup choosing the same osd from the list
or will the pg number be used as seed for the hashing so that r value
changes in the next iteration.

Am I missing something really basic ??
Can somebody please provide me some pointers ?



-- 
Thanks,
Shylesh Kumar M

[-- Attachment #1.2: Type: text/html, Size: 2262 bytes --]

[-- Attachment #2: Type: text/plain, Size: 178 bytes --]

_______________________________________________
ceph-users mailing list
ceph-users-idqoXFIVOFJgJs9I8MT0rw@public.gmane.org
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ceph-users] How does crush selects different osds using hash(pg) in diferent iterations
  2015-03-21 17:46 How does crush selects different osds using hash(pg) in diferent iterations shylesh kumar
@ 2015-03-23 14:09 ` Gregory Farnum
  0 siblings, 0 replies; 2+ messages in thread
From: Gregory Farnum @ 2015-03-23 14:09 UTC (permalink / raw)
  To: shylesh kumar; +Cc: ceph-devel, ceph-users

On Sat, Mar 21, 2015 at 10:46 AM, shylesh kumar <shylesh.mohan@gmail.com> wrote:
> Hi ,
>
> I was going through this simplified crush algorithm given in ceph website.
>
> def crush(pg):
>    all_osds = ['osd.0', 'osd.1', 'osd.2', ...]
>    result = []
>    # size is the number of copies; primary+replicas
>    while len(result) < size:
>    --> r = hash(pg)
>        chosen = all_osds[ r % len(all_osds) ]
>        if chosen in result:
>            # OSD can be picked only once
>            continue
>        result.append(chosen)
>    return result
>
> 10:24 PM (51 minutes ago)
> In the line where r = hash(pg) , will it gives the same hash value in every
> iteration ?
> if that is the case we always endup choosing the same osd from the list
> or will the pg number be used as seed for the hashing so that r value
> changes in the next iteration.
>
> Am I missing something really basic ??
> Can somebody please provide me some pointers ?

I'm not sure where this bit of documentation came from, but the
selection process includes the "attempt" number as one of the inputs.
Where the attempt starts at 0 (or 1, I dunno) and increments each time
we try to map a new OSD to the PG.
-Greg

>
>
>
> --
> Thanks,
> Shylesh Kumar M
>
>
> _______________________________________________
> ceph-users mailing list
> ceph-users@lists.ceph.com
> http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-23 14:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-21 17:46 How does crush selects different osds using hash(pg) in diferent iterations shylesh kumar
2015-03-23 14:09 ` [ceph-users] " Gregory Farnum

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.