I actually start to wonder even using key/value (email_address as the key) to query the record(during registration), will it be still possibility that the two request is too close(client fired 2 sequential requests) and the second will still find no registration of the user because the 1st request is not quick enough to finish saving. After all, Riak saving a record is eventual consistency right? ( or is key save fast enough to ignore?)

Thanks,

-Hao

On 09/05/2015 04:28 AM, Dmitri Zagidulin wrote:
I second what Luke said.

Definitely use Key/Value operations for this case (the users-by-email bucket), which is a One-to-One relationship. Don't use Search or Secondary Indexes.

On Fri, Sep 4, 2015 at 9:18 AM, Luke Bakken <lbak...@basho.com <mailto:lbak...@basho.com>> wrote:

    Use another bucket, keyed by email, with the users generated ID as
    the value:

    Bucket/key: buckets/users-by-email/bob.bar...@gmail.com
    <mailto:bob.bar...@gmail.com>
    Value: Riak generated ID

    There are, I am sure, race conditions and eventual consistency issues
    to keep in mind, but it's good to remember that you can use key/value
    operations in this manner.

    --
    Luke Bakken
    Engineer
    lbak...@basho.com <mailto:lbak...@basho.com>

    On Fri, Sep 4, 2015 at 3:04 AM, Hao <jusf...@163.com
    <mailto:jusf...@163.com>> wrote:
    > Take registration for example, within 1 second, how could I find
    out the
    > same user already registered in the database? Suppose the email
    address is
    > the ID but is not the key. KEY is generated guid.
    >
    > (I have been suggested to use the email address as the key. But
    it's a big
    > change. I just want to make sure that there is really no other way)
    >
    > Thanks,
    >
    > --
    > Hao

    _______________________________________________
    riak-users mailing list
    riak-users@lists.basho.com <mailto:riak-users@lists.basho.com>
    http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com



--
Hao

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to