HBASE-22520 Avoid possible NPE while performing seekBefore in Hal… (#281)
HBASE-22520 Avoid possible NPE while performing seekBefore in HalfStoreFileReader
This commit is contained in:
parent
6ea2566ac3
commit
13c5af38da
|
@ -60,9 +60,9 @@ public class HalfStoreFileReader extends StoreFileReader {
|
||||||
// i.e. empty column and a timestamp of LATEST_TIMESTAMP.
|
// i.e. empty column and a timestamp of LATEST_TIMESTAMP.
|
||||||
protected final byte [] splitkey;
|
protected final byte [] splitkey;
|
||||||
|
|
||||||
protected final Cell splitCell;
|
private final Cell splitCell;
|
||||||
|
|
||||||
private Optional<Cell> firstKey = null;
|
private Optional<Cell> firstKey = Optional.empty();
|
||||||
|
|
||||||
private boolean firstKeySeeked = false;
|
private boolean firstKeySeeked = false;
|
||||||
|
|
||||||
|
@ -269,7 +269,8 @@ public class HalfStoreFileReader extends StoreFileReader {
|
||||||
public boolean seekBefore(Cell key) throws IOException {
|
public boolean seekBefore(Cell key) throws IOException {
|
||||||
if (top) {
|
if (top) {
|
||||||
Optional<Cell> fk = getFirstKey();
|
Optional<Cell> fk = getFirstKey();
|
||||||
if (PrivateCellUtil.compareKeyIgnoresMvcc(getComparator(), key, fk.get()) <= 0) {
|
if (fk.isPresent() &&
|
||||||
|
PrivateCellUtil.compareKeyIgnoresMvcc(getComparator(), key, fk.get()) <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue