This is an automated email from the ASF dual-hosted git repository.
apurtell pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 332575f HBASE-22520 Avoid possible NPE while performing seekBefore in
Hal… (#281)
332575f is described below
commit 332575fa228dfe105e4e7b332e4a63f68752d1cc
Author: virajjasani <[email protected]>
AuthorDate: Fri Jun 7 04:13:36 2019 +0530
HBASE-22520 Avoid possible NPE while performing seekBefore in Hal… (#281)
HBASE-22520 Avoid possible NPE while performing seekBefore in
HalfStoreFileReader
---
.../main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git
a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java
index 2e112c1..11ab068 100644
---
a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java
+++
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java
@@ -60,9 +60,9 @@ public class HalfStoreFileReader extends StoreFileReader {
// i.e. empty column and a timestamp of LATEST_TIMESTAMP.
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;
@@ -269,7 +269,8 @@ public class HalfStoreFileReader extends StoreFileReader {
public boolean seekBefore(Cell key) throws IOException {
if (top) {
Optional<Cell> fk = getFirstKey();
- if (PrivateCellUtil.compareKeyIgnoresMvcc(getComparator(), key,
fk.get()) <= 0) {
+ if (fk.isPresent() &&
+ PrivateCellUtil.compareKeyIgnoresMvcc(getComparator(), key,
fk.get()) <= 0) {
return false;
}
} else {