HBASE-1107 NPE in HStoreScanner.updateReaders
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@731730 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fe345b23bc
commit
18f3f2269b
|
@ -127,6 +127,7 @@ Release 0.19.0 - Unreleased
|
|||
HBASE-1093 NPE in HStore#compact
|
||||
HBASE-1097 SequenceFile.Reader keeps around buffer whose size is that of
|
||||
largest item read -> results in lots of dead heap
|
||||
HBASE-1107 NPE in HStoreScanner.updateReaders
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-901 Add a limit to key length, check key and value length on client side
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -59,6 +60,9 @@ class HStoreScanner implements InternalScanner, ChangedReadersObserver {
|
|||
|
||||
// Used around transition from no storefile to the first.
|
||||
private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
|
||||
// Used to indicate that the scanner has closed (see HBASE-1107)
|
||||
private final AtomicBoolean closing = new AtomicBoolean(false);
|
||||
|
||||
/** Create an Scanner with a handle on the memcache and HStore files. */
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -294,6 +298,7 @@ class HStoreScanner implements InternalScanner, ChangedReadersObserver {
|
|||
}
|
||||
|
||||
public void close() {
|
||||
this.closing.set(true);
|
||||
this.store.deleteChangedReaderObserver(this);
|
||||
doClose();
|
||||
}
|
||||
|
@ -309,6 +314,9 @@ class HStoreScanner implements InternalScanner, ChangedReadersObserver {
|
|||
// Implementation of ChangedReadersObserver
|
||||
|
||||
public void updateReaders() throws IOException {
|
||||
if (this.closing.get()) {
|
||||
return;
|
||||
}
|
||||
this.lock.writeLock().lock();
|
||||
try {
|
||||
MapFile.Reader [] readers = this.store.getReaders();
|
||||
|
|
Loading…
Reference in New Issue