@@ -1294,24 +1294,32 @@ public Reader(CachableBlockFile.CachableBuilder b) throws IOException {
1294
1294
this (new CachableBlockFile .Reader (b ));
1295
1295
}
1296
1296
1297
- private void closeLocalityGroupReaders () {
1297
+ private void closeLocalityGroupReaders (boolean ignoreIOExceptions ) throws IOException {
1298
1298
for (LocalityGroupReader lgr : currentReaders ) {
1299
1299
try {
1300
1300
lgr .close ();
1301
1301
} 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
+ }
1303
1307
}
1304
1308
}
1305
1309
}
1306
1310
1307
1311
@ Override
1308
- public void closeDeepCopies () {
1312
+ public void closeDeepCopies () throws IOException {
1313
+ closeDeepCopies (false );
1314
+ }
1315
+
1316
+ private void closeDeepCopies (boolean ignoreIOExceptions ) throws IOException {
1309
1317
if (deepCopy ) {
1310
1318
throw new IllegalStateException ("Calling closeDeepCopies on a deep copy is not supported" );
1311
1319
}
1312
1320
1313
1321
for (Reader deepCopy : deepCopies ) {
1314
- deepCopy .closeLocalityGroupReaders ();
1322
+ deepCopy .closeLocalityGroupReaders (ignoreIOExceptions );
1315
1323
}
1316
1324
1317
1325
deepCopies .clear ();
@@ -1323,8 +1331,9 @@ public void close() throws IOException {
1323
1331
throw new IllegalStateException ("Calling close on a deep copy is not supported" );
1324
1332
}
1325
1333
1326
- closeDeepCopies ();
1327
- closeLocalityGroupReaders ();
1334
+ // Closes as much as possible igoring and logging exceptions along the way
1335
+ closeDeepCopies (true );
1336
+ closeLocalityGroupReaders (true );
1328
1337
1329
1338
if (sampleReaders != null ) {
1330
1339
for (LocalityGroupReader lgr : sampleReaders ) {
0 commit comments