Journal implements Closeable { synchronized NewEpochResponseProto newEpoch( NamespaceInfo nsInfo, long epoch) throws IOException { checkFormatted(); storage.checkConsistentNamespace(nsInfo); if (epoch <= getLastPromisedEpoch()) { throw new IOException("Proposed epoch " + epoch + " <= last promise " + getLastPromisedEpoch()); } updateLastPromisedEpoch(epoch); abortCurSegment(); NewEpochResponseProto.Builder builder = NewEpochResponseProto.newBuilder(); EditLogFile latestFile = scanStorageForLatestEdits(); if (latestFile != null) { builder.setLastSegmentTxId(latestFile.getFirstTxId()); } return builder.build(); } Journal(Configuration conf, File logDir, String journalId,
      StartupOption startOpt, StorageErrorReporter errorReporter); @Override // Closeable void close(); synchronized long getLastWriterEpoch(); void heartbeat(RequestInfo reqInfo); synchronized boolean isFormatted(); synchronized void startLogSegment(RequestInfo reqInfo, long txid,
      int layoutVersion); synchronized void finalizeLogSegment(RequestInfo reqInfo, long startTxId,
      long endTxId); synchronized void purgeLogsOlderThan(RequestInfo reqInfo,
      long minTxIdToKeep); RemoteEditLogManifest getEditLogManifest(long sinceTxId,
      boolean inProgressOk); synchronized PrepareRecoveryResponseProto prepareRecovery(
      RequestInfo reqInfo, long segmentTxId); synchronized void acceptRecovery(RequestInfo reqInfo,
      SegmentStateProto segment, URL fromUrl); synchronized void doPreUpgrade(); synchronized void doUpgrade(StorageInfo sInfo); synchronized void doFinalize(); Boolean canRollBack(StorageInfo storage, StorageInfo prevStorage,
      int targetLayoutVersion); synchronized void doRollback(); Long getJournalCTime(); static final String LAST_PROMISED_FILENAME; static final String LAST_WRITER_EPOCH; }
@Test (timeout = 10000) public void testNamespaceVerification() throws Exception { journal.newEpoch(FAKE_NSINFO, 1); try { journal.newEpoch(FAKE_NSINFO_2, 2); fail("Did not fail newEpoch() when namespaces mismatched"); } catch (IOException ioe) { GenericTestUtils.assertExceptionContains( "Incompatible namespaceID", ioe); } }