public virtual void Setup() { // start 1 journal node jCluster = new MiniJournalCluster.Builder(new Configuration()).Format(true).NumJournalNodes (NumJn).Build(); jn = jCluster.GetJournalNode(0); }
public virtual void TestJournalNodeMXBean() { // we have not formatted the journals yet, and the journal status in jmx // should be empty since journal objects are created lazily MBeanServer mbs = ManagementFactory.GetPlatformMBeanServer(); ObjectName mxbeanName = new ObjectName("Hadoop:service=JournalNode,name=JournalNodeInfo" ); // getJournalsStatus string journalStatus = (string)mbs.GetAttribute(mxbeanName, "JournalsStatus"); NUnit.Framework.Assert.AreEqual(jn.GetJournalsStatus(), journalStatus); NUnit.Framework.Assert.IsFalse(journalStatus.Contains(Nameservice)); // format the journal ns1 NamespaceInfo FakeNsinfo = new NamespaceInfo(12345, "mycluster", "my-bp", 0L); jn.GetOrCreateJournal(Nameservice).Format(FakeNsinfo); // check again after format // getJournalsStatus journalStatus = (string)mbs.GetAttribute(mxbeanName, "JournalsStatus"); NUnit.Framework.Assert.AreEqual(jn.GetJournalsStatus(), journalStatus); IDictionary <string, IDictionary <string, string> > jMap = new Dictionary <string, IDictionary <string, string> >(); IDictionary <string, string> infoMap = new Dictionary <string, string>(); infoMap["Formatted"] = "true"; jMap[Nameservice] = infoMap; NUnit.Framework.Assert.AreEqual(JSON.ToString(jMap), journalStatus); // restart journal node without formatting jCluster = new MiniJournalCluster.Builder(new Configuration()).Format(false).NumJournalNodes (NumJn).Build(); jn = jCluster.GetJournalNode(0); // re-check journalStatus = (string)mbs.GetAttribute(mxbeanName, "JournalsStatus"); NUnit.Framework.Assert.AreEqual(jn.GetJournalsStatus(), journalStatus); jMap = new Dictionary <string, IDictionary <string, string> >(); infoMap = new Dictionary <string, string>(); infoMap["Formatted"] = "true"; jMap[Nameservice] = infoMap; NUnit.Framework.Assert.AreEqual(JSON.ToString(jMap), journalStatus); }
public virtual void TestOneJNMissingSegments() { QJMTestUtil.WriteSegment(cluster, qjm, 1, 3, true); WaitForAllPendingCalls(qjm.GetLoggerSetForTests()); cluster.GetJournalNode(0).StopAndJoin(0); QJMTestUtil.WriteSegment(cluster, qjm, 4, 3, true); WaitForAllPendingCalls(qjm.GetLoggerSetForTests()); cluster.RestartJournalNode(0); QJMTestUtil.WriteSegment(cluster, qjm, 7, 3, true); WaitForAllPendingCalls(qjm.GetLoggerSetForTests()); cluster.GetJournalNode(1).StopAndJoin(0); QuorumJournalManager readerQjm = CreateSpyingQJM(); IList <EditLogInputStream> streams = Lists.NewArrayList(); try { readerQjm.SelectInputStreams(streams, 1, false); QJMTestUtil.VerifyEdits(streams, 1, 9); } finally { IOUtils.Cleanup(Log, Sharpen.Collections.ToArray(streams, new IDisposable[0])); readerQjm.Close(); } }