On Wed, Jan 4, 2012 at 3:21 PM, Ted Dunning <[email protected]> wrote:
> > > What happens if the transaction has both a setData and a check? > > > > They happen in sequence, but I couldn't say exactly which version the check > will see. I suspect that it will see the version before the setData is > done. > > It actually depends on the placement of the check in relation to the set inside the multi-op. If the check is before the set, the check will see the version before the set, but if the check is after the set, then it will see the updated version after the set increments it. Keep in mind two things here: (1) You may not need the check call at all as the Set() call will fail if the version number doesn't match the specified version in the Set() call. (2) Operations inside a multi-op update the state of any zknodes in the multi-op and all subsequent operations in the multi-op will see that new state. (3) If the multi-op fails, all changes are discarded and we roll back to the prior state.
