Two questions about pre/post update hooks
jeffpk at nphos.com
Fri Jul 8 13:18:52 EDT 2011
(1) AIUI a given key/value data pair is "owned" by a given node at one time
and operations on it happen on that node and are then replicated out. Is
(2) Is the key/value pair "locked" between pre update and post update?
The motivation for this question is this.
I need to do the following operations on update:
(1) In the pre-update hook, get the existing value (lets call it A)
(2) Compare some data in the update (lets call it A') with A
(3) Validate or reject the update based on that comparison
(4) If validated, write A' out as the new value of A, if not, return a
I need 1-4 to happen in a consistent fashion, If someone else can come in
and update A after (1) but before (4), the scheme wont work.
I *could* do my own locking in (1) and then add an unlock step in (5)
assuming that all updates will take place on the same node, but I
dislike injecting locking into a system that has unknown other expectations
of the operation.
It's always darkest just before you are eaten by a grue.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the riak-users