@Override
  public String splitByKey(String key, String entry, ByteBuffer dstBuffer, boolean inclineSplit)
      throws MetadataException {

    if (this.pageBuffer.capacity() != dstBuffer.capacity()) {
      throw new MetadataException("Segments only splits with same capacity.");
    }

    if (memberNum == 0) {
      throw new MetadataException("Segment can not be split with no records.");
    }

    if (key == null && memberNum <= 1) {
      throw new MetadataException("Segment can not be split with only one record.");
    }

    // notice that key can be null here
    boolean monotonic =
        penultKey != null
            && key != null
            && lastKey != null
            && inclineSplit
            && (key.compareTo(lastKey)) * (lastKey.compareTo(penultKey)) > 0;

    int n = memberNum;

    // actual index of key just smaller than the insert, -2 for null key
    int pos = key != null ? getIndexByKey(key) : -2;

    int sp; // virtual index to split
    if (monotonic) {
      // New entry into part with more space
      sp = key.compareTo(lastKey) > 0 ? Math.max(pos, n >> 1) : Math.min(pos, n >> 1);
    } else {
      sp = n >> 1;
    }

    // Little different from InternalSegment, only the front edge key can not split
    sp = sp <= 0 ? 1 : sp;

    // This method BREAKS envelop of the passing in buffer to be more efficient
    // attributes for dstBuffer
    short memberNum = 0;
    short spareOffset = (short) dstBuffer.capacity();
    short spareSize = (short) (spareOffset - SchemaFileConfig.PAGE_HEADER_SIZE);
    dstBuffer.clear();

    short offset;
    int recSize;
    String mKey, sKey = null;
    int aix; // aix for actual index on keyAddressList
    n = key == null ? n - 1 : n; // null key
    // TODO: implement bulk split further
    for (int ix = sp; ix <= n; ix++) {
      if (ix == pos) {
        // Migrate newly insert
        mKey = key;
        recSize = 8 + entry.getBytes().length + mKey.getBytes().length;

        spareOffset -= recSize;
        dstBuffer.position(spareOffset);
        ReadWriteIOUtils.write(mKey, dstBuffer);
        ReadWriteIOUtils.write(entry, dstBuffer);

      } else {
        // Pos equals -2 if key is null
        aix = (ix > pos) && (pos != -2) ? ix - 1 : ix;
        mKey = getKeyByIndex(aix);

        offset = getOffsetByIndex(aix);
        pageBuffer.clear().position(offset);
        recSize = ReadWriteIOUtils.readInt(pageBuffer);
        pageBuffer.position(pageBuffer.position() + recSize);
        recSize += ReadWriteIOUtils.readInt(pageBuffer) + 8;
        pageBuffer.position(offset);
        pageBuffer.limit(offset + recSize);

        spareOffset -= recSize;
        dstBuffer.position(spareOffset);
        dstBuffer.put(this.pageBuffer);
      }
      dstBuffer.position(SchemaFileConfig.PAGE_HEADER_SIZE + memberNum * OFFSET_LEN);
      ReadWriteIOUtils.write(spareOffset, dstBuffer);

      if (ix == sp) {
        // Search key is the first key in split segment
        sKey = mKey;
      }
      memberNum++;
      spareSize -= recSize + 2;
    }

    this.memberNum -= memberNum;
    if (key != null && sp <= pos) {
      // extra key has inserted into split buffer
      this.memberNum++;
    }

    // compact and update status
    compactKeys();
    if (key != null && sp > pos) {
      // new insert shall be in this
      if (insertRecord(key, entry) < 0) {
        throw new SegmentOverflowException(key);
      }
    }

    // flush dstBuffer header
    dstBuffer.clear();
    ReadWriteIOUtils.write(SchemaFileConfig.ALIAS_PAGE, dstBuffer);
    ReadWriteIOUtils.write(-1, dstBuffer);
    ReadWriteIOUtils.write(spareOffset, dstBuffer);
    ReadWriteIOUtils.write(spareSize, dstBuffer);
    ReadWriteIOUtils.write(memberNum, dstBuffer);
    ReadWriteIOUtils.write(nextPage, dstBuffer);

    penultKey = null;
    lastKey = null;
    return sKey;
  }
<b>Page Header Structure: (19 bytes used, 13 bytes reserved)</b> As in {@linkplain
ISchemaPage}.

<p>Page Body Structure:

<ul>
  <li>2 bytes * memberNum: offset of (alias, name) pair, to locate string content
  <li>... spare space...
  <li>var length(4 byte, var length, 4 bytes, var length): (alias, name) pairs, ordered by
      alias
</ul>
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/AliasIndexPage.java