hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Corgan <mcor...@hotpads.com>
Subject Re: Why doesn't KeyValue.equals/CellComparator compare the values?
Date Thu, 27 Feb 2014 04:31:04 GMT
One way to look at it is that HBase is another implementation of a Set
(HashSet, TreetSet, etc).  If the client puts two Cells with the same key
(including timestamp) but different values into HBase, the original design
states that only the latest value will survive.  The default behavior for a
TreeSet on the client is the same (but pluggable with a custom comparator).

There's a comment at the top of Cell.java:

> Uniqueness is determined by the combination of row, column family, column
> qualifier, timestamp, and type.

But maybe one of the committers could add a sentence to emphasize that
value is excluded.


On Wed, Feb 26, 2014 at 7:25 PM, Cosmin Lehene <clehene@adobe.com> wrote:

> I'm assuming is for performance reasons and a tradeoff against
> complicating some use-cases with collections if done differently.
>
> However as Cell and CellComparator is part of the API it also get's used
> in collections and the implicit expectation is that it will compare the
> value as well (I.e. This has potential for some interesting bugs... Yes I
> got bitten by it :)).
>
> Also this doesn't even get mentioned in Cell.equals(Cell, Cell) javadoc
> and the only mention is in KeyValue.equals ("Needed doing 'contains' on
> List.  Only compares the key portion, not the value.").
>
> I saw CellUtil.matchingValue and  Result.compareResults could potentially
> be used, however I'm trying to understand the full context.
>
> I looked over https://issues.apache.org/jira/browse/HBASE-4676 and
> https://issues.apache.org/jira/browse/HBASE-7162 which seem to introduce
> the comparison code, but I couldn't find something explicit so I thought
> that this may have older origins.
>
> Thanks,
> Cosmin
>
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message