private long nextChunkOffset(long chunkOffsetInFile,
                               int totalChunkLength) {
    AlignmentUtils.assert64bAligned(chunkOffsetInFile, "chunkOffsetInFile");
    long nextRecordOffset = AlignmentUtils.roundUpToInt64(chunkOffsetInFile + totalChunkLength);

    int pageSize = storage.pageSize();
    int offsetInPage = storage.toOffsetInPage(nextRecordOffset);
    int remainingOnPage = pageSize - offsetInPage;
    if (remainingOnPage < LogChunkImpl.HEADER_SIZE) {
      throw new IllegalStateException(
        "remainingOnPage(=" + remainingOnPage + ") <= chunkHeader(=" + LogChunkImpl.HEADER_SIZE + ")");
    }
    return nextRecordOffset;
  }
private long nextChunkOffset(long chunkOffsetInFile,
                               int totalChunkLength)