Source:
<code>public Token appendCheckpoints(CorfuRuntime rt, String author) { int numRetries = rt.getParameters().getCheckpointRetries(); int retry = 0; log.info("appendCheckpoints: appending checkpoints for maps", maps.size()); Token minSnapshot = Token.UNINITIALIZED; final long cpStart = System.currentTimeMillis(); try (Timer.Context context = MetricsUtils.getConditionalContext(appendCheckpointsTimer)) { for (ICorfuSMR<T> map : maps) { UUID streamId = map.getCorfuStreamID(); CheckpointWriter<T> cpw = new CheckpointWriter(rt, streamId, author, (T) map); ISerializer serializer = ((CorfuCompileProxy<Map>) map.getCorfuSMRProxy()) .getSerializer(); cpw.setSerializer(serializer); <START> <END> Token minCPSnapshot = Token.UNINITIALIZED; while (retry < numRetries) { try { minCPSnapshot = cpw.appendCheckpoint(); break; } catch (WrongEpochException wee) { log.info("Epoch changed to during append checkpoint snapshot resolution. Sequencer" + " failover can lead to potential epoch regression, retry {}/{}", wee.getCorrectEpoch(), retry, numRetries); retry++; if (retry == numRetries) { String msg = String.format("Epochs changed during checkpoint cycle, " + "over more than %s times. Potential sequencer regressions can lead to data loss. " + "Aborting.", numRetries); throw new IllegalStateException(msg); } } } if (minSnapshot == Token.UNINITIALIZED) { minSnapshot = minCPSnapshot; } else if (Token.min(minCPSnapshot, minSnapshot) == minCPSnapshot) { minSnapshot = minCPSnapshot; } } } finally { log.trace("appendCheckpoints: finished, author '{}' at min globalAddress {}", author, minSnapshot); rt.getObjectsView().TXEnd(); } final long cpStop = System.currentTimeMillis(); log.info("appendCheckpoints: took ms to append checkpoints", cpStop - cpStart, maps.size()); return minSnapshot; }</code><technical_language>snapshot returned appendCheckpoint is a global snapshot regress, select checkpoints snapshot subsequent checkpoints return greater snapshots (instead of finding a min of snapshots)</technical_language>

Target:
public Token appendCheckpoints(CorfuRuntime rt, String author) { int numRetries = rt.getParameters().getCheckpointRetries(); int retry = 0; log.info("appendCheckpoints: appending checkpoints for maps", maps.size()); Token minSnapshot = Token.UNINITIALIZED; final long cpStart = System.currentTimeMillis(); try (Timer.Context context = MetricsUtils.getConditionalContext(appendCheckpointsTimer)) { for (ICorfuSMR<T> map : maps) { UUID streamId = map.getCorfuStreamID(); CheckpointWriter<T> cpw = new CheckpointWriter(rt, streamId, author, (T) map); ISerializer serializer = ((CorfuCompileProxy<Map>) map.getCorfuSMRProxy()) .getSerializer(); cpw.setSerializer(serializer); Token minCPSnapshot = Token.UNINITIALIZED; while (retry < numRetries) { try { minCPSnapshot = cpw.appendCheckpoint(); break; } catch (WrongEpochException wee) { log.info("Epoch changed to during append checkpoint snapshot resolution. Sequencer" + " failover can lead to potential epoch regression, retry {}/{}", wee.getCorrectEpoch(), retry, numRetries); retry++; if (retry == numRetries) { String msg = String.format("Epochs changed during checkpoint cycle, " + "over more than %s times. Potential sequencer regressions can lead to data loss. " + "Aborting.", numRetries); throw new IllegalStateException(msg); } } } if (minSnapshot == Token.UNINITIALIZED) { minSnapshot = minCPSnapshot; } else if (minCPSnapshot.compareTo(minSnapshot) < 0) { String msg = String.format("Potential epoch regression. Subsequent checkpoint returned a greater" + "snapshot than previous {}.", minCPSnapshot, minSnapshot); throw new IllegalStateException(msg); } } } finally { log.trace("appendCheckpoints: finished, author '{}' at min globalAddress {}", author, minSnapshot); rt.getObjectsView().TXEnd(); } final long cpStop = System.currentTimeMillis(); log.info("appendCheckpoints: took ms to append checkpoints", cpStop - cpStart, maps.size()); return minSnapshot; }