hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Beatty <john.bea...@gmail.com>
Subject question about checkAndPut() expected value parameter when testing row nonexistence
Date Sun, 15 Aug 2010 01:32:35 GMT
There appears to be a disconnect between the API [1] and the
implementation [2] of checkAndPut() regarding the expected value
parameter when the caller wants to make the put conditional on the row
not existing. The javadoc states that the caller should use a null
expected value for this purpose, whereas the implementation is
checking for a 0-length byte[]. If a null expected value is given,
checkAndPut() will NPE; see HRegion.java:1520 in trunk.

I believe that null, rather than 0-length byte[], should be used for
requiring row non-existence in checkAndPut(). Besides seeming like the
right API, a 0-length byte[] is technically a valid row key (and least
for a little put/get test I did; I found this surprising).



[1] http://hbase.apache.org/docs/r0.89.20100726/apidocs/org/apache/hadoop/hbase/ipc/HRegionInterface.html#checkAndPut(byte[],
byte[], byte[], byte[], byte[], org.apache.hadoop.hbase.client.Put)

[2] http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?view=markup
-- line 1520

View raw message