We know that hbase is a multi-version management system. Before the 0.96 version, each column defaults to 3 versions. After hbase 0.96, each column is a version. The so-called version is actually inserting different timestamps for the same data. To achieve, the underlying storage of hbase is based on timestamp sorting, so every time we find the data is the latest version, unless we specify the data to read a specific time range.
First look at the api of the Put and Delete commands in Hbase:
Put:
Delete:
As above, the commonly used pu and delete methods are basically the first one. By default, after we insert a piece of data using the Put command, its timestamp takes the current timestamp. Of course, we can also set the timestamp ourselves, but I recommend not to just Setting this timestamp, the wrong setting may cause some inexplicable problems. I just said that hbase is sorted in descending order of time when reading. Every time it is read, it is the latest, so if it is put. Set this timestamp to Long.MAXVALUE, then you don't pass the timestamp when inserting, deleting, or updating, then you will be surprised to find that insert, delete, and update all fail. Why?
Because the timestamp of your operation is less than Long.MAXVALUE, and your version has only one, hbase thinks that an old version can't overwrite the new version. Also delete it, you will find that no matter how many delete commands you execute, This piece of data cannot be deleted.
Note that the second method of Put and Delete in the above api is time-stamped. Don't be misunderstood. This timestamp is not rowkey. It is used for the following column, that is, if it is inserted. One row of data, there are multiple column clusters in this row of data, and there are multiple columns under each column cluster, and their timestamps are the same, then I can specify directly in the second parameter of put, without Specified on each column, of course, if we also specify a timestamp on the column, the default timestamp is used on the column.
to sum up:
Hbase's multi-version storage feature is a powerful feature. When using it, you should pay attention to not modifying the default default timestamp logic. If you modify it, you should consider whether the current timestamp is used in other additions, deletions, and updates. It is greater than the timestamp of the first insertion. If it is not, then this modification will not take effect. Therefore, when you delete a row of hbase data one day, it is found that it has not been deleted. Don't be surprised, there is no problem in the code. The biggest possibility is that the current timestamp is smaller than the timestamp of the data in the library. This requires special attention. Finally, repeat it again. Try not to set a custom timestamp when inserting data into hbase, unless the business scenario requires it.
Flash Bracket,Light Stand Bracket,Camera Flash Mount,Camera Flash Holder
SHAOXING COLORBEE PLASTIC CO.,LTD , https://www.colorbeephoto.com