private void compactWithOverlapPages()
      throws IOException, PageException, WriteProcessException, IllegalPathException {
    while (pointPriorityReader.hasNext()) {
      TimeValuePair currentPoint = pointPriorityReader.currentPoint();
      long currentTime = currentPoint.getTimestamp();

      while (currentTime >= nextChunkStartTime || currentTime >= nextPageStartTime) {
        // current point overlaps with next chunk or next page, then deserialize next chunk if
        // necessary and get next page
        PageElement nextPageElement = getPageFromPageQueue(currentTime);
        // check whether next page is fake overlap or not
        checkAndCompactOverlapPage(nextPageElement, currentPoint);

        // get new current point
        currentPoint = pointPriorityReader.currentPoint();
        currentTime = currentPoint.getTimestamp();
      }

      // write data point into chunk writer
      compactionWriter.write(currentPoint, subTaskId);
      pointPriorityReader.next();
    }
  }
Compact a series of pages that overlap with each other. Eg: The parameters are page 1 and page
2, that is, page 1 only overlaps with page 2, while page 2 overlap with page 3, page 3 overlap
with page 4,and so on, there are 10 pages in total. This method will compact all 10 pages.
Pages in the candidate overlapped pages list will be sequentially judged whether there is a
real overlap, if so, it will be put into the point priority reader and deserialized; if not, it
means that the page is located in a gap inside another pages, and it can be directly flushed to
chunk writer. There will be new overlapped pages added into the list during the process of
compacting overlapped pages. Notice: for a real overlap page, it will be removed from candidate
list after it has been adding into point priority reader and deserializing. For a fake overlap
page, it will be removed from candidate list after it has been flushing to chunk writer
completely.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/executor/fast/SeriesCompactionExecutor.java