Source:
private void performRecovery() throws IOException, StoreException { StoreFindToken endTokenForRecovery; File cleanupTokenFile = new File(dataDir, Cleanup_Token_Filename); if (cleanupTokenFile.exists()) { CrcInputStream crcStream = new CrcInputStream(new FileInputStream(cleanupTokenFile)); DataInputStream stream = new DataInputStream(crcStream); try { short version = stream.readShort(); switch (version) { case 0: startToken = StoreFindToken.fromBytes(stream, factory); endTokenForRecovery = StoreFindToken.fromBytes(stream, factory); break; default: throw new StoreException("Invalid version in cleanup token " + dataDir, StoreErrorCodes.Index_Version_Error); } long crc = crcStream.getValue(); if (crc != stream.readLong()) { logger.error("Crc check does not match for cleanup token file for dataDir {}, creating a clean one ", dataDir); startToken = new StoreFindToken(); endTokenForRecovery = new StoreFindToken(); } } catch (IOException e) { throw new StoreException("Failed to read cleanup token ", e, StoreErrorCodes.Initialization_Error); } finally { stream.close(); } } else { startToken = new StoreFindToken(); endTokenForRecovery = new StoreFindToken(); } startTokenBeforeLogFlush = startTokenSafeToPersist = startToken; if (!endTokenForRecovery.isUninitialized()) { logger.info("Index : hard delete recovery startToken endTokenForRecovery {}", dataDir, startToken, endTokenForRecovery); do { if (!hardDelete()) { logger.warn("Index : hard delete did not advance beyond endToken {}, skipping rest of the recovery", dataDir, endToken); break; } else { logger.info("Index : hard deleted from startToken to endToken {}", dataDir, startToken, endToken); } } while (((StoreFindToken) endToken).getAppropriateOffset() <= endTokenForRecovery.getAppropriateOffset()); } }

Target:
private void performRecovery() throws IOException, StoreException { StoreFindToken endTokenForRecovery; File cleanupTokenFile = new File(dataDir, Cleanup_Token_Filename); if (cleanupTokenFile.exists()) { CrcInputStream crcStream = new CrcInputStream(new FileInputStream(cleanupTokenFile)); DataInputStream stream = new DataInputStream(crcStream); try { short version = stream.readShort(); switch (version) { case 0: startToken = StoreFindToken.fromBytes(stream, factory); endTokenForRecovery = StoreFindToken.fromBytes(stream, factory); break; default: throw new StoreException("Invalid version in cleanup token " + dataDir, StoreErrorCodes.Index_Version_Error); } long crc = crcStream.getValue(); if (crc != stream.readLong()) { logger.error("Crc check does not match for cleanup token file for dataDir {}, creating a clean one ", dataDir); startToken = new StoreFindToken(); endTokenForRecovery = new StoreFindToken(); } } catch (IOException e) { throw new StoreException("Failed to read cleanup token ", e, StoreErrorCodes.Initialization_Error); } finally { stream.close(); } } else { startToken = new StoreFindToken(); endTokenForRecovery = new StoreFindToken(); } startTokenBeforeLogFlush = startTokenSafeToPersist = startToken; if (!endTokenForRecovery.isUninitialized() && !endTokenForRecovery.equals(startToken)) { logger.info("Index : hard delete recovery startToken endTokenForRecovery {}", dataDir, startToken, endTokenForRecovery); do { if (!hardDelete()) { logger.warn("Index : hard delete did not advance beyond endToken {}, skipping rest of the recovery", dataDir, endToken); metrics.hardDeleteIncompleteRecoveryCount.inc(); break; } logger.info("Index : hard deleted from startToken to endToken {}", dataDir, startToken, endToken); } while (endTokenForRecovery.greaterThan((StoreFindToken) endToken)); } }