微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。