/// <exception cref="System.IO.IOException"/> private long GetCommittedTxnIdValue(MiniQJMHACluster qjCluster) { Journal journal1 = qjCluster.GetJournalCluster().GetJournalNode(0).GetOrCreateJournal (MiniQJMHACluster.Nameservice); BestEffortLongFile committedTxnId = (BestEffortLongFile)Whitebox.GetInternalState (journal1, "committedTxnId"); return(committedTxnId != null?committedTxnId.Get() : HdfsConstants.InvalidTxid); }
/// <exception cref="System.IO.IOException"/> private static void CheckJnPreviousDirExistence(MiniQJMHACluster jnCluster, bool shouldExist) { for (int i = 0; i < 3; i++) { CheckPreviousDirExistence(jnCluster.GetJournalCluster().GetJournalDir(i, "ns1"), shouldExist); } if (shouldExist) { AssertEpochFilesCopied(jnCluster); } }
/// <exception cref="System.IO.IOException"/> private static void AssertEpochFilesCopied(MiniQJMHACluster jnCluster) { for (int i = 0; i < 3; i++) { FilePath journalDir = jnCluster.GetJournalCluster().GetJournalDir(i, "ns1"); FilePath currDir = new FilePath(journalDir, "current"); FilePath prevDir = new FilePath(journalDir, "previous"); foreach (string fileName in new string[] { Journal.LastPromisedFilename, Journal. LastWriterEpoch }) { FilePath prevFile = new FilePath(prevDir, fileName); // Possible the prev file doesn't exist, e.g. if there has never been a // writer before the upgrade. if (prevFile.Exists()) { PersistentLongFile prevLongFile = new PersistentLongFile(prevFile, -10); PersistentLongFile currLongFile = new PersistentLongFile(new FilePath(currDir, fileName ), -11); NUnit.Framework.Assert.IsTrue("Value in " + fileName + " has decreased on upgrade in " + journalDir, prevLongFile.Get() <= currLongFile.Get()); } } } }