HBASE-761 IOE: Stream closed exception all over logs
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@678918 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
80843cd04d
commit
440f7256eb
|
@ -23,6 +23,7 @@ import java.io.EOFException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -861,8 +862,8 @@ public class HStore implements HConstants {
|
||||||
* us to throw out deleted values or obsolete versions.
|
* us to throw out deleted values or obsolete versions.
|
||||||
*/
|
*/
|
||||||
private void compactHStoreFiles(final MapFile.Writer compactedOut,
|
private void compactHStoreFiles(final MapFile.Writer compactedOut,
|
||||||
final List<MapFile.Reader> readers) throws IOException {
|
final List<MapFile.Reader> readers)
|
||||||
|
throws IOException {
|
||||||
MapFile.Reader[] rdrs = readers.toArray(new MapFile.Reader[readers.size()]);
|
MapFile.Reader[] rdrs = readers.toArray(new MapFile.Reader[readers.size()]);
|
||||||
try {
|
try {
|
||||||
HStoreKey[] keys = new HStoreKey[rdrs.length];
|
HStoreKey[] keys = new HStoreKey[rdrs.length];
|
||||||
|
@ -897,7 +898,7 @@ public class HStore implements HConstants {
|
||||||
// therefore the one whose value should make it out to the compacted
|
// therefore the one whose value should make it out to the compacted
|
||||||
// store file.
|
// store file.
|
||||||
int smallestKey = -1;
|
int smallestKey = -1;
|
||||||
for(int i = 0; i < rdrs.length; i++) {
|
for (int i = 0; i < rdrs.length; i++) {
|
||||||
if(done[i]) {
|
if(done[i]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -941,8 +942,7 @@ public class HStore implements HConstants {
|
||||||
|
|
||||||
// Advance the smallest key. If that reader's all finished, then
|
// Advance the smallest key. If that reader's all finished, then
|
||||||
// mark it as done.
|
// mark it as done.
|
||||||
if(!rdrs[smallestKey].next(keys[smallestKey],
|
if (!rdrs[smallestKey].next(keys[smallestKey], vals[smallestKey])) {
|
||||||
vals[smallestKey])) {
|
|
||||||
done[smallestKey] = true;
|
done[smallestKey] = true;
|
||||||
rdrs[smallestKey].close();
|
rdrs[smallestKey].close();
|
||||||
rdrs[smallestKey] = null;
|
rdrs[smallestKey] = null;
|
||||||
|
@ -950,14 +950,16 @@ public class HStore implements HConstants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
closeCompactionReaders(readers);
|
closeCompactionReaders(Arrays.asList(rdrs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeCompactionReaders(final List<MapFile.Reader> rdrs) {
|
private void closeCompactionReaders(final List<MapFile.Reader> rdrs) {
|
||||||
for (MapFile.Reader r: rdrs) {
|
for (MapFile.Reader r: rdrs) {
|
||||||
try {
|
try {
|
||||||
|
if (r != null) {
|
||||||
r.close();
|
r.close();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.warn("Exception closing reader for " + this.storeNameStr, e);
|
LOG.warn("Exception closing reader for " + this.storeNameStr, e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue