/// <exception cref="System.IO.IOException"/>
        internal virtual void UpgradeAndVerify(MiniDFSCluster.Builder bld, TestDFSUpgradeFromImage.ClusterVerifier
                                               verifier)
        {
            MiniDFSCluster cluster = null;

            try
            {
                bld.Format(false).StartupOption(HdfsServerConstants.StartupOption.Upgrade).ClusterId
                    ("testClusterId");
                cluster = bld.Build();
                cluster.WaitActive();
                DistributedFileSystem dfs       = cluster.GetFileSystem();
                DFSClient             dfsClient = dfs.dfs;
                //Safemode will be off only after upgrade is complete. Wait for it.
                while (dfsClient.SetSafeMode(HdfsConstants.SafeModeAction.SafemodeGet))
                {
                    Log.Info("Waiting for SafeMode to be OFF.");
                    try
                    {
                        Sharpen.Thread.Sleep(1000);
                    }
                    catch (Exception)
                    {
                    }
                }
                RecoverAllLeases(dfsClient, new Path("/"));
                VerifyFileSystem(dfs);
                if (verifier != null)
                {
                    verifier.VerifyClusterPostUpgrade(cluster);
                }
            }
            finally
            {
                if (cluster != null)
                {
                    cluster.Shutdown();
                }
            }
        }
示例#2
0
 /// <exception cref="System.IO.IOException"/>
 private static void UpgradeAndVerify(TestDFSUpgradeFromImage upgrade, Configuration
                                      conf, TestDFSUpgradeFromImage.ClusterVerifier verifier)
 {
     upgrade.UpgradeAndVerify(new MiniDFSCluster.Builder(conf).NumDataNodes(1).ManageDataDfsDirs
                                  (false).ManageNameDfsDirs(false), verifier);
 }