[FEAT MERGE]adaptive cost model
This commit is contained in:
		@ -6946,6 +6946,201 @@ int ObInnerTableSchema::all_import_table_task_history_schema(ObTableSchema &tabl
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int ObInnerTableSchema::all_aux_stat_schema(ObTableSchema &table_schema)
 | 
			
		||||
{
 | 
			
		||||
  int ret = OB_SUCCESS;
 | 
			
		||||
  uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
 | 
			
		||||
 | 
			
		||||
  //generated fields:
 | 
			
		||||
  table_schema.set_tenant_id(OB_SYS_TENANT_ID);
 | 
			
		||||
  table_schema.set_tablegroup_id(OB_SYS_TABLEGROUP_ID);
 | 
			
		||||
  table_schema.set_database_id(OB_SYS_DATABASE_ID);
 | 
			
		||||
  table_schema.set_table_id(OB_ALL_AUX_STAT_TID);
 | 
			
		||||
  table_schema.set_rowkey_split_pos(0);
 | 
			
		||||
  table_schema.set_is_use_bloomfilter(false);
 | 
			
		||||
  table_schema.set_progressive_merge_num(0);
 | 
			
		||||
  table_schema.set_rowkey_column_num(1);
 | 
			
		||||
  table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
 | 
			
		||||
  table_schema.set_table_type(SYSTEM_TABLE);
 | 
			
		||||
  table_schema.set_index_type(INDEX_TYPE_IS_NOT);
 | 
			
		||||
  table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL);
 | 
			
		||||
 | 
			
		||||
  if (OB_SUCC(ret)) {
 | 
			
		||||
    if (OB_FAIL(table_schema.set_table_name(OB_ALL_AUX_STAT_TNAME))) {
 | 
			
		||||
      LOG_ERROR("fail to set table_name", K(ret));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (OB_SUCC(ret)) {
 | 
			
		||||
    if (OB_FAIL(table_schema.set_compress_func_name(OB_DEFAULT_COMPRESS_FUNC_NAME))) {
 | 
			
		||||
      LOG_ERROR("fail to set compress_func_name", K(ret));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  table_schema.set_part_level(PARTITION_LEVEL_ZERO);
 | 
			
		||||
  table_schema.set_charset_type(ObCharset::get_default_charset());
 | 
			
		||||
  table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
 | 
			
		||||
 | 
			
		||||
  if (OB_SUCC(ret)) {
 | 
			
		||||
    ObObj gmt_create_default;
 | 
			
		||||
    ObObj gmt_create_default_null;
 | 
			
		||||
 | 
			
		||||
    gmt_create_default.set_ext(ObActionFlag::OP_DEFAULT_NOW_FLAG);
 | 
			
		||||
    gmt_create_default_null.set_null();
 | 
			
		||||
    ADD_COLUMN_SCHEMA_TS_T("gmt_create", //column_name
 | 
			
		||||
      ++column_id, //column_id
 | 
			
		||||
      0, //rowkey_id
 | 
			
		||||
      0, //index_id
 | 
			
		||||
      0, //part_key_pos
 | 
			
		||||
      ObTimestampType,  //column_type
 | 
			
		||||
      CS_TYPE_BINARY,//collation_type
 | 
			
		||||
      0, //column length
 | 
			
		||||
      -1, //column_precision
 | 
			
		||||
      6, //column_scale
 | 
			
		||||
      true,//is nullable
 | 
			
		||||
      false, //is_autoincrement
 | 
			
		||||
      false, //is_on_update_for_timestamp
 | 
			
		||||
      gmt_create_default_null,
 | 
			
		||||
      gmt_create_default)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (OB_SUCC(ret)) {
 | 
			
		||||
    ObObj gmt_modified_default;
 | 
			
		||||
    ObObj gmt_modified_default_null;
 | 
			
		||||
 | 
			
		||||
    gmt_modified_default.set_ext(ObActionFlag::OP_DEFAULT_NOW_FLAG);
 | 
			
		||||
    gmt_modified_default_null.set_null();
 | 
			
		||||
    ADD_COLUMN_SCHEMA_TS_T("gmt_modified", //column_name
 | 
			
		||||
      ++column_id, //column_id
 | 
			
		||||
      0, //rowkey_id
 | 
			
		||||
      0, //index_id
 | 
			
		||||
      0, //part_key_pos
 | 
			
		||||
      ObTimestampType,  //column_type
 | 
			
		||||
      CS_TYPE_BINARY,//collation_type
 | 
			
		||||
      0, //column length
 | 
			
		||||
      -1, //column_precision
 | 
			
		||||
      6, //column_scale
 | 
			
		||||
      true,//is nullable
 | 
			
		||||
      false, //is_autoincrement
 | 
			
		||||
      true, //is_on_update_for_timestamp
 | 
			
		||||
      gmt_modified_default_null,
 | 
			
		||||
      gmt_modified_default)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (OB_SUCC(ret)) {
 | 
			
		||||
    ADD_COLUMN_SCHEMA("tenant_id", //column_name
 | 
			
		||||
      ++column_id, //column_id
 | 
			
		||||
      1, //rowkey_id
 | 
			
		||||
      0, //index_id
 | 
			
		||||
      0, //part_key_pos
 | 
			
		||||
      ObIntType, //column_type
 | 
			
		||||
      CS_TYPE_INVALID, //column_collation_type
 | 
			
		||||
      sizeof(int64_t), //column_length
 | 
			
		||||
      20, //column_precision
 | 
			
		||||
      0, //column_scale
 | 
			
		||||
      false, //is_nullable
 | 
			
		||||
      false); //is_autoincrement
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (OB_SUCC(ret)) {
 | 
			
		||||
    ADD_COLUMN_SCHEMA_TS("last_analyzed", //column_name
 | 
			
		||||
      ++column_id, //column_id
 | 
			
		||||
      0, //rowkey_id
 | 
			
		||||
      0, //index_id
 | 
			
		||||
      0, //part_key_pos
 | 
			
		||||
      ObTimestampType, //column_type
 | 
			
		||||
      CS_TYPE_INVALID, //column_collation_type
 | 
			
		||||
      sizeof(ObPreciseDateTime), //column_length
 | 
			
		||||
      -1, //column_precision
 | 
			
		||||
      -1, //column_scale
 | 
			
		||||
      false, //is_nullable
 | 
			
		||||
      false, //is_autoincrement
 | 
			
		||||
      false); //is_on_update_for_timestamp
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (OB_SUCC(ret)) {
 | 
			
		||||
    ObObj cpu_speed_default;
 | 
			
		||||
    cpu_speed_default.set_int(2500);
 | 
			
		||||
    ADD_COLUMN_SCHEMA_T("cpu_speed", //column_name
 | 
			
		||||
      ++column_id, //column_id
 | 
			
		||||
      0, //rowkey_id
 | 
			
		||||
      0, //index_id
 | 
			
		||||
      0, //part_key_pos
 | 
			
		||||
      ObIntType, //column_type
 | 
			
		||||
      CS_TYPE_INVALID, //column_collation_type
 | 
			
		||||
      sizeof(int64_t), //column_length
 | 
			
		||||
      20, //column_precision
 | 
			
		||||
      0, //column_scale
 | 
			
		||||
      true, //is_nullable
 | 
			
		||||
      false, //is_autoincrement
 | 
			
		||||
      cpu_speed_default,
 | 
			
		||||
      cpu_speed_default); //default_value
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (OB_SUCC(ret)) {
 | 
			
		||||
    ObObj disk_seq_read_speed_default;
 | 
			
		||||
    disk_seq_read_speed_default.set_int(2000);
 | 
			
		||||
    ADD_COLUMN_SCHEMA_T("disk_seq_read_speed", //column_name
 | 
			
		||||
      ++column_id, //column_id
 | 
			
		||||
      0, //rowkey_id
 | 
			
		||||
      0, //index_id
 | 
			
		||||
      0, //part_key_pos
 | 
			
		||||
      ObIntType, //column_type
 | 
			
		||||
      CS_TYPE_INVALID, //column_collation_type
 | 
			
		||||
      sizeof(int64_t), //column_length
 | 
			
		||||
      20, //column_precision
 | 
			
		||||
      0, //column_scale
 | 
			
		||||
      true, //is_nullable
 | 
			
		||||
      false, //is_autoincrement
 | 
			
		||||
      disk_seq_read_speed_default,
 | 
			
		||||
      disk_seq_read_speed_default); //default_value
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (OB_SUCC(ret)) {
 | 
			
		||||
    ObObj disk_rnd_read_speed_default;
 | 
			
		||||
    disk_rnd_read_speed_default.set_int(150);
 | 
			
		||||
    ADD_COLUMN_SCHEMA_T("disk_rnd_read_speed", //column_name
 | 
			
		||||
      ++column_id, //column_id
 | 
			
		||||
      0, //rowkey_id
 | 
			
		||||
      0, //index_id
 | 
			
		||||
      0, //part_key_pos
 | 
			
		||||
      ObIntType, //column_type
 | 
			
		||||
      CS_TYPE_INVALID, //column_collation_type
 | 
			
		||||
      sizeof(int64_t), //column_length
 | 
			
		||||
      20, //column_precision
 | 
			
		||||
      0, //column_scale
 | 
			
		||||
      true, //is_nullable
 | 
			
		||||
      false, //is_autoincrement
 | 
			
		||||
      disk_rnd_read_speed_default,
 | 
			
		||||
      disk_rnd_read_speed_default); //default_value
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (OB_SUCC(ret)) {
 | 
			
		||||
    ADD_COLUMN_SCHEMA("network_speed", //column_name
 | 
			
		||||
      ++column_id, //column_id
 | 
			
		||||
      0, //rowkey_id
 | 
			
		||||
      0, //index_id
 | 
			
		||||
      0, //part_key_pos
 | 
			
		||||
      ObIntType, //column_type
 | 
			
		||||
      CS_TYPE_INVALID, //column_collation_type
 | 
			
		||||
      sizeof(int64_t), //column_length
 | 
			
		||||
      20, //column_precision
 | 
			
		||||
      0, //column_scale
 | 
			
		||||
      1000, //is_nullable
 | 
			
		||||
      false); //is_autoincrement
 | 
			
		||||
  }
 | 
			
		||||
  table_schema.set_index_using_type(USING_BTREE);
 | 
			
		||||
  table_schema.set_row_store_type(ENCODING_ROW_STORE);
 | 
			
		||||
  table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
 | 
			
		||||
  table_schema.set_progressive_merge_round(1);
 | 
			
		||||
  table_schema.set_storage_format_version(3);
 | 
			
		||||
  table_schema.set_tablet_id(OB_ALL_AUX_STAT_TID);
 | 
			
		||||
  table_schema.set_aux_lob_meta_tid(OB_ALL_AUX_STAT_AUX_LOB_META_TID);
 | 
			
		||||
  table_schema.set_aux_lob_piece_tid(OB_ALL_AUX_STAT_AUX_LOB_PIECE_TID);
 | 
			
		||||
 | 
			
		||||
  table_schema.set_max_used_column_id(column_id);
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
} // end namespace share
 | 
			
		||||
} // end namespace oceanbase
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user