[
https://issues.apache.org/jira/browse/HDFS-7885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14347963#comment-14347963
]
Zhanwei Wang commented on HDFS-7885:
------------------------------------
In function {{getBlockLocalPathInfo}} the input parameter {{block}} is passed
by the client. Since client will buffer file's metadata,
block.getGenerationStamp() may be older then the real generationStamp on
Datanode. Datanode will report that it cannot find metadata file and then
client fail to read.
{code}
@Override // FsDatasetSpi
public BlockLocalPathInfo getBlockLocalPathInfo(ExtendedBlock block)
throws IOException {
File datafile = getBlockFile(block);
File metafile = FsDatasetUtil.getMetaFile(datafile,
block.getGenerationStamp());
BlockLocalPathInfo info = new BlockLocalPathInfo(block,
datafile.getAbsolutePath(), metafile.getAbsolutePath());
return info;
}
{code}
Test case
enable read-circuit and set {{dfs.client.use.legacy.blockreader.local}} to true
1) crete a file with two blocks.
2) open it for read, but not read. (client fetch block metadata)
3) append to it. (increase generation stamp of last block)
4) continue to read. (will fail)
> Datanode should not trust the generation stamp provided by client
> -----------------------------------------------------------------
>
> Key: HDFS-7885
> URL: https://issues.apache.org/jira/browse/HDFS-7885
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: datanode
> Affects Versions: 2.2.0
> Reporter: vitthal (Suhas) Gogate
> Priority: Critical
>
> Datanode should not trust the generation stamp provided by client, since it
> is prefetched and buffered in client, and concurrent append may increase it.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)