Source:
<code>private static <V extends Persistable & Versionable> void validateConsistency(MigrationContext<V> context) { long migrationCutoff = calculateCutoff(context); long persistedCutoff = context.migrationState().getCutoff(); long greatestSourceEntry = context.sourceLog().getGreatestLogEntry(); Preconditions.checkState(migrationCutoff <= persistedCutoff, "The migration to the destination state log was already performed in the past, but the " + "persisted cutoff value does not match a newly calculated one. This indicates the source " + "log has advanced since the migration was performed which could lead to data corruption if " + "allowed to continue.", SafeArg.of("fresh cutoff", migrationCutoff), SafeArg.of("persisted cutoff", persistedCutoff), SafeArg.of("source greatest entry", greatestSourceEntry)); if (greatestSourceEntry == PaxosAcceptor.NO_LOG_ENTRY) { return; } try { V source = context.hydrator().hydrateFromBytes(context.sourceLog().readRound(greatestSourceEntry)); byte[] destinationBytes = context.destinationLog().readRound(greatestSourceEntry); V dest = destinationBytes != null ? context.hydrator().hydrateFromBytes(destinationBytes) : null; Preconditions.checkState(source.equals(dest), "The migration to the destination state log was already performed in the past, but the " + "entry with the greatest sequence in source log does not match the entry in the " + "destination log. This indicates the source log has advanced since the migration was " + "performed which could lead to data corruption if allowed to continue.", SafeArg.of("source entry", source), SafeArg.of("destination entry", dest)); } catch (IOException e) { <START> Preconditions.checkState(false, "Unable to verify consistency between source and destination paxos logs because the " + "source log entry could not be read."); <END> } }</code><technical_language>weird - throw a SafeIllegalStateException, surely</technical_language>

Target:
private static <V extends Persistable & Versionable> void validateConsistency(MigrationContext<V> context) { long migrationCutoff = calculateCutoff(context); long persistedCutoff = context.migrationState().getCutoff(); long greatestSourceEntry = context.sourceLog().getGreatestLogEntry(); Preconditions.checkState(migrationCutoff <= persistedCutoff, "The migration to the destination state log was already performed in the past, but the " + "persisted cutoff value does not match a newly calculated one. This indicates the source " + "log has advanced since the migration was performed which could lead to data corruption if " + "allowed to continue.", SafeArg.of("fresh cutoff", migrationCutoff), SafeArg.of("persisted cutoff", persistedCutoff), SafeArg.of("source greatest entry", greatestSourceEntry)); if (greatestSourceEntry == PaxosAcceptor.NO_LOG_ENTRY) { return; } try { V source = context.hydrator().hydrateFromBytes(context.sourceLog().readRound(greatestSourceEntry)); byte[] destinationBytes = context.destinationLog().readRound(greatestSourceEntry); V dest = destinationBytes != null ? context.hydrator().hydrateFromBytes(destinationBytes) : null; Preconditions.checkState(source.equalsIgnoringVersion(dest), "The migration to the destination state log was already performed in the past, but the " + "entry with the greatest sequence in source log does not match the entry in the " + "destination log. This indicates the source log has advanced since the migration was " + "performed which could lead to data corruption if allowed to continue.", SafeArg.of("source entry", source), SafeArg.of("destination entry", dest)); } catch (IOException e) { throw new SafeIllegalArgumentException("Unable to verify consistency between source and destination paxos " + "logs because the source log entry could not be read."); } }