Exemplo n.º 1
0
        public virtual void TestMoveSpecificPaths()
        {
            Log.Info("testMoveSpecificPaths");
            Path foo      = new Path("/foo");
            Path barFile  = new Path(foo, "bar");
            Path foo2     = new Path("/foo2");
            Path bar2File = new Path(foo2, "bar2");
            IDictionary <Path, BlockStoragePolicy> policyMap = Maps.NewHashMap();

            policyMap[foo]  = Cold;
            policyMap[foo2] = Warm;
            TestStorageMover.NamespaceScheme nsScheme = new TestStorageMover.NamespaceScheme(
                Arrays.AsList(foo, foo2), Arrays.AsList(barFile, bar2File), BlockSize, null, policyMap
                );
            TestStorageMover.ClusterScheme clusterScheme = new TestStorageMover.ClusterScheme
                                                               (DefaultConf, NumDatanodes, Repl, GenStorageTypes(NumDatanodes), null);
            TestStorageMover.MigrationTest test = new TestStorageMover.MigrationTest(this, clusterScheme
                                                                                     , nsScheme);
            test.SetupCluster();
            try
            {
                test.PrepareNamespace();
                test.SetStoragePolicy();
                IDictionary <URI, IList <Path> > map = Mover.Cli.GetNameNodePathsToMove(test.conf, "-p"
                                                                                        , "/foo/bar", "/foo2");
                int result = Org.Apache.Hadoop.Hdfs.Server.Mover.Mover.Run(map, test.conf);
                NUnit.Framework.Assert.AreEqual(ExitStatus.Success.GetExitCode(), result);
                Sharpen.Thread.Sleep(5000);
                test.Verify(true);
            }
            finally
            {
                test.ShutdownCluster();
            }
        }
Exemplo n.º 2
0
 public virtual void TestNoSpaceArchive()
 {
     Log.Info("testNoSpaceArchive");
     TestStorageMover.PathPolicyMap pathPolicyMap = new TestStorageMover.PathPolicyMap
                                                        (0);
     TestStorageMover.NamespaceScheme nsScheme      = pathPolicyMap.NewNamespaceScheme();
     TestStorageMover.ClusterScheme   clusterScheme = new TestStorageMover.ClusterScheme
                                                          (DefaultConf, NumDatanodes, Repl, GenStorageTypes(NumDatanodes), null);
     TestStorageMover.MigrationTest test = new TestStorageMover.MigrationTest(this, clusterScheme
                                                                              , nsScheme);
     try
     {
         test.RunBasicTest(false);
         // create 2 hot files with replication 3
         short replication = 3;
         for (int i = 0; i < 2; i++)
         {
             Path p = new Path(pathPolicyMap.cold, "file" + i);
             DFSTestUtil.CreateFile(test.dfs, p, BlockSize, replication, 0L);
             WaitForAllReplicas(replication, p, test.dfs);
         }
         // set all the ARCHIVE volume to full
         foreach (DataNode dn in test.cluster.GetDataNodes())
         {
             SetVolumeFull(dn, StorageType.Archive);
             DataNodeTestUtils.TriggerHeartbeat(dn);
         }
         {
             // test increasing replication but new replicas cannot be created
             // since no more ARCHIVE space.
             Path file0 = new Path(pathPolicyMap.cold, "file0");
             TestStorageMover.Replication r = test.GetReplication(file0);
             NUnit.Framework.Assert.AreEqual(0, r.disk);
             short newReplication = (short)5;
             test.dfs.SetReplication(file0, newReplication);
             Sharpen.Thread.Sleep(10000);
             test.VerifyReplication(file0, 0, r.archive);
         }
         {
             // test creating a hot file
             Path p = new Path(pathPolicyMap.hot, "foo");
             DFSTestUtil.CreateFile(test.dfs, p, BlockSize, (short)3, 0L);
         }
         {
             //test move a cold file to warm
             Path file1 = new Path(pathPolicyMap.cold, "file1");
             test.dfs.Rename(file1, pathPolicyMap.warm);
             test.Migrate();
             test.Verify(true);
         }
     }
     finally
     {
         test.ShutdownCluster();
     }
 }
Exemplo n.º 3
0
 public virtual void TestHotWarmColdDirs()
 {
     Log.Info("testHotWarmColdDirs");
     TestStorageMover.PathPolicyMap pathPolicyMap = new TestStorageMover.PathPolicyMap
                                                        (3);
     TestStorageMover.NamespaceScheme nsScheme      = pathPolicyMap.NewNamespaceScheme();
     TestStorageMover.ClusterScheme   clusterScheme = new TestStorageMover.ClusterScheme
                                                          ();
     TestStorageMover.MigrationTest test = new TestStorageMover.MigrationTest(this, clusterScheme
                                                                              , nsScheme);
     try
     {
         test.RunBasicTest(false);
         pathPolicyMap.MoveAround(test.dfs);
         test.Migrate();
         test.Verify(true);
     }
     finally
     {
         test.ShutdownCluster();
     }
 }