Source:
<code>private void compactAndVerify(List<String> segmentsUnderCompaction, long deleteReferenceTimeMs, boolean changeExpected) throws Exception { long logSegmentSizeSumBeforeCompaction = getSumOfLogSegmentEndOffsets(); long logSegmentCountBeforeCompaction = state.index.getLogSegmentCount(); long indexSegmentCountBeforeCompaction = state.index.getIndexSegments().size(); CompactionDetails details = new CompactionDetails(deleteReferenceTimeMs, segmentsUnderCompaction); long expectedValidDataSize = getValidDataSize(segmentsUnderCompaction, deleteReferenceTimeMs); List<String> unaffectedSegments = getUnaffectedSegments(segmentsUnderCompaction); List<LogEntry> validLogEntriesInOrder = getValidLogEntriesInOrder(segmentsUnderCompaction, deleteReferenceTimeMs); Set<MockId> idsInCompactedLogSegments = getIdsInSegments(segmentsUnderCompaction); compactor = getCompactor(state.log, DISK_IO_SCHEDULER); compactor.initialize(state.index); try { compactor.compact(details); } finally { compactor.close(0); } assertFalse("No compaction should be in progress", CompactionLog.isCompactionInProgress(tempDirStr, STORE_ID)); <START> assertEquals("Temp log segment should not be found", 0, compactor.getSwapSegmentsInUse()); <END> long logSegmentSizeAfterCompaction = getSumOfLogSegmentEndOffsets(); long logSegmentCountAfterCompaction = state.index.getLogSegmentCount(); long indexSegmentCountAfterCompaction = state.index.getIndexSegments().size(); verifyCompaction(segmentsUnderCompaction, unaffectedSegments, expectedValidDataSize, validLogEntriesInOrder, idsInCompactedLogSegments, deleteReferenceTimeMs); state.reloadLog(true); verifyCompaction(segmentsUnderCompaction, unaffectedSegments, expectedValidDataSize, validLogEntriesInOrder, idsInCompactedLogSegments, deleteReferenceTimeMs); assertEquals("Sum of log segment capacities changed after reload", logSegmentSizeAfterCompaction, getSumOfLogSegmentEndOffsets()); assertEquals("Log segment count changed after reload", logSegmentCountAfterCompaction, state.index.getLogSegmentCount()); assertEquals("Index segment count changed after reload", indexSegmentCountAfterCompaction, state.index.getIndexSegments().size()); checkVitals(changeExpected, logSegmentSizeSumBeforeCompaction, logSegmentCountBeforeCompaction, indexSegmentCountBeforeCompaction); }</code><technical_language>rephrase statement "Swap segments found"</technical_language>

Target:
private void compactAndVerify(List<String> segmentsUnderCompaction, long deleteReferenceTimeMs, boolean changeExpected) throws Exception { long logSegmentSizeSumBeforeCompaction = getSumOfLogSegmentEndOffsets(); long logSegmentCountBeforeCompaction = state.index.getLogSegmentCount(); long indexSegmentCountBeforeCompaction = state.index.getIndexSegments().size(); CompactionDetails details = new CompactionDetails(deleteReferenceTimeMs, segmentsUnderCompaction); long expectedValidDataSize = getValidDataSize(segmentsUnderCompaction, deleteReferenceTimeMs); List<String> unaffectedSegments = getUnaffectedSegments(segmentsUnderCompaction); List<LogEntry> validLogEntriesInOrder = getValidLogEntriesInOrder(segmentsUnderCompaction, deleteReferenceTimeMs); Set<MockId> idsInCompactedLogSegments = getIdsInSegments(segmentsUnderCompaction); compactor = getCompactor(state.log, DISK_IO_SCHEDULER); compactor.initialize(state.index); try { compactor.compact(details); } finally { compactor.close(0); } assertFalse("No compaction should be in progress", CompactionLog.isCompactionInProgress(tempDirStr, STORE_ID)); assertEquals("Swap segments should not be found", 0, compactor.getSwapSegmentsInUse()); long logSegmentSizeAfterCompaction = getSumOfLogSegmentEndOffsets(); long logSegmentCountAfterCompaction = state.index.getLogSegmentCount(); long indexSegmentCountAfterCompaction = state.index.getIndexSegments().size(); verifyCompaction(segmentsUnderCompaction, unaffectedSegments, expectedValidDataSize, validLogEntriesInOrder, idsInCompactedLogSegments, deleteReferenceTimeMs); state.reloadLog(true); verifyCompaction(segmentsUnderCompaction, unaffectedSegments, expectedValidDataSize, validLogEntriesInOrder, idsInCompactedLogSegments, deleteReferenceTimeMs); assertEquals("Sum of log segment capacities changed after reload", logSegmentSizeAfterCompaction, getSumOfLogSegmentEndOffsets()); assertEquals("Log segment count changed after reload", logSegmentCountAfterCompaction, state.index.getLogSegmentCount()); assertEquals("Index segment count changed after reload", indexSegmentCountAfterCompaction, state.index.getIndexSegments().size()); checkVitals(changeExpected, logSegmentSizeSumBeforeCompaction, logSegmentCountBeforeCompaction, indexSegmentCountBeforeCompaction); verifySavedBytesCount(logSegmentCountBeforeCompaction, 0); }