docs: private void compactBySize() {
      if (maxLogSize > 0 && journal.size() > maxLogSize) {
        JournalSegment<LogEntry> compactSegment = null;
        Long compactIndex = null;
        for (JournalSegment<LogEntry> segment : journal.segments()) {
          Collection<JournalSegment<LogEntry>> remainingSegments = journal.segments(segment.lastIndex() + 1);
          long remainingSize = remainingSegments.stream().mapToLong(JournalSegment::size).sum();
          if (remainingSize > maxLogSize) {
            log.debug("Found outsize journal segment {}", segment.file().file());
            compactSegment = segment;
          } else if (compactSegment != null) {
            compactIndex = segment.index();
            break;
          }
        }
  
        if (compactIndex != null) {
          log.info("Compacting journal by size up to {}", compactIndex);
          journal.compact(compactIndex);
        }
      }
    }