Strings with identical keys

When I need to create an HBase string, I need to call the method Put(row_key)

. Then what happens if I call the method again Put()

with the same value row_key

? Will the existing row be updated or will HBase create a new row?

Is it possible to create 2 lines with the same keys?

+3


source to share


5 answers


String keys are used to uniquely identify a string in Hbase. If you want the same keys in two rows, you are missing something. Please add more details about your requirement or revisit the basics of Hbase architecture



+5


source


Your question should include column values ​​and column classifier values. With a row key, these three are uniquely identifying a value in the hbase table.



Also you can turn on versioning for this column family and have multiple values ​​that can have the same "row key + column family + column qualifier" values. In this case, each unique version (value) is defined by "rowkey + col.fam. + Col.qual. + Timestamp"

+3


source


You cannot have strings with the same key, but you can have multiple versions of Put using timestamps. You can use these built-in timestamps for auditing or timestamping.

If you issue multiple Puts without a version (timestamp), the latest KV version prevails. If you issue multiple puts of the same timestamp, one of those values ​​will be returned, but HBase makes no guarantees about the order and KV will survive the compaction (scheduled cleanup). If you insert multiple Puts with negative timestamps, it will be very bad. Earlier HBase versions produced unpredictable scan results, and later HBase versions threw an exception.

+2


source


With newer versions of Hbase, only the last record can be pulled from the request: get 'emp'; by default the version is maintained at level 1, but under another previous version there in hfiles and dumped during compaction.

0


source


From the documentation for the PUT operation :

Put either adds new rows to the table (if the key is new) or can update existing rows (if the key already exists). Bets are done via Table.put (not for writing) or Table.batch (not for writing).

NB: Emphasis mine

0


source







All Articles