synchronized NewEpochResponseProto newEpoch ( NamespaceInfo nsInfo , long epoch ) throws IOException { checkJournalStorageFormatted ( ) ; journalStorage . checkConsistentNamespace ( nsInfo ) ; // if we are storing image too, check consistency as well if ( imageStorage . isFormatted ( ) ) { imageStorage . checkConsistentNamespace ( nsInfo ) ; } // Check that the new epoch being proposed is in fact newer than // any other that we've promised. if ( epoch <= getLastPromisedEpoch ( ) ) { throw new IOException ( "Proposed epoch " + epoch + " <= last promise " + getLastPromisedEpoch ( ) ) ; } updateLastPromisedEpoch ( epoch ) ; abortCurSegment ( ) ; NewEpochResponseProto ret = new NewEpochResponseProto ( ) ; EditLogFile latestFile = scanStorageForLatestEdits ( ) ; if ( latestFile != null ) { ret . setLastSegmentTxId ( latestFile . getFirstTxId ( ) ) ; } return ret ; }
Try to create a new epoch for this journal .