@Test
  public void compactWholeLogWithChangeExpectedTest() throws Exception {
    refreshState(false, true, false);
    long requiredCount = state.log.getCapacityInBytes() / state.log.getSegmentCapacity() - 2;
    writeDataToMeetRequiredSegmentCount(requiredCount,
        Arrays.asList(state.time.milliseconds() / 2, state.time.milliseconds(), state.time.milliseconds() * 2));
    // do some random deleting.
    int deleteCount =
        Math.min(state.liveKeys.size() / 3, (int) (1.8 * state.log.getSegmentCapacity() / DELETE_RECORD_SIZE));
    List<MockId> allLiveKeys = new ArrayList<>(state.liveKeys);
    for (int i = 0; i < deleteCount; i++) {
      MockId idToDelete = allLiveKeys.remove(TestUtils.RANDOM.nextInt(allLiveKeys.size()));
      state.addDeleteEntry(idToDelete);
    }
    // reload index to make sure journal is on only the latest log segment
    state.reloadIndex(true, false);
    long deleteReferenceTimeMs = state.time.milliseconds();
    List<LogSegmentName> segmentsUnderCompaction = getLogSegments(0, state.index.getLogSegmentCount() - 1);
    compactAndVerify(segmentsUnderCompaction, deleteReferenceTimeMs, true);
  }
Compacts the whole log (except the last log segment) and a changed size is expected i.e. there is some invalid
data.
@throws Exception
ambry-store/src/test/java/com/github/ambry/store/BlobStoreCompactorTest.java