Thanks J-D, good example. Now it makes all clear to me. It helps a lot :) NN
2012/5/24 Jean-Daniel Cryans <jdcry...@apache.org> > On Wed, May 23, 2012 at 8:11 PM, NNever <nnever...@gmail.com> wrote: > > Thanks J-D. > > > > so it means 'Append' keeps write-lock only and 'Put' keeps > > write-lock/read-lock both? > > Yeah... not at all. First, there's no read lock. Then Put is just a > Put, it takes a write lock. Append is a read+write operation, still > just uses a write lock. > > > and if we use 'Append' instead of 'Put', then the chance Clients to wait > > will reduce, right? > > You would use Append instead of Put only if you also need a Get. A > typical example is a list, let's say you have a cell that's like: > > a,b,c > > Now you want to add ",d". Before Append you'd have to do a Get, > manipulate the value (basically add the new data at the end) and then > do a Put. That's 2 round trips. Append is just those operations put > together and it runs all in the region server, saving you 1 round trip > plus you don't have a race condition when you have multiple appenders > on the same cell. > > Hope this helps, > > J-D >