Re: Continuous HTTP POSTs to Riak

2016-03-06 Thread Vitaly E
Hi Qiang,

You mentioned that my suggestion to synchronize the clocks of your Riak
nodes had solved the problem. Let me explain why -- it may clear things up
for you.

Riak uses vector clocks / version vectors

to keep track of the sequence of updates to a particular key. These are
"logical clocks" as opposed to physical clocks that usually can't be relied
upon in a distributed system like Riak. Fetching the vector clock of a key
and passing it back on write (along with a new value), helps Riak decide
which modification is the "latest" one. Keep in mind that "concurrent
modification" does not necessary means simultaneous, but can happen due to
a network partition, for example.

Normally, when a concurrent update is detected (based on vector clocks),
Riak returns siblings and lets a client decide which version should be
used. Since you're running with allow_mult = false, you've actually told
Riak to resolve conflicts for you. In this case Riak still uses vector
clocks when possible, and then time-stamps if there's still a conflict.
Obviously, if you don't pass vector clocks, only time-stamps will be used.
Moreover, without vector clocks any update is considered concurrent, Riak
just doesn't expose it with allow_mult = false (remember, you opted for
automatic conflict resolution?).

Keep in mind that a time-stamp is assigned by the first Riak node a request
hits. The node then forwards the request based on the key this request is
trying to write
.

Now, imagine that a write to a key passes through node X, and within 30 sec
another update to the same key passes through node Y, which is 2 min behind
node X. Since time-stamps are being used to resolve conflicts, the second
update will be considered older than the first one, and eventually
discarded.

So, if this kind of conflict resolution is good enough for you, make sure
your Riak's clocks are in sync (NTP?). I would also suggest to pass vector
clocks anyway.

Hope this helps. Everyone is welcome to correct/clarify.

Vitaly


On Mar 5, 2016 11:07 PM, "Qiang Cao"  wrote:

> Thanks, Russell. I'm just curious. My application handles that. Maybe
> that's just because of the vclock.
>
> -Qiang
>
> On Sat, Mar 5, 2016 at 2:09 PM, Russell Brown 
> wrote:
>
>> And you pass the vclock back after a GET with the next POST? Unless we
>> get a look at the vclocks then it's hard to say why or where you have
>> concurrency. But since concurrency is ultimately unavoidable using riak,
>> why the concern? Can your application/data model handle it is the main
>> question?
>>
>>
>> On 5 Mar 2016, at 19:04, Qiang Cao  wrote:
>>
>> Thanks, Russell! I do a GET immediately after a POST is done. I use
>> apache httpclient, which handles requests synchronously. On the client,
>> POSTs and GETs are sent out sequentially.
>>
>> On Sat, Mar 5, 2016 at 1:57 PM, Russell Brown 
>> wrote:
>>
>>>
>>> On 5 Mar 2016, at 18:43, Qiang Cao  wrote:
>>>
>>> > Just curious. The POSTs are sent out sequentially and a quorum is set
>>> up on Riak. I wonder how would it happen that Riak still considers the POST
>>> requests concurrent?
>>> Did you read the result of POST 1 before sending POST 2? If not, and you
>>> don’t send the causal context, Riak has to view them as concurrent.
>>>
>>> How does the quorum work here?
>>
>> Thanks,
>> Qiang
>>
>> ___
>> riak-users mailing list
>> riak-users@lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>>
>
> ___
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Continuous HTTP POSTs to Riak

2016-03-05 Thread Qiang Cao
Thanks, Russell. I'm just curious. My application handles that. Maybe
that's just because of the vclock.

-Qiang

On Sat, Mar 5, 2016 at 2:09 PM, Russell Brown  wrote:

> And you pass the vclock back after a GET with the next POST? Unless we get
> a look at the vclocks then it's hard to say why or where you have
> concurrency. But since concurrency is ultimately unavoidable using riak,
> why the concern? Can your application/data model handle it is the main
> question?
>
>
> On 5 Mar 2016, at 19:04, Qiang Cao  wrote:
>
> Thanks, Russell! I do a GET immediately after a POST is done. I use apache
> httpclient, which handles requests synchronously. On the client, POSTs and
> GETs are sent out sequentially.
>
> On Sat, Mar 5, 2016 at 1:57 PM, Russell Brown 
> wrote:
>
>>
>> On 5 Mar 2016, at 18:43, Qiang Cao  wrote:
>>
>> > Just curious. The POSTs are sent out sequentially and a quorum is set
>> up on Riak. I wonder how would it happen that Riak still considers the POST
>> requests concurrent?
>> Did you read the result of POST 1 before sending POST 2? If not, and you
>> don’t send the causal context, Riak has to view them as concurrent.
>>
>> How does the quorum work here?
>
> Thanks,
> Qiang
>
> ___
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Continuous HTTP POSTs to Riak

2016-03-05 Thread Russell Brown
And you pass the vclock back after a GET with the next POST? Unless we get a 
look at the vclocks then it's hard to say why or where you have concurrency. 
But since concurrency is ultimately unavoidable using riak, why the concern? 
Can your application/data model handle it is the main question?

On 5 Mar 2016, at 19:04, Qiang Cao  wrote:

> Thanks, Russell! I do a GET immediately after a POST is done. I use apache 
> httpclient, which handles requests synchronously. On the client, POSTs and 
> GETs are sent out sequentially.
> 
> On Sat, Mar 5, 2016 at 1:57 PM, Russell Brown  wrote:
> 
> On 5 Mar 2016, at 18:43, Qiang Cao  wrote:
> 
> > Just curious. The POSTs are sent out sequentially and a quorum is set up on 
> > Riak. I wonder how would it happen that Riak still considers the POST 
> > requests concurrent?
> Did you read the result of POST 1 before sending POST 2? If not, and you 
> don’t send the causal context, Riak has to view them as concurrent.
> 
> How does the quorum work here?
> 
> Thanks,
> Qiang
> ___
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Continuous HTTP POSTs to Riak

2016-03-05 Thread Qiang Cao
Thanks, Russell! I do a GET immediately after a POST is done. I use apache
httpclient, which handles requests synchronously. On the client, POSTs and
GETs are sent out sequentially.

On Sat, Mar 5, 2016 at 1:57 PM, Russell Brown  wrote:

>
> On 5 Mar 2016, at 18:43, Qiang Cao  wrote:
>
> > Just curious. The POSTs are sent out sequentially and a quorum is set up
> on Riak. I wonder how would it happen that Riak still considers the POST
> requests concurrent?
> Did you read the result of POST 1 before sending POST 2? If not, and you
> don’t send the causal context, Riak has to view them as concurrent.
>
> How does the quorum work here?

Thanks,
Qiang
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Continuous HTTP POSTs to Riak

2016-03-05 Thread Russell Brown

On 5 Mar 2016, at 18:43, Qiang Cao  wrote:

> Just curious. The POSTs are sent out sequentially and a quorum is set up on 
> Riak. I wonder how would it happen that Riak still considers the POST 
> requests concurrent?
Did you read the result of POST 1 before sending POST 2? If not, and you don’t 
send the causal context, Riak has to view them as concurrent.

> 
> -Qiang
> 
> On Fri, Mar 4, 2016 at 12:27 PM, Qiang Cao  wrote:
> This worked!  Thank you, Vitaly!
> 
> 
> On Fri, Mar 4, 2016 at 3:18 AM, Vitaly E <13vitam...@gmail.com> wrote:
> Hi Qiang,
> 
> Since you are running with allow_mult=false, make sure the clocks of your 
> Riak nodes are synchronized. If they are out of sync, newer values may get 
> overridden by older ones on read, depending on the node a request hits first. 
> Of course this won't cover 100% of cases because a perfect clock 
> synchronization is just impossible.
> 
> Also, setting notfound_ok to "false" may help if you encounter not founds for 
> keys you are sure have been written.
> 
> Good luck!
> Vitaly
> 
> ___
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


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


Re: Continuous HTTP POSTs to Riak

2016-03-05 Thread Qiang Cao
Just curious. The POSTs are sent out sequentially and a quorum is set up on
Riak. I wonder how would it happen that Riak still considers the POST
requests concurrent?

-Qiang

On Fri, Mar 4, 2016 at 12:27 PM, Qiang Cao  wrote:

> This worked!  Thank you, Vitaly!
>
>
> On Fri, Mar 4, 2016 at 3:18 AM, Vitaly E <13vitam...@gmail.com> wrote:
>
>> Hi Qiang,
>>
>> Since you are running with allow_mult=false, make sure the clocks of your
>> Riak nodes are synchronized. If they are out of sync, newer values may get
>> overridden by older ones on read, depending on the node a request hits
>> first. Of course this won't cover 100% of cases because a perfect clock
>> synchronization is just impossible.
>>
>> Also, setting notfound_ok to "false" may help if you encounter not founds
>> for keys you are sure have been written.
>>
>> Good luck!
>> Vitaly
>>
>
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Continuous HTTP POSTs to Riak

2016-03-04 Thread Qiang Cao
This worked!  Thank you, Vitaly!


On Fri, Mar 4, 2016 at 3:18 AM, Vitaly E <13vitam...@gmail.com> wrote:

> Hi Qiang,
>
> Since you are running with allow_mult=false, make sure the clocks of your
> Riak nodes are synchronized. If they are out of sync, newer values may get
> overridden by older ones on read, depending on the node a request hits
> first. Of course this won't cover 100% of cases because a perfect clock
> synchronization is just impossible.
>
> Also, setting notfound_ok to "false" may help if you encounter not founds
> for keys you are sure have been written.
>
> Good luck!
> Vitaly
>
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Continuous HTTP POSTs to Riak

2016-03-04 Thread Vitaly E
Hi Qiang,

Since you are running with allow_mult=false, make sure the clocks of your
Riak nodes are synchronized. If they are out of sync, newer values may get
overridden by older ones on read, depending on the node a request hits
first. Of course this won't cover 100% of cases because a perfect clock
synchronization is just impossible.

Also, setting notfound_ok to "false" may help if you encounter not founds
for keys you are sure have been written.

Good luck!
Vitaly

On Fri, Mar 4, 2016 at 5:19 AM, Qiang Cao <caoqiang...@gmail.com> wrote:

> Sargun, do you mean I should also pass back the vclock with the GET
> request?
>
>
> On Thu, Mar 3, 2016 at 10:05 PM, Qiang Cao <caoqiang...@gmail.com> wrote:
>
>> Thanks, Sargun and Alexander! I tried setting pr, pw, and sloppy_quorum.
>> It looks that these help. I got less stale values. But the issue wasn't
>> completely resolved. I'm using Riak 2.1.2.
>>
>> -Qiang
>>
>>
>> On Thu, Mar 3, 2016 at 9:46 PM, Sargun Dhillon <sar...@sargun.me> wrote:
>>
>>> So, if you pass back the vclock while pr=pw=quorum, and sloppy_quorum
>>> = false you should get RYOW consistency.
>>>
>>> On Thu, Mar 3, 2016 at 6:25 PM, Christopher Mancini <cmanc...@basho.com>
>>> wrote:
>>> > If you don't need strong consistency for all Riak requests, just
>>> certain
>>> > ones, then explore the use of R and N vals that can be passed along
>>> with the
>>> > request or on a bucket-type level.
>>> >
>>> > On Thu, Mar 3, 2016 at 9:23 PM Mark Schmidt <mschm...@orcawave.net>
>>> wrote:
>>> >>
>>> >> Hi Qiang,
>>> >>
>>> >>
>>> >>
>>> >> Other more skilled folks can correct me if I am wrong, but I believe
>>> you
>>> >> can enforce strong consistency on your nodes:
>>> >> http://docs.basho.com/riak/latest/theory/concepts/strong-consistency/
>>> >>
>>> >>
>>> >>
>>> >> If I recall, you will take a performance hit as all nodes must
>>> receive the
>>> >> data.
>>> >>
>>> >>
>>> >>
>>> >> Thanks,
>>> >>
>>> >>
>>> >>
>>> >> -  Mark Schmidt
>>> >>
>>> >>
>>> >>
>>> >> From: riak-users [mailto:riak-users-boun...@lists.basho.com] On
>>> Behalf Of
>>> >> Qiang Cao
>>> >> Sent: Thursday, March 03, 2016 6:13 PM
>>> >> To: Dave King <djk...@gmail.com>
>>> >> Cc: riak-users <riak-users@lists.basho.com>
>>> >> Subject: Re: Continuous HTTP POSTs to Riak
>>> >>
>>> >>
>>> >>
>>> >> Thanks, Dave! I'm aware of Riak's eventual consistency. I wonder how
>>> I can
>>> >> get Riak work in the way as I need. I'm in a situation where I expect
>>> the
>>> >> immediate GET reads the value I've just posted. And the GET request
>>> isn't
>>> >> sent out until the POST is done.
>>> >>
>>> >>
>>> >>
>>> >> Thanks,
>>> >>
>>> >> -Qiang
>>> >>
>>> >>
>>> >>
>>> >> On Thu, Mar 3, 2016 at 6:53 PM, Dave King <djk...@gmail.com> wrote:
>>> >>
>>> >> You need to google 'Eventual consistency'.
>>> >>
>>> >>
>>> >>
>>> >> - Peace
>>> >>
>>> >> Dave
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> On Thu, Mar 3, 2016 at 4:23 PM, Qiang Cao <caoqiang...@gmail.com>
>>> wrote:
>>> >>
>>> >> Hi All,
>>> >>
>>> >>
>>> >>
>>> >> I use Riak as a KV store and send http requests to its REST API to
>>> update
>>> >> entries. Instead of using curl, I use Apache HttpClient to send
>>> requests.
>>> >>
>>> >>
>>> >>
>>> >> One thing bothering me is that sometimes I find the entry isn't
>>> properly
>>> >> updated after an HTTP POST/PUT. For example, if I do an HTTP GET on
>>> the same
>>> >> key immediately after an HTTP POST, the chance is good that I get a
>>> stale
>>> >>

Re: Continuous HTTP POSTs to Riak

2016-03-03 Thread Qiang Cao
Sargun, do you mean I should also pass back the vclock with the GET request?

On Thu, Mar 3, 2016 at 10:05 PM, Qiang Cao <caoqiang...@gmail.com> wrote:

> Thanks, Sargun and Alexander! I tried setting pr, pw, and sloppy_quorum.
> It looks that these help. I got less stale values. But the issue wasn't
> completely resolved. I'm using Riak 2.1.2.
>
> -Qiang
>
>
> On Thu, Mar 3, 2016 at 9:46 PM, Sargun Dhillon <sar...@sargun.me> wrote:
>
>> So, if you pass back the vclock while pr=pw=quorum, and sloppy_quorum
>> = false you should get RYOW consistency.
>>
>> On Thu, Mar 3, 2016 at 6:25 PM, Christopher Mancini <cmanc...@basho.com>
>> wrote:
>> > If you don't need strong consistency for all Riak requests, just certain
>> > ones, then explore the use of R and N vals that can be passed along
>> with the
>> > request or on a bucket-type level.
>> >
>> > On Thu, Mar 3, 2016 at 9:23 PM Mark Schmidt <mschm...@orcawave.net>
>> wrote:
>> >>
>> >> Hi Qiang,
>> >>
>> >>
>> >>
>> >> Other more skilled folks can correct me if I am wrong, but I believe
>> you
>> >> can enforce strong consistency on your nodes:
>> >> http://docs.basho.com/riak/latest/theory/concepts/strong-consistency/
>> >>
>> >>
>> >>
>> >> If I recall, you will take a performance hit as all nodes must receive
>> the
>> >> data.
>> >>
>> >>
>> >>
>> >> Thanks,
>> >>
>> >>
>> >>
>> >> -  Mark Schmidt
>> >>
>> >>
>> >>
>> >> From: riak-users [mailto:riak-users-boun...@lists.basho.com] On
>> Behalf Of
>> >> Qiang Cao
>> >> Sent: Thursday, March 03, 2016 6:13 PM
>> >> To: Dave King <djk...@gmail.com>
>> >> Cc: riak-users <riak-users@lists.basho.com>
>> >> Subject: Re: Continuous HTTP POSTs to Riak
>> >>
>> >>
>> >>
>> >> Thanks, Dave! I'm aware of Riak's eventual consistency. I wonder how I
>> can
>> >> get Riak work in the way as I need. I'm in a situation where I expect
>> the
>> >> immediate GET reads the value I've just posted. And the GET request
>> isn't
>> >> sent out until the POST is done.
>> >>
>> >>
>> >>
>> >> Thanks,
>> >>
>> >> -Qiang
>> >>
>> >>
>> >>
>> >> On Thu, Mar 3, 2016 at 6:53 PM, Dave King <djk...@gmail.com> wrote:
>> >>
>> >> You need to google 'Eventual consistency'.
>> >>
>> >>
>> >>
>> >> - Peace
>> >>
>> >> Dave
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> On Thu, Mar 3, 2016 at 4:23 PM, Qiang Cao <caoqiang...@gmail.com>
>> wrote:
>> >>
>> >> Hi All,
>> >>
>> >>
>> >>
>> >> I use Riak as a KV store and send http requests to its REST API to
>> update
>> >> entries. Instead of using curl, I use Apache HttpClient to send
>> requests.
>> >>
>> >>
>> >>
>> >> One thing bothering me is that sometimes I find the entry isn't
>> properly
>> >> updated after an HTTP POST/PUT. For example, if I do an HTTP GET on
>> the same
>> >> key immediately after an HTTP POST, the chance is good that I get a
>> stale
>> >> value. This happens when I continuously POST to a multi-node Riak, and
>> some
>> >> of the posts target the same key.
>> >>
>> >>
>> >>
>> >> Also, I find I don't have this issue if I use a single-node Riak. So I
>> >> think something wasn't correct with my multi-node Riak cluster (I set
>> >> "allow_mult" to false).  Any thoughts?
>> >>
>> >>
>> >>
>> >> Thanks in advance!
>> >>
>> >>
>> >>
>> >> Qiang
>> >>
>> >>
>> >>
>> >> ___
>> >> riak-users mailing list
>> >> riak-users@lists.basho.com
>> >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> ___
>> >> riak-users mailing list
>> >> riak-users@lists.basho.com
>> >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>> >
>> > --
>> > Sincerely,
>> >
>> > Christopher Mancini
>> > -
>> >
>> > employee = {
>> > purpose: solve problems with code,
>> > phone:7164625591,
>> > email: cmanc...@basho.com,
>> > github:http://www.github.com/christophermancini
>> > }
>> >
>> > ___
>> > riak-users mailing list
>> > riak-users@lists.basho.com
>> > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>> >
>>
>
>
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Continuous HTTP POSTs to Riak

2016-03-03 Thread Qiang Cao
Thanks, Sargun and Alexander! I tried setting pr, pw, and sloppy_quorum. It
looks that these help. I got less stale values. But the issue wasn't
completely resolved. I'm using Riak 2.1.2.

-Qiang


On Thu, Mar 3, 2016 at 9:46 PM, Sargun Dhillon <sar...@sargun.me> wrote:

> So, if you pass back the vclock while pr=pw=quorum, and sloppy_quorum
> = false you should get RYOW consistency.
>
> On Thu, Mar 3, 2016 at 6:25 PM, Christopher Mancini <cmanc...@basho.com>
> wrote:
> > If you don't need strong consistency for all Riak requests, just certain
> > ones, then explore the use of R and N vals that can be passed along with
> the
> > request or on a bucket-type level.
> >
> > On Thu, Mar 3, 2016 at 9:23 PM Mark Schmidt <mschm...@orcawave.net>
> wrote:
> >>
> >> Hi Qiang,
> >>
> >>
> >>
> >> Other more skilled folks can correct me if I am wrong, but I believe you
> >> can enforce strong consistency on your nodes:
> >> http://docs.basho.com/riak/latest/theory/concepts/strong-consistency/
> >>
> >>
> >>
> >> If I recall, you will take a performance hit as all nodes must receive
> the
> >> data.
> >>
> >>
> >>
> >> Thanks,
> >>
> >>
> >>
> >> -  Mark Schmidt
> >>
> >>
> >>
> >> From: riak-users [mailto:riak-users-boun...@lists.basho.com] On Behalf
> Of
> >> Qiang Cao
> >> Sent: Thursday, March 03, 2016 6:13 PM
> >> To: Dave King <djk...@gmail.com>
> >> Cc: riak-users <riak-users@lists.basho.com>
> >> Subject: Re: Continuous HTTP POSTs to Riak
> >>
> >>
> >>
> >> Thanks, Dave! I'm aware of Riak's eventual consistency. I wonder how I
> can
> >> get Riak work in the way as I need. I'm in a situation where I expect
> the
> >> immediate GET reads the value I've just posted. And the GET request
> isn't
> >> sent out until the POST is done.
> >>
> >>
> >>
> >> Thanks,
> >>
> >> -Qiang
> >>
> >>
> >>
> >> On Thu, Mar 3, 2016 at 6:53 PM, Dave King <djk...@gmail.com> wrote:
> >>
> >> You need to google 'Eventual consistency'.
> >>
> >>
> >>
> >> - Peace
> >>
> >> Dave
> >>
> >>
> >>
> >>
> >>
> >> On Thu, Mar 3, 2016 at 4:23 PM, Qiang Cao <caoqiang...@gmail.com>
> wrote:
> >>
> >> Hi All,
> >>
> >>
> >>
> >> I use Riak as a KV store and send http requests to its REST API to
> update
> >> entries. Instead of using curl, I use Apache HttpClient to send
> requests.
> >>
> >>
> >>
> >> One thing bothering me is that sometimes I find the entry isn't properly
> >> updated after an HTTP POST/PUT. For example, if I do an HTTP GET on the
> same
> >> key immediately after an HTTP POST, the chance is good that I get a
> stale
> >> value. This happens when I continuously POST to a multi-node Riak, and
> some
> >> of the posts target the same key.
> >>
> >>
> >>
> >> Also, I find I don't have this issue if I use a single-node Riak. So I
> >> think something wasn't correct with my multi-node Riak cluster (I set
> >> "allow_mult" to false).  Any thoughts?
> >>
> >>
> >>
> >> Thanks in advance!
> >>
> >>
> >>
> >> Qiang
> >>
> >>
> >>
> >> ___
> >> riak-users mailing list
> >> riak-users@lists.basho.com
> >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> >>
> >>
> >>
> >>
> >>
> >> ___
> >> riak-users mailing list
> >> riak-users@lists.basho.com
> >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> >
> > --
> > Sincerely,
> >
> > Christopher Mancini
> > -
> >
> > employee = {
> > purpose: solve problems with code,
> > phone:7164625591,
> > email: cmanc...@basho.com,
> > github:http://www.github.com/christophermancini
> > }
> >
> > ___
> > riak-users mailing list
> > riak-users@lists.basho.com
> > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> >
>
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Continuous HTTP POSTs to Riak

2016-03-03 Thread Sargun Dhillon
So, if you pass back the vclock while pr=pw=quorum, and sloppy_quorum
= false you should get RYOW consistency.

On Thu, Mar 3, 2016 at 6:25 PM, Christopher Mancini <cmanc...@basho.com> wrote:
> If you don't need strong consistency for all Riak requests, just certain
> ones, then explore the use of R and N vals that can be passed along with the
> request or on a bucket-type level.
>
> On Thu, Mar 3, 2016 at 9:23 PM Mark Schmidt <mschm...@orcawave.net> wrote:
>>
>> Hi Qiang,
>>
>>
>>
>> Other more skilled folks can correct me if I am wrong, but I believe you
>> can enforce strong consistency on your nodes:
>> http://docs.basho.com/riak/latest/theory/concepts/strong-consistency/
>>
>>
>>
>> If I recall, you will take a performance hit as all nodes must receive the
>> data.
>>
>>
>>
>> Thanks,
>>
>>
>>
>> -  Mark Schmidt
>>
>>
>>
>> From: riak-users [mailto:riak-users-boun...@lists.basho.com] On Behalf Of
>> Qiang Cao
>> Sent: Thursday, March 03, 2016 6:13 PM
>> To: Dave King <djk...@gmail.com>
>> Cc: riak-users <riak-users@lists.basho.com>
>> Subject: Re: Continuous HTTP POSTs to Riak
>>
>>
>>
>> Thanks, Dave! I'm aware of Riak's eventual consistency. I wonder how I can
>> get Riak work in the way as I need. I'm in a situation where I expect the
>> immediate GET reads the value I've just posted. And the GET request isn't
>> sent out until the POST is done.
>>
>>
>>
>> Thanks,
>>
>> -Qiang
>>
>>
>>
>> On Thu, Mar 3, 2016 at 6:53 PM, Dave King <djk...@gmail.com> wrote:
>>
>> You need to google 'Eventual consistency'.
>>
>>
>>
>> - Peace
>>
>> Dave
>>
>>
>>
>>
>>
>> On Thu, Mar 3, 2016 at 4:23 PM, Qiang Cao <caoqiang...@gmail.com> wrote:
>>
>> Hi All,
>>
>>
>>
>> I use Riak as a KV store and send http requests to its REST API to update
>> entries. Instead of using curl, I use Apache HttpClient to send requests.
>>
>>
>>
>> One thing bothering me is that sometimes I find the entry isn't properly
>> updated after an HTTP POST/PUT. For example, if I do an HTTP GET on the same
>> key immediately after an HTTP POST, the chance is good that I get a stale
>> value. This happens when I continuously POST to a multi-node Riak, and some
>> of the posts target the same key.
>>
>>
>>
>> Also, I find I don't have this issue if I use a single-node Riak. So I
>> think something wasn't correct with my multi-node Riak cluster (I set
>> "allow_mult" to false).  Any thoughts?
>>
>>
>>
>> Thanks in advance!
>>
>>
>>
>> Qiang
>>
>>
>>
>> ___
>> riak-users mailing list
>> riak-users@lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>>
>>
>>
>>
>> ___
>> riak-users mailing list
>> riak-users@lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
> --
> Sincerely,
>
> Christopher Mancini
> -
>
> employee = {
> purpose: solve problems with code,
> phone:7164625591,
> email: cmanc...@basho.com,
> github:http://www.github.com/christophermancini
> }
>
> ___
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>

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


Re: Continuous HTTP POSTs to Riak

2016-03-03 Thread Alexander Sicular
Hi Qiang,

Check out RYOW semantics in this blog post, part 2 of a 4 part series , 
http://basho.com/posts/technical/riaks-config-behaviors-part-2/ .

-Alexander 


@siculars
http://siculars.posthaven.com

Sent from my iRotaryPhone

> On Mar 3, 2016, at 20:12, Qiang Cao  wrote:
> 
> Thanks, Dave! I'm aware of Riak's eventual consistency. I wonder how I can 
> get Riak work in the way as I need. I'm in a situation where I expect the 
> immediate GET reads the value I've just posted. And the GET request isn't 
> sent out until the POST is done.
> 
> Thanks,
> -Qiang
> 
>> On Thu, Mar 3, 2016 at 6:53 PM, Dave King  wrote:
>> You need to google 'Eventual consistency'.
>> 
>> - Peace
>> Dave
>> 
>> 
>>> On Thu, Mar 3, 2016 at 4:23 PM, Qiang Cao  wrote:
>>> Hi All, 
>>> 
>>> I use Riak as a KV store and send http requests to its REST API to update 
>>> entries. Instead of using curl, I use Apache HttpClient to send requests.
>>> 
>>> One thing bothering me is that sometimes I find the entry isn't properly 
>>> updated after an HTTP POST/PUT. For example, if I do an HTTP GET on the 
>>> same key immediately after an HTTP POST, the chance is good that I get a 
>>> stale value. This happens when I continuously POST to a multi-node Riak, 
>>> and some of the posts target the same key.
>>> 
>>> Also, I find I don't have this issue if I use a single-node Riak. So I 
>>> think something wasn't correct with my multi-node Riak cluster (I set 
>>> "allow_mult" to false).  Any thoughts?
>>> 
>>> Thanks in advance!
>>> 
>>> Qiang
>>> 
>>> ___
>>> riak-users mailing list
>>> riak-users@lists.basho.com
>>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> 
> ___
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Continuous HTTP POSTs to Riak

2016-03-03 Thread Qiang Cao
Thanks, Christopher! I played with n_val, r and w on a bucket-type level
for a while. No luck even I set r equal to n_val (r+w>n_val).

Qiang

On Thu, Mar 3, 2016 at 9:25 PM, Christopher Mancini <cmanc...@basho.com>
wrote:

> If you don't need strong consistency for all Riak requests, just certain
> ones, then explore the use of R and N vals that can be passed along with
> the request or on a bucket-type level.
>
> On Thu, Mar 3, 2016 at 9:23 PM Mark Schmidt <mschm...@orcawave.net> wrote:
>
>> Hi Qiang,
>>
>>
>>
>> Other more skilled folks can correct me if I am wrong, but I believe you
>> can enforce strong consistency on your nodes:
>> http://docs.basho.com/riak/latest/theory/concepts/strong-consistency/
>>
>>
>>
>> If I recall, you will take a performance hit as all nodes must receive
>> the data.
>>
>>
>>
>> Thanks,
>>
>>
>>
>> -  Mark Schmidt
>>
>>
>>
>> *From:* riak-users [mailto:riak-users-boun...@lists.basho.com] *On
>> Behalf Of *Qiang Cao
>> *Sent:* Thursday, March 03, 2016 6:13 PM
>> *To:* Dave King <djk...@gmail.com>
>> *Cc:* riak-users <riak-users@lists.basho.com>
>> *Subject:* Re: Continuous HTTP POSTs to Riak
>>
>>
>>
>> Thanks, Dave! I'm aware of Riak's eventual consistency. I wonder how I
>> can get Riak work in the way as I need. I'm in a situation where I expect
>> the immediate GET reads the value I've just posted. And the GET request
>> isn't sent out until the POST is done.
>>
>>
>>
>> Thanks,
>>
>> -Qiang
>>
>>
>>
>> On Thu, Mar 3, 2016 at 6:53 PM, Dave King <djk...@gmail.com> wrote:
>>
>> You need to google 'Eventual consistency'.
>>
>>
>>
>> - Peace
>>
>> Dave
>>
>>
>>
>>
>>
>> On Thu, Mar 3, 2016 at 4:23 PM, Qiang Cao <caoqiang...@gmail.com> wrote:
>>
>> Hi All,
>>
>>
>>
>> I use Riak as a KV store and send http requests to its REST API to update
>> entries. Instead of using curl, I use Apache HttpClient to send requests.
>>
>>
>>
>> One thing bothering me is that sometimes I find the entry isn't properly
>> updated after an HTTP POST/PUT. For example, if I do an HTTP GET on the
>> same key immediately after an HTTP POST, the chance is good that I get a
>> stale value. This happens when I continuously POST to a multi-node Riak,
>> and some of the posts target the same key.
>>
>>
>>
>> Also, I find I don't have this issue if I use a single-node Riak. So I
>> think something wasn't correct with my multi-node Riak cluster (I set
>> "allow_mult" to false).  Any thoughts?
>>
>>
>>
>> Thanks in advance!
>>
>>
>>
>> Qiang
>>
>>
>>
>> ___
>> riak-users mailing list
>> riak-users@lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>>
>>
>>
>> ___
>> riak-users mailing list
>> riak-users@lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
> --
> Sincerely,
>
> Christopher Mancini
> -
>
> employee = {
> purpose: solve problems with code,
> phone:7164625591,
> email: cmanc...@basho.com,
> github:http://www.github.com/christophermancini
> }
>
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Continuous HTTP POSTs to Riak

2016-03-03 Thread Christopher Mancini
If you don't need strong consistency for all Riak requests, just certain
ones, then explore the use of R and N vals that can be passed along with
the request or on a bucket-type level.

On Thu, Mar 3, 2016 at 9:23 PM Mark Schmidt <mschm...@orcawave.net> wrote:

> Hi Qiang,
>
>
>
> Other more skilled folks can correct me if I am wrong, but I believe you
> can enforce strong consistency on your nodes:
> http://docs.basho.com/riak/latest/theory/concepts/strong-consistency/
>
>
>
> If I recall, you will take a performance hit as all nodes must receive the
> data.
>
>
>
> Thanks,
>
>
>
> -  Mark Schmidt
>
>
>
> *From:* riak-users [mailto:riak-users-boun...@lists.basho.com] *On Behalf
> Of *Qiang Cao
> *Sent:* Thursday, March 03, 2016 6:13 PM
> *To:* Dave King <djk...@gmail.com>
> *Cc:* riak-users <riak-users@lists.basho.com>
> *Subject:* Re: Continuous HTTP POSTs to Riak
>
>
>
> Thanks, Dave! I'm aware of Riak's eventual consistency. I wonder how I can
> get Riak work in the way as I need. I'm in a situation where I expect the
> immediate GET reads the value I've just posted. And the GET request isn't
> sent out until the POST is done.
>
>
>
> Thanks,
>
> -Qiang
>
>
>
> On Thu, Mar 3, 2016 at 6:53 PM, Dave King <djk...@gmail.com> wrote:
>
> You need to google 'Eventual consistency'.
>
>
>
> - Peace
>
> Dave
>
>
>
>
>
> On Thu, Mar 3, 2016 at 4:23 PM, Qiang Cao <caoqiang...@gmail.com> wrote:
>
> Hi All,
>
>
>
> I use Riak as a KV store and send http requests to its REST API to update
> entries. Instead of using curl, I use Apache HttpClient to send requests.
>
>
>
> One thing bothering me is that sometimes I find the entry isn't properly
> updated after an HTTP POST/PUT. For example, if I do an HTTP GET on the
> same key immediately after an HTTP POST, the chance is good that I get a
> stale value. This happens when I continuously POST to a multi-node Riak,
> and some of the posts target the same key.
>
>
>
> Also, I find I don't have this issue if I use a single-node Riak. So I
> think something wasn't correct with my multi-node Riak cluster (I set
> "allow_mult" to false).  Any thoughts?
>
>
>
> Thanks in advance!
>
>
>
> Qiang
>
>
>
> ___
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
>
>
> ___
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
-- 
Sincerely,

Christopher Mancini
-

employee = {
purpose: solve problems with code,
phone:7164625591,
email: cmanc...@basho.com,
github:http://www.github.com/christophermancini
}
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Continuous HTTP POSTs to Riak

2016-03-03 Thread Qiang Cao
Thanks, Dave! I'm aware of Riak's eventual consistency. I wonder how I can
get Riak work in the way as I need. I'm in a situation where I expect the
immediate GET reads the value I've just posted. And the GET request isn't
sent out until the POST is done.

Thanks,
-Qiang

On Thu, Mar 3, 2016 at 6:53 PM, Dave King  wrote:

> You need to google 'Eventual consistency'.
>
> - Peace
> Dave
>
>
> On Thu, Mar 3, 2016 at 4:23 PM, Qiang Cao  wrote:
>
>> Hi All,
>>
>> I use Riak as a KV store and send http requests to its REST API to update
>> entries. Instead of using curl, I use Apache HttpClient to send requests.
>>
>> One thing bothering me is that sometimes I find the entry isn't properly
>> updated after an HTTP POST/PUT. For example, if I do an HTTP GET on the
>> same key immediately after an HTTP POST, the chance is good that I get a
>> stale value. This happens when I continuously POST to a multi-node Riak,
>> and some of the posts target the same key.
>>
>> Also, I find I don't have this issue if I use a single-node Riak. So I
>> think something wasn't correct with my multi-node Riak cluster (I set
>> "allow_mult" to false).  Any thoughts?
>>
>> Thanks in advance!
>>
>> Qiang
>>
>> ___
>> riak-users mailing list
>> riak-users@lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>>
>
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Re: Continuous HTTP POSTs to Riak

2016-03-03 Thread Dave King
You need to google 'Eventual consistency'.

- Peace
Dave


On Thu, Mar 3, 2016 at 4:23 PM, Qiang Cao  wrote:

> Hi All,
>
> I use Riak as a KV store and send http requests to its REST API to update
> entries. Instead of using curl, I use Apache HttpClient to send requests.
>
> One thing bothering me is that sometimes I find the entry isn't properly
> updated after an HTTP POST/PUT. For example, if I do an HTTP GET on the
> same key immediately after an HTTP POST, the chance is good that I get a
> stale value. This happens when I continuously POST to a multi-node Riak,
> and some of the posts target the same key.
>
> Also, I find I don't have this issue if I use a single-node Riak. So I
> think something wasn't correct with my multi-node Riak cluster (I set
> "allow_mult" to false).  Any thoughts?
>
> Thanks in advance!
>
> Qiang
>
> ___
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Continuous HTTP POSTs to Riak

2016-03-03 Thread Qiang Cao
Hi All,

I use Riak as a KV store and send http requests to its REST API to update
entries. Instead of using curl, I use Apache HttpClient to send requests.

One thing bothering me is that sometimes I find the entry isn't properly
updated after an HTTP POST/PUT. For example, if I do an HTTP GET on the
same key immediately after an HTTP POST, the chance is good that I get a
stale value. This happens when I continuously POST to a multi-node Riak,
and some of the posts target the same key.

Also, I find I don't have this issue if I use a single-node Riak. So I
think something wasn't correct with my multi-node Riak cluster (I set
"allow_mult" to false).  Any thoughts?

Thanks in advance!

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