Ejemplo n.º 1
0
        /// <summary>Restart the cluster, optionally saving a new checkpoint.</summary>
        /// <param name="checkpoint">boolean true to save a new checkpoint</param>
        /// <param name="aclsEnabled">if true, ACL support is enabled</param>
        /// <exception cref="System.Exception">if restart fails</exception>
        private void Restart(bool checkpoint, bool aclsEnabled)
        {
            NameNode nameNode = cluster.GetNameNode();

            if (checkpoint)
            {
                NameNodeAdapter.EnterSafeMode(nameNode, false);
                NameNodeAdapter.SaveNamespace(nameNode);
            }
            Shutdown();
            InitCluster(false, aclsEnabled);
        }
Ejemplo n.º 2
0
        public virtual void TestRemoveLeaseWithPrefixPath()
        {
            MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).NumDataNodes(2).Build();

            cluster.WaitActive();
            LeaseManager lm = NameNodeAdapter.GetLeaseManager(cluster.GetNamesystem());

            lm.AddLease("holder1", "/a/b");
            lm.AddLease("holder2", "/a/c");
            NUnit.Framework.Assert.IsNotNull(lm.GetLeaseByPath("/a/b"));
            NUnit.Framework.Assert.IsNotNull(lm.GetLeaseByPath("/a/c"));
            lm.RemoveLeaseWithPrefixPath("/a");
            NUnit.Framework.Assert.IsNull(lm.GetLeaseByPath("/a/b"));
            NUnit.Framework.Assert.IsNull(lm.GetLeaseByPath("/a/c"));
            lm.AddLease("holder1", "/a/b");
            lm.AddLease("holder2", "/a/c");
            lm.RemoveLeaseWithPrefixPath("/a/");
            NUnit.Framework.Assert.IsNull(lm.GetLeaseByPath("/a/b"));
            NUnit.Framework.Assert.IsNull(lm.GetLeaseByPath("/a/c"));
        }