private void doUndeleteSrcDupTest() throws Exception {
    List<MockId> ids = createLogSegmentWithDuplicateOfUndelete();
    List<LogSegmentName> segmentsUnderCompaction = getLogSegments(0, state.index.getLogSegmentCount() - 1);
    Log log = new InterruptionInducingLog(Integer.MAX_VALUE, 1);
    compactWithRecoveryAndVerify(log, DISK_IO_SCHEDULER, state.index, segmentsUnderCompaction,
        state.time.milliseconds(), true, true);

    MockId pu = ids.get(0);
    MockId pd = ids.get(1);
    MockId pt = ids.get(2);
    List<IndexValue> values = state.index.findAllIndexValuesForKey(pu, null);
    assertNotNull(values);
    assertEquals(3, values.size());
    assertTrue(values.get(0).isUndelete());
    assertEquals(1, values.get(0).getLifeVersion());
    assertTrue(values.get(1).isTtlUpdate());
    assertTrue(values.get(2).isPut());
    values = state.index.findAllIndexValuesForKey(pd, null);
    assertNotNull(values);
    assertEquals(1, values.size());
    assertTrue(values.get(0).isDelete());
    values = state.index.findAllIndexValuesForKey(pt, null);
    assertNotNull(values);
    assertEquals(2, values.size());
    assertTrue(values.get(0).isTtlUpdate());
    assertTrue(values.get(1).isPut());
  }
Tests the case where close/crash creates a situation where duplicates, including undeletes, will be detected during
the search for copy candidates in the srcIndex
@throws Exception
ambry-store/src/test/java/com/github/ambry/store/BlobStoreCompactorTest.java