简体   繁体   中英

Does timestamp by default appear in an HBase table?

When we create any HBase table, does timestamp appear in that table when we scan it?

For example:

create 'test', 'cf'

put 'test', 'row1', 'cf:a', 'value1'

put 'test', 'row2', 'cf:b', 'value2'

put 'test', 'row3', 'cf:c', 'value3'

scan 'test'

ROW COLUMN+CELL

row1 column=cf:a, timestamp=1288380727188, value=value1

row2 column=cf:b, timestamp=1288380738440, value=value2

row3 column=cf:c, timestamp=1288380747365, value=value3

Timestamps are actually mandatory part of HBase columns and their main purpose is column versioning. Here is some more detailed explanation about versions and timestamps. Also " HBase definitive guide " book contains detailed PUT operation description which discovers almost everything you can do with timestamps (TS).

The hints here are:

  • If you don't specify TS in PUT, server adds it automatically.
  • You can specify any TS if you specify it manually so you are actually not limited with 'recommended' usage of this field and there is lot of alternatives.
  • Additional options for timestamps (TS) are discovered by 'keep deleted records' table options, minimum number of versions to keep and data 'time to live' (TTL) support.

So yes, you cannot get rid of these timestamps / versions but there is lot of options how to use them.

Yes, everytime you make a PUT on a table you set the timestamp. By default this is the currentTimeInMillis but you can set your own timestamp as well.

The timestamp allows for versioning of the cells. A scan will return the latest version, but you can specify the maximum versioning using Scan.setMaxVersions() or if you want a specific timestamp you can use Scan.setTimeRange() or Scan.setTimeStamp()

Yes it appear. You can see in your example

row1 column=cf:a, timestamp=1288380727188 , value=value1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM