/** * Copyright (c) 2021 OceanBase * OceanBase CE is licensed under Mulan PubL v2. * You can use this software according to the terms and conditions of the Mulan PubL v2. * You may obtain a copy of Mulan PubL v2 at: * http://license.coscl.org.cn/MulanPubL-2.0 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. * See the Mulan PubL v2 for more details. */ #define USING_LOG_PREFIX SHARE_SCHEMA #include "ob_inner_table_schema.h" #include "share/schema/ob_schema_macro_define.h" #include "share/schema/ob_schema_service_sql_impl.h" #include "share/schema/ob_table_schema.h" namespace oceanbase { using namespace share::schema; using namespace common; namespace share { int ObInnerTableSchema::v_ob_global_transaction_ora_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_INVALID_ID); table_schema.set_database_id(OB_ORA_SYS_DATABASE_ID); table_schema.set_table_id(OB_V_OB_GLOBAL_TRANSACTION_ORA_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(0); table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK); table_schema.set_table_type(SYSTEM_VIEW); 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_V_OB_GLOBAL_TRANSACTION_ORA_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)) { if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT * FROM SYS.GV$OB_GLOBAL_TRANSACTION WHERE svr_ip=HOST_IP() AND svr_port=RPC_PORT() )__"))) { LOG_ERROR("fail to set view_definition", K(ret)); } } 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(0); table_schema.set_max_used_column_id(column_id); return ret; } int ObInnerTableSchema::dba_ob_ls_ora_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_INVALID_ID); table_schema.set_database_id(OB_ORA_SYS_DATABASE_ID); table_schema.set_table_id(OB_DBA_OB_LS_ORA_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(0); table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK); table_schema.set_table_type(SYSTEM_VIEW); 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_DBA_OB_LS_ORA_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)) { if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT CAST(A.LS_ID AS NUMBER) AS LS_ID, A.STATUS, C.ZONE_PRIORITY AS PRIMARY_ZONE, CAST(A.UNIT_GROUP_ID AS NUMBER) AS UNIT_GROUP_ID, CAST(A.LS_GROUP_ID AS NUMBER) AS LS_GROUP_ID, /* SYS LS's CREATE_SCN always is NULL, it means nothing */ (CASE A.LS_ID WHEN 1 THEN NULL ELSE CAST(B.CREATE_SCN AS NUMBER) END) AS CREATE_SCN, /* show NULL if not dropped */ (CASE B.DROP_SCN WHEN 1 THEN NULL ELSE CAST(B.DROP_SCN AS NUMBER) END) AS DROP_SCN, /* SYS tenant and Meta tenant always show NULL */ (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN BITAND(A.TENANT_ID, 1) = 1 THEN NULL ELSE CAST(B.SYNC_SCN AS NUMBER) END) AS SYNC_SCN, /* SYS tenant and Meta tenant always show NULL */ (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN BITAND(A.TENANT_ID, 1) = 1 THEN NULL ELSE CAST(B.READABLE_SCN AS NUMBER) END) AS READABLE_SCN FROM SYS.ALL_VIRTUAL_LS_STATUS A JOIN SYS.ALL_VIRTUAL_LS_RECOVERY_STAT B ON A.TENANT_ID = B.TENANT_ID AND A.LS_ID = B.LS_ID JOIN SYS.ALL_VIRTUAL_LS_ELECTION_REFERENCE_INFO C ON A.TENANT_ID = C.TENANT_ID AND A.LS_ID = C.LS_ID WHERE A.TENANT_ID = EFFECTIVE_TENANT_ID() )__"))) { LOG_ERROR("fail to set view_definition", K(ret)); } } 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(0); table_schema.set_max_used_column_id(column_id); return ret; } int ObInnerTableSchema::dba_ob_table_locations_ora_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_INVALID_ID); table_schema.set_database_id(OB_ORA_SYS_DATABASE_ID); table_schema.set_table_id(OB_DBA_OB_TABLE_LOCATIONS_ORA_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(0); table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK); table_schema.set_table_type(SYSTEM_VIEW); 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_DBA_OB_TABLE_LOCATIONS_ORA_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)) { if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT D.DATABASE_NAME, A.TABLE_NAME, A.TABLE_ID, CASE WHEN A.TABLE_TYPE IN (0) THEN 'SYSTEM TABLE' WHEN A.TABLE_TYPE IN (3,6,8,9) THEN 'USER TABLE' WHEN A.TABLE_TYPE IN (5) THEN 'INDEX' WHEN A.TABLE_TYPE IN (12,13) THEN 'LOB AUX TABLE' ELSE NULL END AS TABLE_TYPE, A.PARTITION_NAME, A.SUBPARTITION_NAME, /* INDEX_NAME is valid when table is index */ CASE WHEN A.TABLE_TYPE != 5 THEN NULL WHEN D.DATABASE_NAME != '__recyclebin' THEN SUBSTR(TABLE_NAME, 7 + INSTR(SUBSTR(TABLE_NAME, 7), '_')) ELSE TABLE_NAME END AS INDEX_NAME, CASE WHEN DATA_TABLE_ID = 0 THEN NULL ELSE DATA_TABLE_ID END AS DATA_TABLE_ID, A.TABLET_ID, C.LS_ID, C.ZONE, C.SVR_IP AS SVR_IP, C.SVR_PORT AS SVR_PORT, C.ROLE, C.REPLICA_TYPE FROM ( SELECT TENANT_ID, DATABASE_ID, TABLE_NAME, TABLE_ID, 'NULL' AS PARTITION_NAME, 'NULL' AS SUBPARTITION_NAME, TABLET_ID AS TABLET_ID, TABLE_TYPE, DATA_TABLE_ID FROM SYS.ALL_VIRTUAL_CORE_ALL_TABLE WHERE TABLET_ID != 0 AND TENANT_ID = EFFECTIVE_TENANT_ID() UNION ALL SELECT T.TENANT_ID AS TENANT_ID, T.DATABASE_ID AS DATABASE_ID, T.TABLE_NAME AS TABLE_NAME, T.TABLE_ID AS TABLE_ID, 'NULL' AS PARTITION_NAME, 'NULL' AS SUBPARTITION_NAME, TABLET_ID AS TABLET_ID, TABLE_TYPE, DATA_TABLE_ID FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT T WHERE T.TABLET_ID != 0 AND T.PART_LEVEL = 0 AND T.TENANT_ID = EFFECTIVE_TENANT_ID() UNION ALL SELECT T.TENANT_ID AS TENANT_ID, T.DATABASE_ID AS DATABASE_ID, T.TABLE_NAME AS TABLE_NAME, T.TABLE_ID AS TABLE_ID, P.PART_NAME AS PARTITION_NAME, 'NULL' AS SUBPARTITION_NAME, P.TABLET_ID AS TABLET_ID, TABLE_TYPE, DATA_TABLE_ID FROM SYS.ALL_VIRTUAL_TABLE_REAL_AGENT T JOIN SYS.ALL_VIRTUAL_PART_REAL_AGENT P ON T.TABLE_ID = P.TABLE_ID AND T.TENANT_ID = P.TENANT_ID WHERE T.PART_LEVEL = 1 AND T.TENANT_ID = EFFECTIVE_TENANT_ID() UNION ALL SELECT T.TENANT_ID AS TENANT_ID, T.DATABASE_ID AS DATABASE_ID, T.TABLE_NAME AS TABLE_NAME, T.TABLE_ID AS TABLE_ID, P.PART_NAME AS PARTITION_NAME, Q.SUB_PART_NAME AS SUBPARTITION_NAME, Q.TABLET_ID AS TABLET_ID, TABLE_TYPE, DATA_TABLE_ID FROM SYS.ALL_VIRTUAL_SUB_PART_REAL_AGENT Q JOIN SYS.ALL_VIRTUAL_PART_REAL_AGENT P ON P.PART_ID =Q.PART_ID AND Q.TENANT_ID = P.TENANT_ID JOIN SYS.ALL_VIRTUAL_TABLE_REAL_AGENT T ON T.TABLE_ID =P.TABLE_ID AND T.TENANT_ID = Q.TENANT_ID WHERE T.PART_LEVEL = 2 AND T.TENANT_ID = EFFECTIVE_TENANT_ID() ) A JOIN SYS.DBA_OB_TABLET_TO_LS B ON A.TABLET_ID = B.TABLET_ID JOIN SYS.DBA_OB_LS_LOCATIONS C ON B.LS_ID = C.LS_ID JOIN SYS.ALL_VIRTUAL_DATABASE_REAL_AGENT D ON A.DATABASE_ID = D.DATABASE_ID AND A.TENANT_ID = D.TENANT_ID ORDER BY A.TABLE_ID, A.TABLET_ID, C.ZONE, SVR_IP, SVR_PORT )__"))) { LOG_ERROR("fail to set view_definition", K(ret)); } } 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(0); table_schema.set_max_used_column_id(column_id); return ret; } int ObInnerTableSchema::all_table_history_idx_data_table_id_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_TABLE_HISTORY_IDX_DATA_TABLE_ID_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(3); table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK); table_schema.set_table_type(USER_INDEX); table_schema.set_index_type(INDEX_TYPE_NORMAL_LOCAL); table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL); if (OB_SUCC(ret)) { if (OB_FAIL(table_schema.set_table_name(OB_ALL_TABLE_HISTORY_IDX_DATA_TABLE_ID_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)) { ++column_id; // for gmt_create } if (OB_SUCC(ret)) { ++column_id; // for gmt_modified } 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_TABLE_HISTORY_IDX_DATA_TABLE_ID_TID); if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("data_table_id", //column_name column_id + 23, //column_id 1, //rowkey_id 1, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale true,//is_nullable false); //is_autoincrement } if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("tenant_id", //column_name column_id + 1, //column_id 2, //rowkey_id 0, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("table_id", //column_name column_id + 2, //column_id 3, //rowkey_id 0, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("schema_version", //column_name column_id + 3, //column_id 4, //rowkey_id 0, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } table_schema.set_index_status(INDEX_STATUS_AVAILABLE); table_schema.set_index_type(INDEX_TYPE_NORMAL_LOCAL); table_schema.set_data_table_id(OB_ALL_TABLE_HISTORY_TID); table_schema.set_max_used_column_id(column_id + 23); return ret; } int ObInnerTableSchema::all_log_archive_piece_files_idx_status_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_LOG_ARCHIVE_PIECE_FILES_IDX_STATUS_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(4); table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK); table_schema.set_table_type(USER_INDEX); table_schema.set_index_type(INDEX_TYPE_NORMAL_LOCAL); table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL); if (OB_SUCC(ret)) { if (OB_FAIL(table_schema.set_table_name(OB_ALL_LOG_ARCHIVE_PIECE_FILES_IDX_STATUS_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)) { ++column_id; // for gmt_create } if (OB_SUCC(ret)) { ++column_id; // for gmt_modified } 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_LOG_ARCHIVE_PIECE_FILES_IDX_STATUS_TID); if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("tenant_id", //column_name column_id + 1, //column_id 1, //rowkey_id 1, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("dest_id", //column_name column_id + 2, //column_id 2, //rowkey_id 2, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } if (OB_SUCC(ret)) { ObObj file_status_default; file_status_default.set_varchar(ObString::make_string("INVALID")); ADD_COLUMN_SCHEMA_T("file_status", //column_name column_id + 18, //column_id 3, //rowkey_id 3, //index_id 0, //part_key_pos ObVarcharType, //column_type CS_TYPE_UTF8MB4_BIN, //column_collation_type OB_DEFAULT_STATUS_LENTH, //column_length -1, //column_precision -1, //column_scale false, //is_nullable false, //is_autoincrement file_status_default, file_status_default); //default_value } if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("round_id", //column_name column_id + 3, //column_id 4, //rowkey_id 0, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("piece_id", //column_name column_id + 4, //column_id 5, //rowkey_id 0, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } table_schema.set_index_status(INDEX_STATUS_AVAILABLE); table_schema.set_index_type(INDEX_TYPE_NORMAL_LOCAL); table_schema.set_data_table_id(OB_ALL_LOG_ARCHIVE_PIECE_FILES_TID); table_schema.set_max_used_column_id(column_id + 18); return ret; } int ObInnerTableSchema::all_backup_set_files_idx_status_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_BACKUP_SET_FILES_IDX_STATUS_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(3); table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK); table_schema.set_table_type(USER_INDEX); table_schema.set_index_type(INDEX_TYPE_NORMAL_LOCAL); table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL); if (OB_SUCC(ret)) { if (OB_FAIL(table_schema.set_table_name(OB_ALL_BACKUP_SET_FILES_IDX_STATUS_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)) { ++column_id; // for gmt_create } if (OB_SUCC(ret)) { ++column_id; // for gmt_modified } 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_BACKUP_SET_FILES_IDX_STATUS_TID); if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("tenant_id", //column_name column_id + 1, //column_id 1, //rowkey_id 1, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("dest_id", //column_name column_id + 3, //column_id 2, //rowkey_id 2, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("file_status", //column_name column_id + 11, //column_id 3, //rowkey_id 3, //index_id 0, //part_key_pos ObVarcharType, //column_type CS_TYPE_UTF8MB4_BIN, //column_collation_type OB_DEFAULT_STATUS_LENTH, //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("backup_set_id", //column_name column_id + 2, //column_id 4, //rowkey_id 0, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } table_schema.set_index_status(INDEX_STATUS_AVAILABLE); table_schema.set_index_type(INDEX_TYPE_NORMAL_LOCAL); table_schema.set_data_table_id(OB_ALL_BACKUP_SET_FILES_TID); table_schema.set_max_used_column_id(column_id + 11); return ret; } int ObInnerTableSchema::all_ddl_task_status_idx_task_key_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_DDL_TASK_STATUS_IDX_TASK_KEY_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(USER_INDEX); table_schema.set_index_type(INDEX_TYPE_UNIQUE_LOCAL); table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL); if (OB_SUCC(ret)) { if (OB_FAIL(table_schema.set_table_name(OB_ALL_DDL_TASK_STATUS_IDX_TASK_KEY_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)) { ++column_id; // for gmt_create } if (OB_SUCC(ret)) { ++column_id; // for gmt_modified } 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_DDL_TASK_STATUS_IDX_TASK_KEY_TID); if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("target_object_id", //column_name column_id + 4, //column_id 1, //rowkey_id 1, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("object_id", //column_name column_id + 3, //column_id 2, //rowkey_id 2, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("schema_version", //column_name column_id + 6, //column_id 3, //rowkey_id 3, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA_WITH_COLUMN_FLAGS("shadow_pk_0", //column_name column_id + 32768, //column_id 4, //rowkey_id 0, //index_id 0, //part_key_pos ObIntType, //column_type CS_TYPE_INVALID, //column_collation_type sizeof(int64_t), //column_length -1, //column_precision -1, //column_scale true,//is_nullable false,//is_autoincrement true,//is_hidden false);//is_storing_column } if (OB_SUCC(ret)) { ADD_COLUMN_SCHEMA("task_id", //column_name column_id + 1, //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 -1, //column_precision -1, //column_scale false,//is_nullable false); //is_autoincrement } table_schema.set_index_status(INDEX_STATUS_AVAILABLE); table_schema.set_index_type(INDEX_TYPE_UNIQUE_LOCAL); table_schema.set_data_table_id(OB_ALL_DDL_TASK_STATUS_TID); table_schema.set_max_used_column_id(column_id + 32768); return ret; } } // end namespace share } // end namespace oceanbase