From 2d17ce39994b0baabd000b7afc68468e58155759 Mon Sep 17 00:00:00 2001 From: larsh Date: Sat, 22 Mar 2014 04:09:16 +0000 Subject: [PATCH] HBASE-10805 Speed up KeyValueHeap.next() a bit git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1580149 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/hadoop/hbase/regionserver/KeyValueHeap.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 b243b0e356f..42702de5747 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 @@ -112,8 +112,8 @@ public class KeyValueHeap extends NonReversedNonLazyKeyValueScanner this.current = pollRealKV(); } else { KeyValueScanner topScanner = this.heap.peek(); - if (topScanner == null || - this.comparator.compare(kvNext, topScanner.peek()) >= 0) { + // no need to add current back to the heap if it is the only scanner left + if (topScanner != null && this.comparator.compare(kvNext, topScanner.peek()) >= 0) { this.heap.add(this.current); this.current = pollRealKV(); }