org.apache.hadoop.hdfs.server.namenode.ha.BootstrapStandby的实例源码

项目:hadoop    文件TestBootstrapStandbyWithBKJM.java   
/**
 * While boostrapping,in_progress transaction entries should be skipped.
 * Bootstrap usage for BKJM : "-force","-nonInteractive","-skipSharedEditsCheck"
 */
@Test
public void testBootstrapStandbyWithActivenn() throws Exception {
  // make nn0 active
  cluster.transitionToActive(0);

  // do ops and generate in-progress edit log data
  Configuration confNN1 = cluster.getConfiguration(1);
  distributedFileSystem dfs = (distributedFileSystem) HATestUtil
      .configureFailoverFs(cluster,confNN1);
  for (int i = 1; i <= 10; i++) {
    dfs.mkdirs(new Path("/test" + i));
  }
  dfs.close();

  // shutdown nn1 and delete its edit log files
  cluster.shutdownNameNode(1);
  deleteEditLogIfExists(confNN1);
  cluster.getNameNodeRpc(0).setSafeMode(SafeModeAction.SAFEMODE_ENTER,true);
  cluster.getNameNodeRpc(0).saveNamespace();
  cluster.getNameNodeRpc(0).setSafeMode(SafeModeAction.SAFEMODE_LEAVE,true);

  // check without -skipSharedEditsCheck,Bootstrap should fail for BKJM
  // immediately after saveNamespace
  int rc = BootstrapStandby.run(new String[] { "-force","-nonInteractive" },confNN1);
  Assert.assertEquals("Mismatches return code",6,rc);

  // check with -skipSharedEditsCheck
  rc = BootstrapStandby.run(new String[] { "-force","-skipSharedEditsCheck" },rc);

  // Checkpoint as fast as we can,in a tight loop.
  confNN1.setInt(DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_PERIOD_KEY,1);
  cluster.restartNameNode(1);
  cluster.transitionToStandby(1);

  NameNode nn0 = cluster.getNameNode(0);
  HATestUtil.waitForStandbyToCatchUp(nn0,cluster.getNameNode(1));
  long expectedCheckpointTxId = NameNodeAdapter.getNamesystem(nn0)
      .getFSImage().getMostRecentCheckpointTxId();
  HATestUtil.waitForCheckpoint(cluster,1,ImmutableList.of((int) expectedCheckpointTxId));

  // Should have copied over the namespace
  FSImageTestUtil.assertNNHasCheckpoints(cluster,ImmutableList.of((int) expectedCheckpointTxId));
  FSImageTestUtil.assertNNFilesMatch(cluster);
}
项目:aliyun-oss-hadoop-fs    文件TestBootstrapStandbyWithBKJM.java   
/**
 * While boostrapping,true);
  cluster.getNameNodeRpc(0).saveNamespace(0,0);
  cluster.getNameNodeRpc(0).setSafeMode(SafeModeAction.SAFEMODE_LEAVE,ImmutableList.of((int) expectedCheckpointTxId));
  FSImageTestUtil.assertNNFilesMatch(cluster);
}
项目:big-c    文件TestBootstrapStandbyWithBKJM.java   
/**
 * While boostrapping,ImmutableList.of((int) expectedCheckpointTxId));
  FSImageTestUtil.assertNNFilesMatch(cluster);
}
项目:hadoop-2.6.0-cdh5.4.3    文件TestBootstrapStandbyWithBKJM.java   
/**
 * While boostrapping,ImmutableList.of((int) expectedCheckpointTxId));
  FSImageTestUtil.assertNNFilesMatch(cluster);
}
项目:FlexMap    文件TestBootstrapStandbyWithBKJM.java   
/**
 * While boostrapping,ImmutableList.of((int) expectedCheckpointTxId));
  FSImageTestUtil.assertNNFilesMatch(cluster);
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...