-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-18296. Memory fragmentation in ChecksumFileSystem readVectored() #7732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
steveloughran
merged 9 commits into
apache:branch-3.4
from
steveloughran:s3/HADOOP-18296-readbuffer-leak-branch-3.4
Jul 21, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
86d6bac
HADOOP-18296. Memory fragmentation in ChecksumFileSystem readVectored()
steveloughran 995fcc4
HADOOP-18296. Buffer slicing in checksum fs
steveloughran 3c855c0
explicitly disable analytics on the classic vector read tests
steveloughran 0ea6638
review and checkstyle
steveloughran b51f2e8
HADOOP-18296. review feedback
steveloughran de78242
HADOOP-18296. test failure
steveloughran b663701
HADOOP-18296. review feedback and test failure.
steveloughran 6daf71b
HADOOP-18296. other bits of review feedback.
steveloughran f749eeb
HADOOP-18296. Feedback & use internal @VisibleForTesting tag
steveloughran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,7 @@ | |
import org.apache.hadoop.util.StringUtils; | ||
|
||
import static org.apache.hadoop.fs.VectoredReadUtils.LOG_BYTE_BUFFER_RELEASED; | ||
import static org.apache.hadoop.fs.VectoredReadUtils.hasVectorIOCapability; | ||
import static org.apache.hadoop.fs.VectoredReadUtils.sortRangeList; | ||
import static org.apache.hadoop.fs.VectoredReadUtils.validateRangeRequest; | ||
import static org.apache.hadoop.fs.impl.PathCapabilitiesSupport.validatePathCapabilityArgs; | ||
|
@@ -293,15 +294,12 @@ public FileDescriptor getFileDescriptor() throws IOException { | |
|
||
@Override | ||
public boolean hasCapability(String capability) { | ||
// a bit inefficient, but intended to make it easier to add | ||
// new capabilities. | ||
switch (capability.toLowerCase(Locale.ENGLISH)) { | ||
case StreamCapabilities.IOSTATISTICS: | ||
case StreamCapabilities.IOSTATISTICS_CONTEXT: | ||
case StreamCapabilities.VECTOREDIO: | ||
return true; | ||
default: | ||
return false; | ||
return hasVectorIOCapability(capability); | ||
} | ||
} | ||
|
||
|
@@ -400,7 +398,9 @@ private void initiateRead() { | |
for(int i = 0; i < ranges.size(); ++i) { | ||
FileRange range = ranges.get(i); | ||
buffers[i] = allocateRelease.getBuffer(false, range.getLength()); | ||
channel.read(buffers[i], range.getOffset(), i, this); | ||
final ByteBuffer buffer = buffers[i]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any specific reason for this refactoring and making it final? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets me refer to it in the debug() statement |
||
LOG.debug("Reading file range {} into buffer {}", range, System.identityHashCode(buffer)); | ||
channel.read(buffer, range.getOffset(), i, this); | ||
} | ||
} | ||
|
||
|
@@ -416,6 +416,8 @@ private void initiateRead() { | |
public void completed(Integer result, Integer rangeIndex) { | ||
FileRange range = ranges.get(rangeIndex); | ||
ByteBuffer buffer = buffers[rangeIndex]; | ||
LOG.debug("Completed read range {} into buffer {} outcome={} remaining={}", | ||
range, System.identityHashCode(buffer), result, buffer.remaining()); | ||
if (result == -1) { | ||
// no data was read back. | ||
failed(new EOFException("Read past End of File"), rangeIndex); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this actually change the logic? It seems like
hasVectorIOCapability
checksStreamCapabilities.VECTOREDIO
, just like the old code did.