Examples of NNStorage


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

 
 
  private void assertExistsInStorageDirs(MiniDFSCluster cluster,
      NameNodeDirType dirType,
      String filename) {
    NNStorage storage = cluster.getNamesystem().getFSImage().getStorage();
    for (StorageDirectory sd : storage.dirIterable(dirType)) {
      File f = new File(sd.getCurrentDir(), filename);
      assertTrue("Expect that " + f + " exists", f.exists());
    }
  }
View Full Code Here

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

   * Tests the getEditLogManifest function using mock storage for a number
   * of different situations.
   */
  @Test
  public void testEditLogManifestMocks() throws IOException {
    NNStorage storage;
    FSEditLog log;
    // Simple case - different directories have the same
    // set of logs, with an in-progress one at end
    storage = mockStorageWithEdits(
        "[1,100]|[101,200]|[201,]",
View Full Code Here

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

      long txid = dfs.rollEdits();
      Assert.assertTrue(txid > 0);

      int retries = 0;
      while (++retries < 5) {
        NNStorage storage = dfsCluster.getNamesystem(1).getFSImage()
            .getStorage();
        if (storage.getFsImageName(txid - 1) != null) {
          return;
        }
        Thread.sleep(1000);
      }
      Assert.fail("new checkpoint does not exist");
View Full Code Here

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

        "=====================================================");

    long imageTxId = proxy.getMostRecentCheckpointTxId();
    long curTxId = proxy.getTransactionID();
   
    NNStorage storage = new NNStorage(conf, dirsToFormat, editUrisToFormat);
   
    // Check with the user before blowing away data.
    if (!Storage.confirmFormat(storage.dirIterable(null),
            force, interactive)) {
      return ERR_CODE_ALREADY_FORMATTED;
    }
   
    // Format the storage (writes VERSION file)
    storage.format(nsInfo);

    // Load the newly formatted image, using all of the directories (including shared
    // edits)
    FSImage image = new FSImage(conf);
    image.getStorage().setStorageInfo(storage);
View Full Code Here

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

      dfs.setSafeMode(SafeModeAction.SAFEMODE_LEAVE);
      // create new directory
      dfs.mkdirs(bar);

      // check NNStorage
      NNStorage storage = cluster.getNamesystem().getFSImage().getStorage();
      checkNNStorage(storage, 3, -1); // (startSegment, mkdir, endSegment)
    } finally {
      if (cluster != null) {
        cluster.shutdown();
      }
    }

    NameNode nn = null;
    try {
      nn = NameNode.createNameNode(new String[] { "-rollingUpgrade",
          "rollback" }, conf);
      // make sure /foo is still there, but /bar is not
      INode fooNode = nn.getNamesystem().getFSDirectory()
          .getINode4Write(foo.toString());
      Assert.assertNotNull(fooNode);
      INode barNode = nn.getNamesystem().getFSDirectory()
          .getINode4Write(bar.toString());
      Assert.assertNull(barNode);

      // check the details of NNStorage
      NNStorage storage = nn.getNamesystem().getFSImage().getStorage();
      // (startSegment, upgrade marker, mkdir, endSegment)
      checkNNStorage(storage, 3, 7);
    } finally {
      if (nn != null) {
        nn.stop();
View Full Code Here

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

      dfs = dfsCluster.getFileSystem(0);
      Assert.assertTrue(dfs.exists(foo));
      Assert.assertFalse(dfs.exists(bar));

      // check the details of NNStorage
      NNStorage storage = dfsCluster.getNamesystem(0).getFSImage()
          .getStorage();
      // segments:(startSegment, mkdir, start upgrade endSegment),
      // (startSegment, mkdir, endSegment)
      checkNNStorage(storage, 4, 7);
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.getNamesystem().getFSImage().getStorage();
    for (StorageDirectory sd : storage.dirIterable(dirType)) {
      File f = new File(sd.getCurrentDir(), filename);
      assertTrue("Expect that " + f + " exists", f.exists());
    }
  }
View Full Code Here

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

   * Tests the getEditLogManifest function using mock storage for a number
   * of different situations.
   */
  @Test
  public void testEditLogManifestMocks() throws IOException {
    NNStorage storage;
    FSEditLog log;
    // Simple case - different directories have the same
    // set of logs, with an in-progress one at end
    storage = mockStorageWithEdits(
        "[1,100]|[101,200]|[201,]",
View Full Code Here

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
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.