Skip to content

Commit deefe4d

Browse files
committed
Merge branch '2.1' into 3.1
2 parents 98cbd85 + 22831aa commit deefe4d

File tree

4 files changed

+133
-153
lines changed

4 files changed

+133
-153
lines changed

core/src/main/java/org/apache/accumulo/core/file/rfile/RFile.java

+15-6
Original file line numberDiff line numberDiff line change
@@ -1294,24 +1294,32 @@ public Reader(CachableBlockFile.CachableBuilder b) throws IOException {
12941294
this(new CachableBlockFile.Reader(b));
12951295
}
12961296

1297-
private void closeLocalityGroupReaders() {
1297+
private void closeLocalityGroupReaders(boolean ignoreIOExceptions) throws IOException {
12981298
for (LocalityGroupReader lgr : currentReaders) {
12991299
try {
13001300
lgr.close();
13011301
} catch (IOException e) {
1302-
log.warn("Errored out attempting to close LocalityGroupReader.", e);
1302+
if (ignoreIOExceptions) {
1303+
log.warn("Errored out attempting to close LocalityGroupReader.", e);
1304+
} else {
1305+
throw e;
1306+
}
13031307
}
13041308
}
13051309
}
13061310

13071311
@Override
1308-
public void closeDeepCopies() {
1312+
public void closeDeepCopies() throws IOException {
1313+
closeDeepCopies(false);
1314+
}
1315+
1316+
private void closeDeepCopies(boolean ignoreIOExceptions) throws IOException {
13091317
if (deepCopy) {
13101318
throw new IllegalStateException("Calling closeDeepCopies on a deep copy is not supported");
13111319
}
13121320

13131321
for (Reader deepCopy : deepCopies) {
1314-
deepCopy.closeLocalityGroupReaders();
1322+
deepCopy.closeLocalityGroupReaders(ignoreIOExceptions);
13151323
}
13161324

13171325
deepCopies.clear();
@@ -1323,8 +1331,9 @@ public void close() throws IOException {
13231331
throw new IllegalStateException("Calling close on a deep copy is not supported");
13241332
}
13251333

1326-
closeDeepCopies();
1327-
closeLocalityGroupReaders();
1334+
// Closes as much as possible igoring and logging exceptions along the way
1335+
closeDeepCopies(true);
1336+
closeLocalityGroupReaders(true);
13281337

13291338
if (sampleReaders != null) {
13301339
for (LocalityGroupReader lgr : sampleReaders) {

0 commit comments

Comments
 (0)