add virtual table __all_virtual_ls_log_restore_status and view V$OB_LS_LOG_RESTORE_STATUS

This commit is contained in:
obdev 2023-05-10 04:41:31 +00:00 committed by ob-robot
parent e5dfdeb83d
commit dc8b7ebdb7
14 changed files with 1043 additions and 13 deletions

View File

@ -47,6 +47,17 @@ using namespace palf;
namespace logservice
{
using namespace oceanbase::share;
const char *type_str[static_cast<int>(RestoreSyncStatus::MAX_RESTORE_SYNC_STATUS)] = {
"Invalid restore status",
" ",
"There is a gap between the log source and standby",
"Log conflicts, the standby with the same LSN is different from the log source",
"Log source cannot be accessed, the user name or password of the replication account may be incorrect",
"Log source is unreachable, the log source access point may be unavailable",
"Unexpected exceptions",
};
ObLogRestoreHandler::ObLogRestoreHandler() :
parent_(NULL),
context_(),
@ -826,5 +837,100 @@ bool ObLogRestoreHandler::restore_to_end_unlock_() const
}
return bret;
}
int ObLogRestoreHandler::get_ls_restore_status_info(RestoreStatusInfo &restore_status_info)
{
int ret = OB_SUCCESS;
RLockGuard guard(lock_);
LSN lsn;
share::SCN scn;
share::ObTaskId trace_id;
int ret_code = OB_SUCCESS;
bool error_exist = false;
bool is_leader = true;
RestoreSyncStatus sync_status;
if (!is_strong_leader(role_)) {
is_leader = false;
CLOG_LOG(TRACE, "restore not leader", K(role_));
} else if (OB_FAIL(palf_handle_.get_end_lsn(lsn))) {
CLOG_LOG(WARN, "fail to get end lsn when get ls restore status info");
} else if (OB_FAIL(palf_handle_.get_end_scn(scn))) {
CLOG_LOG(WARN, "fail to get end scn");
} else if (OB_FAIL(get_restore_error(trace_id, ret_code, error_exist))) {
CLOG_LOG(WARN, "fail to get restore error");
} else if (error_exist) {
CLOG_LOG(TRACE, "start to mark restore sync error", K(trace_id), K(ret_code), K(context_.error_context_.error_type_));
if (OB_FAIL(get_err_code_and_message_(ret_code, context_.error_context_.error_type_, sync_status, restore_status_info.comment_))) {
CLOG_LOG(WARN, "fail to get err code and message", K(ret_code), K(context_.error_context_.error_type_), K(sync_status));
} else {
restore_status_info.sync_status_ = sync_status;
}
} else if (!error_exist) {
restore_status_info.sync_status_ = RestoreSyncStatus::RESTORE_SYNC_NORMAL;
CLOG_LOG(TRACE, "error is not exist, restore sync is normal", K(error_exist), K(restore_status_info.sync_status_));
}
if (is_leader && OB_SUCC(ret)) {
restore_status_info.ls_id_ = id_;
restore_status_info.err_code_ = ret_code;
restore_status_info.sync_lsn_ = lsn.val_;
restore_status_info.sync_scn_ = scn;
if (OB_FAIL(restore_status_info.comment_.assign_fmt("%s", type_str[int(restore_status_info.sync_status_)]))) {
CLOG_LOG(WARN, "fail to assign comment", K(sync_status));
} else {
CLOG_LOG(TRACE, "success to get error code and message", K(restore_status_info));
}
}
return ret;
}
int ObLogRestoreHandler::get_err_code_and_message_(int ret_code,
ObLogRestoreErrorContext::ErrorType error_type,
RestoreSyncStatus &sync_status,
ObSqlString &comment)
{
int ret = OB_SUCCESS;
if (OB_ERR_OUT_OF_LOWER_BOUND == ret_code) {
sync_status = RestoreSyncStatus::RESTORE_SYNC_STANDBY_LOG_NOT_MATCH;
} else if (OB_ERR_UNEXPECTED == ret_code && error_type == ObLogRestoreErrorContext::ErrorType::SUBMIT_LOG) {
sync_status = RestoreSyncStatus::RESTORE_SYNC_SOURCE_HAS_A_GAP;
} else if (-ER_CONNECT_FAILED == ret_code && error_type == ObLogRestoreErrorContext::ErrorType::FETCH_LOG) {
sync_status = RestoreSyncStatus::RESTORE_SYNC_CHECK_NETWORK;
} else if (-ER_ACCESS_DENIED_ERROR == ret_code && error_type == ObLogRestoreErrorContext::ErrorType::FETCH_LOG) {
sync_status = RestoreSyncStatus::RESTORE_SYNC_CHECK_USER_OR_PASSWORD;
} else {
sync_status = RestoreSyncStatus::RESTORE_SYNC_NOT_AVAILABLE;
}
CLOG_LOG(TRACE, "get err code and message succ", K(sync_status), K(comment));
return ret;
}
RestoreStatusInfo::RestoreStatusInfo()
: ls_id_(share::ObLSID::INVALID_LS_ID),
sync_lsn_(LOG_INVALID_LSN_VAL),
sync_status_(RestoreSyncStatus::INVALID_RESTORE_SYNC_STATUS),
err_code_(OB_SUCCESS)
{
sync_scn_.reset();
comment_.reset();
}
void RestoreStatusInfo::reset()
{
ls_id_ = share::ObLSID::INVALID_LS_ID;
sync_lsn_ = LOG_INVALID_LSN_VAL;
sync_scn_.reset();
sync_status_ = RestoreSyncStatus::INVALID_RESTORE_SYNC_STATUS;
err_code_ = OB_SUCCESS;
comment_.reset();
}
bool RestoreStatusInfo::is_valid() const
{
return ls_id_ != share::ObLSID::INVALID_LS_ID
&& sync_lsn_ != LOG_INVALID_LSN_VAL
&& sync_scn_.is_valid()
&& sync_status_ != RestoreSyncStatus::INVALID_RESTORE_SYNC_STATUS;
}
} // namespace logservice
} // namespace oceanbase

View File

@ -75,6 +75,56 @@ struct RestoreDiagnoseInfo
}
};
enum class RestoreSyncStatus {
INVALID_RESTORE_SYNC_STATUS = 0,
RESTORE_SYNC_NORMAL = 1,
RESTORE_SYNC_SOURCE_HAS_A_GAP = 2,
RESTORE_SYNC_STANDBY_LOG_NOT_MATCH = 3,
RESTORE_SYNC_CHECK_USER_OR_PASSWORD = 4,
RESTORE_SYNC_CHECK_NETWORK = 5,
RESTORE_SYNC_NOT_AVAILABLE = 6,
MAX_RESTORE_SYNC_STATUS
};
inline int restore_sync_status_to_string(const RestoreSyncStatus status, char *str_buf_, const int64_t str_len)
{
int ret = OB_SUCCESS;
if (RestoreSyncStatus::RESTORE_SYNC_NORMAL == status) {
strncpy(str_buf_, "NORMAL", str_len);
} else if (RestoreSyncStatus::RESTORE_SYNC_SOURCE_HAS_A_GAP == status) {
strncpy(str_buf_, "SOURCE HAS A GAP", str_len);
} else if (RestoreSyncStatus::RESTORE_SYNC_STANDBY_LOG_NOT_MATCH == status) {
strncpy(str_buf_, "STANDBY LOG NOT MATCH", str_len);
} else if (RestoreSyncStatus::RESTORE_SYNC_CHECK_USER_OR_PASSWORD == status) {
strncpy(str_buf_, "CHECK USER OR PASSWORD", str_len);
} else if (RestoreSyncStatus::RESTORE_SYNC_CHECK_NETWORK == status) {
strncpy(str_buf_, "CHECK NETWORK", str_len);
} else if (RestoreSyncStatus::RESTORE_SYNC_NOT_AVAILABLE == status) {
strncpy(str_buf_, "NOT AVAILABLE", str_len);
} else {
ret = OB_INVALID_ARGUMENT;
}
return ret;
}
struct RestoreStatusInfo
{
public:
RestoreStatusInfo();
~RestoreStatusInfo() { reset(); }
bool is_valid() const;
void reset();
TO_STRING_KV(K_(ls_id), K_(sync_lsn), K_(sync_scn), K_(sync_status), K_(err_code), K_(comment));
public:
int64_t ls_id_;
int64_t sync_lsn_;
share::SCN sync_scn_;
RestoreSyncStatus sync_status_;
int err_code_;
ObSqlString comment_;
};
// The interface to submit log for physical restore and physical standby
class ObLogRestoreHandler : public ObLogHandlerBase
{
@ -177,7 +227,7 @@ public:
int get_next_sorted_task(ObFetchLogTask *&task);
bool restore_to_end() const;
int diagnose(RestoreDiagnoseInfo &diagnose_info);
int get_ls_restore_status_info(RestoreStatusInfo &restore_status_info);
TO_STRING_KV(K_(is_inited), K_(is_in_stop_state), K_(id), K_(proposal_id), K_(role), KP_(parent), K_(context), K_(restore_context));
private:
@ -191,6 +241,7 @@ private:
int check_restore_to_newest_from_archive_(ObLogArchivePieceContext &piece_context,
const palf::LSN &end_lsn, const share::SCN &end_scn, share::SCN &archive_scn);
bool restore_to_end_unlock_() const;
int get_err_code_and_message_(int ret_code, ObLogRestoreErrorContext::ErrorType error_type, RestoreSyncStatus &err_type, ObSqlString &comment);
private:
ObRemoteLogParent *parent_;

View File

@ -370,6 +370,7 @@ ob_set_subtarget(ob_server virtual_table
virtual_table/ob_virtual_table_iterator_factory.cpp
virtual_table/ob_all_virtual_dml_stats.cpp
virtual_table/ob_all_virtual_archive_dest_status.cpp
virtual_table/ob_all_virtual_ls_log_restore_status.cpp
virtual_table/ob_virtual_span_info.cpp
virtual_table/ob_virtual_show_trace.cpp
virtual_table/ob_all_virtual_sql_plan.cpp

View File

@ -0,0 +1,208 @@
/**
* 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 SERVER
#include "ob_all_virtual_ls_log_restore_status.h"
#include "observer/ob_sql_client_decorator.h"
#include "observer/ob_server_struct.h"
#include "lib/ob_define.h"
#include "lib/ob_errno.h"
#include "lib/oblog/ob_log_module.h"
#include "lib/string/ob_sql_string.h"
#include "lib/mysqlclient/ob_mysql_proxy.h"
#include "storage/tx_storage/ob_ls_map.h" // ObLSIterator
#include "storage/tx_storage/ob_ls_service.h" // ObLSService
using namespace oceanbase::share;
namespace oceanbase
{
namespace observer
{
ObVirtualLSLogRestoreStatus::ObVirtualLSLogRestoreStatus() :
is_inited_(false)
{}
ObVirtualLSLogRestoreStatus::~ObVirtualLSLogRestoreStatus()
{
destroy();
}
int ObVirtualLSLogRestoreStatus::init(omt::ObMultiTenant *omt)
{
int ret = OB_SUCCESS;
if (is_inited_) {
ret = OB_INIT_TWICE;
SERVER_LOG(WARN, "init twice", K(ret));
} else if (OB_ISNULL(omt)) {
ret = OB_INVALID_ARGUMENT;
SERVER_LOG(WARN, "invalid arguments, omt is null", K(ret), K(omt));
} else {
omt_ = omt;
is_inited_ = true;
}
return ret;
}
int ObVirtualLSLogRestoreStatus::inner_get_next_row(common::ObNewRow *&row)
{
int ret = OB_SUCCESS;
ObLSIterator *iter = NULL;
common::ObSharedGuard<ObLSIterator> guard;
if (false == start_to_read_) {
auto func_iterate_tenant = [&]() -> int
{
int ret = OB_SUCCESS;
ObLSService *ls_svr = MTL(ObLSService*);
if (is_user_tenant(MTL_ID())) {
if (OB_ISNULL(ls_svr)) {
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN, "mtl ObLSService should not be null", K(ret));
} else if (OB_FAIL(ls_svr->get_ls_iter(guard, ObLSGetMod::LOG_MOD))) {
SERVER_LOG(WARN, "get ls iter failed", K(ret));
} else if (OB_ISNULL(iter = guard.get_ptr())) {
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN, "ls iter is NULL", K(ret), K(iter));
} else {
while (OB_SUCC(ret)) {
ObLS *ls = NULL;
logservice::ObLogRestoreHandler *restore_handler;
if (OB_FAIL(iter->get_next(ls))) {
if (OB_ITER_END != ret) {
SERVER_LOG(WARN, "iter ls get next failed", K(ret));
} else {
SERVER_LOG(WARN, "iter to end", K(ret));
}
} else if (OB_ISNULL(ls)) {
SERVER_LOG(WARN, "ls is NULL", K(ret), K(ls));
} else {
SERVER_LOG(TRACE, "start to iterate this log_stream", K(MTL_ID()), K(ls->get_ls_id()));
logservice::RestoreStatusInfo restore_status_info;
restore_handler = ls->get_log_restore_handler();
if (OB_ISNULL(restore_handler)) {
SERVER_LOG(WARN, "restore handler is NULL", K(ret), K(ls));
} else if (OB_FAIL(restore_handler->get_ls_restore_status_info(restore_status_info))) {
SERVER_LOG(WARN, "fail to get ls restore status info");
} else if (!restore_status_info.is_valid()) {
SERVER_LOG(WARN, "restore status info is invalid", K(restore_status_info));
} else if (OB_FAIL(insert_ls_restore_status_info_(restore_status_info))) {
SERVER_LOG(WARN, "fail to insert ls restore status info");
} else {
SERVER_LOG(TRACE, "iterate this log_stream success");
scanner_.add_row(cur_row_);
}
}
} // while
if (OB_ITER_END == ret) {
ret = OB_SUCCESS;
}
}
}
return ret;
};
if (OB_FAIL(omt_->operate_each_tenant_for_sys_or_self(func_iterate_tenant))) {
SERVER_LOG(WARN, "ObMultiTenant operate_each_tenant_for_sys_or_self failed", K(ret));
} else {
scanner_it_ = scanner_.begin();
start_to_read_ = true;
}
}// start to read
if (OB_SUCC(ret) && true == start_to_read_) {
if (OB_FAIL(scanner_it_.get_next_row(cur_row_))) {
if (OB_ITER_END != ret) {
SERVER_LOG(WARN, "fail to get next row", KR(ret));
}
} else {
row = &cur_row_;
}
}
return ret;
}
void ObVirtualLSLogRestoreStatus::destroy()
{
is_inited_ = false;
omt_ = NULL;
}
int ObVirtualLSLogRestoreStatus::insert_ls_restore_status_info_(logservice::RestoreStatusInfo &restore_status_info)
{
int ret = OB_SUCCESS;
const int64_t count = output_column_ids_.count();
for (int64_t i = 0; OB_SUCC(ret) && i < count; i++) {
uint64_t col_id = output_column_ids_.at(i);
switch (col_id) {
case OB_APP_MIN_COLUMN_ID: {
cur_row_.cells_[i].set_int(MTL_ID());
break;
}
case OB_APP_MIN_COLUMN_ID + 1: {
if (false == GCTX.self_addr().ip_to_string(ip_, common::OB_IP_PORT_STR_BUFF)) {
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN, "ip_to_string failed", K(ret));
} else {
cur_row_.cells_[i].set_varchar(ObString::make_string(ip_));
cur_row_.cells_[i].set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
}
break;
}
case OB_APP_MIN_COLUMN_ID + 2: {
cur_row_.cells_[i].set_int(GCTX.self_addr().get_port());
break;
}
case OB_APP_MIN_COLUMN_ID + 3: {
cur_row_.cells_[i].set_int(restore_status_info.ls_id_);
break;
}
case OB_APP_MIN_COLUMN_ID + 4: {
cur_row_.cells_[i].set_uint64(restore_status_info.sync_lsn_ < 0 ? 0 : restore_status_info.sync_lsn_);
break;
}
case OB_APP_MIN_COLUMN_ID + 5: {
cur_row_.cells_[i].set_uint64((restore_status_info.sync_scn_.get_val_for_inner_table_field()));
break;
}
case OB_APP_MIN_COLUMN_ID + 6: {
if (OB_FAIL(restore_sync_status_to_string(restore_status_info.sync_status_, restore_status_str_,
sizeof(restore_status_str_)))) {
SERVER_LOG(WARN, "restore_sync_status to string failed", K(restore_status_info));
} else {
cur_row_.cells_[i].set_varchar(ObString::make_string(restore_status_str_));
cur_row_.cells_[i].set_collation_type(ObCharset::get_default_collation(
ObCharset::get_default_charset()));
}
break;
}
case OB_APP_MIN_COLUMN_ID + 7: {
cur_row_.cells_[i].set_int(restore_status_info.err_code_);
break;
}
case OB_APP_MIN_COLUMN_ID + 8: {
if (OB_FAIL(databuff_printf(comment_, sizeof(comment_), "%.*s",
static_cast<int>(restore_status_info.comment_.length()), restore_status_info.comment_.ptr()))) {
SERVER_LOG(WARN, "restore_sync_status comment to string failed", K(restore_status_info));
} else {
cur_row_.cells_[i].set_varchar(ObString::make_string(comment_));
cur_row_.cells_[i].set_collation_type(ObCharset::get_default_collation(
ObCharset::get_default_charset()));
}
break;
}
}
}
SERVER_LOG(TRACE, "insert restore status info success", K(restore_status_info));
return ret;
}
} // namespace observer
} // namespace oceanbase

View File

@ -0,0 +1,46 @@
/**
* 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.
*/
#ifndef OCEANBASE_OBSERVER_OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_H_
#define OCEANBASE_OBSERVER_OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_H_
#include "share/ob_virtual_table_projector.h"
#include "logservice/restoreservice/ob_log_restore_handler.h"
namespace oceanbase
{
namespace observer
{
class ObVirtualLSLogRestoreStatus : public common::ObVirtualTableProjector
{
public:
ObVirtualLSLogRestoreStatus();
virtual ~ObVirtualLSLogRestoreStatus();
int init(omt::ObMultiTenant *omt);
virtual int inner_get_next_row(common::ObNewRow *&row);
void destroy();
private:
int insert_ls_restore_status_info_(logservice::RestoreStatusInfo &restore_status_info);
private:
static const int64_t VARCHAR_32 = 32;
static const int64_t VARCHAR_2048 = 2048;
bool is_inited_;
char restore_status_str_[VARCHAR_32] = {'\0'};
char ip_[common::OB_IP_PORT_STR_BUFF] = {'\0'};
char comment_[VARCHAR_2048] = {'\0'};
omt::ObMultiTenant *omt_;
DISALLOW_COPY_AND_ASSIGN(ObVirtualLSLogRestoreStatus);
};
}//end namespace observer
}//end namespace oceanbase
#endif //OCEANBASE_OBSERVER_OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_H_

View File

@ -202,6 +202,7 @@
#include "observer/virtual_table/ob_all_virtual_opt_stat_gather_monitor.h"
#include "observer/virtual_table/ob_all_virtual_thread.h"
#include "observer/virtual_table/ob_all_virtual_px_p2p_datahub.h"
#include "observer/virtual_table/ob_all_virtual_ls_log_restore_status.h"
namespace oceanbase
{
@ -2379,6 +2380,18 @@ int ObVTIterCreator::create_vt_iter(ObVTableScanParam &params,
}
break;
}
case OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_TID: {
ObVirtualLSLogRestoreStatus *ls_log_restore_status = NULL;
omt::ObMultiTenant *omt = GCTX.omt_;
if (OB_FAIL(NEW_VIRTUAL_TABLE(ObVirtualLSLogRestoreStatus, ls_log_restore_status))) {
SERVER_LOG(ERROR, "failed to init ObVirtualLSLogRestoreStatus", K(ret));
} else if (ls_log_restore_status->init(omt)) {
SERVER_LOG(WARN, "fail to init ObVirtualLSLogRestoreStatus with omt", K(ret));
} else {
vt_iter = static_cast<ObVirtualTableIterator *>(ls_log_restore_status);
}
break;
}
END_CREATE_VT_ITER_SWITCH_LAMBDA
#define AGENT_VIRTUAL_TABLE_CREATE_ITER

View File

@ -0,0 +1,219 @@
/**
* 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_log_restore_status_schema(ObTableSchema &table_schema)
{
int ret = OB_SUCCESS;
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
//generated fields:
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
table_schema.set_tablegroup_id(OB_INVALID_ID);
table_schema.set_database_id(OB_SYS_DATABASE_ID);
table_schema.set_table_id(OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_TID);
table_schema.set_rowkey_split_pos(0);
table_schema.set_is_use_bloomfilter(false);
table_schema.set_progressive_merge_num(0);
table_schema.set_rowkey_column_num(0);
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_LOG_RESTORE_STATUS_TNAME))) {
LOG_ERROR("fail to set table_name", K(ret));
}
}
if (OB_SUCC(ret)) {
if (OB_FAIL(table_schema.set_compress_func_name(OB_DEFAULT_COMPRESS_FUNC_NAME))) {
LOG_ERROR("fail to set compress_func_name", K(ret));
}
}
table_schema.set_part_level(PARTITION_LEVEL_ZERO);
table_schema.set_charset_type(ObCharset::get_default_charset());
table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("tenant_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
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("svr_ip", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
1, //part_key_pos
ObVarcharType, //column_type
CS_TYPE_INVALID, //column_collation_type
MAX_IP_ADDR_LENGTH, //column_length
-1, //column_precision
-1, //column_scale
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("svr_port", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
2, //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
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("sync_lsn", //column_name
++column_id, //column_id
0, //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("sync_scn", //column_name
++column_id, //column_id
0, //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("sync_status", //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
128, //column_length
-1, //column_precision
-1, //column_scale
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("err_code", //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("comment", //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
MAX_COLUMN_COMMENT_LENGTH, //column_length
-1, //column_precision
-1, //column_scale
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
table_schema.get_part_option().set_part_num(1);
table_schema.set_part_level(PARTITION_LEVEL_ONE);
table_schema.get_part_option().set_part_func_type(PARTITION_FUNC_TYPE_LIST_COLUMNS);
if (OB_FAIL(table_schema.get_part_option().set_part_expr("svr_ip, svr_port"))) {
LOG_WARN("set_part_expr failed", K(ret));
} else if (OB_FAIL(table_schema.mock_list_partition_array())) {
LOG_WARN("mock list partition array failed", K(ret));
}
}
table_schema.set_index_using_type(USING_HASH);
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

View File

@ -537,6 +537,195 @@ int ObInnerTableSchema::all_virtual_timestamp_service_ora_schema(ObTableSchema &
return ret;
}
int ObInnerTableSchema::all_virtual_ls_log_restore_status_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_LOG_RESTORE_STATUS_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(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_LOG_RESTORE_STATUS_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("TENANT_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("SVR_IP", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
1, //part_key_pos
ObVarcharType, //column_type
CS_TYPE_UTF8MB4_BIN, //column_collation_type
MAX_IP_ADDR_LENGTH, //column_length
2, //column_precision
-1, //column_scale
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("SVR_PORT", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
2, //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_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("SYNC_LSN", //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("SYNC_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("SYNC_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
128, //column_length
2, //column_precision
-1, //column_scale
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("ERR_CODE", //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("COMMENT", //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
MAX_COLUMN_COMMENT_LENGTH, //column_length
2, //column_precision
-1, //column_scale
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
table_schema.get_part_option().set_part_num(1);
table_schema.set_part_level(PARTITION_LEVEL_ONE);
table_schema.get_part_option().set_part_func_type(PARTITION_FUNC_TYPE_LIST);
if (OB_FAIL(table_schema.get_part_option().set_part_expr("SVR_IP, SVR_PORT"))) {
LOG_WARN("set_part_expr failed", K(ret));
} else if (OB_FAIL(table_schema.mock_list_partition_array())) {
LOG_WARN("mock list partition array failed", K(ret));
}
}
table_schema.set_index_using_type(USING_HASH);
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

View File

@ -575,6 +575,56 @@ int ObInnerTableSchema::dba_ob_table_stat_stale_info_schema(ObTableSchema &table
return ret;
}
int ObInnerTableSchema::v_ob_ls_log_restore_status_schema(ObTableSchema &table_schema)
{
int ret = OB_SUCCESS;
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
//generated fields:
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
table_schema.set_tablegroup_id(OB_INVALID_ID);
table_schema.set_database_id(OB_SYS_DATABASE_ID);
table_schema.set_table_id(OB_V_OB_LS_LOG_RESTORE_STATUS_TID);
table_schema.set_rowkey_split_pos(0);
table_schema.set_is_use_bloomfilter(false);
table_schema.set_progressive_merge_num(0);
table_schema.set_rowkey_column_num(0);
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
table_schema.set_table_type(SYSTEM_VIEW);
table_schema.set_index_type(INDEX_TYPE_IS_NOT);
table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL);
if (OB_SUCC(ret)) {
if (OB_FAIL(table_schema.set_table_name(OB_V_OB_LS_LOG_RESTORE_STATUS_TNAME))) {
LOG_ERROR("fail to set table_name", K(ret));
}
}
if (OB_SUCC(ret)) {
if (OB_FAIL(table_schema.set_compress_func_name(OB_DEFAULT_COMPRESS_FUNC_NAME))) {
LOG_ERROR("fail to set compress_func_name", K(ret));
}
}
table_schema.set_part_level(PARTITION_LEVEL_ZERO);
table_schema.set_charset_type(ObCharset::get_default_charset());
table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
if (OB_SUCC(ret)) {
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT TENANT_ID, LS_ID, SYNC_LSN, SYNC_SCN, SYNC_STATUS, ERR_CODE, COMMENT FROM OCEANBASE.__ALL_VIRTUAL_LS_LOG_RESTORE_STATUS; )__"))) {
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_external_table_files_schema(ObTableSchema &table_schema)
{
int ret = OB_SUCCESS;

View File

@ -1425,6 +1425,56 @@ int ObInnerTableSchema::v_ob_timestamp_service_ora_schema(ObTableSchema &table_s
return ret;
}
int ObInnerTableSchema::v_ob_ls_log_restore_status_ora_schema(ObTableSchema &table_schema)
{
int ret = OB_SUCCESS;
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
//generated fields:
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
table_schema.set_tablegroup_id(OB_INVALID_ID);
table_schema.set_database_id(OB_ORA_SYS_DATABASE_ID);
table_schema.set_table_id(OB_V_OB_LS_LOG_RESTORE_STATUS_ORA_TID);
table_schema.set_rowkey_split_pos(0);
table_schema.set_is_use_bloomfilter(false);
table_schema.set_progressive_merge_num(0);
table_schema.set_rowkey_column_num(0);
table_schema.set_load_type(TABLE_LOAD_TYPE_IN_DISK);
table_schema.set_table_type(SYSTEM_VIEW);
table_schema.set_index_type(INDEX_TYPE_IS_NOT);
table_schema.set_def_type(TABLE_DEF_TYPE_INTERNAL);
if (OB_SUCC(ret)) {
if (OB_FAIL(table_schema.set_table_name(OB_V_OB_LS_LOG_RESTORE_STATUS_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 TENANT_ID, LS_ID, SYNC_LSN, SYNC_SCN, SYNC_STATUS, ERR_CODE, "COMMENT" FROM SYS.ALL_VIRTUAL_LS_LOG_RESTORE_STATUS; )__"))) {
LOG_ERROR("fail to set view_definition", K(ret));
}
}
table_schema.set_index_using_type(USING_BTREE);
table_schema.set_row_store_type(ENCODING_ROW_STORE);
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
table_schema.set_progressive_merge_round(1);
table_schema.set_storage_format_version(3);
table_schema.set_tablet_id(0);
table_schema.set_max_used_column_id(column_id);
return ret;
}
int ObInnerTableSchema::all_table_idx_data_table_id_schema(ObTableSchema &table_schema)
{
int ret = OB_SUCCESS;

View File

@ -885,6 +885,7 @@ public:
static int all_virtual_virtual_long_ops_status_mysql_sys_agent_schema(share::schema::ObTableSchema &table_schema);
static int all_virtual_timestamp_service_schema(share::schema::ObTableSchema &table_schema);
static int all_virtual_px_p2p_datahub_schema(share::schema::ObTableSchema &table_schema);
static int all_virtual_ls_log_restore_status_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);
@ -1106,6 +1107,7 @@ public:
static int all_virtual_log_restore_source_ora_schema(share::schema::ObTableSchema &table_schema);
static int all_virtual_px_p2p_datahub_ora_schema(share::schema::ObTableSchema &table_schema);
static int all_virtual_timestamp_service_ora_schema(share::schema::ObTableSchema &table_schema);
static int all_virtual_ls_log_restore_status_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);
@ -1421,6 +1423,7 @@ public:
static int gv_sql_join_filter_schema(share::schema::ObTableSchema &table_schema);
static int v_sql_join_filter_schema(share::schema::ObTableSchema &table_schema);
static int dba_ob_table_stat_stale_info_schema(share::schema::ObTableSchema &table_schema);
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_synonyms_schema(share::schema::ObTableSchema &table_schema);
@ -1820,6 +1823,7 @@ public:
static int gv_ob_arbitration_service_status_ora_schema(share::schema::ObTableSchema &table_schema);
static int v_ob_arbitration_service_status_ora_schema(share::schema::ObTableSchema &table_schema);
static int v_ob_timestamp_service_ora_schema(share::schema::ObTableSchema &table_schema);
static int v_ob_ls_log_restore_status_ora_schema(share::schema::ObTableSchema &table_schema);
static int all_table_aux_lob_meta_schema(share::schema::ObTableSchema &table_schema);
static int all_column_aux_lob_meta_schema(share::schema::ObTableSchema &table_schema);
static int all_ddl_operation_aux_lob_meta_schema(share::schema::ObTableSchema &table_schema);
@ -3090,6 +3094,7 @@ const schema_create_func virtual_table_schema_creators [] = {
ObInnerTableSchema::all_virtual_virtual_long_ops_status_mysql_sys_agent_schema,
ObInnerTableSchema::all_virtual_timestamp_service_schema,
ObInnerTableSchema::all_virtual_px_p2p_datahub_schema,
ObInnerTableSchema::all_virtual_ls_log_restore_status_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,
@ -3320,6 +3325,7 @@ const schema_create_func virtual_table_schema_creators [] = {
ObInnerTableSchema::all_virtual_log_restore_source_ora_schema,
ObInnerTableSchema::all_virtual_px_p2p_datahub_ora_schema,
ObInnerTableSchema::all_virtual_timestamp_service_ora_schema,
ObInnerTableSchema::all_virtual_ls_log_restore_status_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,
@ -3716,6 +3722,7 @@ const schema_create_func sys_view_schema_creators [] = {
ObInnerTableSchema::gv_sql_join_filter_schema,
ObInnerTableSchema::v_sql_join_filter_schema,
ObInnerTableSchema::dba_ob_table_stat_stale_info_schema,
ObInnerTableSchema::v_ob_ls_log_restore_status_schema,
ObInnerTableSchema::cdb_ob_external_table_files_schema,
ObInnerTableSchema::dba_db_links_schema,
ObInnerTableSchema::dba_synonyms_schema,
@ -4115,6 +4122,7 @@ const schema_create_func sys_view_schema_creators [] = {
ObInnerTableSchema::gv_ob_arbitration_service_status_ora_schema,
ObInnerTableSchema::v_ob_arbitration_service_status_ora_schema,
ObInnerTableSchema::v_ob_timestamp_service_ora_schema,
ObInnerTableSchema::v_ob_ls_log_restore_status_ora_schema,
NULL,};
const schema_create_func core_index_table_schema_creators [] = {
@ -4610,6 +4618,7 @@ const uint64_t tenant_space_tables [] = {
OB_ALL_VIRTUAL_VIRTUAL_LONG_OPS_STATUS_MYSQL_SYS_AGENT_TID,
OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_TID,
OB_ALL_VIRTUAL_PX_P2P_DATAHUB_TID,
OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_TID,
OB_ALL_VIRTUAL_SQL_AUDIT_ORA_TID,
OB_ALL_VIRTUAL_SQL_AUDIT_ORA_ALL_VIRTUAL_SQL_AUDIT_I1_TID,
OB_ALL_VIRTUAL_PLAN_STAT_ORA_TID,
@ -4839,6 +4848,7 @@ const uint64_t tenant_space_tables [] = {
OB_ALL_VIRTUAL_LOG_RESTORE_SOURCE_ORA_TID,
OB_ALL_VIRTUAL_PX_P2P_DATAHUB_ORA_TID,
OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_ORA_TID,
OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_ORA_TID,
OB_GV_OB_PLAN_CACHE_STAT_TID,
OB_GV_OB_PLAN_CACHE_PLAN_STAT_TID,
OB_SCHEMATA_TID,
@ -5074,6 +5084,7 @@ const uint64_t tenant_space_tables [] = {
OB_GV_SQL_JOIN_FILTER_TID,
OB_V_SQL_JOIN_FILTER_TID,
OB_DBA_OB_TABLE_STAT_STALE_INFO_TID,
OB_V_OB_LS_LOG_RESTORE_STATUS_TID,
OB_DBA_DB_LINKS_TID,
OB_DBA_SYNONYMS_TID,
OB_DBA_OBJECTS_ORA_TID,
@ -5472,6 +5483,7 @@ const uint64_t tenant_space_tables [] = {
OB_GV_OB_ARBITRATION_SERVICE_STATUS_ORA_TID,
OB_V_OB_ARBITRATION_SERVICE_STATUS_ORA_TID,
OB_V_OB_TIMESTAMP_SERVICE_ORA_TID,
OB_V_OB_LS_LOG_RESTORE_STATUS_ORA_TID,
OB_ALL_TABLE_IDX_DATA_TABLE_ID_TID,
OB_ALL_TABLE_IDX_DB_TB_NAME_TID,
OB_ALL_TABLE_IDX_TB_NAME_TID,
@ -6182,7 +6194,8 @@ const uint64_t all_ora_mapping_virtual_table_org_tables [] = {
OB_ALL_VIRTUAL_OBJ_LOCK_TID,
OB_ALL_VIRTUAL_LOG_RESTORE_SOURCE_TID,
OB_ALL_VIRTUAL_PX_P2P_DATAHUB_TID,
OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_TID, };
OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_TID,
OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_TID, };
const uint64_t all_ora_mapping_virtual_tables [] = { OB_ALL_VIRTUAL_SQL_AUDIT_ORA_TID
, OB_ALL_VIRTUAL_PLAN_STAT_ORA_TID
@ -6305,6 +6318,7 @@ const uint64_t all_ora_mapping_virtual_tables [] = { OB_ALL_VIRTUAL_SQL_AUDIT_O
, OB_ALL_VIRTUAL_LOG_RESTORE_SOURCE_ORA_TID
, OB_ALL_VIRTUAL_PX_P2P_DATAHUB_ORA_TID
, OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_ORA_TID
, OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_ORA_TID
, };
/* start/end_pos is start/end postition for column with tenant id */
@ -6705,6 +6719,7 @@ const char* const tenant_space_table_names [] = {
OB_ALL_VIRTUAL_VIRTUAL_LONG_OPS_STATUS_MYSQL_SYS_AGENT_TNAME,
OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_TNAME,
OB_ALL_VIRTUAL_PX_P2P_DATAHUB_TNAME,
OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_TNAME,
OB_ALL_VIRTUAL_SQL_AUDIT_ORA_TNAME,
OB_ALL_VIRTUAL_SQL_AUDIT_ORA_ALL_VIRTUAL_SQL_AUDIT_I1_TNAME,
OB_ALL_VIRTUAL_PLAN_STAT_ORA_TNAME,
@ -6934,6 +6949,7 @@ const char* const tenant_space_table_names [] = {
OB_ALL_VIRTUAL_LOG_RESTORE_SOURCE_ORA_TNAME,
OB_ALL_VIRTUAL_PX_P2P_DATAHUB_ORA_TNAME,
OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_ORA_TNAME,
OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_ORA_TNAME,
OB_GV_OB_PLAN_CACHE_STAT_TNAME,
OB_GV_OB_PLAN_CACHE_PLAN_STAT_TNAME,
OB_SCHEMATA_TNAME,
@ -7169,6 +7185,7 @@ const char* const tenant_space_table_names [] = {
OB_GV_SQL_JOIN_FILTER_TNAME,
OB_V_SQL_JOIN_FILTER_TNAME,
OB_DBA_OB_TABLE_STAT_STALE_INFO_TNAME,
OB_V_OB_LS_LOG_RESTORE_STATUS_TNAME,
OB_DBA_DB_LINKS_TNAME,
OB_DBA_SYNONYMS_TNAME,
OB_DBA_OBJECTS_ORA_TNAME,
@ -7567,6 +7584,7 @@ const char* const tenant_space_table_names [] = {
OB_GV_OB_ARBITRATION_SERVICE_STATUS_ORA_TNAME,
OB_V_OB_ARBITRATION_SERVICE_STATUS_ORA_TNAME,
OB_V_OB_TIMESTAMP_SERVICE_ORA_TNAME,
OB_V_OB_LS_LOG_RESTORE_STATUS_ORA_TNAME,
OB_ALL_TABLE_IDX_DATA_TABLE_ID_TNAME,
OB_ALL_TABLE_IDX_DB_TB_NAME_TNAME,
OB_ALL_TABLE_IDX_TB_NAME_TNAME,
@ -8290,6 +8308,7 @@ const uint64_t tenant_distributed_vtables [] = {
OB_ALL_VIRTUAL_ARBITRATION_SERVICE_STATUS_TID,
OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_TID,
OB_ALL_VIRTUAL_PX_P2P_DATAHUB_TID,
OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_TID,
OB_ALL_VIRTUAL_SQL_AUDIT_ORA_TID,
OB_ALL_VIRTUAL_SQL_AUDIT_ORA_ALL_VIRTUAL_SQL_AUDIT_I1_TID,
OB_ALL_VIRTUAL_PLAN_STAT_ORA_TID,
@ -8353,7 +8372,8 @@ const uint64_t tenant_distributed_vtables [] = {
OB_ALL_VIRTUAL_ARBITRATION_SERVICE_STATUS_ORA_TID,
OB_ALL_VIRTUAL_OBJ_LOCK_ORA_TID,
OB_ALL_VIRTUAL_PX_P2P_DATAHUB_ORA_TID,
OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_ORA_TID, };
OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_ORA_TID,
OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_ORA_TID, };
const uint64_t restrict_access_virtual_tables[] = {
OB_ALL_VIRTUAL_SQL_AUDIT_ORA_TID,
@ -8449,7 +8469,8 @@ const uint64_t restrict_access_virtual_tables[] = {
OB_ALL_VIRTUAL_ARBITRATION_MEMBER_INFO_ORA_TID,
OB_ALL_VIRTUAL_ARBITRATION_SERVICE_STATUS_ORA_TID,
OB_ALL_VIRTUAL_PX_P2P_DATAHUB_ORA_TID,
OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_ORA_TID };
OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_ORA_TID,
OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_ORA_TID };
static inline bool is_restrict_access_virtual_table(const uint64_t tid)
@ -10522,11 +10543,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 = 233;
const int64_t OB_VIRTUAL_TABLE_COUNT = 671;
const int64_t OB_SYS_VIEW_COUNT = 714;
const int64_t OB_SYS_TENANT_TABLE_COUNT = 1623;
const int64_t OB_VIRTUAL_TABLE_COUNT = 673;
const int64_t OB_SYS_VIEW_COUNT = 716;
const int64_t OB_SYS_TENANT_TABLE_COUNT = 1627;
const int64_t OB_CORE_SCHEMA_VERSION = 1;
const int64_t OB_BOOTSTRAP_SCHEMA_VERSION = 1626;
const int64_t OB_BOOTSTRAP_SCHEMA_VERSION = 1630;
} // end namespace share
} // end namespace oceanbase

View File

@ -627,6 +627,7 @@ const uint64_t OB_ALL_VIRTUAL_ARBITRATION_SERVICE_STATUS_TID = 12387; // "__all_
const uint64_t OB_ALL_VIRTUAL_VIRTUAL_LONG_OPS_STATUS_MYSQL_SYS_AGENT_TID = 12393; // "__all_virtual_virtual_long_ops_status_mysql_sys_agent"
const uint64_t OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_TID = 12395; // "__all_virtual_timestamp_service"
const uint64_t OB_ALL_VIRTUAL_PX_P2P_DATAHUB_TID = 12397; // "__all_virtual_px_p2p_datahub"
const uint64_t OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_TID = 12400; // "__all_virtual_ls_log_restore_status"
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"
@ -848,6 +849,7 @@ const uint64_t OB_ALL_VIRTUAL_OBJ_LOCK_ORA_TID = 15305; // "ALL_VIRTUAL_OBJ_LOCK
const uint64_t OB_ALL_VIRTUAL_LOG_RESTORE_SOURCE_ORA_TID = 15376; // "ALL_VIRTUAL_LOG_RESTORE_SOURCE_ORA"
const uint64_t OB_ALL_VIRTUAL_PX_P2P_DATAHUB_ORA_TID = 15384; // "ALL_VIRTUAL_PX_P2P_DATAHUB_ORA"
const uint64_t OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_ORA_TID = 15385; // "ALL_VIRTUAL_TIMESTAMP_SERVICE_ORA"
const uint64_t OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_ORA_TID = 15387; // "ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_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"
@ -1163,6 +1165,7 @@ const uint64_t OB_V_OB_PX_P2P_DATAHUB_TID = 21420; // "V$OB_PX_P2P_DATAHUB"
const uint64_t OB_GV_SQL_JOIN_FILTER_TID = 21421; // "GV$SQL_JOIN_FILTER"
const uint64_t OB_V_SQL_JOIN_FILTER_TID = 21422; // "V$SQL_JOIN_FILTER"
const uint64_t OB_DBA_OB_TABLE_STAT_STALE_INFO_TID = 21423; // "DBA_OB_TABLE_STAT_STALE_INFO"
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_SYNONYMS_TID = 25001; // "DBA_SYNONYMS"
@ -1562,6 +1565,7 @@ const uint64_t OB_V_OB_ARBITRATION_MEMBER_INFO_ORA_TID = 28190; // "V$OB_ARBITRA
const uint64_t OB_GV_OB_ARBITRATION_SERVICE_STATUS_ORA_TID = 28191; // "GV$OB_ARBITRATION_SERVICE_STATUS_ORA"
const uint64_t OB_V_OB_ARBITRATION_SERVICE_STATUS_ORA_TID = 28192; // "V$OB_ARBITRATION_SERVICE_STATUS_ORA"
const uint64_t OB_V_OB_TIMESTAMP_SERVICE_ORA_TID = 28193; // "V$OB_TIMESTAMP_SERVICE_ORA"
const uint64_t OB_V_OB_LS_LOG_RESTORE_STATUS_ORA_TID = 28194; // "V$OB_LS_LOG_RESTORE_STATUS_ORA"
const uint64_t OB_ALL_TABLE_AUX_LOB_META_TID = 50003; // "__all_table_aux_lob_meta"
const uint64_t OB_ALL_COLUMN_AUX_LOB_META_TID = 50004; // "__all_column_aux_lob_meta"
const uint64_t OB_ALL_DDL_OPERATION_AUX_LOB_META_TID = 50005; // "__all_ddl_operation_aux_lob_meta"
@ -2816,6 +2820,7 @@ const char *const OB_ALL_VIRTUAL_ARBITRATION_SERVICE_STATUS_TNAME = "__all_virtu
const char *const OB_ALL_VIRTUAL_VIRTUAL_LONG_OPS_STATUS_MYSQL_SYS_AGENT_TNAME = "__all_virtual_virtual_long_ops_status_mysql_sys_agent";
const char *const OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_TNAME = "__all_virtual_timestamp_service";
const char *const OB_ALL_VIRTUAL_PX_P2P_DATAHUB_TNAME = "__all_virtual_px_p2p_datahub";
const char *const OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_TNAME = "__all_virtual_ls_log_restore_status";
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";
@ -3037,6 +3042,7 @@ const char *const OB_ALL_VIRTUAL_OBJ_LOCK_ORA_TNAME = "ALL_VIRTUAL_OBJ_LOCK";
const char *const OB_ALL_VIRTUAL_LOG_RESTORE_SOURCE_ORA_TNAME = "ALL_VIRTUAL_LOG_RESTORE_SOURCE";
const char *const OB_ALL_VIRTUAL_PX_P2P_DATAHUB_ORA_TNAME = "ALL_VIRTUAL_PX_P2P_DATAHUB";
const char *const OB_ALL_VIRTUAL_TIMESTAMP_SERVICE_ORA_TNAME = "ALL_VIRTUAL_TIMESTAMP_SERVICE";
const char *const OB_ALL_VIRTUAL_LS_LOG_RESTORE_STATUS_ORA_TNAME = "ALL_VIRTUAL_LS_LOG_RESTORE_STATUS";
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";
@ -3352,6 +3358,7 @@ const char *const OB_V_OB_PX_P2P_DATAHUB_TNAME = "V$OB_PX_P2P_DATAHUB";
const char *const OB_GV_SQL_JOIN_FILTER_TNAME = "GV$SQL_JOIN_FILTER";
const char *const OB_V_SQL_JOIN_FILTER_TNAME = "V$SQL_JOIN_FILTER";
const char *const OB_DBA_OB_TABLE_STAT_STALE_INFO_TNAME = "DBA_OB_TABLE_STAT_STALE_INFO";
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_SYNONYMS_TNAME = "DBA_SYNONYMS";
@ -3751,6 +3758,7 @@ const char *const OB_V_OB_ARBITRATION_MEMBER_INFO_ORA_TNAME = "V$OB_ARBITRATION_
const char *const OB_GV_OB_ARBITRATION_SERVICE_STATUS_ORA_TNAME = "GV$OB_ARBITRATION_SERVICE_STATUS";
const char *const OB_V_OB_ARBITRATION_SERVICE_STATUS_ORA_TNAME = "V$OB_ARBITRATION_SERVICE_STATUS";
const char *const OB_V_OB_TIMESTAMP_SERVICE_ORA_TNAME = "V$OB_TIMESTAMP_SERVICE";
const char *const OB_V_OB_LS_LOG_RESTORE_STATUS_ORA_TNAME = "V$OB_LS_LOG_RESTORE_STATUS";
const char *const OB_ALL_TABLE_AUX_LOB_META_TNAME = "__all_table_aux_lob_meta";
const char *const OB_ALL_COLUMN_AUX_LOB_META_TNAME = "__all_column_aux_lob_meta";
const char *const OB_ALL_DDL_OPERATION_AUX_LOB_META_TNAME = "__all_ddl_operation_aux_lob_meta";

View File

@ -11776,9 +11776,32 @@ def_table_schema(
# 12398: __all_virtual_column_group
# 12399: __all_virtual_storage_leak_info
# 12400 __all_virtual_ls_log_restore_status
# 12401: __all_virtual_tenant_parameter
def_table_schema(
owner = 'zhaoyongheng.zyh',
table_name = '__all_virtual_ls_log_restore_status',
table_id = '12400',
table_type = 'VIRTUAL_TABLE',
gm_columns = [],
in_tenant_space = True,
rowkey_columns = [
],
normal_columns = [
('tenant_id', 'int'),
('svr_ip', 'varchar:MAX_IP_ADDR_LENGTH'),
('svr_port', 'int'),
('ls_id', 'int'),
('sync_lsn', 'uint'),
('sync_scn', 'uint'),
('sync_status', 'varchar:128'),
('err_code', 'int'),
('comment', 'varchar:MAX_COLUMN_COMMENT_LENGTH'),
],
partition_columns = ['svr_ip', 'svr_port'],
vtable_route_policy = 'distributed',
)
# 12401: __all_virtual_tenant_parameter
#
# 余留位置
#
@ -12136,7 +12159,7 @@ def_table_schema(**gen_oracle_mapping_virtual_table_def('15376', all_def_keyword
def_table_schema(**no_direct_access(gen_oracle_mapping_virtual_table_def('15384', all_def_keywords['__all_virtual_px_p2p_datahub'])))
def_table_schema(**no_direct_access(gen_oracle_mapping_virtual_table_def('15385', all_def_keywords['__all_virtual_timestamp_service'])))
# 15386: __all_virtual_column_group
# 15387: __all_virtual_ls_log_restore_status
def_table_schema(**no_direct_access(gen_oracle_mapping_virtual_table_def('15387', all_def_keywords['__all_virtual_ls_log_restore_status'])))
# 15388: __all_virtual_tenant_parameter
@ -26989,7 +27012,28 @@ JOIN OCEANBASE.__ALL_OPTSTAT_GLOBAL_PREFS GP
""".replace("\n", " ")
)
# 21424: V$OB_LS_LOG_RESTORE_STATUS
def_table_schema(
owner = 'zhaoyongheng.zyh',
table_name = 'V$OB_LS_LOG_RESTORE_STATUS',
table_id = '21424',
table_type = 'SYSTEM_VIEW',
gm_columns = [],
rowkey_columns = [],
normal_columns = [],
in_tenant_space = True,
view_definition =
"""
SELECT TENANT_ID,
LS_ID,
SYNC_LSN,
SYNC_SCN,
SYNC_STATUS,
ERR_CODE,
COMMENT
FROM OCEANBASE.__ALL_VIRTUAL_LS_LOG_RESTORE_STATUS;
""".replace("\n", " ")
)
def_table_schema(
owner = 'jim.wjh',
table_name = 'CDB_OB_EXTERNAL_TABLE_FILES',
@ -50874,7 +50918,29 @@ def_table_schema(
""".replace("\n", " ")
)
# 28194: V$OB_LS_LOG_RESTORE_STATUS
def_table_schema(
owner = 'zhaoyongheng.zyh',
table_name = 'V$OB_LS_LOG_RESTORE_STATUS',
name_postfix = '_ORA',
database_id = 'OB_ORA_SYS_DATABASE_ID',
table_id = '28194',
table_type = 'SYSTEM_VIEW',
gm_columns = [],
rowkey_columns = [],
normal_columns = [],
in_tenant_space = True,
view_definition =
"""
SELECT TENANT_ID,
LS_ID,
SYNC_LSN,
SYNC_SCN,
SYNC_STATUS,
ERR_CODE,
"COMMENT"
FROM SYS.ALL_VIRTUAL_LS_LOG_RESTORE_STATUS;
""".replace("\n", " ")
)
################################################################################
# Lob Table (50000, 70000)

View File

@ -599,6 +599,7 @@ select 0xffffffffff & table_id, table_name, table_type, database_id, part_num fr
12393 __all_virtual_virtual_long_ops_status_mysql_sys_agent 2 201001 1
12395 __all_virtual_timestamp_service 2 201001 1
12397 __all_virtual_px_p2p_datahub 2 201001 1
12400 __all_virtual_ls_log_restore_status 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
@ -914,6 +915,7 @@ select 0xffffffffff & table_id, table_name, table_type, database_id, part_num fr
21421 GV$SQL_JOIN_FILTER 1 201001 1
21422 V$SQL_JOIN_FILTER 1 201001 1
21423 DBA_OB_TABLE_STAT_STALE_INFO 1 201001 1
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
check sys table count and table_id range success