You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Pablo Musa <pa...@psafe.com> on 2012/09/03 22:22:21 UTC

Put and Increment atomically

Hey guys,
I want to insert new columns into a row:fam and increment 2 of them atomically.
In other words, I am using columns as entries and I want to count them and their
sizes.

For example, I want to insert these new columns:
row1:f1:c1 = h_v_j
row1:f1:c2 = g_r_w
row1:f1:c3 = z_l_p
row1:f1:c4 = n_m_j

*The values are fixed size information which I used '_' as separator above.

But I also want to keep track of how many columns do I have and sum one of
the information.
row1:f1:count = Increment(4)
row1:f1:size = Increment(j+w+p+j)

I can do them separately, send the puts and then send the increments, but
I would like to know if it is possible to do it atomically.

I did some search and found the link below, but it only talks about put/delete.
Why not adding increment?
http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/RowMutations.html

I don't know if it is clear enough.

Thanks,
Pablo

Re: Put and Increment atomically

Posted by Jean-Daniel Cryans <jd...@apache.org>.
Hi Pablo,

It's currently not possible (like you saw).

What's your use case? Maybe there's different/better way to achieve
what you want to do?

J-D

On Mon, Sep 3, 2012 at 1:22 PM, Pablo Musa <pa...@psafe.com> wrote:
> Hey guys,
> I want to insert new columns into a row:fam and increment 2 of them atomically.
> In other words, I am using columns as entries and I want to count them and their
> sizes.
>
> For example, I want to insert these new columns:
> row1:f1:c1 = h_v_j
> row1:f1:c2 = g_r_w
> row1:f1:c3 = z_l_p
> row1:f1:c4 = n_m_j
>
> *The values are fixed size information which I used '_' as separator above.
>
> But I also want to keep track of how many columns do I have and sum one of
> the information.
> row1:f1:count = Increment(4)
> row1:f1:size = Increment(j+w+p+j)
>
> I can do them separately, send the puts and then send the increments, but
> I would like to know if it is possible to do it atomically.
>
> I did some search and found the link below, but it only talks about put/delete.
> Why not adding increment?
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/RowMutations.html
>
> I don't know if it is clear enough.
>
> Thanks,
> Pablo