Examples of NNStorage


Examples of org.apache.hadoop.hdfs.server.namenode.NNStorage

      sds.add(FSImageTestUtil.mockStorageDirectory(
          NameNodeDirType.EDITS, false,
          files.toArray(new String[0])));
    }
   
    NNStorage storage = Mockito.mock(NNStorage.class);
    Mockito.doReturn(sds).when(storage).dirIterable(NameNodeDirType.EDITS);
    return storage;
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NNStorage

   *
   * @return the created version file
   */
  public static File[] createNameNodeVersionFile(Configuration conf,
      File[] parent, StorageInfo version, String bpid) throws IOException {
    Storage storage = new NNStorage(conf,
                              Collections.<URI>emptyList(),
                              Collections.<URI>emptyList());
    storage.setStorageInfo(version);
    File[] versionFiles = new File[parent.length];
    for (int i = 0; i < parent.length; i++) {
      versionFiles[i] = new File(parent[i], "VERSION");
      StorageDirectory sd = new StorageDirectory(parent[i].getParentFile());
      storage.writeProperties(versionFiles[i], sd);
    }
    return versionFiles;
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NNStorage

        NotifierConfig.LOG_READER_STREAM_ERROR_SLEEP,
        NotifierConfig.LOG_READER_STREAM_ERROR_SLEEP_DEFAULT);

    if (editsURI != null) {
      if (editsURI.getScheme().equals(NNStorage.LOCAL_URI_SCHEME)) {
        StorageDirectory sd = new NNStorage(new StorageInfo()).new StorageDirectory(
            new File(editsURI.getPath()));
        remoteJournalManager = new FileJournalManagerReadOnly(sd);
      } else {
        throw new IOException("Other journals not supported yet.");
      }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NNStorage

  }
 
  private JournalManager constructJournalManager(URI editsUri)
      throws IOException {
    if (editsUri.getScheme().equals(NNStorage.LOCAL_URI_SCHEME)) {
      StorageDirectory sd = new NNStorage(new StorageInfo()).new StorageDirectory(
          new File(editsUri.getPath()));
      return new FileJournalManagerReadOnly(sd);
    } else if (editsUri.getScheme().equals(QuorumJournalManager.QJM_URI_SCHEME)) {
      return new QuorumJournalManager(conf, editsUri,
              new NamespaceInfo(new StorageInfo()), null, false);
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NNStorage

  private void setUp(String name) throws IOException {
    LOG.info("------ TEST start : " + name);
    FileUtil.fullyDelete(base_dir);
    editsDir = new File(base_dir, "edits");
    storageDirectory = new NNStorage(new StorageInfo(-41, 0, 0)).new StorageDirectory(
        editsDir);
    format(storageDirectory);
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NNStorage

  @Test
  public void testVersion() throws IOException {
    // -37 is pre-transactional layout
    int lv = 12345;
    StorageInfo si = new StorageInfo(lv, 10, 0);
    StorageDirectory sd = new NNStorage(si).new StorageDirectory(editsDir);
    format(sd);

    URI editsURI = Util.stringAsURI(sd.getRoot().getAbsolutePath());
    int version = NotifierUtils.getVersion(editsURI);
    LOG.info("Read version: " + lv);
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NNStorage

  @Test
  public void testMissingVersion() throws IOException {
    // -37 is pre-transactional layout
    int lv = 12345;
    StorageInfo si = new StorageInfo(lv, 10, 0);
    StorageDirectory sd = new NNStorage(si).new StorageDirectory(editsDir);
    format(sd);

    URI editsURI = Util.stringAsURI(sd.getRoot().getAbsolutePath());

    // remove verision file
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NNStorage

   * Read version file from the given directory and return
   * the layout stored therein.
   */
  public static int getVersion(URI editsURI) throws IOException {
    if (editsURI.getScheme().equals(NNStorage.LOCAL_URI_SCHEME)) {
      StorageDirectory sd = new NNStorage(new StorageInfo()).new StorageDirectory(
          new File(editsURI.getPath()));
      File versionFile = sd.getVersionFile();
      if (!versionFile.exists()) {
        throw new IOException("No VERSION file in: " + editsURI + "version file: " + versionFile );
      }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NNStorage

    for (int i = 0; i < parent.length; i++) {
      File versionFile = new File(parent[i], "VERSION");
      FileUtil.fullyDelete(versionFile);
      switch (nodeType) {
      case NAME_NODE:
        storage = new NNStorage(version);
        break;
      case DATA_NODE:
        storage = new DataStorage(version, "doNotCare", null);
        if (version.layoutVersion <= FSConstants.FEDERATION_VERSION) {
          File nsRoot = NameSpaceSliceStorage.getNsRoot(namespaceId, parent[i]);
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NNStorage

 
 
  private void assertExistsInStorageDirs(MiniDFSCluster cluster,
      NameNodeDirType dirType,
      String filename) {
    NNStorage storage = cluster.getNameNode().getNamesystem().getFSImage().storage;
    for (StorageDirectory sd : storage.dirIterable(dirType)) {
      File f = new File(sd.getCurrentDir(), filename);
      assertTrue("Expect that " + f + " exists", f.exists());
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.