@Override
  public int insertRecord(String alias, String name) throws RecordDuplicatedException {
    if (spareSize < OFFSET_LEN + 8 + alias.getBytes().length + name.getBytes().length) {
      return -1;
    }

    // check whether key already exists
    int pos = getIndexByKey(alias);
    if (memberNum > 0 && pos < memberNum && getKeyByIndex(pos).equals(alias)) {
      // not insert duplicated alias
      return spareSize;
    }

    if (SchemaFileConfig.PAGE_HEADER_SIZE
            + OFFSET_LEN * (memberNum + 1)
            + 8
            + alias.getBytes().length
            + name.getBytes().length
        > spareOffset) {
      compactKeys();
    }

    // append key
    this.pageBuffer.clear();
    this.spareOffset =
        (short) (this.spareOffset - alias.getBytes().length - name.getBytes().length - 8);
    this.pageBuffer.position(spareOffset);
    ReadWriteIOUtils.write(alias, this.pageBuffer);
    ReadWriteIOUtils.write(name, this.pageBuffer);

    int migNum = memberNum - pos;
    if (migNum > 0) {
      // move compound pointers
      ByteBuffer buf = ByteBuffer.allocate(migNum * OFFSET_LEN);
      this.pageBuffer.limit(SchemaFileConfig.PAGE_HEADER_SIZE + OFFSET_LEN * memberNum);
      this.pageBuffer.position(SchemaFileConfig.PAGE_HEADER_SIZE + OFFSET_LEN * pos);
      buf.put(this.pageBuffer);

      this.pageBuffer.position(SchemaFileConfig.PAGE_HEADER_SIZE + OFFSET_LEN * pos);
      ReadWriteIOUtils.write(spareOffset, this.pageBuffer);

      buf.clear();
      this.pageBuffer.limit(this.pageBuffer.limit() + OFFSET_LEN);
      this.pageBuffer.put(buf);
    } else {
      // append compound pointer
      this.pageBuffer.limit(this.pageBuffer.capacity());
      this.pageBuffer.position(SchemaFileConfig.PAGE_HEADER_SIZE + memberNum * OFFSET_LEN);
      ReadWriteIOUtils.write(spareOffset, this.pageBuffer);
    }

    spareSize -= (alias.getBytes().length + name.getBytes().length + 8 + OFFSET_LEN);
    memberNum++;

    penultKey = lastKey;
    lastKey = alias;
    return spareSize;
  }
<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