public virtual void TestSharedEditsMissingLogs()
        {
            RemoveStandbyNameDirs();
            CheckpointSignature sig = nn0.GetRpcServer().RollEditLog();

            NUnit.Framework.Assert.AreEqual(3, sig.GetCurSegmentTxId());
            // Should have created edits_1-2 in shared edits dir
            URI      editsUri     = cluster.GetSharedEditsDir(0, 1);
            FilePath editsDir     = new FilePath(editsUri);
            FilePath editsSegment = new FilePath(new FilePath(editsDir, "current"), NNStorage
                                                 .GetFinalizedEditsFileName(1, 2));

            GenericTestUtils.AssertExists(editsSegment);
            // Delete the segment.
            NUnit.Framework.Assert.IsTrue(editsSegment.Delete());
            // Trying to bootstrap standby should now fail since the edit
            // logs aren't available in the shared dir.
            GenericTestUtils.LogCapturer logs = GenericTestUtils.LogCapturer.CaptureLogs(LogFactory
                                                                                         .GetLog(typeof(BootstrapStandby)));
            try
            {
                int rc = BootstrapStandby.Run(new string[] { "-force" }, cluster.GetConfiguration
                                                  (1));
                NUnit.Framework.Assert.AreEqual(BootstrapStandby.ErrCodeLogsUnavailable, rc);
            }
            finally
            {
                logs.StopCapturing();
            }
            GenericTestUtils.AssertMatches(logs.GetOutput(), "FATAL.*Unable to read transaction ids 1-3 from the configured shared"
                                           );
        }
Example #2
0
        public virtual void TestConvertCheckpointSignature()
        {
            CheckpointSignature s = new CheckpointSignature(GetStorageInfo(HdfsServerConstants.NodeType
                                                                           .NameNode), "bpid", 100, 1);

            HdfsProtos.CheckpointSignatureProto sProto = PBHelper.Convert(s);
            CheckpointSignature s1 = PBHelper.Convert(sProto);

            NUnit.Framework.Assert.AreEqual(s.GetBlockpoolID(), s1.GetBlockpoolID());
            NUnit.Framework.Assert.AreEqual(s.GetClusterID(), s1.GetClusterID());
            NUnit.Framework.Assert.AreEqual(s.GetCTime(), s1.GetCTime());
            NUnit.Framework.Assert.AreEqual(s.GetCurSegmentTxId(), s1.GetCurSegmentTxId());
            NUnit.Framework.Assert.AreEqual(s.GetLayoutVersion(), s1.GetLayoutVersion());
            NUnit.Framework.Assert.AreEqual(s.GetMostRecentCheckpointTxId(), s1.GetMostRecentCheckpointTxId
                                                ());
            NUnit.Framework.Assert.AreEqual(s.GetNamespaceID(), s1.GetNamespaceID());
        }