Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a494af3
GH-3558: Properly close buffers
Fokko May 13, 2026
d1a7cec
Track the buffers and close all the resources in tests
Fokko May 13, 2026
00931ba
Disable verification for now
Fokko May 16, 2026
e4dc4fc
Merge branch 'fd-correctly-close-buffers' of github.com:Fokko/parquet…
Fokko May 16, 2026
ca0ce18
Reduce changes
Fokko May 16, 2026
0ec9fde
Merge branch 'master' into fd-correctly-close-buffers
Fokko Jun 21, 2026
a470682
Merge branch 'master' of github.com:apache/parquet-java into fd-corre…
Fokko Jun 21, 2026
c6e92d1
Merge branch 'fd-correctly-close-buffers' of github.com:Fokko/parquet…
Fokko Jun 21, 2026
ffd978e
Spotless
Fokko Jun 21, 2026
81297e1
Revert some unrelated changes
Fokko Jun 21, 2026
6a2fe5e
Thanks Gang
Fokko Jul 12, 2026
4b45d07
Merge branch 'master' into fd-correctly-close-buffers
Fokko Jul 14, 2026
8fc07d2
Merge branch 'master' of github.com:apache/parquet-java into fd-corre…
Fokko Jul 17, 2026
4fbc84e
Revert "Thanks Gang"
Fokko Jul 17, 2026
e1edc2d
Release in try-catch
Fokko Jul 17, 2026
cb6d8f5
Fix failing test
Fokko Jul 17, 2026
28778e6
Revert unrelated changes
Fokko Jul 17, 2026
8bc2f2d
Merge branch 'master' into fd-correctly-close-buffers
Fokko Sep 4, 2026
84dd78f
Move registering the buffer up
Fokko Sep 4, 2026
15242c9
Revert unrelated change
Fokko Sep 4, 2026
f0703ef
Merge branch 'master' of github.com:apache/parquet-java into fd-corre…
Fokko Sep 4, 2026
83d784d
Merge branch 'master' of github.com:apache/parquet-java into fd-corre…
Fokko Sep 4, 2026
a32e652
Merge branch 'master' of github.com:apache/parquet-java into fd-corre…
Fokko Sep 7, 2026
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 @@ -464,7 +464,12 @@ private String cacheKey(CompressionCodecName codecName) {

private String cacheKey(CompressionCodecName codecName, int level) {
String codecClass = codecName.getHadoopCompressionCodecClassName();
return (codecClass == null ? codecName.name() : codecClass) + ":" + level;
// Use a distinct namespace ("#level=") for the leveled path so that this key can never
// collide with the no-level cacheKey(codecName), which appends the raw configuration value
// (e.g. "<codecClass>:5" when zlib.compress.level=5 is set directly). Both maps that use
// these keys (the per-factory compressors map and the shared static CODEC_BY_NAME) would
// otherwise return a codec built from the raw config instead of the level-configured one.
return (codecClass == null ? codecName.name() : codecClass) + "#level=" + level;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1191,10 +1191,18 @@ private ColumnChunkPageReadStore internalReadRowGroup(int blockIndex) throws IOE
}
// actually read all the chunks
ChunkListBuilder builder = new ChunkListBuilder(block.getRowCount());
readAllPartsVectoredOrNormal(allParts, builder);
rowGroup.setReleaser(builder.releaser);
for (Chunk chunk : builder.build()) {
readChunkPages(chunk, block, rowGroup);
try {
readAllPartsVectoredOrNormal(allParts, builder);
rowGroup.setReleaser(builder.releaser);
for (Chunk chunk : builder.build()) {
readChunkPages(chunk, block, rowGroup);
}
} catch (RuntimeException | IOException e) {
// If we fail before the releaser is transferred to the row group (e.g. a vectored range
// times out after earlier ranges already registered their buffers), release any buffers
// that were registered so far so that partially-read row groups do not leak.
builder.releaser.close();
throw e;
}

return rowGroup;
Expand Down Expand Up @@ -1466,10 +1474,18 @@ private ColumnChunkPageReadStore internalReadFilteredRowGroup(
}
}
}
readAllPartsVectoredOrNormal(allParts, builder);
rowGroup.setReleaser(builder.releaser);
for (Chunk chunk : builder.build()) {
readChunkPages(chunk, block, rowGroup);
try {
readAllPartsVectoredOrNormal(allParts, builder);
rowGroup.setReleaser(builder.releaser);
for (Chunk chunk : builder.build()) {
readChunkPages(chunk, block, rowGroup);
}
} catch (RuntimeException | IOException e) {
// If we fail before the releaser is transferred to the row group (e.g. a vectored range
// times out after earlier ranges already registered their buffers), release any buffers
// that were registered so far so that partially-read row groups do not leak.
builder.releaser.close();
throw e;
}

return rowGroup;
Expand Down Expand Up @@ -2369,6 +2385,12 @@ public void readFromVectoredRange(ParquetFileRange currRange, ChunkListBuilder b
currRange,
timeoutSeconds);
buffer = FutureIO.awaitFuture(currRange.getDataReadFuture(), timeoutSeconds, TimeUnit.SECONDS);
// Register the buffer for release as soon as it is acquired, before running any code that
// could throw (the metrics callback below is user-supplied). Otherwise an exception here
// would leak this buffer, since the row group has not yet taken ownership of the releaser.
// Requires fs.file.checksum.verify=false so the returned buffer is the allocator buffer
// rather than a sliced subset (see Hadoop's fs.file.checksum.verify docs).
builder.addBuffersToRelease(Collections.singletonList(buffer));
setReadMetrics(readStart, currRange.getLength());
// report in a counter the data we just scanned
BenchmarkCounter.incrementBytesRead(currRange.getLength());
Expand Down
33 changes: 33 additions & 0 deletions parquet-hadoop/src/test/resources/core-site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configuration>
<property>
<name>fs.file.checksum.verify</name>
<value>false</value>
<description>
Disable checksum verification on the local file system used by tests.
Hadoop's ChecksumFileSystem.readVectored allocates checksum buffers via
the caller-supplied ByteBufferAllocator without releasing them; the
leaked buffers trip TrackingByteBufferAllocator leak detection in tests.
Turning off checksum verification skips the checksum read path entirely
and avoids the leak.
</description>
</property>
</configuration>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<spotless.version>3.8.0</spotless.version>
<shade.prefix>shaded.parquet</shade.prefix>
<!-- Guarantees no newer classes/methods/constants are used by parquet. -->
<hadoop.version>3.3.0</hadoop.version>
<hadoop.version>3.4.2</hadoop.version>
<previous.version>1.18.0</previous.version>
<thrift.executable>thrift</thrift.executable>
<format.thrift.executable>${thrift.executable}</format.thrift.executable>
Expand Down
Loading