private static short reEstimateSegSize(int expSize, int batchSize) throws MetadataException {
    if (batchSize < SchemaFileConfig.SEG_SIZE_METRIC[0]) {
      return reEstimateSegSize(expSize);
    }
    int base_tier = 0;
    for (int i = 0; i < SchemaFileConfig.SEG_SIZE_LST.length; i++) {
      if (SchemaFileConfig.SEG_SIZE_LST[i] >= expSize) {
        base_tier = i;
        break;
      }
    }
    int tier = SchemaFileConfig.SEG_SIZE_LST.length - 1;
    while (tier >= base_tier) {
      if (batchSize > SchemaFileConfig.SEG_SIZE_METRIC[tier]) {
        return SchemaFileConfig.SEG_SIZE_LST[tier];
      }
      tier--;
    }
    return SchemaFileConfig.SEG_SIZE_LST[base_tier];
  }
This method {@linkplain #reEstimateSegSize} is called when {@linkplain
SchemaPageOverflowException} occurs. It is designed to accelerate when there is lots of new
children nodes, avoiding segments extend several times.

<p>Notice that SegmentOverflowException inside a page with sufficient space will not reach
here. Supposed to merge with SchemaFile#reEstimateSegSize.

@param expSize expected size calculated from next new record
@param batchSize size of children within one #writeNewChildren(ICachedMNode)
@return estimated size
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/pagemgr/PageManager.java