HBASE-20350 NullPointerException in Scanner during close()

Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/281c29ff
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/281c29ff
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/281c29ff

Branch: refs/heads/HBASE-19064
Commit: 281c29ff6070e08743ee96b0f7ce916bb1c3bba5
Parents: 199b392
Author: Apekshit Sharma <a...@apache.org>
Authored: Fri Apr 6 20:24:45 2018 -0700
Committer: Michael Stack <st...@apache.org>
Committed: Wed Apr 11 14:34:57 2018 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/281c29ff/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java
index 053ae99..b0f42d7 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java
@@ -224,8 +224,8 @@ public class KeyValueHeap extends 
NonReversedNonLazyKeyValueScanner
       this.current.close();
     }
     if (this.heap != null) {
-      KeyValueScanner scanner;
-      while ((scanner = this.heap.poll()) != null) {
+      // Order of closing the scanners shouldn't matter here, so simply 
iterate and close them.
+      for (KeyValueScanner scanner : heap) {
         scanner.close();
       }
     }

Reply via email to