[
https://issues.apache.org/jira/browse/HDFS-14101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16699560#comment-16699560
]
Kihwal Lee commented on HDFS-14101:
-----------------------------------
The test creates two files with random sizes. In a failed run, one was 295
bytes and the other 1 byte.
Then the meta file is overwritten to corrupt the block.
{code:java}
List<File> metaFiles = MiniDFSCluster.getAllBlockFiles(data_dir);
...
File metaFile = metaFiles.get(0);
RandomAccessFile file = new RandomAccessFile(metaFile, "rw");
FileChannel channel = file.getChannel();
long position = channel.size() - 2;
...
channel.write(ByteBuffer.wrap(buffer), position);
{code}
At a glance, the meta file cannot be 0 or 1 byte long, since it has a header.
But the implementation of {{getAllBlockFiles()}} does not return meta files. It
actually returns list of data files.
{code:java}
for (File f : files) {
if (f.getName().startsWith(Block.BLOCK_FILE_PREFIX) &&
!f.getName().endsWith(Block.METADATA_EXTENSION)) {
results.add(f);
...
}
{code}
So this test fails if the random test file length happens to be too small.
> Random failure of testListCorruptFilesCorruptedBlock
> ----------------------------------------------------
>
> Key: HDFS-14101
> URL: https://issues.apache.org/jira/browse/HDFS-14101
> Project: Hadoop HDFS
> Issue Type: Bug
> Affects Versions: 2.8.5
> Reporter: Kihwal Lee
> Priority: Major
>
> We've seen this occasionally.
> {noformat}
> java.lang.IllegalArgumentException: Negative position
> at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:755)
> at org.apache.hadoop.hdfs.server.namenode.
>
> TestListCorruptFileBlocks.testListCorruptFilesCorruptedBlock(TestListCorruptFileBlocks.java:105)
> {noformat}
> The test has a flaw.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]