On Sat, Mar 21, 2015 at 10:46 AM, shylesh kumar <shylesh.mo...@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
>
_______________________________________________
ceph-users mailing list
ceph-users@lists.ceph.com
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

Reply via email to