@Override
    public boolean append(@NotNull ByteBufferWriter writer,
                          int recordSize) throws IOException {
      int newAllocatedCursor;
      while (true) {//CAS loop (allocatedCursor -> allocatedCursor + recordSize):
        int header = readHeader();
        int allocatedCursor = unpackAllocatedCursor(header);
        int committedCursor = unpackCommittedCursor(header);
        newAllocatedCursor = allocatedCursor + recordSize;
        if (newAllocatedCursor > capacity()) {
          return false;
        }
        if (casHeader(header, packChunkHeader(newAllocatedCursor, committedCursor))) {
          break;
        }
      }

      int recordStartingOffset = newAllocatedCursor - recordSize;
      ByteBuffer bufferForWrite = pageBuffer
        .slice(offsetInBuffer + OFFSET_PAYLOAD + recordStartingOffset, recordSize)
        .order(pageBuffer.order());
      try {
        writer.write(bufferForWrite);
      }
      finally {
        //
        while (true) {//CAS loop/spin loop:
          // wait for committedCursor=start of record
          // => cas(committedCursor -> committedCursor + recordSize)
          int _header = readHeader();
          int _allocatedCursor = unpackAllocatedCursor(_header);
          int _committedCursor = unpackCommittedCursor(_header);
          if (_committedCursor == recordStartingOffset) {
            if (casHeader(_header, packChunkHeader(_allocatedCursor, _committedCursor + recordSize))) {
              break;
            }
          }
        }
      }
      return true;
    }
@Override
    public boolean append(@NotNull ByteBufferWriter writer,
                          int recordSize)