When I need to create an HBase-row, I have to call Put(row_key)
method. Then, what happens if I'll call Put()
method again with the same row_key
value? Will the existing row be updated or HBase will create the new row?
Is it possible to create 2 rows with identical keys?
Row-keys are used to identify a row uniquely in Hbase. If you want two rows to have identical keys, then you are missing something. Please add more information regarding your requirement, or revisit the basics of Hbase architecture
Your question should include column family and column qualifier values as well. With row key, these three are unique identifier of a value in hbase table.
Also you can enable versioning for that column family and have multiple values which can have same "row key + column family + column qualifier" values. In this case every unique version (value) is defined by "rowkey+ col.fam. +col.qual. + timestamp"
You cannot have rows with the same key, but you can have multiple versions of Put using timestamps. You can use these built-in timestamps for audit or for timestamping.
If you issue multiple Puts without specifying version (timestamp), the latest version of the KV will prevail. If you issue multiple puts the same explicitly set timestamp, one of those values will be returned but HBase provides no guarantees about the the order and which KV will survive the compaction (scheduled cleanup). If you insert multiple Puts with negative timestamps this will be really bad. Earlier HBase versions will produce unpredictable scan results while later HBase versions will throw an exception.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With