Hu Liu, created HDFS-7294:
-----------------------------

             Summary: Use stored timestamp instead of timestamp provided by 
client in FsDatasetImpl#getBlockLocalPathInfo
                 Key: HDFS-7294
                 URL: https://issues.apache.org/jira/browse/HDFS-7294
             Project: Hadoop HDFS
          Issue Type: Bug
    Affects Versions: 2.5.1
            Reporter: Hu Liu,


In current implementation, datanode use the timestamp provided by client 
without checking:
{code}
  public BlockLocalPathInfo getBlockLocalPathInfo(ExtendedBlock block)
      throws IOException {
    File datafile = getBlockFile(block);
    File metafile = FsDatasetUtil.getMetaFile(datafile,     
block.getGenerationStamp());
{code}
But in some scenario, the client may provide wrong timestamp and the 
getBlockLocalPathInfo will return wrong path to client. We can fix it by using 
timestamp of stored block.
Meanwhile, we should also check the  meta file like data file if there is disk 
failure.
{code}
  File validateBlockFile(String bpid, Block b) {
    //Should we check for metadata file too?
    final File f;
    synchronized(this) {
      f = getFile(bpid, b.getBlockId());
    }
    
    if(f != null ) {
      if(f.exists())
        return f;
   
      // if file is not null, but doesn't exist - possibly disk failed
      datanode.checkDiskError();
    }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to