init push
This commit is contained in:
835
src/share/inner_table/ob_inner_table_schema.20001_20050.cpp
Normal file
835
src/share/inner_table/ob_inner_table_schema.20001_20050.cpp
Normal file
@ -0,0 +1,835 @@
|
||||
/**
|
||||
* 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::gv_plan_cache_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(combine_id(OB_SYS_TENANT_ID, OB_SYS_TABLEGROUP_ID));
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_SYS_DATABASE_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_GV_PLAN_CACHE_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(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_GV_PLAN_CACHE_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( SELECT tenant_id,svr_ip,svr_port,sql_num,mem_used,mem_hold,access_count, hit_count,hit_rate,plan_num,mem_limit,hash_bucket,stmtkey_num FROM oceanbase.__all_virtual_plan_cache_stat WHERE is_serving_tenant(svr_ip, svr_port, effective_tenant_id()) and (tenant_id = effective_tenant_id() or effective_tenant_id() = 1) )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::gv_plan_cache_plan_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(combine_id(OB_SYS_TENANT_ID, OB_SYS_TABLEGROUP_ID));
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_SYS_DATABASE_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_GV_PLAN_CACHE_PLAN_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(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_GV_PLAN_CACHE_PLAN_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( SELECT tenant_id,svr_ip,svr_port,plan_id,sql_id,type,is_bind_sensitive,is_bind_aware,db_id,statement,query_sql,special_params,param_infos, sys_vars,plan_hash,first_load_time,schema_version,merged_version,last_active_time,avg_exe_usec,slowest_exe_time,slowest_exe_usec,slow_count,hit_count,plan_size,executions,disk_reads,direct_writes,buffer_gets,application_wait_time,concurrency_wait_time,user_io_wait_time,rows_processed,elapsed_time,cpu_time,large_querys,delayed_large_querys,delayed_px_querys,outline_version,outline_id,outline_data,acs_sel_info,table_scan,evolution, evo_executions, evo_cpu_time, timeout_count, ps_stmt_id, sessid, temp_tables, is_use_jit,object_type,hints_info,hints_all_worked, pl_schema_id, is_batched_multi_stmt FROM oceanbase.__all_virtual_plan_stat WHERE is_serving_tenant(svr_ip, svr_port, effective_tenant_id()) and (tenant_id = effective_tenant_id() or effective_tenant_id() = 1) )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::schemata_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(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_SCHEMATA_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_SCHEMATA_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( SELECT 'def' AS CATALOG_NAME, DATABASE_NAME AS SCHEMA_NAME, 'utf8mb4' AS DEFAULT_CHARACTER_SET_NAME, 'utf8mb4_general_ci' AS DEFAULT_COLLATION_NAME, NULL AS SQL_PATH FROM oceanbase.__all_virtual_database a WHERE a.tenant_id = effective_tenant_id() and in_recyclebin = 0 and database_name != '__recyclebin' )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::character_sets_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(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_CHARACTER_SETS_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_CHARACTER_SETS_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( SELECT CHARSET AS CHARACTER_SET_NAME, DEFAULT_COLLATION AS DEFAULT_COLLATE_NAME, DESCRIPTION, max_length AS MAXLEN FROM oceanbase.__tenant_virtual_charset )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::global_variables_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(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_GLOBAL_VARIABLES_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_GLOBAL_VARIABLES_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( SELECT `variable_name` as VARIABLE_NAME, `value` as VARIABLE_VALUE FROM oceanbase.__tenant_virtual_global_variable )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::statistics_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(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_STATISTICS_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_STATISTICS_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( SELECT 'def' as TABLE_CATALOG, table_schema AS TABLE_SCHEMA, `table` as TABLE_NAME, non_unique AS NON_UNIQUE, index_schema as INDEX_SCHEMA, key_name as INDEX_NAME, seq_in_index as SEQ_IN_INDEX, column_name as COLUMN_NAME, collation as COLLATION, cardinality as CARDINALITY, sub_part as SUB_PART, packed as PACKED, `null` as NULLABLE, index_type as INDEX_TYPE, COMMENT, index_comment as INDEX_COMMENT, is_visible as IS_VISIBLE FROM oceanbase.__tenant_virtual_table_index )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::views_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(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_VIEWS_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_VIEWS_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__(select /*+ READ_CONSISTENCY(WEAK) */ 'def' AS TABLE_CATALOG, d.database_name as TABLE_SCHEMA, t.table_name as TABLE_NAME, t.view_definition as VIEW_DEFINITION, 'NONE' as CHECK_OPTION, case t.view_is_updatable when 1 then 'YES' else 'NO' end as IS_UPDATABLE, 'NONE' as DEFINER, 'NONE' AS SECURITY_TYPE, case t.collation_type when 45 then 'utf8mb4' else 'NONE' end AS CHARACTER_SET_CLIENT, case t.collation_type when 45 then 'utf8mb4_general_ci' else 'NONE' end AS COLLATION_CONNECTION from oceanbase.__all_virtual_table as t join oceanbase.__all_virtual_database as d on t.tenant_id = effective_tenant_id() and d.tenant_id = effective_tenant_id() and t.database_id = d.database_id where (t.table_type = 1 or t.table_type = 4) and d.in_recyclebin = 0 and d.database_name != '__recyclebin' and d.database_name != 'information_schema' and d.database_name != 'oceanbase' )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::tables_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(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_TABLES_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_TABLES_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__(select /*+ READ_CONSISTENCY(WEAK), use_merge(b, c, d, e)*/ 'def' as TABLE_CATALOG, b.database_name as TABLE_SCHEMA, a.table_name as TABLE_NAME, case when a.database_id & 0xFFFFFFFFFF = 2 then 'SYSTEM VIEW' when (a.table_type = 1 or a.table_type = 4) then 'VIEW' when a.table_type = 2 then 'SYSTEM TABLE' when a.table_type = 1 then 'INDEX' else 'BASE TABLE' end as TABLE_TYPE, NULL as ENGINE, NULL as VERSION, NULL as ROW_FORMAT, sum(c.row_count) as TABLE_ROWS, case when sum(c.row_count) = 0 then 0 else sum(c.data_size)/sum(c.row_count) end as AVG_ROW_LENGTH, sum(c.data_size) as DATA_LENGTH, NULL as MAX_DATA_LENGTH, NULL as INDEX_LENGTH, NULL as DATA_FREE, NULL as AUTO_INCREMENT, a.gmt_create as CREATE_TIME, a.gmt_modified as UPDATE_TIME, NULL as CHECK_TIME, d.collation as TABLE_COLLATION, cast(NULL as unsigned) as CHECKSUM, NULL as CREATE_OPTIONS, a.comment as TABLE_COMMENT from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_database b on a.database_id = b.database_id left join oceanbase.__all_virtual_tenant_partition_meta_table c on a.table_id = c.table_id and c.tenant_id = effective_tenant_id() and a.tenant_id = c.tenant_id and c.role = 1 inner join oceanbase.__all_collation d on a.collation_type = d.id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and a.table_type != 5 and b.database_name != '__recyclebin' and b.in_recyclebin = 0 group by a.table_id, b.database_name, a.table_name, a.table_type, a.gmt_create, a.gmt_modified, d.collation, a.comment )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::collations_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(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_COLLATIONS_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_COLLATIONS_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__(select collation as COLLATION_NAME, charset as CHARACTER_SET_NAME, id as ID, `is_default` as IS_DEFAULT, is_compiled as IS_COMPILED, sortlen as SORTLEN from oceanbase.__tenant_virtual_collation )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::collation_character_set_applicability_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(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_COLLATION_CHARACTER_SET_APPLICABILITY_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_COLLATION_CHARACTER_SET_APPLICABILITY_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__(select collation as COLLATION_NAME, charset as CHARACTER_SET_NAME from oceanbase.__tenant_virtual_collation )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::processlist_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(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_PROCESSLIST_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_PROCESSLIST_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__(SELECT id AS ID, user AS USER, host AS HOST, db AS DB, command AS COMMAND, time AS TIME, state AS STATE, info AS INFO FROM oceanbase.__all_virtual_processlist WHERE is_serving_tenant(svr_ip, svr_port, 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(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::key_column_usage_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(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_KEY_COLUMN_USAGE_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_KEY_COLUMN_USAGE_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__((select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, c.database_name as CONSTRAINT_SCHEMA, 'PRIMARY' as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, c.database_name as TABLE_SCHEMA, a.table_name as TABLE_NAME, b.column_name as COLUMN_NAME, b.rowkey_position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, NULL as REFERENCED_TABLE_SCHEMA, NULL as REFERENCED_TABLE_NAME, NULL as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_column b on a.table_id = b.table_id inner join oceanbase.__all_virtual_database c on a.database_id = c.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and c.in_recyclebin = 0 and c.database_name != '__recyclebin' and b.rowkey_position > 0 and b.column_id >= 16 and a.table_type != 5 and b.column_flags & (0x1 << 8) = 0) union (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, d.database_name as CONSTRAINT_SCHEMA, substr(a.table_name, 2 + length(substring_index(a.table_name,'_',4))) as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, d.database_name as TABLE_SCHEMA, c.table_name as TABLE_NAME, b.column_name as COLUMN_NAME, b.index_position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, NULL as REFERENCED_TABLE_SCHEMA, NULL as REFERENCED_TABLE_NAME, NULL as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_column b on a.table_id = b.table_id inner join oceanbase.__all_virtual_table c on a.data_table_id = c.table_id inner join oceanbase.__all_virtual_database d on c.database_id = d.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and d.in_recyclebin = 0 and d.tenant_id = effective_tenant_id() and d.database_name != '__recyclebin' and a.table_type = 5 and a.index_type in (2, 4, 8) and b.index_position > 0) )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::dba_outlines_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(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_DBA_OUTLINES_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_OUTLINES_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__(select /*+ READ_CONSISTENCY(WEAK)*/ a.name as NAME, a.owner as OWNER, b.database_name as DB_NAME, NULL as CATEGORY, a.used as USED, a.gmt_create as TIMESTAMP, a.version as VERSION, a.sql_text as SQL_TEXT, a.signature as SIGNATURE, a.compatible as COMPATIBLE, a.enabled as ENABLED, a.format as FORMAT, a.outline_content as OUTLINE_CONTENT, a.outline_target as OUTLINE_TARGET, a.owner_id as OWNER_ID from oceanbase.__all_virtual_outline a inner join oceanbase.__all_virtual_database b on a.database_id = b.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and b.in_recyclebin = 0 )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::engines_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(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_ENGINES_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_ENGINES_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT * FROM oceanbase.__all_virtual_engine )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::routines_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(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
table_schema.set_table_id(combine_id(OB_SYS_TENANT_ID, OB_ROUTINES_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_ROUTINES_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()));
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( select SPECIFIC_NAME, 'def' as ROUTINE_CATALOG, db as ROUTINE_SCHEMA, name as ROUTINE_NAME, type as ROUTINE_TYPE, '' as DATA_TYPE, NULL as CHARACTER_MAXIMUM_LENGTH, NULL as CHARACTER_OCTET_LENGTH, NULL as NUMERIC_PRECISION, NULL as NUMERIC_SCALE, NULL as DATETIME_PRECISION, NULL as CHARACTER_SET_NAME, NULL as COLLATION_NAME, NULL as DTD_IDENTIFIER, 'SQL' as ROUTINE_BODY, body as ROUTINE_DEFINITION, NULL as EXTERNAL_NAME, NULL as EXTERNAL_LANGUAGE, 'SQL' as PARAMETER_STYLE, IS_DETERMINISTIC, SQL_DATA_ACCESS, NULL as SQL_PATH, SECURITY_TYPE, CREATED, modified as LAST_ALTERED, SQL_MODE, comment as ROUTINE_COMMENT, DEFINER, CHARACTER_SET_CLIENT, COLLATION_CONNECTION, collation_database as DATABASE_COLLATION from mysql.proc; )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
table_schema.set_index_using_type(USING_BTREE);
|
||||
table_schema.set_row_store_type(FLAT_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
|
||||
table_schema.set_progressive_merge_round(1);
|
||||
table_schema.set_storage_format_version(3);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // end namespace share
|
||||
} // end namespace oceanbase
|
||||
Reference in New Issue
Block a user