Source:
private void readCleanupTokenAndPopulateRecoveryRange() throws IOException, StoreException { File cleanupTokenFile = new File(dataDir, Cleanup_Token_Filename); StoreFindToken recoveryStartToken = recoveryEndToken = new StoreFindToken(); startToken = startTokenBeforeLogFlush = startTokenSafeToPersist = endToken = new StoreFindToken(); if (cleanupTokenFile.exists()) { CrcInputStream crcStream = new CrcInputStream(new FileInputStream(cleanupTokenFile)); DataInputStream stream = new DataInputStream(crcStream); try { short version = stream.readShort(); switch (version) { case Cleanup_Token_Version_V0: recoveryStartToken = StoreFindToken.fromBytes(stream, factory); recoveryEndToken = StoreFindToken.fromBytes(stream, factory); hardDeleteRecoveryRange = new HardDeletePersistInfo(stream, factory); break; case Cleanup_Token_Version_V1: recoveryStartToken = StoreFindToken.fromBytes(stream, factory); recoveryEndToken = StoreFindToken.fromBytes(stream, factory); byte pauseByte = stream.readByte(); if (pauseByte == 1) { paused.set(true); } hardDeleteRecoveryRange = new HardDeletePersistInfo(stream, factory); break; default: hardDeleteRecoveryRange.clear(); metrics.hardDeleteIncompleteRecoveryCount.inc(); throw new StoreException("Invalid version in cleanup token " + dataDir, StoreErrorCodes.Index_Version_Error); } long crc = crcStream.getValue(); if (crc != stream.readLong()) { hardDeleteRecoveryRange.clear(); metrics.hardDeleteIncompleteRecoveryCount.inc(); throw new StoreException( "Crc check does not match for cleanup token file for dataDir " + dataDir + " aborting. ", StoreErrorCodes.Illegal_Index_State); } } catch (IOException e) { hardDeleteRecoveryRange.clear(); metrics.hardDeleteIncompleteRecoveryCount.inc(); throw new StoreException("Failed to read cleanup token ", e, StoreErrorCodes.Initialization_Error); } finally { stream.close(); } } startToken = startTokenBeforeLogFlush = startTokenSafeToPersist = endToken = recoveryStartToken; }

Target:
private void readCleanupTokenAndPopulateRecoveryRange() throws IOException, StoreException { File cleanupTokenFile = new File(dataDir, Cleanup_Token_Filename); StoreFindToken recoveryStartToken = recoveryEndToken = new StoreFindToken(); startToken = startTokenBeforeLogFlush = startTokenSafeToPersist = endToken = new StoreFindToken(); if (cleanupTokenFile.exists()) { CrcInputStream crcStream = new CrcInputStream(new FileInputStream(cleanupTokenFile)); DataInputStream stream = new DataInputStream(crcStream); try { short version = stream.readShort(); switch (version) { case Cleanup_Token_Version_V0: recoveryStartToken = StoreFindToken.fromBytes(stream, factory); recoveryEndToken = StoreFindToken.fromBytes(stream, factory); hardDeleteRecoveryRange = new HardDeletePersistInfo(stream, factory); break; case Cleanup_Token_Version_V1: recoveryStartToken = StoreFindToken.fromBytes(stream, factory); recoveryEndToken = StoreFindToken.fromBytes(stream, factory); paused.set(stream.readByte() == (byte) 1); hardDeleteRecoveryRange = new HardDeletePersistInfo(stream, factory); break; default: hardDeleteRecoveryRange.clear(); metrics.hardDeleteIncompleteRecoveryCount.inc(); throw new StoreException("Invalid version in cleanup token " + dataDir, StoreErrorCodes.Index_Version_Error); } long crc = crcStream.getValue(); if (crc != stream.readLong()) { hardDeleteRecoveryRange.clear(); metrics.hardDeleteIncompleteRecoveryCount.inc(); throw new StoreException( "Crc check does not match for cleanup token file for dataDir " + dataDir + " aborting. ", StoreErrorCodes.Illegal_Index_State); } } catch (IOException e) { hardDeleteRecoveryRange.clear(); metrics.hardDeleteIncompleteRecoveryCount.inc(); throw new StoreException("Failed to read cleanup token ", e, StoreErrorCodes.Initialization_Error); } finally { stream.close(); } } startToken = startTokenBeforeLogFlush = startTokenSafeToPersist = endToken = recoveryStartToken; }