*/
public RowResult getClosestRowBefore(final byte [] row)
throws IOException{
// look across all the HStores for this region and determine what the
// closest key is across all column families, since the data may be sparse
HStoreKey key = null;
checkRow(row);
splitsAndClosesLock.readLock().lock();
try {
// examine each column family for the preceeding or matching key
for (HStore store : stores.values()) {
// get the closest key
byte [] closestKey = store.getRowKeyAtOrBefore(row);
// if it happens to be an exact match, we can stop looping
if (Bytes.equals(row, closestKey)) {
key = new HStoreKey(closestKey);
break;
}
// otherwise, we need to check if it's the max and move to the next
if (closestKey != null
&& (key == null || Bytes.compareTo(closestKey, key.getRow()) > 0) ) {
key = new HStoreKey(closestKey);
}
}
if (key == null) {
return null;
}
// now that we've found our key, get the values
HbaseMapWritable<byte [], Cell> cells =
new HbaseMapWritable<byte [], Cell>();
for (HStore s: stores.values()) {
s.getFull(key, null, cells);
}
return new RowResult(key.getRow(), cells);
} finally {
splitsAndClosesLock.readLock().unlock();
}
}