__all_ls will delete anymore and add ls_event to history
This commit is contained in:
parent
1e30cd9247
commit
3e4a57c15d
@ -793,20 +793,22 @@ int ObRecoveryLSService::process_ls_operator_in_trans_(
|
||||
tenant_info.get_switchover_status(), trans))) {
|
||||
LOG_WARN("failed to drop ls", KR(ret), K(tenant_id_), K(ls_attr));
|
||||
}
|
||||
} else if (OB_FAIL(ls_operator.get_ls_status_info(tenant_id_, ls_attr.get_ls_id(),
|
||||
ls_status, trans))) {
|
||||
LOG_WARN("failed to get ls status", KR(ret), K(tenant_id_), K(ls_attr));
|
||||
} else if (share::is_ls_drop_end_op(ls_attr.get_ls_operation_type())) {
|
||||
if (OB_FAIL(ls_life_agent.set_ls_offline_in_trans(tenant_id_, ls_attr.get_ls_id(),
|
||||
ls_attr.get_ls_status(), sync_scn, tenant_info.get_switchover_status(), trans))) {
|
||||
LOG_WARN("failed to set offline", KR(ret), K(tenant_id_), K(ls_attr), K(sync_scn), K(tenant_info));
|
||||
ls_status.status_, sync_scn, tenant_info.get_switchover_status(), trans))) {
|
||||
LOG_WARN("failed to set offline", KR(ret), K(tenant_id_), K(ls_attr),
|
||||
K(sync_scn), K(tenant_info), K(ls_status));
|
||||
}
|
||||
} else if (ls_status.ls_is_creating()) {
|
||||
//can not be creating, must be created or other status
|
||||
ret = OB_EAGAIN;
|
||||
LOG_WARN("ls not created, need wait", KR(ret), K(ls_status));
|
||||
} else {
|
||||
ObLSStatus target_status = share::OB_LS_EMPTY;
|
||||
if (OB_FAIL(ls_operator.get_ls_status_info(tenant_id_, ls_attr.get_ls_id(),
|
||||
ls_status, trans))) {
|
||||
LOG_WARN("failed to get ls status", KR(ret), K(tenant_id_), K(ls_attr));
|
||||
} else if (ls_status.ls_is_creating()) {
|
||||
ret = OB_EAGAIN;
|
||||
LOG_WARN("ls not created, need wait", KR(ret), K(ls_status));
|
||||
} else if (share::is_ls_create_end_op(ls_attr.get_ls_operation_type())) {
|
||||
if (share::is_ls_create_end_op(ls_attr.get_ls_operation_type())) {
|
||||
// set ls to normal
|
||||
target_status = share::OB_LS_NORMAL;
|
||||
} else if (share::is_ls_tenant_drop_op(ls_attr.get_ls_operation_type())) {
|
||||
|
@ -1104,6 +1104,350 @@ int ObInnerTableSchema::all_virtual_tenant_event_history_schema(ObTableSchema &t
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_virtual_balance_task_helper_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_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_ALL_VIRTUAL_BALANCE_TASK_HELPER_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(2);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(VIRTUAL_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_VIRTUAL_BALANCE_TASK_HELPER_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)) {
|
||||
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
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("operation_scn", //column_name
|
||||
++column_id, //column_id
|
||||
2, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObUInt64Type, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(uint64_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA_TS("gmt_create", //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)) {
|
||||
ADD_COLUMN_SCHEMA_TS("gmt_modified", //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 operation_type_default;
|
||||
operation_type_default.set_varchar(ObString::make_string(""));
|
||||
ADD_COLUMN_SCHEMA_T("operation_type", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
OB_DEFAULT_STATUS_LENTH, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false, //is_autoincrement
|
||||
operation_type_default,
|
||||
operation_type_default); //default_value
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("src_ls", //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
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("dest_ls", //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
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("ls_group_id", //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
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //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(0);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::all_virtual_balance_group_ls_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_INVALID_ID);
|
||||
table_schema.set_database_id(OB_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_ALL_VIRTUAL_BALANCE_GROUP_LS_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(4);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(VIRTUAL_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_VIRTUAL_BALANCE_GROUP_LS_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)) {
|
||||
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
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("balance_group_id_high", //column_name
|
||||
++column_id, //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("balance_group_id_low", //column_name
|
||||
++column_id, //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("ls_id", //column_name
|
||||
++column_id, //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_TS("gmt_create", //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)) {
|
||||
ADD_COLUMN_SCHEMA_TS("gmt_modified", //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 tablet_group_count_default;
|
||||
tablet_group_count_default.set_int(0);
|
||||
ADD_COLUMN_SCHEMA_T("tablet_group_count", //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
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false, //is_autoincrement
|
||||
tablet_group_count_default,
|
||||
tablet_group_count_default); //default_value
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ObObj balance_group_name_default;
|
||||
balance_group_name_default.set_varchar(ObString::make_string(""));
|
||||
ADD_COLUMN_SCHEMA_T("balance_group_name", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
OB_MAX_BALANCE_GROUP_NAME_LENGTH, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false, //is_autoincrement
|
||||
balance_group_name_default,
|
||||
balance_group_name_default); //default_value
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace share
|
||||
} // end namespace oceanbase
|
||||
|
179
src/share/inner_table/ob_inner_table_schema.15401_15450.cpp
Normal file
179
src/share/inner_table/ob_inner_table_schema.15401_15450.cpp
Normal file
@ -0,0 +1,179 @@
|
||||
/**
|
||||
* 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"
|
||||
#include "share/scn.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace share::schema;
|
||||
using namespace common;
|
||||
namespace share
|
||||
{
|
||||
|
||||
int ObInnerTableSchema::all_virtual_ls_real_agent_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_ALL_VIRTUAL_LS_REAL_AGENT_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(1);
|
||||
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
|
||||
table_schema.set_table_type(VIRTUAL_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_VIRTUAL_LS_REAL_AGENT_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(ObCollationType::CS_TYPE_UTF8MB4_BIN);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("LS_ID", //column_name
|
||||
++column_id, //column_id
|
||||
1, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObNumberType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
38, //column_length
|
||||
38, //column_precision
|
||||
0, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("LS_GROUP_ID", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObNumberType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
38, //column_length
|
||||
38, //column_precision
|
||||
0, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("STATUS", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_UTF8MB4_BIN, //column_collation_type
|
||||
100, //column_length
|
||||
2, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("FLAG", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObVarcharType, //column_type
|
||||
CS_TYPE_UTF8MB4_BIN, //column_collation_type
|
||||
OB_MAX_LS_FLAG_LENGTH, //column_length
|
||||
2, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("CREATE_SCN", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObNumberType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
38, //column_length
|
||||
38, //column_precision
|
||||
0, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("GMT_CREATE", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampLTZType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
0, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("GMT_MODIFIED", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObTimestampLTZType, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
0, //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
false, //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(0);
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace share
|
||||
} // end namespace oceanbase
|
@ -410,7 +410,7 @@ int ObInnerTableSchema::dba_ob_tenants_schema(ObTableSchema &table_schema)
|
||||
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 A.TENANT_ID, TENANT_NAME, (CASE WHEN A.TENANT_ID = 1 THEN 'SYS' WHEN (A.TENANT_ID & 0x1) = 1 THEN 'META' ELSE 'USER' END) AS TENANT_TYPE, A.gmt_create AS CREATE_TIME, A.gmt_modified AS MODIFY_TIME, PRIMARY_ZONE, LOCALITY, CASE previous_locality WHEN "" THEN NULL ELSE previous_locality END AS PREVIOUS_LOCALITY, CASE compatibility_mode WHEN 0 THEN 'MYSQL' WHEN 1 THEN 'ORACLE' ELSE NULL END AS COMPATIBILITY_MODE, STATUS, CASE in_recyclebin WHEN 0 THEN 'NO' ELSE 'YES' END AS IN_RECYCLEBIN, CASE locked WHEN 0 THEN 'NO' ELSE 'YES' END AS LOCKED, (CASE WHEN A.TENANT_ID = 1 THEN 'PRIMARY' WHEN (A.TENANT_ID & 0x1) = 1 THEN 'PRIMARY' ELSE TENANT_ROLE END) AS TENANT_ROLE, (CASE WHEN A.TENANT_ID = 1 THEN 'NORMAL' WHEN (A.TENANT_ID & 0x1) = 1 THEN 'NORMAL' ELSE SWITCHOVER_STATUS END) AS SWITCHOVER_STATUS, (CASE WHEN A.TENANT_ID = 1 THEN 0 WHEN (A.TENANT_ID & 0x1) = 1 THEN 0 ELSE SWITCHOVER_EPOCH END) AS SWITCHOVER_EPOCH, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (A.TENANT_ID & 0x1) = 1 THEN NULL ELSE SYNC_SCN END) AS SYNC_SCN, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (A.TENANT_ID & 0x1) = 1 THEN NULL ELSE REPLAYABLE_SCN END) AS REPLAYABLE_SCN, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (A.TENANT_ID & 0x1) = 1 THEN NULL ELSE READABLE_SCN END) AS READABLE_SCN, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (A.TENANT_ID & 0x1) = 1 THEN NULL ELSE RECOVERY_UNTIL_SCN END) AS RECOVERY_UNTIL_SCN, (CASE WHEN A.TENANT_ID = 1 THEN 'NOARCHIVELOG' WHEN (A.TENANT_ID & 0x1) = 1 THEN 'NOARCHIVELOG' ELSE LOG_MODE END) AS LOG_MODE, ARBITRATION_SERVICE_STATUS, UNIT_NUM, COMPATIBLE FROM OCEANBASE.__ALL_VIRTUAL_TENANT_MYSQL_SYS_AGENT AS A LEFT JOIN OCEANBASE.__ALL_VIRTUAL_TENANT_INFO AS B ON A.TENANT_ID = B.TENANT_ID LEFT JOIN (SELECT TENANT_ID, (CASE WHEN TENANT_ID < 1 THEN NULL WHEN TENANT_ID != 1 THEN TENANT_ID - 1 ELSE NULL END) AS META_TENANT_ID, MIN(UNIT_COUNT) AS UNIT_NUM FROM OCEANBASE.__ALL_VIRTUAL_RESOURCE_POOL_MYSQL_SYS_AGENT GROUP BY TENANT_ID) AS C ON A.TENANT_ID = C.TENANT_ID OR A.TENANT_ID = C.META_TENANT_ID LEFT JOIN (SELECT TENANT_ID, MIN(VALUE) AS COMPATIBLE FROM OCEANBASE.__ALL_VIRTUAL_TENANT_PARAMETER WHERE NAME = 'compatible' GROUP BY TENANT_ID) AS D ON A.TENANT_ID = D.TENANT_ID )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT A.TENANT_ID, TENANT_NAME, (CASE WHEN A.TENANT_ID = 1 THEN 'SYS' WHEN (A.TENANT_ID & 0x1) = 1 THEN 'META' ELSE 'USER' END) AS TENANT_TYPE, A.gmt_create AS CREATE_TIME, A.gmt_modified AS MODIFY_TIME, PRIMARY_ZONE, LOCALITY, CASE previous_locality WHEN "" THEN NULL ELSE previous_locality END AS PREVIOUS_LOCALITY, CASE compatibility_mode WHEN 0 THEN 'MYSQL' WHEN 1 THEN 'ORACLE' ELSE NULL END AS COMPATIBILITY_MODE, STATUS, CASE in_recyclebin WHEN 0 THEN 'NO' ELSE 'YES' END AS IN_RECYCLEBIN, CASE locked WHEN 0 THEN 'NO' ELSE 'YES' END AS LOCKED, (CASE WHEN A.TENANT_ID = 1 THEN 'PRIMARY' WHEN (A.TENANT_ID & 0x1) = 1 THEN 'PRIMARY' ELSE TENANT_ROLE END) AS TENANT_ROLE, (CASE WHEN A.TENANT_ID = 1 THEN 'NORMAL' WHEN (A.TENANT_ID & 0x1) = 1 THEN 'NORMAL' ELSE SWITCHOVER_STATUS END) AS SWITCHOVER_STATUS, (CASE WHEN A.TENANT_ID = 1 THEN 0 WHEN (A.TENANT_ID & 0x1) = 1 THEN 0 ELSE SWITCHOVER_EPOCH END) AS SWITCHOVER_EPOCH, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (A.TENANT_ID & 0x1) = 1 THEN NULL ELSE SYNC_SCN END) AS SYNC_SCN, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (A.TENANT_ID & 0x1) = 1 THEN NULL ELSE REPLAYABLE_SCN END) AS REPLAYABLE_SCN, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (A.TENANT_ID & 0x1) = 1 THEN NULL ELSE READABLE_SCN END) AS READABLE_SCN, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (A.TENANT_ID & 0x1) = 1 THEN NULL ELSE RECOVERY_UNTIL_SCN END) AS RECOVERY_UNTIL_SCN, (CASE WHEN A.TENANT_ID = 1 THEN 'NOARCHIVELOG' WHEN (A.TENANT_ID & 0x1) = 1 THEN 'NOARCHIVELOG' ELSE LOG_MODE END) AS LOG_MODE, ARBITRATION_SERVICE_STATUS, UNIT_NUM, COMPATIBLE, (CASE WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 1 ELSE B.MAX_LS_ID END) AS MAX_LS_ID FROM OCEANBASE.__ALL_VIRTUAL_TENANT_MYSQL_SYS_AGENT AS A LEFT JOIN OCEANBASE.__ALL_VIRTUAL_TENANT_INFO AS B ON A.TENANT_ID = B.TENANT_ID LEFT JOIN (SELECT TENANT_ID, (CASE WHEN TENANT_ID < 1 THEN NULL WHEN TENANT_ID != 1 THEN TENANT_ID - 1 ELSE NULL END) AS META_TENANT_ID, MIN(UNIT_COUNT) AS UNIT_NUM FROM OCEANBASE.__ALL_VIRTUAL_RESOURCE_POOL_MYSQL_SYS_AGENT GROUP BY TENANT_ID) AS C ON A.TENANT_ID = C.TENANT_ID OR A.TENANT_ID = C.META_TENANT_ID LEFT JOIN (SELECT TENANT_ID, MIN(VALUE) AS COMPATIBLE FROM OCEANBASE.__ALL_VIRTUAL_TENANT_PARAMETER WHERE NAME = 'compatible' GROUP BY TENANT_ID) AS D ON A.TENANT_ID = D.TENANT_ID )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
|
@ -1325,6 +1325,106 @@ int ObInnerTableSchema::dba_db_links_schema(ObTableSchema &table_schema)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::dba_ob_ls_history_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_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_DBA_OB_LS_HISTORY_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_HISTORY_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 (CASE WHEN A.LS_ID IS NULL THEN B.LS_ID ELSE A.LS_ID END) AS LS_ID, (CASE WHEN A.LS_GROUP_ID IS NULL THEN B.LS_GROUP_ID ELSE A.LS_GROUP_ID END) AS LS_GROUP_ID, (CASE WHEN A.STATUS IS NULL THEN B.STATUS ELSE A.STATUS END) AS STATUS, (CASE WHEN A.FLAG IS NULL THEN B.FLAG ELSE A.FLAG END) AS FLAG, (CASE WHEN A.LS_ID = 1 THEN 0 ELSE B.CREATE_SCN END) AS CREATE_SCN FROM OCEANBASE.__ALL_VIRTUAL_LS_STATUS AS A FULL JOIN OCEANBASE.__ALL_LS AS B ON A.LS_ID = B.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::cdb_ob_ls_history_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_SYS_DATABASE_ID);
|
||||
table_schema.set_table_id(OB_CDB_OB_LS_HISTORY_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_CDB_OB_LS_HISTORY_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 (CASE WHEN A.TENANT_ID IS NULL THEN B.TENANT_ID ELSE A.TENANT_ID END) AS TENANT_ID, (CASE WHEN A.LS_ID IS NULL THEN B.LS_ID ELSE A.LS_ID END) AS LS_ID, (CASE WHEN A.LS_GROUP_ID IS NULL THEN B.LS_GROUP_ID ELSE A.LS_GROUP_ID END) AS LS_GROUP_ID, (CASE WHEN A.STATUS IS NULL THEN B.STATUS ELSE A.STATUS END) AS STATUS, (CASE WHEN A.FLAG IS NULL THEN B.FLAG ELSE A.FLAG END) AS FLAG, (CASE WHEN A.LS_ID = 1 THEN 0 ELSE B.CREATE_SCN END) AS CREATE_SCN FROM OCEANBASE.__ALL_VIRTUAL_LS_STATUS AS A FULL JOIN OCEANBASE.__ALL_VIRTUAL_LS AS B ON A.LS_ID = B.LS_ID AND A.TENANT_ID = B.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_tenant_event_history_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -360,7 +360,7 @@ int ObInnerTableSchema::dba_ob_tenants_ora_schema(ObTableSchema &table_schema)
|
||||
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 A.TENANT_ID, TENANT_NAME, (CASE WHEN A.TENANT_ID = 1 THEN 'SYS' WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 'META' ELSE 'USER' END) AS TENANT_TYPE, A.gmt_create AS CREATE_TIME, A.gmt_modified AS MODIFY_TIME, PRIMARY_ZONE, LOCALITY, CASE previous_locality WHEN '' THEN NULL ELSE previous_locality END AS PREVIOUS_LOCALITY, CASE compatibility_mode WHEN 0 THEN 'MYSQL' WHEN 1 THEN 'ORACLE' ELSE NULL END AS COMPATIBILITY_MODE, STATUS, CASE in_recyclebin WHEN 0 THEN 'NO' ELSE 'YES' END AS IN_RECYCLEBIN, CASE locked WHEN 0 THEN 'NO' ELSE 'YES' END AS LOCKED, (CASE WHEN A.TENANT_ID = 1 THEN 'PRIMARY' WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 'PRIMARY' ELSE TENANT_ROLE END) AS TENANT_ROLE, (CASE WHEN A.TENANT_ID = 1 THEN 'NORMAL' WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 'NORMAL' ELSE SWITCHOVER_STATUS END) AS SWITCHOVER_STATUS, (CASE WHEN A.TENANT_ID = 1 THEN 0 WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 0 ELSE SWITCHOVER_EPOCH END) AS SWITCHOVER_EPOCH, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN NULL ELSE SYNC_SCN END) AS SYNC_SCN, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN NULL ELSE REPLAYABLE_SCN END) AS REPLAYABLE_SCN, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN NULL ELSE READABLE_SCN END) AS READABLE_SCN, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN NULL ELSE RECOVERY_UNTIL_SCN END) AS RECOVERY_UNTIL_SCN, (CASE WHEN A.TENANT_ID = 1 THEN 'NOARCHIVELOG' WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 'NOARCHIVELOG' ELSE LOG_MODE END) AS LOG_MODE, ARBITRATION_SERVICE_STATUS, UNIT_NUM, COMPATIBLE FROM SYS.ALL_VIRTUAL_TENANT_SYS_AGENT A LEFT JOIN SYS.ALL_VIRTUAL_TENANT_INFO B ON A.TENANT_ID = B.TENANT_ID LEFT JOIN (SELECT TENANT_ID, (CASE WHEN TENANT_ID < 1 THEN NULL WHEN TENANT_ID != 1 THEN TENANT_ID - 1 ELSE NULL END) AS META_TENANT_ID, MIN(UNIT_COUNT) AS UNIT_NUM FROM SYS.ALL_VIRTUAL_RESOURCE_POOL_SYS_AGENT GROUP BY TENANT_ID) C ON A.TENANT_ID = C.TENANT_ID OR A.TENANT_ID = C.META_TENANT_ID LEFT JOIN (SELECT TENANT_ID, MIN(VALUE) AS COMPATIBLE FROM SYS.ALL_VIRTUAL_TENANT_PARAMETER WHERE NAME = 'compatible' GROUP BY TENANT_ID) D ON A.TENANT_ID = D.TENANT_ID WHERE A.TENANT_ID = EFFECTIVE_TENANT_ID() )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT A.TENANT_ID, TENANT_NAME, (CASE WHEN A.TENANT_ID = 1 THEN 'SYS' WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 'META' ELSE 'USER' END) AS TENANT_TYPE, A.gmt_create AS CREATE_TIME, A.gmt_modified AS MODIFY_TIME, PRIMARY_ZONE, LOCALITY, CASE previous_locality WHEN '' THEN NULL ELSE previous_locality END AS PREVIOUS_LOCALITY, CASE compatibility_mode WHEN 0 THEN 'MYSQL' WHEN 1 THEN 'ORACLE' ELSE NULL END AS COMPATIBILITY_MODE, STATUS, CASE in_recyclebin WHEN 0 THEN 'NO' ELSE 'YES' END AS IN_RECYCLEBIN, CASE locked WHEN 0 THEN 'NO' ELSE 'YES' END AS LOCKED, (CASE WHEN A.TENANT_ID = 1 THEN 'PRIMARY' WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 'PRIMARY' ELSE TENANT_ROLE END) AS TENANT_ROLE, (CASE WHEN A.TENANT_ID = 1 THEN 'NORMAL' WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 'NORMAL' ELSE SWITCHOVER_STATUS END) AS SWITCHOVER_STATUS, (CASE WHEN A.TENANT_ID = 1 THEN 0 WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 0 ELSE SWITCHOVER_EPOCH END) AS SWITCHOVER_EPOCH, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN NULL ELSE SYNC_SCN END) AS SYNC_SCN, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN NULL ELSE REPLAYABLE_SCN END) AS REPLAYABLE_SCN, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN NULL ELSE READABLE_SCN END) AS READABLE_SCN, (CASE WHEN A.TENANT_ID = 1 THEN NULL WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN NULL ELSE RECOVERY_UNTIL_SCN END) AS RECOVERY_UNTIL_SCN, (CASE WHEN A.TENANT_ID = 1 THEN 'NOARCHIVELOG' WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 'NOARCHIVELOG' ELSE LOG_MODE END) AS LOG_MODE, ARBITRATION_SERVICE_STATUS, UNIT_NUM, COMPATIBLE, (CASE WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 1 ELSE B.MAX_LS_ID END) AS MAX_LS_ID FROM SYS.ALL_VIRTUAL_TENANT_SYS_AGENT A LEFT JOIN SYS.ALL_VIRTUAL_TENANT_INFO B ON A.TENANT_ID = B.TENANT_ID LEFT JOIN (SELECT TENANT_ID, (CASE WHEN TENANT_ID < 1 THEN NULL WHEN TENANT_ID != 1 THEN TENANT_ID - 1 ELSE NULL END) AS META_TENANT_ID, MIN(UNIT_COUNT) AS UNIT_NUM FROM SYS.ALL_VIRTUAL_RESOURCE_POOL_SYS_AGENT GROUP BY TENANT_ID) C ON A.TENANT_ID = C.TENANT_ID OR A.TENANT_ID = C.META_TENANT_ID LEFT JOIN (SELECT TENANT_ID, MIN(VALUE) AS COMPATIBLE FROM SYS.ALL_VIRTUAL_TENANT_PARAMETER WHERE NAME = 'compatible' GROUP BY TENANT_ID) D ON A.TENANT_ID = D.TENANT_ID WHERE A.TENANT_ID = EFFECTIVE_TENANT_ID() )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,56 @@ using namespace common;
|
||||
namespace share
|
||||
{
|
||||
|
||||
int ObInnerTableSchema::dba_ob_ls_history_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_HISTORY_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_HISTORY_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 (CASE WHEN A.LS_ID IS NULL THEN B.LS_ID ELSE A.LS_ID END) AS LS_ID, (CASE WHEN A.LS_GROUP_ID IS NULL THEN B.LS_GROUP_ID ELSE A.LS_GROUP_ID END) AS LS_GROUP_ID, (CASE WHEN A.STATUS IS NULL THEN B.STATUS ELSE A.STATUS END) AS STATUS, (CASE WHEN A.FLAG IS NULL THEN B.FLAG ELSE A.FLAG END) AS FLAG, (CASE WHEN A.LS_ID = 1 THEN 0 ELSE B.CREATE_SCN END) AS CREATE_SCN FROM SYS.ALL_VIRTUAL_LS_STATUS A FULL JOIN SYS.ALL_VIRTUAL_LS_REAL_AGENT B ON A.LS_ID = B.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_tenant_event_history_ora_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -911,6 +911,8 @@ public:
|
||||
static int all_virtual_tenant_parameter_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_tablet_buffer_info_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_tenant_event_history_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_balance_task_helper_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_balance_group_ls_stat_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_sql_audit_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_plan_stat_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_plan_cache_plan_explain_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -1142,6 +1144,7 @@ public:
|
||||
static int all_virtual_ls_log_restore_status_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_tenant_parameter_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_tenant_event_history_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int all_virtual_ls_real_agent_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int gv_ob_plan_cache_stat_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int gv_ob_plan_cache_plan_stat_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int schemata_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -1472,6 +1475,8 @@ public:
|
||||
static int v_ob_ls_log_restore_status_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int cdb_ob_external_table_files_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_db_links_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_ob_ls_history_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int cdb_ob_ls_history_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_ob_tenant_event_history_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int cdb_ob_tenant_event_history_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_synonyms_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -1712,6 +1717,7 @@ public:
|
||||
static int gv_sql_join_filter_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int v_sql_join_filter_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_ob_table_stat_stale_info_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_ob_ls_history_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int dba_ob_tenant_event_history_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int gv_ob_sql_audit_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
static int v_ob_sql_audit_ora_schema(share::schema::ObTableSchema &table_schema);
|
||||
@ -3193,6 +3199,8 @@ const schema_create_func virtual_table_schema_creators [] = {
|
||||
ObInnerTableSchema::all_virtual_tenant_parameter_schema,
|
||||
ObInnerTableSchema::all_virtual_tablet_buffer_info_schema,
|
||||
ObInnerTableSchema::all_virtual_tenant_event_history_schema,
|
||||
ObInnerTableSchema::all_virtual_balance_task_helper_schema,
|
||||
ObInnerTableSchema::all_virtual_balance_group_ls_stat_schema,
|
||||
ObInnerTableSchema::all_virtual_sql_plan_monitor_all_virtual_sql_plan_monitor_i1_schema,
|
||||
ObInnerTableSchema::all_virtual_sql_audit_all_virtual_sql_audit_i1_schema,
|
||||
ObInnerTableSchema::all_virtual_sysstat_all_virtual_sysstat_i1_schema,
|
||||
@ -3433,6 +3441,7 @@ const schema_create_func virtual_table_schema_creators [] = {
|
||||
ObInnerTableSchema::all_virtual_ls_log_restore_status_ora_schema,
|
||||
ObInnerTableSchema::all_virtual_tenant_parameter_ora_schema,
|
||||
ObInnerTableSchema::all_virtual_tenant_event_history_ora_schema,
|
||||
ObInnerTableSchema::all_virtual_ls_real_agent_ora_schema,
|
||||
ObInnerTableSchema::all_virtual_table_real_agent_ora_idx_data_table_id_real_agent_schema,
|
||||
ObInnerTableSchema::all_virtual_table_real_agent_ora_idx_db_tb_name_real_agent_schema,
|
||||
ObInnerTableSchema::all_virtual_table_real_agent_ora_idx_tb_name_real_agent_schema,
|
||||
@ -3844,6 +3853,8 @@ const schema_create_func sys_view_schema_creators [] = {
|
||||
ObInnerTableSchema::v_ob_ls_log_restore_status_schema,
|
||||
ObInnerTableSchema::cdb_ob_external_table_files_schema,
|
||||
ObInnerTableSchema::dba_db_links_schema,
|
||||
ObInnerTableSchema::dba_ob_ls_history_schema,
|
||||
ObInnerTableSchema::cdb_ob_ls_history_schema,
|
||||
ObInnerTableSchema::dba_ob_tenant_event_history_schema,
|
||||
ObInnerTableSchema::cdb_ob_tenant_event_history_schema,
|
||||
ObInnerTableSchema::dba_synonyms_schema,
|
||||
@ -4084,6 +4095,7 @@ const schema_create_func sys_view_schema_creators [] = {
|
||||
ObInnerTableSchema::gv_sql_join_filter_ora_schema,
|
||||
ObInnerTableSchema::v_sql_join_filter_ora_schema,
|
||||
ObInnerTableSchema::dba_ob_table_stat_stale_info_ora_schema,
|
||||
ObInnerTableSchema::dba_ob_ls_history_ora_schema,
|
||||
ObInnerTableSchema::dba_ob_tenant_event_history_ora_schema,
|
||||
ObInnerTableSchema::gv_ob_sql_audit_ora_schema,
|
||||
ObInnerTableSchema::v_ob_sql_audit_ora_schema,
|
||||
@ -5004,6 +5016,7 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_ORA_TID,
|
||||
OB_ALL_VIRTUAL_TENANT_PARAMETER_ORA_TID,
|
||||
OB_ALL_VIRTUAL_TENANT_EVENT_HISTORY_ORA_TID,
|
||||
OB_ALL_VIRTUAL_LS_REAL_AGENT_ORA_TID,
|
||||
OB_GV_OB_PLAN_CACHE_STAT_TID,
|
||||
OB_GV_OB_PLAN_CACHE_PLAN_STAT_TID,
|
||||
OB_SCHEMATA_TID,
|
||||
@ -5247,6 +5260,7 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_DBA_OB_TABLE_STAT_STALE_INFO_TID,
|
||||
OB_V_OB_LS_LOG_RESTORE_STATUS_TID,
|
||||
OB_DBA_DB_LINKS_TID,
|
||||
OB_DBA_OB_LS_HISTORY_TID,
|
||||
OB_DBA_OB_TENANT_EVENT_HISTORY_TID,
|
||||
OB_DBA_SYNONYMS_TID,
|
||||
OB_DBA_OBJECTS_ORA_TID,
|
||||
@ -5486,6 +5500,7 @@ const uint64_t tenant_space_tables [] = {
|
||||
OB_GV_SQL_JOIN_FILTER_ORA_TID,
|
||||
OB_V_SQL_JOIN_FILTER_ORA_TID,
|
||||
OB_DBA_OB_TABLE_STAT_STALE_INFO_ORA_TID,
|
||||
OB_DBA_OB_LS_HISTORY_ORA_TID,
|
||||
OB_DBA_OB_TENANT_EVENT_HISTORY_ORA_TID,
|
||||
OB_GV_OB_SQL_AUDIT_ORA_TID,
|
||||
OB_V_OB_SQL_AUDIT_ORA_TID,
|
||||
@ -7168,6 +7183,7 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_ORA_TNAME,
|
||||
OB_ALL_VIRTUAL_TENANT_PARAMETER_ORA_TNAME,
|
||||
OB_ALL_VIRTUAL_TENANT_EVENT_HISTORY_ORA_TNAME,
|
||||
OB_ALL_VIRTUAL_LS_REAL_AGENT_ORA_TNAME,
|
||||
OB_GV_OB_PLAN_CACHE_STAT_TNAME,
|
||||
OB_GV_OB_PLAN_CACHE_PLAN_STAT_TNAME,
|
||||
OB_SCHEMATA_TNAME,
|
||||
@ -7411,6 +7427,7 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_DBA_OB_TABLE_STAT_STALE_INFO_TNAME,
|
||||
OB_V_OB_LS_LOG_RESTORE_STATUS_TNAME,
|
||||
OB_DBA_DB_LINKS_TNAME,
|
||||
OB_DBA_OB_LS_HISTORY_TNAME,
|
||||
OB_DBA_OB_TENANT_EVENT_HISTORY_TNAME,
|
||||
OB_DBA_SYNONYMS_TNAME,
|
||||
OB_DBA_OBJECTS_ORA_TNAME,
|
||||
@ -7650,6 +7667,7 @@ const char* const tenant_space_table_names [] = {
|
||||
OB_GV_SQL_JOIN_FILTER_ORA_TNAME,
|
||||
OB_V_SQL_JOIN_FILTER_ORA_TNAME,
|
||||
OB_DBA_OB_TABLE_STAT_STALE_INFO_ORA_TNAME,
|
||||
OB_DBA_OB_LS_HISTORY_ORA_TNAME,
|
||||
OB_DBA_OB_TENANT_EVENT_HISTORY_ORA_TNAME,
|
||||
OB_GV_OB_SQL_AUDIT_ORA_TNAME,
|
||||
OB_V_OB_SQL_AUDIT_ORA_TNAME,
|
||||
@ -10878,11 +10896,11 @@ static inline int get_sys_table_lob_aux_schema(const uint64_t tid,
|
||||
|
||||
const int64_t OB_CORE_TABLE_COUNT = 4;
|
||||
const int64_t OB_SYS_TABLE_COUNT = 242;
|
||||
const int64_t OB_VIRTUAL_TABLE_COUNT = 698;
|
||||
const int64_t OB_SYS_VIEW_COUNT = 737;
|
||||
const int64_t OB_SYS_TENANT_TABLE_COUNT = 1682;
|
||||
const int64_t OB_VIRTUAL_TABLE_COUNT = 701;
|
||||
const int64_t OB_SYS_VIEW_COUNT = 740;
|
||||
const int64_t OB_SYS_TENANT_TABLE_COUNT = 1688;
|
||||
const int64_t OB_CORE_SCHEMA_VERSION = 1;
|
||||
const int64_t OB_BOOTSTRAP_SCHEMA_VERSION = 1685;
|
||||
const int64_t OB_BOOTSTRAP_SCHEMA_VERSION = 1691;
|
||||
|
||||
} // end namespace share
|
||||
} // end namespace oceanbase
|
||||
|
@ -322,6 +322,13 @@ bool vt_mapping_init()
|
||||
tmp_vt_mapping.is_real_vt_ = true;
|
||||
}
|
||||
|
||||
{
|
||||
int64_t idx = OB_ALL_VIRTUAL_LS_REAL_AGENT_ORA_TID - start_idx;
|
||||
VTMapping &tmp_vt_mapping = vt_mappings[idx];
|
||||
tmp_vt_mapping.mapping_tid_ = OB_ALL_LS_TID;
|
||||
tmp_vt_mapping.is_real_vt_ = true;
|
||||
}
|
||||
|
||||
{
|
||||
int64_t idx = OB_ALL_VIRTUAL_MONITOR_MODIFIED_REAL_AGENT_ORA_TID - start_idx;
|
||||
VTMapping &tmp_vt_mapping = vt_mappings[idx];
|
||||
|
@ -653,6 +653,8 @@ const uint64_t OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_TID = 12400; // "__all_virtu
|
||||
const uint64_t OB_ALL_VIRTUAL_TENANT_PARAMETER_TID = 12401; // "__all_virtual_tenant_parameter"
|
||||
const uint64_t OB_ALL_VIRTUAL_TABLET_BUFFER_INFO_TID = 12405; // "__all_virtual_tablet_buffer_info"
|
||||
const uint64_t OB_ALL_VIRTUAL_TENANT_EVENT_HISTORY_TID = 12415; // "__all_virtual_tenant_event_history"
|
||||
const uint64_t OB_ALL_VIRTUAL_BALANCE_TASK_HELPER_TID = 12416; // "__all_virtual_balance_task_helper"
|
||||
const uint64_t OB_ALL_VIRTUAL_BALANCE_GROUP_LS_STAT_TID = 12417; // "__all_virtual_balance_group_ls_stat"
|
||||
const uint64_t OB_ALL_VIRTUAL_SQL_AUDIT_ORA_TID = 15009; // "ALL_VIRTUAL_SQL_AUDIT_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_PLAN_STAT_ORA_TID = 15010; // "ALL_VIRTUAL_PLAN_STAT_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_PLAN_CACHE_PLAN_EXPLAIN_ORA_TID = 15012; // "ALL_VIRTUAL_PLAN_CACHE_PLAN_EXPLAIN_ORA"
|
||||
@ -884,6 +886,7 @@ const uint64_t OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_ORA_TID = 15385; // "ALL_VIRTUAL
|
||||
const uint64_t OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_ORA_TID = 15387; // "ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_TENANT_PARAMETER_ORA_TID = 15388; // "ALL_VIRTUAL_TENANT_PARAMETER_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_TENANT_EVENT_HISTORY_ORA_TID = 15399; // "ALL_VIRTUAL_TENANT_EVENT_HISTORY_ORA"
|
||||
const uint64_t OB_ALL_VIRTUAL_LS_REAL_AGENT_ORA_TID = 15402; // "ALL_VIRTUAL_LS_REAL_AGENT_ORA"
|
||||
const uint64_t OB_GV_OB_PLAN_CACHE_STAT_TID = 20001; // "GV$OB_PLAN_CACHE_STAT"
|
||||
const uint64_t OB_GV_OB_PLAN_CACHE_PLAN_STAT_TID = 20002; // "GV$OB_PLAN_CACHE_PLAN_STAT"
|
||||
const uint64_t OB_SCHEMATA_TID = 20003; // "SCHEMATA"
|
||||
@ -1214,6 +1217,8 @@ const uint64_t OB_DBA_OB_TABLE_STAT_STALE_INFO_TID = 21423; // "DBA_OB_TABLE_STA
|
||||
const uint64_t OB_V_OB_LS_LOG_RESTORE_STATUS_TID = 21424; // "V$OB_LS_LOG_RESTORE_STATUS"
|
||||
const uint64_t OB_CDB_OB_EXTERNAL_TABLE_FILES_TID = 21425; // "CDB_OB_EXTERNAL_TABLE_FILES"
|
||||
const uint64_t OB_DBA_DB_LINKS_TID = 21426; // "DBA_DB_LINKS"
|
||||
const uint64_t OB_DBA_OB_LS_HISTORY_TID = 21445; // "DBA_OB_LS_HISTORY"
|
||||
const uint64_t OB_CDB_OB_LS_HISTORY_TID = 21446; // "CDB_OB_LS_HISTORY"
|
||||
const uint64_t OB_DBA_OB_TENANT_EVENT_HISTORY_TID = 21447; // "DBA_OB_TENANT_EVENT_HISTORY"
|
||||
const uint64_t OB_CDB_OB_TENANT_EVENT_HISTORY_TID = 21448; // "CDB_OB_TENANT_EVENT_HISTORY"
|
||||
const uint64_t OB_DBA_SYNONYMS_TID = 25001; // "DBA_SYNONYMS"
|
||||
@ -1454,6 +1459,7 @@ const uint64_t OB_V_OB_PX_P2P_DATAHUB_ORA_TID = 25244; // "V$OB_PX_P2P_DATAHUB_O
|
||||
const uint64_t OB_GV_SQL_JOIN_FILTER_ORA_TID = 25245; // "GV$SQL_JOIN_FILTER_ORA"
|
||||
const uint64_t OB_V_SQL_JOIN_FILTER_ORA_TID = 25246; // "V$SQL_JOIN_FILTER_ORA"
|
||||
const uint64_t OB_DBA_OB_TABLE_STAT_STALE_INFO_ORA_TID = 25247; // "DBA_OB_TABLE_STAT_STALE_INFO_ORA"
|
||||
const uint64_t OB_DBA_OB_LS_HISTORY_ORA_TID = 25258; // "DBA_OB_LS_HISTORY_ORA"
|
||||
const uint64_t OB_DBA_OB_TENANT_EVENT_HISTORY_ORA_TID = 25259; // "DBA_OB_TENANT_EVENT_HISTORY_ORA"
|
||||
const uint64_t OB_GV_OB_SQL_AUDIT_ORA_TID = 28002; // "GV$OB_SQL_AUDIT_ORA"
|
||||
const uint64_t OB_V_OB_SQL_AUDIT_ORA_TID = 28003; // "V$OB_SQL_AUDIT_ORA"
|
||||
@ -2919,6 +2925,8 @@ const char *const OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_TNAME = "__all_virtual_ls
|
||||
const char *const OB_ALL_VIRTUAL_TENANT_PARAMETER_TNAME = "__all_virtual_tenant_parameter";
|
||||
const char *const OB_ALL_VIRTUAL_TABLET_BUFFER_INFO_TNAME = "__all_virtual_tablet_buffer_info";
|
||||
const char *const OB_ALL_VIRTUAL_TENANT_EVENT_HISTORY_TNAME = "__all_virtual_tenant_event_history";
|
||||
const char *const OB_ALL_VIRTUAL_BALANCE_TASK_HELPER_TNAME = "__all_virtual_balance_task_helper";
|
||||
const char *const OB_ALL_VIRTUAL_BALANCE_GROUP_LS_STAT_TNAME = "__all_virtual_balance_group_ls_stat";
|
||||
const char *const OB_ALL_VIRTUAL_SQL_AUDIT_ORA_TNAME = "ALL_VIRTUAL_SQL_AUDIT";
|
||||
const char *const OB_ALL_VIRTUAL_PLAN_STAT_ORA_TNAME = "ALL_VIRTUAL_PLAN_STAT";
|
||||
const char *const OB_ALL_VIRTUAL_PLAN_CACHE_PLAN_EXPLAIN_ORA_TNAME = "ALL_VIRTUAL_PLAN_CACHE_PLAN_EXPLAIN";
|
||||
@ -3150,6 +3158,7 @@ const char *const OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_ORA_TNAME = "ALL_VIRTUAL_TIME
|
||||
const char *const OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_ORA_TNAME = "ALL_VIRTUAL_LS_LOG_RESTORE_STATUS";
|
||||
const char *const OB_ALL_VIRTUAL_TENANT_PARAMETER_ORA_TNAME = "ALL_VIRTUAL_TENANT_PARAMETER";
|
||||
const char *const OB_ALL_VIRTUAL_TENANT_EVENT_HISTORY_ORA_TNAME = "ALL_VIRTUAL_TENANT_EVENT_HISTORY";
|
||||
const char *const OB_ALL_VIRTUAL_LS_REAL_AGENT_ORA_TNAME = "ALL_VIRTUAL_LS_REAL_AGENT";
|
||||
const char *const OB_GV_OB_PLAN_CACHE_STAT_TNAME = "GV$OB_PLAN_CACHE_STAT";
|
||||
const char *const OB_GV_OB_PLAN_CACHE_PLAN_STAT_TNAME = "GV$OB_PLAN_CACHE_PLAN_STAT";
|
||||
const char *const OB_SCHEMATA_TNAME = "SCHEMATA";
|
||||
@ -3480,6 +3489,8 @@ const char *const OB_DBA_OB_TABLE_STAT_STALE_INFO_TNAME = "DBA_OB_TABLE_STAT_STA
|
||||
const char *const OB_V_OB_LS_LOG_RESTORE_STATUS_TNAME = "V$OB_LS_LOG_RESTORE_STATUS";
|
||||
const char *const OB_CDB_OB_EXTERNAL_TABLE_FILES_TNAME = "CDB_OB_EXTERNAL_TABLE_FILES";
|
||||
const char *const OB_DBA_DB_LINKS_TNAME = "DBA_DB_LINKS";
|
||||
const char *const OB_DBA_OB_LS_HISTORY_TNAME = "DBA_OB_LS_HISTORY";
|
||||
const char *const OB_CDB_OB_LS_HISTORY_TNAME = "CDB_OB_LS_HISTORY";
|
||||
const char *const OB_DBA_OB_TENANT_EVENT_HISTORY_TNAME = "DBA_OB_TENANT_EVENT_HISTORY";
|
||||
const char *const OB_CDB_OB_TENANT_EVENT_HISTORY_TNAME = "CDB_OB_TENANT_EVENT_HISTORY";
|
||||
const char *const OB_DBA_SYNONYMS_TNAME = "DBA_SYNONYMS";
|
||||
@ -3720,6 +3731,7 @@ const char *const OB_V_OB_PX_P2P_DATAHUB_ORA_TNAME = "V$OB_PX_P2P_DATAHUB";
|
||||
const char *const OB_GV_SQL_JOIN_FILTER_ORA_TNAME = "GV$SQL_JOIN_FILTER";
|
||||
const char *const OB_V_SQL_JOIN_FILTER_ORA_TNAME = "V$SQL_JOIN_FILTER";
|
||||
const char *const OB_DBA_OB_TABLE_STAT_STALE_INFO_ORA_TNAME = "DBA_OB_TABLE_STAT_STALE_INFO";
|
||||
const char *const OB_DBA_OB_LS_HISTORY_ORA_TNAME = "DBA_OB_LS_HISTORY";
|
||||
const char *const OB_DBA_OB_TENANT_EVENT_HISTORY_ORA_TNAME = "DBA_OB_TENANT_EVENT_HISTORY";
|
||||
const char *const OB_GV_OB_SQL_AUDIT_ORA_TNAME = "GV$OB_SQL_AUDIT";
|
||||
const char *const OB_V_OB_SQL_AUDIT_ORA_TNAME = "V$OB_SQL_AUDIT";
|
||||
|
@ -12272,10 +12272,16 @@ def_table_schema(**gen_iterate_private_virtual_table_def(
|
||||
in_tenant_space = True,
|
||||
keywords = all_def_keywords['__all_tenant_event_history']))
|
||||
|
||||
#
|
||||
# 12416: __all_virtual_balance_task_helper
|
||||
def_table_schema(**gen_iterate_private_virtual_table_def(
|
||||
table_id = '12416',
|
||||
table_name = '__all_virtual_balance_task_helper',
|
||||
keywords = all_def_keywords['__all_balance_task_helper']))
|
||||
|
||||
def_table_schema(**gen_iterate_private_virtual_table_def(
|
||||
table_id = '12417',
|
||||
table_name = '__all_virtual_balance_group_ls_stat',
|
||||
keywords = all_def_keywords['__all_balance_group_ls_stat']))
|
||||
|
||||
# 12417: __all_virtual_balance_group_ls_stat
|
||||
# 12418: __all_virtual_cgroup_info
|
||||
# 12419: __all_virtual_cgroup_config
|
||||
|
||||
@ -12520,7 +12526,7 @@ def_table_schema(**no_direct_access(gen_oracle_mapping_real_virtual_table_def('1
|
||||
def_table_schema(**gen_oracle_mapping_real_virtual_table_def('15281', all_def_keywords['__all_tenant_rewrite_rules']))
|
||||
def_table_schema(**no_direct_access(gen_sys_agent_virtual_table_def('15282', all_def_keywords['__all_tenant'])))
|
||||
|
||||
# 15283: __all_virtual_tenant_info_agent
|
||||
# 15283: __all_virtual_tenant_info_agent abandoned
|
||||
|
||||
def_table_schema(**no_direct_access(gen_oracle_mapping_virtual_table_def('15284', all_def_keywords['__all_virtual_sql_plan'])))
|
||||
# 15285 abandoned
|
||||
@ -12657,8 +12663,7 @@ def_table_schema(**gen_oracle_mapping_virtual_table_def('15399', all_def_keyword
|
||||
|
||||
# 15401: __all_virtual_data_activity_metrics
|
||||
|
||||
# 15402: __all_virtual_ls
|
||||
|
||||
def_table_schema(**gen_oracle_mapping_real_virtual_table_def('15402', all_def_keywords['__all_ls']))
|
||||
# 余留位置
|
||||
|
||||
################################################################################
|
||||
@ -16442,7 +16447,10 @@ SELECT A.TENANT_ID,
|
||||
END) AS LOG_MODE,
|
||||
ARBITRATION_SERVICE_STATUS,
|
||||
UNIT_NUM,
|
||||
COMPATIBLE
|
||||
COMPATIBLE,
|
||||
(CASE
|
||||
WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 1
|
||||
ELSE B.MAX_LS_ID END) AS MAX_LS_ID
|
||||
FROM OCEANBASE.__ALL_VIRTUAL_TENANT_MYSQL_SYS_AGENT AS A
|
||||
LEFT JOIN OCEANBASE.__ALL_VIRTUAL_TENANT_INFO AS B
|
||||
ON A.TENANT_ID = B.TENANT_ID
|
||||
@ -27838,8 +27846,75 @@ def_table_schema(
|
||||
# 21442: DBA_OB_MVIEW_REFRESH_STMT_STATS
|
||||
# 21443: DBA_WR_CONTROL
|
||||
# 21444: CDB_WR_CONTROL
|
||||
# 21445: DBA_OB_LS_HISTORY
|
||||
# 21446: CDB_OB_LS_HISTORY
|
||||
def_table_schema(
|
||||
owner = 'msy164651',
|
||||
table_name = 'DBA_OB_LS_HISTORY',
|
||||
table_id = '21445',
|
||||
table_type = 'SYSTEM_VIEW',
|
||||
in_tenant_space = True,
|
||||
gm_columns = [],
|
||||
rowkey_columns = [],
|
||||
normal_columns = [],
|
||||
view_definition =
|
||||
"""
|
||||
SELECT
|
||||
(CASE
|
||||
WHEN A.LS_ID IS NULL THEN B.LS_ID
|
||||
ELSE A.LS_ID END) AS LS_ID,
|
||||
(CASE
|
||||
WHEN A.LS_GROUP_ID IS NULL THEN B.LS_GROUP_ID
|
||||
ELSE A.LS_GROUP_ID END) AS LS_GROUP_ID,
|
||||
(CASE
|
||||
WHEN A.STATUS IS NULL THEN B.STATUS
|
||||
ELSE A.STATUS END) AS STATUS,
|
||||
(CASE
|
||||
WHEN A.FLAG IS NULL THEN B.FLAG
|
||||
ELSE A.FLAG END) AS FLAG,
|
||||
(CASE
|
||||
WHEN A.LS_ID = 1 THEN 0
|
||||
ELSE B.CREATE_SCN END) AS CREATE_SCN
|
||||
FROM OCEANBASE.__ALL_VIRTUAL_LS_STATUS AS A
|
||||
FULL JOIN OCEANBASE.__ALL_LS AS B
|
||||
ON A.LS_ID = B.LS_ID
|
||||
WHERE A.TENANT_ID = EFFECTIVE_TENANT_ID();
|
||||
""".replace("\n", " "),
|
||||
)
|
||||
|
||||
def_table_schema(
|
||||
owner = 'msy164651',
|
||||
table_name = 'CDB_OB_LS_HISTORY',
|
||||
table_id = '21446',
|
||||
table_type = 'SYSTEM_VIEW',
|
||||
gm_columns = [],
|
||||
rowkey_columns = [],
|
||||
normal_columns = [],
|
||||
view_definition =
|
||||
"""
|
||||
SELECT
|
||||
(CASE
|
||||
WHEN A.TENANT_ID IS NULL THEN B.TENANT_ID
|
||||
ELSE A.TENANT_ID END) AS TENANT_ID,
|
||||
(CASE
|
||||
WHEN A.LS_ID IS NULL THEN B.LS_ID
|
||||
ELSE A.LS_ID END) AS LS_ID,
|
||||
(CASE
|
||||
WHEN A.LS_GROUP_ID IS NULL THEN B.LS_GROUP_ID
|
||||
ELSE A.LS_GROUP_ID END) AS LS_GROUP_ID,
|
||||
(CASE
|
||||
WHEN A.STATUS IS NULL THEN B.STATUS
|
||||
ELSE A.STATUS END) AS STATUS,
|
||||
(CASE
|
||||
WHEN A.FLAG IS NULL THEN B.FLAG
|
||||
ELSE A.FLAG END) AS FLAG,
|
||||
(CASE
|
||||
WHEN A.LS_ID = 1 THEN 0
|
||||
ELSE B.CREATE_SCN END) AS CREATE_SCN
|
||||
FROM OCEANBASE.__ALL_VIRTUAL_LS_STATUS AS A
|
||||
FULL JOIN OCEANBASE.__ALL_VIRTUAL_LS AS B
|
||||
ON A.LS_ID = B.LS_ID AND A.TENANT_ID = B.TENANT_ID;
|
||||
""".replace("\n", " "),
|
||||
)
|
||||
|
||||
|
||||
def_table_schema(
|
||||
owner = 'wanhong.wwh',
|
||||
@ -44348,7 +44423,10 @@ SELECT A.TENANT_ID,
|
||||
END) AS LOG_MODE,
|
||||
ARBITRATION_SERVICE_STATUS,
|
||||
UNIT_NUM,
|
||||
COMPATIBLE
|
||||
COMPATIBLE,
|
||||
(CASE
|
||||
WHEN (MOD(A.TENANT_ID, 2)) = 1 THEN 1
|
||||
ELSE B.MAX_LS_ID END) AS MAX_LS_ID
|
||||
FROM SYS.ALL_VIRTUAL_TENANT_SYS_AGENT A
|
||||
LEFT JOIN SYS.ALL_VIRTUAL_TENANT_INFO B
|
||||
ON A.TENANT_ID = B.TENANT_ID
|
||||
@ -45726,8 +45804,41 @@ JOIN SYS.ALL_VIRTUAL_OPTSTAT_GLOBAL_PREFS_REAL_AGENT GP
|
||||
# 25255: DBA_OB_MVIEW_REFRESH_STMT_STATS
|
||||
# 25256: DBMS_LOCK_ALLOCATED
|
||||
# 25257: DBA_WR_CONTROL
|
||||
# 25258: DBA_OB_LS_HISTORY
|
||||
|
||||
def_table_schema(
|
||||
owner = 'msy164651',
|
||||
table_name = 'DBA_OB_LS_HISTORY',
|
||||
name_postfix = '_ORA',
|
||||
database_id = 'OB_ORA_SYS_DATABASE_ID',
|
||||
table_id = '25258',
|
||||
table_type = 'SYSTEM_VIEW',
|
||||
in_tenant_space = True,
|
||||
gm_columns = [],
|
||||
rowkey_columns = [],
|
||||
normal_columns = [],
|
||||
view_definition =
|
||||
"""
|
||||
SELECT
|
||||
(CASE
|
||||
WHEN A.LS_ID IS NULL THEN B.LS_ID
|
||||
ELSE A.LS_ID END) AS LS_ID,
|
||||
(CASE
|
||||
WHEN A.LS_GROUP_ID IS NULL THEN B.LS_GROUP_ID
|
||||
ELSE A.LS_GROUP_ID END) AS LS_GROUP_ID,
|
||||
(CASE
|
||||
WHEN A.STATUS IS NULL THEN B.STATUS
|
||||
ELSE A.STATUS END) AS STATUS,
|
||||
(CASE
|
||||
WHEN A.FLAG IS NULL THEN B.FLAG
|
||||
ELSE A.FLAG END) AS FLAG,
|
||||
(CASE
|
||||
WHEN A.LS_ID = 1 THEN 0
|
||||
ELSE B.CREATE_SCN END) AS CREATE_SCN
|
||||
FROM SYS.ALL_VIRTUAL_LS_STATUS A
|
||||
FULL JOIN SYS.ALL_VIRTUAL_LS_REAL_AGENT B
|
||||
ON A.LS_ID = B.LS_ID
|
||||
WHERE A.TENANT_ID = EFFECTIVE_TENANT_ID();
|
||||
""".replace("\n", " "),
|
||||
)
|
||||
def_table_schema(
|
||||
owner = 'wanhong.wwh',
|
||||
table_name = 'DBA_OB_TENANT_EVENT_HISTORY',
|
||||
|
@ -449,6 +449,8 @@ case OB_ALL_VIRTUAL_BACKUP_STORAGE_INFO_TID:
|
||||
case OB_ALL_VIRTUAL_BACKUP_STORAGE_INFO_HISTORY_TID:
|
||||
case OB_ALL_VIRTUAL_BACKUP_TASK_TID:
|
||||
case OB_ALL_VIRTUAL_BACKUP_TASK_HISTORY_TID:
|
||||
case OB_ALL_VIRTUAL_BALANCE_GROUP_LS_STAT_TID:
|
||||
case OB_ALL_VIRTUAL_BALANCE_TASK_HELPER_TID:
|
||||
case OB_ALL_VIRTUAL_COLUMN_CHECKSUM_ERROR_INFO_TID:
|
||||
case OB_ALL_VIRTUAL_DEADLOCK_EVENT_HISTORY_TID:
|
||||
case OB_ALL_VIRTUAL_GLOBAL_CONTEXT_VALUE_TID:
|
||||
@ -843,6 +845,38 @@ case OB_ALL_VIRTUAL_ZONE_MERGE_INFO_TID:
|
||||
break;
|
||||
}
|
||||
|
||||
case OB_ALL_VIRTUAL_BALANCE_GROUP_LS_STAT_TID: {
|
||||
ObIteratePrivateVirtualTable *iter = NULL;
|
||||
const bool meta_record_in_sys = false;
|
||||
if (OB_FAIL(NEW_VIRTUAL_TABLE(ObIteratePrivateVirtualTable, iter))) {
|
||||
SERVER_LOG(WARN, "create iterate private virtual table iterator failed", KR(ret));
|
||||
} else if (OB_FAIL(iter->init(OB_ALL_BALANCE_GROUP_LS_STAT_TID, meta_record_in_sys, index_schema, params))) {
|
||||
SERVER_LOG(WARN, "iterate private virtual table iter init failed", KR(ret));
|
||||
iter->~ObIteratePrivateVirtualTable();
|
||||
allocator.free(iter);
|
||||
iter = NULL;
|
||||
} else {
|
||||
vt_iter = iter;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case OB_ALL_VIRTUAL_BALANCE_TASK_HELPER_TID: {
|
||||
ObIteratePrivateVirtualTable *iter = NULL;
|
||||
const bool meta_record_in_sys = false;
|
||||
if (OB_FAIL(NEW_VIRTUAL_TABLE(ObIteratePrivateVirtualTable, iter))) {
|
||||
SERVER_LOG(WARN, "create iterate private virtual table iterator failed", KR(ret));
|
||||
} else if (OB_FAIL(iter->init(OB_ALL_BALANCE_TASK_HELPER_TID, meta_record_in_sys, index_schema, params))) {
|
||||
SERVER_LOG(WARN, "iterate private virtual table iter init failed", KR(ret));
|
||||
iter->~ObIteratePrivateVirtualTable();
|
||||
allocator.free(iter);
|
||||
iter = NULL;
|
||||
} else {
|
||||
vt_iter = iter;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case OB_ALL_VIRTUAL_COLUMN_CHECKSUM_ERROR_INFO_TID: {
|
||||
ObIteratePrivateVirtualTable *iter = NULL;
|
||||
const bool meta_record_in_sys = false;
|
||||
@ -1098,7 +1132,9 @@ case OB_ALL_VIRTUAL_ZONE_MERGE_INFO_TID:
|
||||
}
|
||||
break;
|
||||
}
|
||||
END_CREATE_VT_ITER_SWITCH_LAMBDA
|
||||
|
||||
BEGIN_CREATE_VT_ITER_SWITCH_LAMBDA
|
||||
case OB_ALL_VIRTUAL_LS_RESTORE_HISTORY_TID: {
|
||||
ObIteratePrivateVirtualTable *iter = NULL;
|
||||
const bool meta_record_in_sys = false;
|
||||
@ -1130,9 +1166,7 @@ case OB_ALL_VIRTUAL_ZONE_MERGE_INFO_TID:
|
||||
}
|
||||
break;
|
||||
}
|
||||
END_CREATE_VT_ITER_SWITCH_LAMBDA
|
||||
|
||||
BEGIN_CREATE_VT_ITER_SWITCH_LAMBDA
|
||||
case OB_ALL_VIRTUAL_LS_STATUS_TID: {
|
||||
ObIteratePrivateVirtualTable *iter = NULL;
|
||||
const bool meta_record_in_sys = true;
|
||||
|
@ -222,6 +222,7 @@ int ObLSCreator::create_user_ls(
|
||||
}
|
||||
const int64_t cost = ObTimeUtility::current_time() - start_time;
|
||||
LOG_INFO("finish to create log stream", KR(ret), K_(id), K_(tenant_id), K(cost));
|
||||
LS_EVENT_ADD(tenant_id_, id_, "create_ls_finish", ret, paxos_replica_num, "", K(cost));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -291,6 +292,7 @@ int ObLSCreator::create_tenant_sys_ls(
|
||||
|
||||
const int64_t cost = ObTimeUtility::current_time() - start_time;
|
||||
LOG_INFO("finish to create log stream", KR(ret), K_(id), K_(tenant_id), K(cost));
|
||||
LS_EVENT_ADD(tenant_id_, id_, "create_ls_finish", ret, paxos_replica_num, "", K(cost));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -491,6 +493,7 @@ int ObLSCreator::check_create_ls_result_(const int64_t rpc_count,
|
||||
LOG_WARN("success count less than majority", KR(ret), K(paxos_replica_num),
|
||||
K(member_list));
|
||||
}
|
||||
LS_EVENT_ADD(tenant_id_, id_, "create_ls", ret, paxos_replica_num, member_list);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -656,6 +659,7 @@ int ObLSCreator::check_set_memberlist_result_(const int64_t rpc_count,
|
||||
const int64_t paxos_replica_num)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t success_cnt = 0;
|
||||
if (OB_UNLIKELY(!is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret));
|
||||
@ -665,7 +669,6 @@ int ObLSCreator::check_set_memberlist_result_(const int64_t rpc_count,
|
||||
LOG_WARN("rpc count not equal to result count", KR(ret), K(rpc_count),
|
||||
K(return_code_array), "arg count", set_member_list_proxy_.get_args().count());
|
||||
} else {
|
||||
int64_t success_cnt = 0;
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < return_code_array.count(); ++i) {
|
||||
if (OB_SUCCESS != return_code_array.at(i)) {
|
||||
LOG_WARN("rpc is failed", KR(ret), K(return_code_array.at(i)), K(i));
|
||||
@ -687,6 +690,7 @@ int ObLSCreator::check_set_memberlist_result_(const int64_t rpc_count,
|
||||
K(paxos_replica_num));
|
||||
}
|
||||
}
|
||||
LS_EVENT_ADD(tenant_id_, id_, "set_ls_member_list", ret, paxos_replica_num, success_cnt);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "lib/mysqlclient/ob_mysql_proxy.h"
|
||||
#include "lib/string/ob_sql_string.h"
|
||||
#include "share/scn.h"
|
||||
#include "rootserver/ob_rs_event_history_table_operator.h"
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace common
|
||||
@ -32,17 +33,35 @@ namespace sqlclient
|
||||
{
|
||||
class ObMySQLResult;
|
||||
}
|
||||
|
||||
}
|
||||
namespace share
|
||||
{
|
||||
class ObLSID;
|
||||
struct ObLSStatusInfo;
|
||||
/**
|
||||
* @description:
|
||||
* In order to let switchover switch the accessmode of all LS correctly,
|
||||
* when creating, deleting, and updating LS status,
|
||||
* it needs to be mutually exclusive with switchover status of __all_tenant_info
|
||||
*/
|
||||
#define ALL_LS_EVENT_ADD(tenant_id, ls_id, event, ret, sql, args...)\
|
||||
do {\
|
||||
const int64_t MAX_VALUE_LENGTH = 512; \
|
||||
char VALUE[MAX_VALUE_LENGTH] = {""}; \
|
||||
int64_t pos = 0; \
|
||||
common::ObCurTraceId::TraceId *trace_id = ObCurTraceId::get_trace_id();\
|
||||
common::databuff_print_kv(VALUE, MAX_VALUE_LENGTH, pos, ##args, KPC(trace_id)); \
|
||||
ROOTSERVICE_EVENT_ADD("LS", event, "tenant_id", tenant_id, "ls_id", ls_id,\
|
||||
"ret", ret, "sql", ObHexEscapeSqlStr(sql.string()),\
|
||||
"", NULL, "", NULL, ObHexEscapeSqlStr(VALUE));\
|
||||
} while (0)
|
||||
|
||||
#define LS_EVENT_ADD(tenant_id, ls_id, event, ret, paxos_cnt, success_cnt, args...)\
|
||||
do {\
|
||||
const int64_t MAX_VALUE_LENGTH = 512; \
|
||||
char VALUE[MAX_VALUE_LENGTH] = {""}; \
|
||||
int64_t pos = 0; \
|
||||
common::ObCurTraceId::TraceId *trace_id = ObCurTraceId::get_trace_id();\
|
||||
common::databuff_print_kv(VALUE, MAX_VALUE_LENGTH, pos, ##args, KPC(trace_id)); \
|
||||
ROOTSERVICE_EVENT_ADD("LS", event, "tenant_id", tenant_id, "ls_id", ls_id,\
|
||||
"ret", ret, "success_cnt", success_cnt, "paxos_cnt", paxos_cnt, "", NULL, ObHexEscapeSqlStr(VALUE));\
|
||||
} while (0)
|
||||
|
||||
|
||||
enum ObLSStatus
|
||||
{
|
||||
@ -55,8 +74,17 @@ enum ObLSStatus
|
||||
OB_LS_WAIT_OFFLINE,
|
||||
OB_LS_CREATE_ABORT,
|
||||
OB_LS_PRE_TENANT_DROPPING,//only for sys ls
|
||||
OB_LS_DROPPED,//for __all_ls
|
||||
OB_LS_MAX_STATUS,
|
||||
};
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* In order to let switchover switch the accessmode of all LS correctly,
|
||||
* when creating, deleting, and updating LS status,
|
||||
* it needs to be mutually exclusive with switchover status of __all_tenant_info
|
||||
*/
|
||||
|
||||
/*
|
||||
*log stream lifetime description:
|
||||
If an inner_table needs to be aware of the creation and deletion of the log stream;
|
||||
|
@ -46,7 +46,58 @@ using namespace transaction::tablelock;
|
||||
|
||||
namespace share
|
||||
{
|
||||
#define APPEND_LS_EXIST_STATUS()\
|
||||
if (OB_SUCC(ret) && only_existing_ls) {\
|
||||
if (OB_FAIL(sql.append_fmt(" and status != '%s' and status != '%s'",\
|
||||
ls_status_to_str(OB_LS_DROPPED), ls_status_to_str(OB_LS_CREATE_ABORT)))) {\
|
||||
LOG_WARN("failed to append", KR(ret), K(sql));\
|
||||
}\
|
||||
}
|
||||
static const char* LS_FLAG_ARRAY[] = { ""/*NORMAL*/, "DUPLICATE", "BLOCK_TABLET_IN" };
|
||||
const char* LS_STATUS_ARRAY[] =
|
||||
{
|
||||
"CREATING",
|
||||
"CREATED",
|
||||
"NORMAL",
|
||||
"DROPPING",
|
||||
"TENANT_DROPPING",
|
||||
"WAIT_OFFLINE",
|
||||
"CREATE_ABORT",
|
||||
"PRE_TENANT_DROPPING",
|
||||
"DROPPED"
|
||||
};
|
||||
|
||||
ObLSStatus str_to_ls_status(const ObString &status_str)
|
||||
{
|
||||
ObLSStatus ret_status = OB_LS_EMPTY;
|
||||
if (status_str.empty()) {
|
||||
ret_status = OB_LS_EMPTY;
|
||||
} else {
|
||||
for (int64_t i = 0; i < ARRAYSIZEOF(LS_STATUS_ARRAY); i++) {
|
||||
if (0 == status_str.case_compare(LS_STATUS_ARRAY[i])) {
|
||||
ret_status = static_cast<ObLSStatus>(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret_status;
|
||||
}
|
||||
|
||||
const char* ls_status_to_str(const ObLSStatus &status)
|
||||
{
|
||||
const char* str = "UNKNOWN";
|
||||
STATIC_ASSERT(ARRAYSIZEOF(LS_STATUS_ARRAY) == OB_LS_MAX_STATUS,
|
||||
"status string array size mismatch with enum ObLSStatus");
|
||||
|
||||
|
||||
if (OB_UNLIKELY(OB_LS_EMPTY == status
|
||||
|| status >= OB_LS_MAX_STATUS)) {
|
||||
LOG_WARN_RET(OB_INVALID_ARGUMENT, "invalid log stream status", K(status));
|
||||
} else {
|
||||
str = LS_STATUS_ARRAY[status];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
int ObLSFlag::assign(const ObLSFlag &ls_flag)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -311,6 +362,7 @@ int ObLSAttrOperator::insert_ls(
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObLSFlagStr flag_str;
|
||||
common::ObSqlString sql;
|
||||
if (OB_UNLIKELY(!ls_attr.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("operation is invalid", KR(ret), K(ls_attr));
|
||||
@ -320,7 +372,6 @@ int ObLSAttrOperator::insert_ls(
|
||||
} else if (OB_FAIL(ls_attr.get_ls_flag().flag_to_str(flag_str))) {
|
||||
LOG_WARN("fail to convert flag to string", KR(ret), K(ls_attr));
|
||||
} else {
|
||||
ObSqlString sql;
|
||||
if (FAILEDx(sql.assign_fmt(
|
||||
"insert into %s (ls_id, ls_group_id, status, flag, create_scn) values(%ld, "
|
||||
"%ld, '%s', '%s', '%lu')",
|
||||
@ -338,7 +389,8 @@ int ObLSAttrOperator::insert_ls(
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG_INFO("[LS_OPERATOR] insert ls", KR(ret), K(ls_attr), KP(trans));
|
||||
LOG_INFO("[LS_OPERATOR] insert ls", KR(ret), K(ls_attr), K(sql));
|
||||
ALL_LS_EVENT_ADD(tenant_id_, ls_attr.get_ls_id(), "insert_ls", ret, sql);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -347,6 +399,7 @@ int ObLSAttrOperator::delete_ls(
|
||||
const ObTenantSwitchoverStatus &working_sw_status)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t compat_version = 0;
|
||||
if (OB_UNLIKELY(!ls_id.is_valid()
|
||||
|| !is_valid_status_in_ls(old_status))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
@ -357,6 +410,14 @@ int ObLSAttrOperator::delete_ls(
|
||||
} else if (ls_id.is_sys_ls() && OB_LS_CREATING == old_status) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("sys ls can not create abort", KR(ret), K(old_status), K(ls_id));
|
||||
} else if (OB_FAIL(GET_MIN_DATA_VERSION(tenant_id_, compat_version))) {
|
||||
LOG_WARN("get min data_version failed", K(ret), K(tenant_id_));
|
||||
} else if (compat_version >= DATA_VERSION_4_2_0_0) {
|
||||
share::ObLSStatus new_status = OB_LS_CREATING == old_status ?
|
||||
OB_LS_CREATE_ABORT : OB_LS_DROPPED;
|
||||
if (OB_FAIL(update_ls_status(ls_id, old_status, new_status, working_sw_status))) {
|
||||
LOG_WARN("failed to update ls status", KR(ret), K(ls_id), K(old_status), K(new_status), K(working_sw_status));
|
||||
}
|
||||
} else {
|
||||
ObSqlString sql;
|
||||
ObLSAttr ls_attr;
|
||||
@ -381,6 +442,7 @@ int ObLSAttrOperator::delete_ls(
|
||||
LOG_WARN("failed to operator ls", KR(ret), K(new_ls_attr), K(sql));
|
||||
}
|
||||
LOG_INFO("[LS_OPERATOR] delete ls", KR(ret), K(ls_id), K(old_status));
|
||||
ALL_LS_EVENT_ADD(tenant_id_, ls_id, "delete_ls", ret, sql);
|
||||
}
|
||||
}
|
||||
|
||||
@ -507,11 +569,15 @@ int ObLSAttrOperator::update_ls_status_in_trans(const ObLSID &id,
|
||||
}
|
||||
LOG_INFO("[LS_OPERATOR] update ls status", KR(ret), K(ls_attr), K(new_ls_attr));
|
||||
}
|
||||
ALL_LS_EVENT_ADD(tenant_id_, id, "update_ls_status", ret, sql);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLSAttrOperator::get_ls_attr(const ObLSID &id, const bool for_update, common::ObISQLClient &client, ObLSAttr &ls_attr)
|
||||
int ObLSAttrOperator::get_ls_attr(const ObLSID &id,
|
||||
const bool for_update, common::ObISQLClient &client,
|
||||
ObLSAttr &ls_attr,
|
||||
const bool only_existing_ls)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ls_attr.reset();
|
||||
@ -539,6 +605,9 @@ int ObLSAttrOperator::get_ls_attr(const ObLSID &id, const bool for_update, commo
|
||||
} else if (OB_UNLIKELY(1 != ls_array.count())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("more than one ls is unexpected", KR(ret), K(ls_array), K(sql));
|
||||
} else if (only_existing_ls && ls_array.at(0).ls_is_dropped_create_abort()) {
|
||||
ret = OB_ENTRY_NOT_EXIST;
|
||||
LOG_INFO("ls is dropped or create abort", KR(ret), K(ls_array));
|
||||
} else if (OB_FAIL(ls_attr.assign(ls_array.at(0)))) {
|
||||
LOG_WARN("failed to assign ls attr", KR(ret), K(ls_array));
|
||||
}
|
||||
@ -549,7 +618,9 @@ int ObLSAttrOperator::get_ls_attr(const ObLSID &id, const bool for_update, commo
|
||||
}
|
||||
|
||||
int ObLSAttrOperator::get_duplicate_ls_attr(const bool for_update,
|
||||
common::ObISQLClient &client, ObLSAttr &ls_attr)
|
||||
common::ObISQLClient &client,
|
||||
ObLSAttr &ls_attr,
|
||||
bool only_existing_ls)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ls_attr.reset();
|
||||
@ -574,6 +645,9 @@ int ObLSAttrOperator::get_duplicate_ls_attr(const bool for_update,
|
||||
} else if (OB_UNLIKELY(1 != ls_array.count())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("more than one ls is unexpected", KR(ret), K(ls_array), K(sql));
|
||||
} else if (only_existing_ls && ls_array.at(0).ls_is_dropped_create_abort()) {
|
||||
ret = OB_ENTRY_NOT_EXIST;
|
||||
LOG_INFO("ls is dropped or create abort", KR(ret), K(ls_array));
|
||||
} else if (OB_FAIL(ls_attr.assign(ls_array.at(0)))) {
|
||||
LOG_WARN("failed to assign ls attr", KR(ret), K(ls_array));
|
||||
}
|
||||
@ -583,7 +657,8 @@ int ObLSAttrOperator::get_duplicate_ls_attr(const bool for_update,
|
||||
}
|
||||
|
||||
int ObLSAttrOperator::get_all_ls_by_order(
|
||||
ObLSAttrIArray &ls_operation_array)
|
||||
ObLSAttrIArray &ls_operation_array,
|
||||
bool only_existing_ls)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ls_operation_array.reset();
|
||||
@ -593,10 +668,15 @@ int ObLSAttrOperator::get_all_ls_by_order(
|
||||
} else {
|
||||
ObSqlString sql;
|
||||
if (OB_FAIL(sql.assign_fmt(
|
||||
"select * from %s order by ls_id",
|
||||
OB_ALL_LS_TNAME))) {
|
||||
"select * from %s where 1=1", OB_ALL_LS_TNAME))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(sql));
|
||||
} else if (OB_FAIL(exec_read(tenant_id_, sql, *proxy_, this, ls_operation_array))) {
|
||||
} else {
|
||||
APPEND_LS_EXIST_STATUS()
|
||||
if (FAILEDx(sql.append(" order by ls_id"))) {
|
||||
LOG_WARN("failed to append", KR(ret), K(sql));
|
||||
}
|
||||
}
|
||||
if (FAILEDx(exec_read(tenant_id_, sql, *proxy_, this, ls_operation_array))) {
|
||||
LOG_WARN("failed to construct ls attr", KR(ret), K(sql));
|
||||
}
|
||||
}
|
||||
@ -604,7 +684,7 @@ int ObLSAttrOperator::get_all_ls_by_order(
|
||||
}
|
||||
|
||||
int ObLSAttrOperator::load_all_ls_and_snapshot(
|
||||
const SCN &read_scn, ObLSAttrIArray &ls_array)
|
||||
const SCN &read_scn, ObLSAttrIArray &ls_array, bool only_existing_ls)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ls_array.reset();
|
||||
@ -616,10 +696,13 @@ int ObLSAttrOperator::load_all_ls_and_snapshot(
|
||||
if (OB_UNLIKELY(!read_scn.is_valid())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("read scn is invalid", KR(ret), K(read_scn));
|
||||
} else if (OB_FAIL(sql.assign_fmt("select * from %s as of snapshot %lu",
|
||||
} else if (OB_FAIL(sql.assign_fmt("select * from %s as of snapshot %lu where 1=1",
|
||||
OB_ALL_LS_TNAME, read_scn.get_val_for_inner_table_field()))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(sql), K(read_scn));
|
||||
} else if (OB_FAIL(exec_read(tenant_id_, sql, *proxy_, this, ls_array))) {
|
||||
} else {
|
||||
APPEND_LS_EXIST_STATUS()
|
||||
}
|
||||
if (FAILEDx(exec_read(tenant_id_, sql, *proxy_, this, ls_array))) {
|
||||
LOG_WARN("failed to construct ls attr", KR(ret), K(sql));
|
||||
}
|
||||
}
|
||||
@ -692,6 +775,10 @@ ObLSOperationType ObLSAttrOperator::get_ls_operation_by_status(const ObLSStatus
|
||||
type_ret = OB_LS_OP_TENANT_DROP_PRE;
|
||||
} else if (OB_LS_DROPPING == ls_status) {
|
||||
type_ret = OB_LS_OP_DROP_PRE;
|
||||
} else if (OB_LS_DROPPED == ls_status) {
|
||||
type_ret = OB_LS_OP_DROP_END;
|
||||
} else if (OB_LS_CREATE_ABORT == ls_status) {
|
||||
type_ret = OB_LS_OP_CREATE_ABORT;
|
||||
} else {
|
||||
type_ret = OB_LS_OP_INVALID_TYPE;
|
||||
LOG_WARN_RET(OB_ERR_UNEXPECTED, "status is invalid", K(ls_status));
|
||||
@ -758,6 +845,7 @@ int ObLSAttrOperator::alter_ls_group_in_trans(const ObLSAttr &ls_info,
|
||||
LOG_WARN("failed to process sub trans", KR(ret), K(new_ls_info));
|
||||
}
|
||||
}
|
||||
ALL_LS_EVENT_ADD(tenant_id_, ls_info.get_ls_id(), "alter_ls_group", ret, sql);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -798,6 +886,7 @@ int ObLSAttrOperator::update_ls_flag_in_trans(const ObLSID &id,
|
||||
LOG_WARN("failed to exec write", KR(ret), K(tenant_id_), K(sql));
|
||||
}
|
||||
}
|
||||
ALL_LS_EVENT_ADD(tenant_id_, id, "update_ls_flag", ret, sql);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -851,7 +940,9 @@ int ObLSAttrOperator::get_random_normal_user_ls(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLSAttrOperator::get_all_ls_by_order(const bool lock_sys_ls, ObLSAttrIArray &ls_operation_array)
|
||||
int ObLSAttrOperator::get_all_ls_by_order(const bool lock_sys_ls,
|
||||
ObLSAttrIArray &ls_operation_array,
|
||||
bool only_existing_ls)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ls_operation_array.reset();
|
||||
@ -869,11 +960,16 @@ int ObLSAttrOperator::get_all_ls_by_order(const bool lock_sys_ls, ObLSAttrIArray
|
||||
} else {
|
||||
ObSqlString sql;
|
||||
if (OB_FAIL(sql.assign_fmt(
|
||||
"select * from %s order by ls_id",
|
||||
OB_ALL_LS_TNAME))) {
|
||||
"select * from %s where 1=1", OB_ALL_LS_TNAME))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(sql));
|
||||
} else if (OB_FAIL(exec_read(tenant_id_, sql, trans, this, ls_operation_array))) {
|
||||
LOG_WARN("failed to construct ls attr", KR(ret), K(sql), K_(tenant_id));
|
||||
} else {
|
||||
APPEND_LS_EXIST_STATUS()
|
||||
if (FAILEDx(sql.append(" order by ls_id"))) {
|
||||
LOG_WARN("failed to append", KR(ret), K(sql));
|
||||
}
|
||||
}
|
||||
if (FAILEDx(exec_read(tenant_id_, sql, *proxy_, this, ls_operation_array))) {
|
||||
LOG_WARN("failed to construct ls attr", KR(ret), K(sql));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,21 +38,81 @@ class ObMySQLResult;
|
||||
namespace share
|
||||
{
|
||||
class SCN;
|
||||
ObLSStatus str_to_ls_status(const ObString &status_str);
|
||||
const char* ls_status_to_str(const ObLSStatus &status);
|
||||
|
||||
inline bool ls_is_empty_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_EMPTY == status;
|
||||
}
|
||||
|
||||
inline bool ls_is_invalid_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_MAX_STATUS == status
|
||||
|| ls_is_empty_status(status);
|
||||
}
|
||||
|
||||
inline bool ls_is_creating_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_CREATING == status;
|
||||
}
|
||||
|
||||
inline bool ls_is_created_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_CREATED == status;
|
||||
}
|
||||
|
||||
inline bool ls_is_normal_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_NORMAL == status;
|
||||
}
|
||||
|
||||
inline bool ls_is_tenant_dropping_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_TENANT_DROPPING == status;
|
||||
}
|
||||
|
||||
inline bool ls_is_dropping_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_DROPPING == status;
|
||||
}
|
||||
|
||||
inline bool ls_is_wait_offline_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_WAIT_OFFLINE == status;
|
||||
}
|
||||
inline bool ls_is_create_abort_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_CREATE_ABORT == status;
|
||||
}
|
||||
|
||||
inline bool ls_need_create_abort_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_CREATING == status || OB_LS_CREATED == status;
|
||||
}
|
||||
|
||||
inline bool ls_is_pre_tenant_dropping_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_PRE_TENANT_DROPPING == status;
|
||||
}
|
||||
|
||||
inline bool ls_is_dropped_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_DROPPED == status;
|
||||
}
|
||||
|
||||
inline bool is_valid_status_in_ls(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_CREATING == status || OB_LS_NORMAL == status
|
||||
|| OB_LS_DROPPING == status || OB_LS_TENANT_DROPPING == status
|
||||
|| OB_LS_PRE_TENANT_DROPPING == status
|
||||
|| OB_LS_DROPPED == status
|
||||
|| OB_LS_CREATE_ABORT == status;
|
||||
}
|
||||
//maybe empty, DUPLICATE, BLOCK_TABLET_IN, DUPLICATE|BLOCK_TABLET_IN
|
||||
static const int64_t FLAG_STR_LENGTH = 100;
|
||||
typedef common::ObFixedLengthString<FLAG_STR_LENGTH> ObLSFlagStr;
|
||||
class SCN;
|
||||
bool ls_is_empty_status(const ObLSStatus &status);
|
||||
bool ls_is_creating_status(const ObLSStatus &status);
|
||||
bool ls_is_created_status(const ObLSStatus &status);
|
||||
bool ls_is_normal_status(const ObLSStatus &status);
|
||||
bool ls_is_tenant_dropping_status(const ObLSStatus &status);
|
||||
bool ls_is_dropping_status(const ObLSStatus &status);
|
||||
bool ls_is_wait_offline_status(const ObLSStatus &status);
|
||||
bool is_valid_status_in_ls(const ObLSStatus &status);
|
||||
bool ls_is_create_abort_status(const ObLSStatus &status);
|
||||
bool ls_need_create_abort_status(const ObLSStatus &status);
|
||||
bool ls_is_pre_tenant_dropping_status(const ObLSStatus &status);
|
||||
//TODO for duplicate ls
|
||||
enum ObLSFlagForCompatible
|
||||
{
|
||||
@ -158,6 +218,11 @@ struct ObLSAttr
|
||||
return ls_is_pre_tenant_dropping_status(status_);
|
||||
}
|
||||
|
||||
bool ls_is_dropped_create_abort() const
|
||||
{
|
||||
return ls_is_dropped_status(status_)
|
||||
|| ls_is_create_abort_status(status_);
|
||||
}
|
||||
bool ls_is_normal() const
|
||||
{
|
||||
return ls_is_normal_status(status_);
|
||||
@ -229,13 +294,20 @@ public:
|
||||
// @params[in] for_update, whether to lock line
|
||||
// @params[in] client, sql client to use
|
||||
// @params[out] ls_attr, the result
|
||||
// @params[in] only_existing_ls : Mark whether to get the LS that has been deleted or create_abort
|
||||
int get_duplicate_ls_attr(
|
||||
const bool for_update,
|
||||
common::ObISQLClient &client,
|
||||
ObLSAttr &ls_attr);
|
||||
|
||||
ObLSAttr &ls_attr,
|
||||
bool only_existing_ls = true);
|
||||
/**
|
||||
* @description: get ls list from all_ls table
|
||||
* @param[out] ls_operation_array ls list
|
||||
* @params[in] only_existing_ls : Mark whether to get the LS that has been deleted or create_abort
|
||||
* */
|
||||
int get_all_ls_by_order(
|
||||
ObLSAttrIArray &ls_array);
|
||||
ObLSAttrIArray &ls_array,
|
||||
bool only_existing_ls = true);
|
||||
/**
|
||||
* @description:
|
||||
* get ls list from all_ls table,
|
||||
@ -243,9 +315,12 @@ public:
|
||||
* to make sure mutual exclusion with load balancing thread
|
||||
* @param[in] lock_sys_ls whether lock SYS LS in __all_ls table
|
||||
* @param[out] ls_operation_array ls list
|
||||
* @params[in] only_existing_ls : Mark whether to get the LS that has been deleted or create_abort
|
||||
* @return return code
|
||||
*/
|
||||
int get_all_ls_by_order(const bool lock_sys_ls, ObLSAttrIArray &ls_operation_array);
|
||||
int get_all_ls_by_order(const bool lock_sys_ls,
|
||||
ObLSAttrIArray &ls_operation_array,
|
||||
bool only_existing_ls = true);
|
||||
int insert_ls(const ObLSAttr &ls_attr,
|
||||
const ObTenantSwitchoverStatus &working_sw_status,
|
||||
ObMySQLTransaction *trans = NULL);
|
||||
@ -259,13 +334,15 @@ public:
|
||||
const ObTenantSwitchoverStatus &working_sw_status,
|
||||
common::ObMySQLTransaction &trans);
|
||||
static ObLSOperationType get_ls_operation_by_status(const ObLSStatus &ls_status);
|
||||
int get_ls_attr(const ObLSID &id, const bool for_update, common::ObISQLClient &client, ObLSAttr &ls_attr);
|
||||
int get_ls_attr(const ObLSID &id, const bool for_update, common::ObISQLClient &client,
|
||||
ObLSAttr &ls_attr, bool only_existing_ls = true);
|
||||
/*
|
||||
* description: get all ls with snapshot
|
||||
* @param[in] read_scn:the snapshot of read_version
|
||||
* @param[out] ObLSAttrIArray ls_info in __all_ls
|
||||
* @params[in] only_existing_ls : Mark whether to get the LS that has been deleted or create_abort
|
||||
* */
|
||||
int load_all_ls_and_snapshot(const share::SCN &read_scn, ObLSAttrIArray &ls_array);
|
||||
int load_all_ls_and_snapshot(const share::SCN &read_scn, ObLSAttrIArray &ls_array, bool only_existing_ls = true);
|
||||
static int get_tenant_gts(const uint64_t &tenant_id, SCN >s_scn);
|
||||
static int get_tenant_gts(const uint64_t &tenant_id, int64_t >s_ts_ns);
|
||||
int alter_ls_group_in_trans(const ObLSAttr &ls_info,
|
||||
|
@ -39,46 +39,6 @@ namespace oceanbase
|
||||
{
|
||||
namespace share
|
||||
{
|
||||
const char* LS_STATUS_ARRAY[] =
|
||||
{
|
||||
"CREATING",
|
||||
"CREATED",
|
||||
"NORMAL",
|
||||
"DROPPING",
|
||||
"TENANT_DROPPING",
|
||||
"WAIT_OFFLINE",
|
||||
"CREATE_ABORT",
|
||||
"PRE_TENANT_DROPPING"
|
||||
};
|
||||
|
||||
ObLSStatus str_to_ls_status(const ObString &status_str)
|
||||
{
|
||||
ObLSStatus ret_status = OB_LS_EMPTY;
|
||||
if (status_str.empty()) {
|
||||
ret_status = OB_LS_EMPTY;
|
||||
} else {
|
||||
for (int64_t i = 0; i < ARRAYSIZEOF(LS_STATUS_ARRAY); i++) {
|
||||
if (0 == status_str.case_compare(LS_STATUS_ARRAY[i])) {
|
||||
ret_status = static_cast<ObLSStatus>(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret_status;
|
||||
}
|
||||
|
||||
const char* ls_status_to_str(const ObLSStatus &status)
|
||||
{
|
||||
const char* str = "UNKNOWN";
|
||||
|
||||
if (OB_UNLIKELY(OB_LS_EMPTY == status)) {
|
||||
LOG_WARN_RET(OB_INVALID_ARGUMENT, "invalid log stream status", K(status));
|
||||
} else {
|
||||
str = LS_STATUS_ARRAY[status];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
OB_SERIALIZE_MEMBER(ObMemberListFlag, flag_);
|
||||
|
||||
int64_t ObMemberListFlag::to_string(char *buf, const int64_t buf_len) const
|
||||
@ -98,7 +58,7 @@ bool ObLSStatusInfo::is_valid() const
|
||||
&& (ls_id_.is_sys_ls()
|
||||
|| (OB_INVALID_ID != ls_group_id_
|
||||
&& OB_INVALID_ID != unit_group_id_))
|
||||
&& share::OB_LS_EMPTY != status_
|
||||
&& !ls_is_invalid_status(status_)
|
||||
&& flag_.is_valid();
|
||||
}
|
||||
|
||||
@ -124,7 +84,7 @@ int ObLSStatusInfo::init(const uint64_t tenant_id,
|
||||
if (OB_UNLIKELY(!id.is_valid()
|
||||
|| !flag.is_valid()
|
||||
|| OB_INVALID_TENANT_ID == tenant_id
|
||||
|| OB_LS_EMPTY == status)) {
|
||||
|| ls_is_invalid_status(status))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(id), K(ls_group_id),
|
||||
K(status), K(unit_group_id), K(flag));
|
||||
@ -162,62 +122,6 @@ int ObLSStatusInfo::assign(const ObLSStatusInfo &other)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ls_is_empty_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_EMPTY == status;
|
||||
}
|
||||
|
||||
bool ls_is_creating_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_CREATING == status;
|
||||
}
|
||||
|
||||
bool ls_is_created_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_CREATED == status;
|
||||
}
|
||||
|
||||
bool ls_is_normal_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_NORMAL == status;
|
||||
}
|
||||
|
||||
bool ls_is_tenant_dropping_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_TENANT_DROPPING == status;
|
||||
}
|
||||
|
||||
bool ls_is_dropping_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_DROPPING == status;
|
||||
}
|
||||
|
||||
bool ls_is_wait_offline_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_WAIT_OFFLINE == status;
|
||||
}
|
||||
bool ls_is_create_abort_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_CREATE_ABORT == status;
|
||||
}
|
||||
|
||||
bool ls_need_create_abort_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_CREATING == status || OB_LS_CREATED == status;
|
||||
}
|
||||
|
||||
bool ls_is_pre_tenant_dropping_status(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_PRE_TENANT_DROPPING == status;
|
||||
}
|
||||
|
||||
bool is_valid_status_in_ls(const ObLSStatus &status)
|
||||
{
|
||||
return OB_LS_CREATING == status || OB_LS_NORMAL == status
|
||||
|| OB_LS_DROPPING == status || OB_LS_TENANT_DROPPING == status
|
||||
|| OB_LS_PRE_TENANT_DROPPING == status;
|
||||
}
|
||||
|
||||
|
||||
/////////ObLSPrimaryZoneInfo
|
||||
int ObLSPrimaryZoneInfo::init(const uint64_t tenant_id, const uint64_t ls_group_id, const ObLSID ls_id,
|
||||
@ -274,6 +178,8 @@ int ObLSStatusOperator::create_new_ls(const ObLSStatusInfo &ls_info,
|
||||
int ret = OB_SUCCESS;
|
||||
ObAllTenantInfo tenant_info;
|
||||
ObLSFlagStr flag_str;
|
||||
common::ObSqlString sql;
|
||||
const char *table_name = OB_ALL_LS_STATUS_TNAME;
|
||||
if (OB_UNLIKELY(!ls_info.is_valid()
|
||||
|| !working_sw_status.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
@ -300,8 +206,6 @@ int ObLSStatusOperator::create_new_ls(const ObLSStatusInfo &ls_info,
|
||||
if (OB_FAIL(ret)) {
|
||||
} else {
|
||||
ObDMLSqlSplicer dml_splicer;
|
||||
common::ObSqlString sql;
|
||||
const char *table_name = OB_ALL_LS_STATUS_TNAME;
|
||||
if (OB_FAIL(dml_splicer.add_pk_column("tenant_id", ls_info.tenant_id_))
|
||||
|| OB_FAIL(dml_splicer.add_pk_column("ls_id", ls_info.ls_id_.id()))
|
||||
|| OB_FAIL(dml_splicer.add_column("status", ls_status_to_str(ls_info.status_)))
|
||||
@ -322,6 +226,8 @@ int ObLSStatusOperator::create_new_ls(const ObLSStatusInfo &ls_info,
|
||||
LOG_WARN("failed to update tenant max ls id", KR(ret), K(ls_info));
|
||||
}
|
||||
}
|
||||
|
||||
ALL_LS_EVENT_ADD(ls_info.tenant_id_, ls_info.ls_id_, "create_new_ls", ret, sql);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -332,6 +238,7 @@ int ObLSStatusOperator::drop_ls(const uint64_t &tenant_id,
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObAllTenantInfo tenant_info;
|
||||
common::ObSqlString sql;
|
||||
if (OB_UNLIKELY(!ls_id.is_valid() || OB_INVALID_TENANT_ID == tenant_id
|
||||
|| !working_sw_status.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
@ -343,7 +250,6 @@ int ObLSStatusOperator::drop_ls(const uint64_t &tenant_id,
|
||||
ret = OB_NEED_RETRY;
|
||||
LOG_WARN("tenant not in specified switchover status", K(tenant_id), K(working_sw_status), K(tenant_info));
|
||||
} else {
|
||||
common::ObSqlString sql;
|
||||
if (OB_FAIL(sql.assign_fmt("DELETE from %s where ls_id = %ld and tenant_id = %lu",
|
||||
OB_ALL_LS_STATUS_TNAME, ls_id.id(), tenant_id))) {
|
||||
LOG_WARN("failed to assign sql", KR(ret), K(ls_id), K(sql));
|
||||
@ -351,6 +257,7 @@ int ObLSStatusOperator::drop_ls(const uint64_t &tenant_id,
|
||||
LOG_WARN("failed to exec write", KR(ret), K(tenant_id), K(ls_id), K(sql));
|
||||
}
|
||||
}
|
||||
ALL_LS_EVENT_ADD(tenant_id, ls_id, "drop_ls", ret, sql);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -383,13 +290,13 @@ int ObLSStatusOperator::update_ls_primary_zone(
|
||||
{
|
||||
UNUSEDx(zone_priority);
|
||||
int ret = OB_SUCCESS;
|
||||
common::ObSqlString sql;
|
||||
if (OB_UNLIKELY(!ls_id.is_valid()
|
||||
|| primary_zone.is_empty()
|
||||
|| OB_INVALID_TENANT_ID == tenant_id)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid_argument", KR(ret), K(ls_id), K(primary_zone), K(tenant_id));
|
||||
} else {
|
||||
common::ObSqlString sql;
|
||||
if (OB_FAIL(sql.assign_fmt("UPDATE %s set primary_zone = '%s' where ls_id "
|
||||
"= %ld and tenant_id = %lu",
|
||||
OB_ALL_LS_STATUS_TNAME, primary_zone.ptr(),
|
||||
@ -400,6 +307,7 @@ int ObLSStatusOperator::update_ls_primary_zone(
|
||||
LOG_WARN("failed to exec write", KR(ret), K(ls_id), K(sql), K(tenant_id));
|
||||
}
|
||||
}
|
||||
ALL_LS_EVENT_ADD(tenant_id, ls_id, "update_ls_primary_zone", ret, sql);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -412,8 +320,8 @@ int ObLSStatusOperator::update_ls_status(
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!id.is_valid()
|
||||
|| OB_LS_EMPTY == new_status
|
||||
|| OB_LS_EMPTY == old_status
|
||||
|| ls_is_invalid_status(new_status)
|
||||
|| ls_is_invalid_status(old_status)
|
||||
|| OB_INVALID_TENANT_ID == tenant_id
|
||||
|| !switch_status.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
@ -450,8 +358,8 @@ int ObLSStatusOperator::update_ls_status_in_trans(
|
||||
int ret = OB_SUCCESS;
|
||||
ObAllTenantInfo tenant_info;
|
||||
if (OB_UNLIKELY(!id.is_valid()
|
||||
|| OB_LS_EMPTY == new_status
|
||||
|| OB_LS_EMPTY == old_status
|
||||
|| ls_is_invalid_status(new_status)
|
||||
|| ls_is_invalid_status(old_status)
|
||||
|| OB_INVALID_TENANT_ID == tenant_id
|
||||
|| !switch_status.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
@ -492,6 +400,7 @@ int ObLSStatusOperator::update_ls_status_in_trans(
|
||||
} else if (OB_FAIL(exec_write(tenant_id, sql, this, trans))) {
|
||||
LOG_WARN("failed to exec write", KR(ret), K(tenant_id), K(id), K(sql));
|
||||
}
|
||||
ALL_LS_EVENT_ADD(tenant_id, id, "update_ls_status", ret, sql);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -527,6 +436,7 @@ int ObLSStatusOperator::alter_ls_group_id(const uint64_t tenant_id, const ObLSID
|
||||
} else if (OB_FAIL(exec_write(tenant_id, sql, this, client))) {
|
||||
LOG_WARN("failed to exec write", KR(ret), K(tenant_id), K(id), K(sql));
|
||||
}
|
||||
ALL_LS_EVENT_ADD(tenant_id, id, "alter_ls_group", ret, sql);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -538,7 +448,7 @@ int ObLSStatusOperator::update_init_member_list(
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_compatible_with_readonly_replica = false;
|
||||
ObSqlString learner_list_sub_sql;
|
||||
common::ObSqlString sql;
|
||||
if (OB_UNLIKELY(!id.is_valid()
|
||||
|| !member_list.is_valid()
|
||||
|| OB_INVALID_TENANT_ID == tenant_id)) {
|
||||
@ -550,11 +460,11 @@ int ObLSStatusOperator::update_init_member_list(
|
||||
LOG_WARN("failed to check data version for read-only replica", KR(ret),
|
||||
"exec_tenant_id", ObLSLifeIAgent::get_exec_tenant_id(tenant_id));
|
||||
} else {
|
||||
common::ObSqlString sql;
|
||||
ObSqlString visible_member_list;
|
||||
ObString hex_member_list;
|
||||
ObSqlString visible_learner_list;
|
||||
ObString hex_learner_list;
|
||||
ObSqlString learner_list_sub_sql;
|
||||
ObArenaAllocator allocator("MemberList");
|
||||
if (OB_FAIL(get_visible_member_list_str_(member_list, allocator, visible_member_list, arb_member))) {
|
||||
LOG_WARN("failed to get visible member list", KR(ret), K(member_list));
|
||||
@ -590,6 +500,7 @@ int ObLSStatusOperator::update_init_member_list(
|
||||
LOG_WARN("failed to exec write", KR(ret), K(id), K(sql));
|
||||
}
|
||||
}
|
||||
ALL_LS_EVENT_ADD(tenant_id, id, "update_ls_init_member_list", ret, sql);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -56,20 +56,6 @@ namespace schema
|
||||
class ObMultiVersionSchemaService;
|
||||
}
|
||||
|
||||
ObLSStatus str_to_ls_status(const ObString &status_str);
|
||||
const char* ls_status_to_str(const ObLSStatus &status);
|
||||
|
||||
bool ls_is_empty_status(const ObLSStatus &status);
|
||||
bool ls_is_creating_status(const ObLSStatus &status);
|
||||
bool ls_is_created_status(const ObLSStatus &status);
|
||||
bool ls_is_normal_status(const ObLSStatus &status);
|
||||
bool ls_is_tenant_dropping_status(const ObLSStatus &status);
|
||||
bool ls_is_dropping_status(const ObLSStatus &status);
|
||||
bool ls_is_wait_offline_status(const ObLSStatus &status);
|
||||
bool is_valid_status_in_ls(const ObLSStatus &status);
|
||||
bool ls_is_create_abort_status(const ObLSStatus &status);
|
||||
bool ls_need_create_abort_status(const ObLSStatus &status);
|
||||
bool ls_is_pre_tenant_dropping_status(const ObLSStatus &status);
|
||||
class ObLSStatusOperator;
|
||||
|
||||
const int64_t MAX_MEMBERLIST_FLAG_LENGTH = 10;
|
||||
@ -258,7 +244,6 @@ class ObLSStatusOperator : public ObLSLifeIAgent, public ObLSTemplateOperator
|
||||
public:
|
||||
ObLSStatusOperator() {};
|
||||
virtual ~ObLSStatusOperator(){}
|
||||
|
||||
public:
|
||||
/*
|
||||
* description: override of ObLSLifeIAgent
|
||||
|
@ -588,9 +588,7 @@ int ObPrimaryStandbyService::switch_to_standby_prepare_ls_status_(
|
||||
ObAllTenantInfo &new_tenant_info)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObMySQLTransaction trans;
|
||||
ObLSAttr sys_ls_attr;
|
||||
share::ObLSAttrOperator ls_operator(tenant_id, sql_proxy_);
|
||||
share::schema::ObSchemaGetterGuard schema_guard;
|
||||
const share::schema::ObTenantSchema *tenant_schema = NULL;
|
||||
int64_t new_switchover_epoch = OB_INVALID_VERSION;
|
||||
|
@ -625,6 +625,8 @@ select 0xffffffffff & table_id, table_name, table_type, database_id, part_num fr
|
||||
12401 __all_virtual_tenant_parameter 2 201001 1
|
||||
12405 __all_virtual_tablet_buffer_info 2 201001 1
|
||||
12415 __all_virtual_tenant_event_history 2 201001 1
|
||||
12416 __all_virtual_balance_task_helper 2 201001 1
|
||||
12417 __all_virtual_balance_group_ls_stat 2 201001 1
|
||||
20001 GV$OB_PLAN_CACHE_STAT 1 201001 1
|
||||
20002 GV$OB_PLAN_CACHE_PLAN_STAT 1 201001 1
|
||||
20003 SCHEMATA 1 201002 1
|
||||
@ -955,6 +957,8 @@ select 0xffffffffff & table_id, table_name, table_type, database_id, part_num fr
|
||||
21424 V$OB_LS_LOG_RESTORE_STATUS 1 201001 1
|
||||
21425 CDB_OB_EXTERNAL_TABLE_FILES 1 201001 1
|
||||
21426 DBA_DB_LINKS 1 201001 1
|
||||
21445 DBA_OB_LS_HISTORY 1 201001 1
|
||||
21446 CDB_OB_LS_HISTORY 1 201001 1
|
||||
21447 DBA_OB_TENANT_EVENT_HISTORY 1 201001 1
|
||||
21448 CDB_OB_TENANT_EVENT_HISTORY 1 201001 1
|
||||
check sys table count and table_id range success
|
||||
|
Loading…
x
Reference in New Issue
Block a user