/** */ public void testDistributedUpgrade() throws Exception { int numDirs = 1; TestDFSUpgradeFromImage testImg = new TestDFSUpgradeFromImage(); testImg.unpackStorage(); int numDNs = testImg.numDataNodes; // register new upgrade objects (ignore all existing) UpgradeObjectCollection.initialize(); UpgradeObjectCollection.registerUpgrade(new UO_Datanode1()); UpgradeObjectCollection.registerUpgrade(new UO_Namenode1()); UpgradeObjectCollection.registerUpgrade(new UO_Datanode2()); UpgradeObjectCollection.registerUpgrade(new UO_Namenode2()); UpgradeObjectCollection.registerUpgrade(new UO_Datanode3()); UpgradeObjectCollection.registerUpgrade(new UO_Namenode3()); conf = new Configuration(); if (System.getProperty("test.build.data") == null) { // to test to be run outside of ant System.setProperty("test.build.data", "build/test/data"); } conf.setInt("dfs.datanode.scan.period.hours", -1); // block scanning off log("NameNode start in regular mode when dustributed upgrade is required", numDirs); startNameNodeShouldFail(StartupOption.REGULAR); log("Start NameNode only distributed upgrade", numDirs); // cluster = new MiniDFSCluster(conf, 0, StartupOption.UPGRADE); cluster = new MiniDFSCluster(0, conf, 0, false, true, StartupOption.UPGRADE, null); cluster.shutdown(); log("NameNode start in regular mode when dustributed upgrade has been started", numDirs); startNameNodeShouldFail(StartupOption.REGULAR); log("NameNode rollback to the old version that require a dustributed upgrade", numDirs); startNameNodeShouldFail(StartupOption.ROLLBACK); log("Normal distributed upgrade for the cluster", numDirs); cluster = new MiniDFSCluster(0, conf, numDNs, false, true, StartupOption.UPGRADE, null); DFSAdmin dfsAdmin = new DFSAdmin(); dfsAdmin.setConf(conf); dfsAdmin.run(new String[] {"-safemode", "wait"}); dfsAdmin.run(new String[] {"-finalizeUpgrade"}); cluster.shutdown(); // it should be ok to start in regular mode log("NameCluster regular startup after the upgrade", numDirs); cluster = new MiniDFSCluster(0, conf, numDNs, false, true, StartupOption.REGULAR, null); cluster.waitActive(); cluster.shutdown(); }
/** */ public void testDistributedUpgrade() throws Exception { int numDirs = 1; TestDFSUpgradeFromImage testImg = new TestDFSUpgradeFromImage(); testImg.unpackStorage(); int numDNs = testImg.numDataNodes; // register new upgrade objects (ignore all existing) UpgradeObjectCollection.initialize(); UpgradeObjectCollection.registerUpgrade(new UO_Datanode1()); UpgradeObjectCollection.registerUpgrade(new UO_Namenode1()); UpgradeObjectCollection.registerUpgrade(new UO_Datanode2()); UpgradeObjectCollection.registerUpgrade(new UO_Namenode2()); UpgradeObjectCollection.registerUpgrade(new UO_Datanode3()); UpgradeObjectCollection.registerUpgrade(new UO_Namenode3()); conf = new Configuration(); if (System.getProperty("test.build.data") == null) { // to test to be run outside of ant System.setProperty("test.build.data", "build/test/data"); } conf.setInt("dfs.datanode.scan.period.hours", -1); // block scanning off log("NameNode start in regular mode when dustributed upgrade is required", numDirs); startNameNodeShouldFail(StartupOption.REGULAR); log("Start NameNode only distributed upgrade", numDirs); // cluster = new MiniDFSCluster(conf, 0, StartupOption.UPGRADE); cluster = new MiniDFSCluster(0, conf, 0, false, true, StartupOption.UPGRADE, null); cluster.shutdown(); log("NameNode start in regular mode when dustributed upgrade has been started", numDirs); startNameNodeShouldFail(StartupOption.REGULAR); log("NameNode rollback to the old version that require a dustributed upgrade", numDirs); startNameNodeShouldFail(StartupOption.ROLLBACK); log("Normal distributed upgrade for the cluster", numDirs); cluster = new MiniDFSCluster(0, conf, numDNs, false, true, StartupOption.UPGRADE, null); DFSAdmin dfsAdmin = new DFSAdmin(); dfsAdmin.setConf(conf); dfsAdmin.run(new String[] {"-safemode", "wait"}); cluster.shutdown(); // it should be ok to start in regular mode log("NameCluster regular startup after the upgrade", numDirs); cluster = new MiniDFSCluster(0, conf, numDNs, false, true, StartupOption.REGULAR, null); cluster.waitActive(); cluster.shutdown(); }
/** */ public void testDistributedUpgrade() throws Exception { int numDirs = 1; TestDFSUpgradeFromImage testImg = new TestDFSUpgradeFromImage(); testImg.unpackStorage(); int numDNs = testImg.numDataNodes; // register new upgrade objects (ignore all existing) UpgradeObjectCollection.initialize(); UpgradeObjectCollection.registerUpgrade(new UO_Datanode1()); UpgradeObjectCollection.registerUpgrade(new UO_Namenode1()); UpgradeObjectCollection.registerUpgrade(new UO_Datanode2()); UpgradeObjectCollection.registerUpgrade(new UO_Namenode2()); UpgradeObjectCollection.registerUpgrade(new UO_Datanode3()); UpgradeObjectCollection.registerUpgrade(new UO_Namenode3()); conf = new HdfsConfiguration(); if (System.getProperty("test.build.data") == null) { // to test to be run outside of ant System.setProperty("test.build.data", "build/test/data"); } conf.setInt("dfs.datanode.scan.period.hours", -1); // block scanning off log("NameNode start in regular mode when dustributed upgrade is required", numDirs); startNameNodeShouldFail(StartupOption.REGULAR); log("Start NameNode only distributed upgrade", numDirs); // cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0).format(false) // .startupOption(StartupOption.UPGRADE).build(); cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0) .format(false) .startupOption(StartupOption.UPGRADE) .build(); cluster.shutdown(); log("NameNode start in regular mode when dustributed upgrade has been started", numDirs); startNameNodeShouldFail(StartupOption.REGULAR); log("NameNode rollback to the old version that require a dustributed upgrade", numDirs); startNameNodeShouldFail(StartupOption.ROLLBACK); log("Normal distributed upgrade for the cluster", numDirs); cluster = new MiniDFSCluster.Builder(conf) .numDataNodes(numDNs) .format(false) .startupOption(StartupOption.UPGRADE) .build(); DFSAdmin dfsAdmin = new DFSAdmin(); dfsAdmin.setConf(conf); dfsAdmin.run(new String[] {"-safemode", "wait"}); cluster.shutdown(); // it should be ok to start in regular mode log("NameCluster regular startup after the upgrade", numDirs); cluster = new MiniDFSCluster.Builder(conf) .numDataNodes(numDNs) .format(false) .startupOption(StartupOption.REGULAR) .build(); cluster.waitActive(); cluster.shutdown(); }