I have a HBase table with a single column family and columns are added to
it over time. These columns are named as the timestamp they were created,
so unless I query the row I do not know what all columns it has.

Now given a row, I want to _atomically_ remove all the existing columns of
this column family and add a new set of columns and values.

So I thought of using RowMutations like:

==============
RowMutations mutations = new RowMutations(row);

//delete the column family
Delete delete = new Delete(row);
delete.deleteFamily(cf);

//add new columns
Put put = new Put(row);
put.add(cf, col1, v1);
put.add(cf, col2, v2);

//delete column family and add new columns to same family
mutations.add(delete);
mutations.add(put);

table.mutateRow(mutations);
==============

But what this code ends up doing is just deleting the column family, it
does not add the new columns. Is this behaviour expected?

If so, then how can I achieve my goal of _atomically_ replacing all columns
of a column family with a new set of columns?

Thanks,
Vinod

Reply via email to