/** * Increments, logs and then returns the stamp */ long nextGenerationStamp(boolean legacyBlock) throws IOException, SafeModeException { assert hasWriteLock(); checkNameNodeSafeMode("Cannot get next generation stamp"); long gs = blockIdManager.nextGenerationStamp(legacyBlock); if (legacyBlock) { getEditLog().logGenerationStampV1(gs); } else { getEditLog().logGenerationStampV2(gs); } // NB: callers sync the log return gs; }
/** * Increments, logs and then returns the stamp */ long nextGenerationStamp(boolean legacyBlock) throws IOException, SafeModeException { assert hasWriteLock(); checkNameNodeSafeMode("Cannot get next generation stamp"); long gs = blockIdManager.nextGenerationStamp(legacyBlock); if (legacyBlock) { getEditLog().logGenerationStampV1(gs); } else { getEditLog().logGenerationStampV2(gs); } // NB: callers sync the log return gs; }
editlog.openForWrite(); for (int i = 2; i < TXNS_PER_ROLL; i++) { editlog.logGenerationStampV2((long) 0); editlog.rollEditLog(); editlog.logGenerationStampV2((long) i); editlog.logSync(); editlog.logGenerationStampV2((long) i);