@Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("Version:")
        .append(CURRENT_VERSION)
        .append("\n")
        .append("StartTime:")
        .append(startTime)
        .append("\n")
        .append("StartOffsetOfLastIndexSegmentForDeleteCheck");
    if (startOffsetOfLastIndexSegmentForDeleteCheck == null) {
      sb.append("null");
    } else {
      sb.append(startOffsetOfLastIndexSegmentForDeleteCheck.toString());
    }
    sb.append("\n");
    sb.append("CurrentIndex:")
        .append(currentIdx)
        .append("\n")
        .append("CycleLogSize:")
        .append(cycleLogs.size())
        .append("\n")
        .append("CycleLogs:");
    for (CycleLog cycleLog : cycleLogs) {
      sb.append(cycleLog.toString()).append("\n\n");
    }
    return sb.toString();
  }
Flush the CompactionLog following the version 1 or 2 format.
Version 1:
    version
    startTime
    byte to indicate whether startOffsetOfLastIndexSegmentForDeleteCheck is present (1) or not (0)
    startOffsetOfLastIndexSegmentForDeleteCheck if not null
    index of current cycle's log
    size of cycle log list
    cycleLog1 (see CycleLog#toBytes())
    cycleLog2
    ...
    crc

Version 2:
    version
    startTime
    byte to indicate whether startOffsetOfLastIndexSegmentForDeleteCheck is present (1) or not (0)
    startOffsetOfLastIndexSegmentForDeleteCheck if not null
    index of current cycle's log
    size of cycle log list
    cycleLog1 (see CycleLog#toBytes())
    cycleLog2
    ...
    size of beforeAndAfterIndexSegmentOffsetsMap
    beforeOffset1, afterOffset1
    beforeOffset2, afterOffset2
    ...
    crc
@param stream The output stream to write bytes to
@throws IOException
ambry-store/src/main/java/com/github/ambry/store/CompactionLog.java