Skip to content

Commit

Permalink
Merge branch '2.1' into 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
keith-turner committed Jan 16, 2025
2 parents 98cbd85 + 22831aa commit deefe4d
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 153 deletions.
21 changes: 15 additions & 6 deletions core/src/main/java/org/apache/accumulo/core/file/rfile/RFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -1294,24 +1294,32 @@ public Reader(CachableBlockFile.CachableBuilder b) throws IOException {
this(new CachableBlockFile.Reader(b));
}

private void closeLocalityGroupReaders() {
private void closeLocalityGroupReaders(boolean ignoreIOExceptions) throws IOException {
for (LocalityGroupReader lgr : currentReaders) {
try {
lgr.close();
} catch (IOException e) {
log.warn("Errored out attempting to close LocalityGroupReader.", e);
if (ignoreIOExceptions) {
log.warn("Errored out attempting to close LocalityGroupReader.", e);
} else {
throw e;
}
}
}
}

@Override
public void closeDeepCopies() {
public void closeDeepCopies() throws IOException {
closeDeepCopies(false);
}

private void closeDeepCopies(boolean ignoreIOExceptions) throws IOException {
if (deepCopy) {
throw new IllegalStateException("Calling closeDeepCopies on a deep copy is not supported");
}

for (Reader deepCopy : deepCopies) {
deepCopy.closeLocalityGroupReaders();
deepCopy.closeLocalityGroupReaders(ignoreIOExceptions);
}

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

closeDeepCopies();
closeLocalityGroupReaders();
// Closes as much as possible igoring and logging exceptions along the way
closeDeepCopies(true);
closeLocalityGroupReaders(true);

if (sampleReaders != null) {
for (LocalityGroupReader lgr : sampleReaders) {
Expand Down
Loading

0 comments on commit deefe4d

Please sign in to comment.