Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ public TsFileInsertionEventScanParser(
tsFileSequenceReader.position((long) TSFileConfig.MAGIC_STRING.getBytes().length + 1);

prepareData();
if (Objects.isNull(chunkReader)) {
close();
}
} catch (final Exception e) {
close();
throw e;
Expand Down Expand Up @@ -440,7 +443,7 @@ private void prepareData() throws IOException, IllegalPathException {
} while (Objects.nonNull(chunkReader) && !chunkReader.hasNextSatisfiedPage());

if (Objects.isNull(chunkReader)) {
close();
// Let the caller release the last tablet's memory before closing the parser.
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,16 @@ public void testScanParserReleasesTabletMemoryAfterRawTabletGenerated() throws E
null,
null,
false)) {
replaceAllocatedTabletMemory(
parser,
new PipeMemoryBlock(0) {
@Override
public void close() {
Assert.assertEquals(0, getMemoryUsageInBytes());
super.close();
}
});

final Iterator<TabletInsertionEvent> iterator = parser.toTabletInsertionEvents().iterator();

Assert.assertTrue(iterator.hasNext());
Expand Down
Loading