HBASE-19502 Make sure we have closed all StoreFileScanner if we fail to open any StoreFileScanners
This commit is contained in:
parent
7c871849de
commit
a489292a83
|
@ -137,6 +137,8 @@ public class StoreFileScanner implements KeyValueScanner {
|
|||
file.initReader();
|
||||
sortedFiles.add(file);
|
||||
}
|
||||
boolean succ = false;
|
||||
try {
|
||||
for (int i = 0, n = files.size(); i < n; i++) {
|
||||
HStoreFile sf = sortedFiles.remove();
|
||||
StoreFileScanner scanner;
|
||||
|
@ -148,6 +150,14 @@ public class StoreFileScanner implements KeyValueScanner {
|
|||
}
|
||||
scanners.add(scanner);
|
||||
}
|
||||
succ = true;
|
||||
} finally {
|
||||
if (!succ) {
|
||||
for (StoreFileScanner scanner : scanners) {
|
||||
scanner.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
return scanners;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue