Esempio n. 1
0
        public virtual void TestTailer()
        {
            Configuration conf = new HdfsConfiguration();

            conf.SetInt(DFSConfigKeys.DfsHaTaileditsPeriodKey, 1);
            HAUtil.SetAllowStandbyReads(conf, true);
            MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).NnTopology(MiniDFSNNTopology
                                                                                 .SimpleHATopology()).NumDataNodes(0).Build();

            cluster.WaitActive();
            cluster.TransitionToActive(0);
            NameNode nn1 = cluster.GetNameNode(0);
            NameNode nn2 = cluster.GetNameNode(1);

            try
            {
                for (int i = 0; i < DirsToMake / 2; i++)
                {
                    NameNodeAdapter.Mkdirs(nn1, GetDirPath(i), new PermissionStatus("test", "test", new
                                                                                    FsPermission((short)0x1ed)), true);
                }
                HATestUtil.WaitForStandbyToCatchUp(nn1, nn2);
                for (int i_1 = 0; i_1 < DirsToMake / 2; i_1++)
                {
                    NUnit.Framework.Assert.IsTrue(NameNodeAdapter.GetFileInfo(nn2, GetDirPath(i_1), false
                                                                              ).IsDir());
                }
                for (int i_2 = DirsToMake / 2; i_2 < DirsToMake; i_2++)
                {
                    NameNodeAdapter.Mkdirs(nn1, GetDirPath(i_2), new PermissionStatus("test", "test",
                                                                                      new FsPermission((short)0x1ed)), true);
                }
                HATestUtil.WaitForStandbyToCatchUp(nn1, nn2);
                for (int i_3 = DirsToMake / 2; i_3 < DirsToMake; i_3++)
                {
                    NUnit.Framework.Assert.IsTrue(NameNodeAdapter.GetFileInfo(nn2, GetDirPath(i_3), false
                                                                              ).IsDir());
                }
            }
            finally
            {
                cluster.Shutdown();
            }
        }