@ -59,6 +59,9 @@ int ObCompatModeGetter::get_table_compat_mode(
|
||||
|| table_id <= 0)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid tenant_id or table_id", KR(ret), K(tenant_id), K(table_id));
|
||||
} else if (is_ls_reserved_table(table_id)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("table id cannot be ls inner table id", KR(ret), K(tenant_id), K(table_id));
|
||||
} else if (is_inner_table(table_id)) {
|
||||
mode = (is_ora_virtual_table(table_id)
|
||||
|| is_ora_sys_view_table(table_id)) ?
|
||||
@ -70,6 +73,25 @@ int ObCompatModeGetter::get_table_compat_mode(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObCompatModeGetter::get_tablet_compat_mode(
|
||||
const uint64_t tenant_id,
|
||||
const common::ObTabletID &tablet_id,
|
||||
lib::Worker::CompatMode& mode)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(
|
||||
OB_INVALID_TENANT_ID == tenant_id
|
||||
|| !tablet_id.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid tenant_id or tablet_id", KR(ret), K(tenant_id), K(tablet_id));
|
||||
} else if (tablet_id.is_sys_tablet()) {
|
||||
mode = lib::Worker::CompatMode::MYSQL;
|
||||
} else {
|
||||
ret = instance().get_tenant_compat_mode(tenant_id, mode);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObCompatModeGetter::check_is_oracle_mode_with_tenant_id(const uint64_t tenant_id, bool &is_oracle_mode)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include "lib/hash/ob_hashmap.h"
|
||||
#include "lib/ob_define.h"
|
||||
#include "common/sql_mode/ob_sql_mode.h"
|
||||
#include "common/ob_tablet_id.h"
|
||||
#include "lib/worker.h"
|
||||
#include "lib/mysqlclient/ob_mysql_proxy.h"
|
||||
|
||||
@ -35,6 +36,7 @@ public:
|
||||
//对外提供全局函数接口
|
||||
static int get_tenant_mode(const uint64_t tenant_id, lib::Worker::CompatMode& mode);
|
||||
static int get_table_compat_mode(const uint64_t tenant_id, const int64_t table_id, lib::Worker::CompatMode& mode);
|
||||
static int get_tablet_compat_mode(const uint64_t tenant_id, const common::ObTabletID &tablet_id, lib::Worker::CompatMode& mode);
|
||||
static int check_is_oracle_mode_with_tenant_id(const uint64_t tenant_id, bool &is_oracle_mode);
|
||||
static int check_is_oracle_mode_with_table_id(
|
||||
const uint64_t tenant_id,
|
||||
|
||||
@ -2041,6 +2041,7 @@ int ObTabletGroupMetaRestoreTask::create_or_update_tablet_(
|
||||
const bool is_transfer = false;
|
||||
const ObTabletRestoreStatus::STATUS restore_status = ObTabletRestoreStatus::PENDING;
|
||||
const ObTabletDataStatus::STATUS data_status = ObTabletDataStatus::COMPLETE;
|
||||
lib::Worker::CompatMode compat_mode = lib::Worker::CompatMode::INVALID;
|
||||
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
@ -2048,14 +2049,18 @@ int ObTabletGroupMetaRestoreTask::create_or_update_tablet_(
|
||||
} else if (!tablet_id.is_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("create or update tablet get invalid argument", K(ret), K(tablet_id));
|
||||
} else if (OB_FAIL(share::ObCompatModeGetter::get_tablet_compat_mode(ctx_->arg_.tenant_id_, tablet_id, compat_mode))) {
|
||||
LOG_WARN("failed to get tenant mode", KR(ret),"tenant_id", ctx_->arg_.tenant_id_, K(tablet_id));
|
||||
} else {
|
||||
lib::CompatModeGuard g(compat_mode);
|
||||
ObMigrationTabletParam param;
|
||||
param.ls_id_ = ctx_->arg_.ls_id_;
|
||||
param.tablet_id_ = tablet_id;
|
||||
param.data_tablet_id_ = tablet_id;
|
||||
param.create_scn_ = ObTabletMeta::INIT_CREATE_SCN;
|
||||
param.clog_checkpoint_scn_.reset();
|
||||
param.compat_mode_ = lib::Worker::get_compatibility_mode();
|
||||
// Compat mode of sys tables is MYSQL no matter what if the tenant is ORACLE mode.
|
||||
param.compat_mode_ = compat_mode;
|
||||
param.multi_version_start_ = 0;
|
||||
param.snapshot_version_ = 0;
|
||||
param.tx_data_.tablet_status_ = ObTabletStatus::NORMAL;
|
||||
|
||||
Reference in New Issue
Block a user