@Override
  protected long getTargetSegmentAddress(long curSegAddr, String recKey, SchemaPageContext cxt)
      throws IOException, MetadataException {
    cxt.treeTrace[0] = 0;
    ISchemaPage curPage = getPageInstance(getPageIndex(curSegAddr), cxt);
    if (curPage.getAsSegmentedPage() != null) {
      return curSegAddr;
    }

    int i = 0; // mark the trace of b+ tree node
    while (curPage.getAsInternalPage() != null) {
      i++;
      cxt.treeTrace[i] = curPage.getPageIndex();
      curPage = getPageInstance(curPage.getAsInternalPage().getRecordByKey(recKey), cxt);
    }
    cxt.treeTrace[0] = i; // bound in no.0 elem, points the parent the return

    return getGlobalIndex(curPage.getPageIndex(), (short) 0);
  }
Search the segment contains target key with a B+Tree structure.

@param curSegAddr address of the parent.
@param recKey target key.
@return address of the target segment.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/pagemgr/BTreePageManager.java