-
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
Changes from 2 commits
86d6bac
995fcc4
3c855c0
0ea6638
b51f2e8
de78242
b663701
6daf71b
f749eeb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,5 +42,12 @@ public class LocalFileSystemConfigKeys extends CommonConfigurationKeys { | |
public static final String LOCAL_FS_CLIENT_WRITE_PACKET_SIZE_KEY = | ||
"file.client-write-packet-size"; | ||
public static final int LOCAL_FS_CLIENT_WRITE_PACKET_SIZE_DEFAULT = 64*1024; | ||
|
||
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. Unnecessary change? |
||
/** | ||
* Verify checksums on read -default is true. | ||
* <p> | ||
* {@value}. | ||
*/ | ||
public static final String LOCAL_FS_VERIFY_CHECKSUM = "file.verify-checksum"; | ||
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. rename fs.file.checksum.very and delclare in core-defaults to make more visible |
||
} | ||
|
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); | ||
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. Does this actually change the logic? It seems like |
||
} | ||
} | ||
|
||
|
@@ -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); | ||
|
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.
nit: this name seems a bit off to me. Also javadocs.