Does each sibling have an individual vclock or just vclock? I see that
riak only returns 1 vclock per get response in PBC.
Thanks,
Shuhao
On 12-12-28 08:33 AM, Sean Cribbs wrote:
Let me clarify a bit:
1) There is only one vclock in a response, but at one time prior to
you requesting the key, the vclock of individual replicas were
divergent, which results in the siblings.
2) The ETag is related to the "vtag" but is not exactly the same.
Reading the riak_kv source gives us this function:
generate_etag(RD, Ctx) ->
case select_doc(Ctx) of
{MD, _} ->
{dict:fetch(?MD_VTAG, MD), RD, Ctx};
multiple_choices ->
{ok, Doc} = Ctx#ctx.doc,
<<ETag:128/integer>> =
crypto:md5(term_to_binary(riak_object:vclock(Doc))),
{riak_core_util:integer_to_list(ETag, 62), RD, Ctx}
end.
Also at
https://github.com/basho/riak_kv/blob/master/src/riak_kv_wm_object.erl#L861
What that means is, when there is a single item (either when you have
selected the vtag from a list, or when there are no siblings), the
internal "MD_VTAG" metadata is given as the ETag, i.e. the first
clause of the case statement. When there are multiple choices, i.e.
all siblings are listed by vtag or presented in full, then the ETag is
an MD5 hash of the vclock, i.e. the second clause of the case
statement.
Over Protocol Buffers, the same applies, the 'vtag' field is extracted
from the metadata from each sibling. However, there is no top-level
ETag per se, but the encoded vector clock is used for conditional
requests.
On Thu, Dec 27, 2012 at 9:15 PM, Shuhao Wu <[email protected]> wrote:
Then what exactly is etag/vtag.
Shuhao
On Dec 27, 2012 7:16 PM, "Pavan Venkatesh" <[email protected]> wrote:
With 2 siblings, you'll still have 1 vector clock (no matter if its
through http or protobuf).
Each sibling will have the same vector clock.
Pavan
From: Shuhao Wu <[email protected]>
Date: Thursday, December 27, 2012 2:22 PM
To: Pavan Venkatesh <[email protected]>
Cc: <[email protected]>
Subject: Re: vclock, vtag, entity tag
Wait. So with 2 siblings, I should get 2 different vclock and 2 etags from
http.
But the specification from pbc tells me it will only return 1 vclock and 2
vtags
Shuhao
Sent from my phone.
On 2012-12-27 5:19 PM, "Pavan Venkatesh" <[email protected]> wrote:
Hi Shuhao,
Lets say, two clients update the same object at the same time (through
http or protobuf),then a sibling is created, but with the same vector
clock.They merge into single object with one vector clock, but these
siblings live in the same object.
User intervention is required and one can pick the correct value and
issue
a put request with that vector clock in order to resolve the conflict.
Hope this helps.
Pavan
On 12/25/12 10:08 PM, "Shuhao" <[email protected]> wrote:
Hi,
I'm just browsing through the API documentations for Riak and I just
noticed a couple of things that's pretty confusing:
It's my understanding that with the HTTP fetch request, each
object/sibling returned will have its own vclock in the form of the HTTP
header `X-Riak-Vclock` and an entity tag under the header `ETag`. There
is also a vtag url parameter specified by the HTTP fetch request which I
assume fetches specific sibling with that entity tag. [1]
[1]:
http://docs.basho.com/riak/latest/references/apis/http/HTTP-Fetch-Object/
However, the protobuf client will return a list of siblings but only
with 1 vclock with `optional bytes vclock = 2;` for all the siblings
returned under `content`. For each sibling, there will be a `vtag`
attribute, which I assume is the entity tag as specified in the HTTP
document. [2]
[2]:
http://docs.basho.com/riak/latest/references/apis/protocol-buffers/PBC-Fet
ch
-Object/
So the confusion is that why is it that in the HTTP request, each
sibling has its own vclock and entity tag/vtag while in the PBC request,
the entire response only has 1 vclock and each object has its own
vtag/entity tag. I'm not too sure if my understanding is complete.
Thanks,
Shuhao
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com