Esempio n. 1
0
		public virtual void TestScanEditLog()
		{
			// use a future layout version
			journal.StartLogSegment(MakeRI(1), 1, NameNodeLayoutVersion.CurrentLayoutVersion 
				- 1);
			// in the segment we write garbage editlog, which can be scanned but
			// cannot be decoded
			int numTxns = 5;
			byte[] ops = QJMTestUtil.CreateGabageTxns(1, 5);
			journal.Journal(MakeRI(2), 1, 1, numTxns, ops);
			// verify the in-progress editlog segment
			QJournalProtocolProtos.SegmentStateProto segmentState = journal.GetSegmentInfo(1);
			NUnit.Framework.Assert.IsTrue(segmentState.GetIsInProgress());
			NUnit.Framework.Assert.AreEqual(numTxns, segmentState.GetEndTxId());
			NUnit.Framework.Assert.AreEqual(1, segmentState.GetStartTxId());
			// finalize the segment and verify it again
			journal.FinalizeLogSegment(MakeRI(3), 1, numTxns);
			segmentState = journal.GetSegmentInfo(1);
			NUnit.Framework.Assert.IsFalse(segmentState.GetIsInProgress());
			NUnit.Framework.Assert.AreEqual(numTxns, segmentState.GetEndTxId());
			NUnit.Framework.Assert.AreEqual(1, segmentState.GetStartTxId());
		}