Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # user - Problem deleting neighboors with timestamp=0


Copy link to this message
-
Problem deleting neighboors with timestamp=0
Chris Larsen 2012-11-18, 20:14
Hello, I was going nuts over an issue where I would try to delete a single
column but a neighboring column (sorted by the column names in bytes) was
also being deleted because, I found out, the timestamp for the neighbor was
set to 0. Here are some of the columns in the row (taken from the shell
utility)

 

hbase(main):002:0> get 'mytable',
"\x00\x01\xAA\x50\x8E\xC4\x20\x00\x00\x01\x00\x00\xAC"

COLUMN                                  CELL

t:\x00\x17                             timestamp=1351533601998,
value=\x00\x00\x00\x00O\xB2\xDC[

t:\x00\x17\x03\xD7\x...(long name)     timestamp=0, value=\x00\x00\x... lots
of binary data....

t:\x03\xD7                             timestamp=1351533661458,
value=\x00\x00\x00\x00O\xB9\xD1\xE5

t:\x07\x97                             timestamp=1351533721758,
value=\x00\x00\x00\x00O\xBC#\xD0

t:\x0BW                                timestamp=1351533781738,
value=\x00\x00\x00\x00O\xBD\xB93

 

I wanted to delete the column "t:\x00\x17" but every time I did, the column
"t:\x00\x17\x03\xD7\x..." would also be deleted so that I'd wind up with:

 

hbase(main):005:0> get 'mytable',
"\x00\x01\xAA\x50\x8E\xC4\x20\x00\x00\x01\x00\x00\xAC"

COLUMN                                  CELL

t:\x03\xD7                             timestamp=1351533661458,
value=\x00\x00\x00\x00O\xB9\xD1\xE5

t:\x07\x97                             timestamp=1351533721758,
value=\x00\x00\x00\x00O\xBC#\xD0

t:\x0BW                                timestamp=1351533781738,
value=\x00\x00\x00\x00O\xBD\xB93

 

My JAVA code looked like this:

 

HTableInterface table = factory.createHTableInterface(config,
"mytable".getBytes());

Delete delete = new Delete(HexToBytes("0001AA508EC4200000010000AC"));

delete.deleteColumn("t".getBytes(), new byte[] { (byte) 0x00, (byte) 0x17
});

table.delete(delete);

 

as I was typing this out, I noticed that the column I didn't want to delete
had a timestamp of 0. I put the column back with a valid timestamp and tried
deleting the original column, and it worked properly. I fixed my code to
always provide a positive timestamp, but my question is, are timestamps set
to 0 valid for storing data in HBase? And if so, then this may be a bug that
needs addressing. Thanks!