Skip to content

Commit

Permalink
[core] fix the problem that RecordReader may not be closed in asynchr…
Browse files Browse the repository at this point in the history
…onous compact thread. (#2309)
  • Loading branch information
liming30 authored Nov 13, 2023
1 parent c9cf20a commit 6fb34fb
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ private void advanceIfNeeded() {
break;
} else {
currentIterator.releaseBatch();
// because reader#readBatch will be affected by interrupt, which will cause
// currentIterator#releaseBatch to be executed twice.
currentIterator = null;
currentIterator = reader.readBatch();
if (currentIterator == null) {
break;
Expand All @@ -89,9 +92,12 @@ private void advanceIfNeeded() {

@Override
public void close() throws Exception {
if (currentIterator != null) {
currentIterator.releaseBatch();
try {
if (currentIterator != null) {
currentIterator.releaseBatch();
}
} finally {
reader.close();
}
reader.close();
}
}

0 comments on commit 6fb34fb

Please sign in to comment.