Example usage for org.apache.hadoop.hdfs.server.protocol DatanodeStorage DatanodeStorage

List of usage examples for org.apache.hadoop.hdfs.server.protocol DatanodeStorage DatanodeStorage

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.server.protocol DatanodeStorage DatanodeStorage.

Prototype

public DatanodeStorage(String storageID) 

Source Link

Document

Create a storage with State#NORMAL and StorageType#DEFAULT .

Usage

From source file:io.hops.experiments.benchmarks.blockreporting.TinyDatanode.java

License:Apache License

void register(boolean isDataNodePopulated) throws Exception {
    List<BlockReportingNameNodeHandle> namenodes = nameNodeSelector.getNameNodes();
    // get versions from the namenode
    nsInfo = namenodes.get(0).getDataNodeRPC().versionRequest();
    dnRegistration = new DatanodeRegistration(
            new DatanodeID(DNS.getDefaultIP("default"), DNS.getDefaultHost("default", "default"), "",
                    getNodePort(dnIdx), DFSConfigKeys.DFS_DATANODE_HTTP_DEFAULT_PORT,
                    DFSConfigKeys.DFS_DATANODE_IPC_DEFAULT_PORT),
            new DataStorage(nsInfo, ""), new ExportedBlockKeys(), VersionInfo.getVersion());
    dnRegistration.setStorageID(createNewStorageId(dnRegistration.getXferPort(), dnIdx));
    // register datanode
    for (BlockReportingNameNodeHandle nn : namenodes) {
        dnRegistration = nn.getDataNodeRPC().registerDatanode(dnRegistration);
    }/*from ww  w .j a va2s.  c  o m*/
    //first block reports
    storage = new DatanodeStorage(dnRegistration.getStorageID());
    if (!isDataNodePopulated) {
        firstBlockReport(new BlockListAsLongs(null, null).getBlockListAsLongs());
    }
}