hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Daniel Cryans <jdcry...@apache.org>
Subject Re: Append and Put
Date Thu, 24 May 2012 03:23:14 GMT
On Wed, May 23, 2012 at 8:11 PM, NNever <nneverwei@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

Mime
View raw message