Hadoop 2.6.0 FSDirectory源代码分析

来源:互联网 发布:mac如何安装应用程序 编辑:程序博客网 时间:2024/05/15 14:51

FSDirectory和FSNamesystem类管理命名空间的状态,FSDirectory 完全是内存的数据结构,它的所有操作都发生在内存中。相反,FSNamesystem把所有的操作都持久化到磁盘上。

/** * Both FSDirectory and FSNamesystem manage the state of the namespace. * FSDirectory is a pure in-memory data structure, all of whose operations * happen entirely in memory. In contrast, FSNamesystem persists the operations * to the disk. * @see org.apache.hadoop.hdfs.server.namenode.FSNamesystem **/


创建根结点的方法如下,

 private static INodeDirectory createRoot(FSNamesystem namesystem) {    final INodeDirectory r = new INodeDirectory(        INodeId.ROOT_INODE_ID,        INodeDirectory.ROOT_NAME,        namesystem.createFsOwnerPermissions(new FsPermission((short) 0755)),        0L);    r.addDirectoryWithQuotaFeature(        DirectoryWithQuotaFeature.DEFAULT_NAMESPACE_QUOTA,        DirectoryWithQuotaFeature.DEFAULT_DISKSPACE_QUOTA);    r.addSnapshottableFeature();    r.setSnapshotQuota(0);    return r;  }




0 0
原创粉丝点击