fix ls_staus_operator interface
This commit is contained in:
@ -57,7 +57,6 @@ using namespace storage;
|
|||||||
using namespace palf;
|
using namespace palf;
|
||||||
namespace rootserver
|
namespace rootserver
|
||||||
{
|
{
|
||||||
|
|
||||||
ERRSIM_POINT_DEF(ERRSIM_END_TRANS_ERROR);
|
ERRSIM_POINT_DEF(ERRSIM_END_TRANS_ERROR);
|
||||||
#define RESTORE_EVENT_ADD \
|
#define RESTORE_EVENT_ADD \
|
||||||
int ret_code = OB_SUCCESS; \
|
int ret_code = OB_SUCCESS; \
|
||||||
@ -592,15 +591,25 @@ int ObRecoveryLSService::process_gc_log_(logservice::ObGCLSLog &gc_log, const SC
|
|||||||
common::ObMySQLTransaction trans;
|
common::ObMySQLTransaction trans;
|
||||||
const uint64_t meta_tenant_id = gen_meta_tenant_id(tenant_id_);
|
const uint64_t meta_tenant_id = gen_meta_tenant_id(tenant_id_);
|
||||||
ObLSLifeAgentManager ls_life_agent(*proxy_);
|
ObLSLifeAgentManager ls_life_agent(*proxy_);
|
||||||
|
ObTenantInfoLoader *tenant_info_loader = MTL(ObTenantInfoLoader*);
|
||||||
|
ObAllTenantInfo tenant_info;
|
||||||
if (OB_ISNULL(proxy_)) {
|
if (OB_ISNULL(proxy_)) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("proxy is null", KR(ret));
|
LOG_WARN("proxy is null", KR(ret));
|
||||||
} else if (OB_FAIL(trans.start(proxy_, meta_tenant_id))) {
|
} else if (OB_FAIL(trans.start(proxy_, meta_tenant_id))) {
|
||||||
LOG_WARN("failed to start trans", KR(ret), K(meta_tenant_id));
|
LOG_WARN("failed to start trans", KR(ret), K(meta_tenant_id));
|
||||||
} else if (OB_FAIL(ls_life_agent.set_ls_offline_in_trans(
|
} else if (OB_ISNULL(tenant_info_loader)) {
|
||||||
tenant_id_, SYS_LS, share::OB_LS_TENANT_DROPPING, sync_scn, share::NORMAL_SWITCHOVER_STATUS,
|
ret = OB_ERR_UNEXPECTED;
|
||||||
|
LOG_WARN("tenant report is null", KR(ret), K(tenant_id_));
|
||||||
|
} else if (OB_FAIL(tenant_info_loader->get_tenant_info(tenant_info))) {
|
||||||
|
LOG_WARN("failed to get tenant info", KR(ret));
|
||||||
|
} else if (OB_UNLIKELY(tenant_info.is_primary())) {
|
||||||
|
ret = OB_ERR_UNEXPECTED;
|
||||||
|
LOG_WARN("tenant info is primary", KR(ret), K(tenant_info));
|
||||||
|
} else if (OB_FAIL(ls_life_agent.set_ls_offline_in_trans(
|
||||||
|
tenant_id_, SYS_LS, share::OB_LS_TENANT_DROPPING, sync_scn, tenant_info.get_switchover_status(),
|
||||||
trans))) {
|
trans))) {
|
||||||
LOG_WARN("failed to set offline", KR(ret), K(tenant_id_), K(sync_scn));
|
LOG_WARN("failed to set offline", KR(ret), K(tenant_id_), K(sync_scn), K(tenant_info));
|
||||||
} else if (OB_FAIL(report_sys_ls_recovery_stat_in_trans_(sync_scn, false, trans,
|
} else if (OB_FAIL(report_sys_ls_recovery_stat_in_trans_(sync_scn, false, trans,
|
||||||
"report recovery stat and process gc log"))) {
|
"report recovery stat and process gc log"))) {
|
||||||
LOG_WARN("failed to report sys ls recovery stat", KR(ret), K(sync_scn));
|
LOG_WARN("failed to report sys ls recovery stat", KR(ret), K(sync_scn));
|
||||||
@ -746,13 +755,23 @@ int ObRecoveryLSService::process_ls_operator_in_trans_(
|
|||||||
const share::ObLSAttr &ls_attr, const SCN &sync_scn, ObMySQLTransaction &trans)
|
const share::ObLSAttr &ls_attr, const SCN &sync_scn, ObMySQLTransaction &trans)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
ObTenantInfoLoader *tenant_info_loader = MTL(ObTenantInfoLoader*);
|
||||||
const uint64_t meta_tenant_id = gen_meta_tenant_id(tenant_id_);
|
const uint64_t meta_tenant_id = gen_meta_tenant_id(tenant_id_);
|
||||||
|
ObAllTenantInfo tenant_info;
|
||||||
if (OB_UNLIKELY(!ls_attr.is_valid() || !trans.is_started())) {
|
if (OB_UNLIKELY(!ls_attr.is_valid() || !trans.is_started())) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("ls attr is invalid", KR(ret), K(ls_attr), "trans_start", trans.is_started());
|
LOG_WARN("ls attr is invalid", KR(ret), K(ls_attr), "trans_start", trans.is_started());
|
||||||
} else if (OB_ISNULL(proxy_)) {
|
} else if (OB_ISNULL(proxy_)) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("proxy is null", KR(ret));
|
LOG_WARN("proxy is null", KR(ret));
|
||||||
|
} else if (OB_ISNULL(tenant_info_loader)) {
|
||||||
|
ret = OB_ERR_UNEXPECTED;
|
||||||
|
LOG_WARN("tenant report is null", KR(ret), K(tenant_id_));
|
||||||
|
} else if (OB_FAIL(tenant_info_loader->get_tenant_info(tenant_info))) {
|
||||||
|
LOG_WARN("failed to get tenant info", KR(ret));
|
||||||
|
} else if (OB_UNLIKELY(tenant_info.is_primary())) {
|
||||||
|
ret = OB_ERR_UNEXPECTED;
|
||||||
|
LOG_WARN("tenant info is primary", KR(ret), K(tenant_info));
|
||||||
} else {
|
} else {
|
||||||
ObLSStatusOperator ls_operator;
|
ObLSStatusOperator ls_operator;
|
||||||
share::ObLSStatusInfo ls_status;
|
share::ObLSStatusInfo ls_status;
|
||||||
@ -766,17 +785,18 @@ int ObRecoveryLSService::process_ls_operator_in_trans_(
|
|||||||
}
|
}
|
||||||
} else if (share::is_ls_create_pre_op(ls_attr.get_ls_operation_type())) {
|
} else if (share::is_ls_create_pre_op(ls_attr.get_ls_operation_type())) {
|
||||||
//create new ls;
|
//create new ls;
|
||||||
if (OB_FAIL(create_new_ls_(ls_attr, sync_scn, trans))) {
|
if (OB_FAIL(create_new_ls_(ls_attr, sync_scn, tenant_info.get_switchover_status(), trans))) {
|
||||||
LOG_WARN("failed to create new ls", KR(ret), K(sync_scn), K(ls_attr));
|
LOG_WARN("failed to create new ls", KR(ret), K(sync_scn), K(ls_attr), K(tenant_info));
|
||||||
}
|
}
|
||||||
} else if (share::is_ls_create_abort_op(ls_attr.get_ls_operation_type())) {
|
} else if (share::is_ls_create_abort_op(ls_attr.get_ls_operation_type())) {
|
||||||
if (OB_FAIL(ls_life_agent.drop_ls_in_trans(tenant_id_, ls_attr.get_ls_id(), share::NORMAL_SWITCHOVER_STATUS, trans))) {
|
if (OB_FAIL(ls_life_agent.drop_ls_in_trans(tenant_id_, ls_attr.get_ls_id(),
|
||||||
|
tenant_info.get_switchover_status(), trans))) {
|
||||||
LOG_WARN("failed to drop ls", KR(ret), K(tenant_id_), K(ls_attr));
|
LOG_WARN("failed to drop ls", KR(ret), K(tenant_id_), K(ls_attr));
|
||||||
}
|
}
|
||||||
} else if (share::is_ls_drop_end_op(ls_attr.get_ls_operation_type())) {
|
} 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(),
|
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, share::NORMAL_SWITCHOVER_STATUS, trans))) {
|
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));
|
LOG_WARN("failed to set offline", KR(ret), K(tenant_id_), K(ls_attr), K(sync_scn), K(tenant_info));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ObLSStatus target_status = share::OB_LS_EMPTY;
|
ObLSStatus target_status = share::OB_LS_EMPTY;
|
||||||
@ -799,12 +819,12 @@ int ObRecoveryLSService::process_ls_operator_in_trans_(
|
|||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("unexpected operation type", KR(ret), K(ls_attr));
|
LOG_WARN("unexpected operation type", KR(ret), K(ls_attr));
|
||||||
}
|
}
|
||||||
if (FAILEDx(ls_operator.update_ls_status(tenant_id_, ls_attr.get_ls_id(),
|
if (FAILEDx(ls_operator.update_ls_status_in_trans(tenant_id_, ls_attr.get_ls_id(),
|
||||||
ls_status.status_, target_status,
|
ls_status.status_, target_status, tenant_info.get_switchover_status(), trans))) {
|
||||||
share::NORMAL_SWITCHOVER_STATUS, trans))) {
|
|
||||||
LOG_WARN("failed to update ls status", KR(ret), K(tenant_id_), K(ls_attr),
|
LOG_WARN("failed to update ls status", KR(ret), K(tenant_id_), K(ls_attr),
|
||||||
K(ls_status), K(target_status));
|
K(ls_status), K(target_status));
|
||||||
}
|
}
|
||||||
|
ret = ERRSIM_END_TRANS_ERROR ? : ret;
|
||||||
LOG_INFO("[LS_RECOVERY] update ls status", KR(ret), K(ls_attr), K(target_status));
|
LOG_INFO("[LS_RECOVERY] update ls status", KR(ret), K(ls_attr), K(target_status));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -837,12 +857,14 @@ int ObRecoveryLSService::porcess_alter_ls_group_(const share::ObLSAttr &ls_attr,
|
|||||||
|
|
||||||
int ObRecoveryLSService::create_new_ls_(const share::ObLSAttr &ls_attr,
|
int ObRecoveryLSService::create_new_ls_(const share::ObLSAttr &ls_attr,
|
||||||
const SCN &sync_scn,
|
const SCN &sync_scn,
|
||||||
|
const ObTenantSwitchoverStatus &switchover_status,
|
||||||
common::ObMySQLTransaction &trans)
|
common::ObMySQLTransaction &trans)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (!share::is_ls_create_pre_op(ls_attr.get_ls_operation_type())) {
|
if (!share::is_ls_create_pre_op(ls_attr.get_ls_operation_type())
|
||||||
|
|| ! switchover_status.is_valid()) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("ls not create pre operation", KR(ret), K(ls_attr));
|
LOG_WARN("invalid argument", KR(ret), K(ls_attr), K(switchover_status));
|
||||||
} else {
|
} else {
|
||||||
//create new ls;
|
//create new ls;
|
||||||
DEBUG_SYNC(BEFORE_RECOVER_USER_LS);
|
DEBUG_SYNC(BEFORE_RECOVER_USER_LS);
|
||||||
@ -864,8 +886,9 @@ int ObRecoveryLSService::create_new_ls_(const share::ObLSAttr &ls_attr,
|
|||||||
ObLSFlag ls_flag = ls_attr.get_ls_flag();
|
ObLSFlag ls_flag = ls_attr.get_ls_flag();
|
||||||
if (OB_FAIL(ObLSServiceHelper::create_new_ls_in_trans(ls_attr.get_ls_id(),
|
if (OB_FAIL(ObLSServiceHelper::create_new_ls_in_trans(ls_attr.get_ls_id(),
|
||||||
ls_attr.get_ls_group_id(), ls_attr.get_create_scn(),
|
ls_attr.get_ls_group_id(), ls_attr.get_create_scn(),
|
||||||
share::NORMAL_SWITCHOVER_STATUS, tenant_stat, trans, ls_flag))) {
|
switchover_status, tenant_stat, trans, ls_flag))) {
|
||||||
LOG_WARN("failed to add new ls status info", KR(ret), K(ls_attr), K(sync_scn), K(tenant_stat));
|
LOG_WARN("failed to add new ls status info", KR(ret), K(ls_attr), K(sync_scn),
|
||||||
|
K(tenant_stat), K(switchover_status));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_INFO("[LS_RECOVERY] create new ls", KR(ret), K(ls_attr));
|
LOG_INFO("[LS_RECOVERY] create new ls", KR(ret), K(ls_attr));
|
||||||
|
|||||||
@ -104,6 +104,7 @@ private:
|
|||||||
common::ObMySQLTransaction &trans);
|
common::ObMySQLTransaction &trans);
|
||||||
int create_new_ls_(const share::ObLSAttr &ls_attr,
|
int create_new_ls_(const share::ObLSAttr &ls_attr,
|
||||||
const share::SCN &syn_scn,
|
const share::SCN &syn_scn,
|
||||||
|
const ObTenantSwitchoverStatus &switchover_status,
|
||||||
common::ObMySQLTransaction &trans);
|
common::ObMySQLTransaction &trans);
|
||||||
int construct_sys_ls_recovery_stat_based_on_sync_scn_(
|
int construct_sys_ls_recovery_stat_based_on_sync_scn_(
|
||||||
const share::SCN &syn_scn,
|
const share::SCN &syn_scn,
|
||||||
|
|||||||
@ -1180,7 +1180,7 @@ int ObRestoreService::finish_create_ls_(
|
|||||||
//no need to update
|
//no need to update
|
||||||
} else if (ls_info == status_info.status_) {
|
} else if (ls_info == status_info.status_) {
|
||||||
//no need update
|
//no need update
|
||||||
} else if (OB_FAIL(status_op.update_ls_status(
|
} else if (OB_FAIL(status_op.update_ls_status_in_trans(
|
||||||
tenant_id, status_info.ls_id_, status_info.status_,
|
tenant_id, status_info.ls_id_, status_info.status_,
|
||||||
ls_info, share::NORMAL_SWITCHOVER_STATUS, trans))) {
|
ls_info, share::NORMAL_SWITCHOVER_STATUS, trans))) {
|
||||||
LOG_WARN("failed to update status", KR(ret), K(tenant_id), K(status_info), K(ls_info));
|
LOG_WARN("failed to update status", KR(ret), K(tenant_id), K(status_info), K(ls_info));
|
||||||
|
|||||||
@ -305,7 +305,7 @@ int ObBalanceJobTableOperator::fill_dml_spliter(share::ObDMLSqlSplicer &dml,
|
|||||||
// remove job from __all_balance_job to __all_balance_job_history
|
// remove job from __all_balance_job to __all_balance_job_history
|
||||||
int ObBalanceJobTableOperator::clean_job(const uint64_t tenant_id,
|
int ObBalanceJobTableOperator::clean_job(const uint64_t tenant_id,
|
||||||
const ObBalanceJobID job_id,
|
const ObBalanceJobID job_id,
|
||||||
ObISQLClient &client)
|
ObMySQLProxy &client)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ObBalanceJob job;
|
ObBalanceJob job;
|
||||||
|
|||||||
@ -214,7 +214,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
static int clean_job(const uint64_t tenant_id,
|
static int clean_job(const uint64_t tenant_id,
|
||||||
const ObBalanceJobID job_id,
|
const ObBalanceJobID job_id,
|
||||||
ObISQLClient &client);
|
ObMySQLProxy &client);
|
||||||
static int fill_dml_spliter(share::ObDMLSqlSplicer &dml,
|
static int fill_dml_spliter(share::ObDMLSqlSplicer &dml,
|
||||||
const ObBalanceJob &job);
|
const ObBalanceJob &job);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -363,12 +363,13 @@ int ObLSStatusOperator::set_ls_offline(const uint64_t &tenant_id,
|
|||||||
{
|
{
|
||||||
UNUSEDx(drop_scn);
|
UNUSEDx(drop_scn);
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (OB_UNLIKELY(!ls_id.is_valid() || OB_INVALID_TENANT_ID == tenant_id)) {
|
if (OB_UNLIKELY(!ls_id.is_valid() || OB_INVALID_TENANT_ID == tenant_id
|
||||||
|
|| !working_sw_status.is_valid())) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("invalid_argument", KR(ret), K(ls_id), K(tenant_id));
|
LOG_WARN("invalid_argument", KR(ret), K(ls_id), K(tenant_id), K(working_sw_status));
|
||||||
} else if (OB_FAIL(update_ls_status(tenant_id, ls_id,
|
} else if (OB_FAIL(update_ls_status_in_trans(tenant_id, ls_id,
|
||||||
ls_status, OB_LS_WAIT_OFFLINE, working_sw_status, trans))) {
|
ls_status, OB_LS_WAIT_OFFLINE, working_sw_status, trans))) {
|
||||||
LOG_WARN("failed to update ls status", KR(ret), K(tenant_id), K(ls_id), K(ls_status));
|
LOG_WARN("failed to update ls status", KR(ret), K(tenant_id), K(ls_id), K(ls_status), K(working_sw_status));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -407,7 +408,7 @@ int ObLSStatusOperator::update_ls_status(
|
|||||||
const ObLSID &id, const ObLSStatus &old_status,
|
const ObLSID &id, const ObLSStatus &old_status,
|
||||||
const ObLSStatus &new_status,
|
const ObLSStatus &new_status,
|
||||||
const ObTenantSwitchoverStatus &switch_status,
|
const ObTenantSwitchoverStatus &switch_status,
|
||||||
ObISQLClient &client)
|
ObMySQLProxy &client)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (OB_UNLIKELY(!id.is_valid()
|
if (OB_UNLIKELY(!id.is_valid()
|
||||||
@ -421,19 +422,12 @@ int ObLSStatusOperator::update_ls_status(
|
|||||||
} else {
|
} else {
|
||||||
//init_member_list is no need after create success
|
//init_member_list is no need after create success
|
||||||
ObMySQLTransaction trans;
|
ObMySQLTransaction trans;
|
||||||
ObAllTenantInfo tenant_info;
|
|
||||||
const uint64_t exec_tenant_id =
|
const uint64_t exec_tenant_id =
|
||||||
ObLSLifeIAgent::get_exec_tenant_id(tenant_id);
|
ObLSLifeIAgent::get_exec_tenant_id(tenant_id);
|
||||||
if (OB_FAIL(trans.start(&client, exec_tenant_id))) {
|
if (OB_FAIL(trans.start(&client, exec_tenant_id))) {
|
||||||
LOG_WARN("failed to start trans", KR(ret), K(exec_tenant_id));
|
LOG_WARN("failed to start trans", KR(ret), K(exec_tenant_id));
|
||||||
} else if (OB_FAIL(ObAllTenantInfoProxy::load_tenant_info(
|
} else if (OB_FAIL(update_ls_status_in_trans(tenant_id, id, old_status, new_status, switch_status, trans))) {
|
||||||
tenant_id, &trans, true, tenant_info))) {
|
LOG_WARN("failed to update ls status in trans", KR(ret), K(tenant_id), K(id), K(old_status), K(new_status), K(switch_status));
|
||||||
LOG_WARN("failed to load tenant info", KR(ret), K(tenant_id));
|
|
||||||
} else if (switch_status != tenant_info.get_switchover_status()) {
|
|
||||||
ret = OB_NEED_RETRY;
|
|
||||||
LOG_WARN("tenant not expect switchover status", KR(ret), K(tenant_info));
|
|
||||||
} else if (OB_FAIL(update_ls_status_in_trans_(tenant_id, id, old_status, new_status, trans))) {
|
|
||||||
LOG_WARN("failed to update ls status in trans", KR(ret), K(tenant_id), K(id), K(old_status), K(new_status));
|
|
||||||
}
|
}
|
||||||
if (trans.is_started()) {
|
if (trans.is_started()) {
|
||||||
int tmp_ret = OB_SUCCESS;
|
int tmp_ret = OB_SUCCESS;
|
||||||
@ -446,20 +440,29 @@ int ObLSStatusOperator::update_ls_status(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObLSStatusOperator::update_ls_status_in_trans_(
|
int ObLSStatusOperator::update_ls_status_in_trans(
|
||||||
const uint64_t tenant_id,
|
const uint64_t tenant_id,
|
||||||
const ObLSID &id, const ObLSStatus &old_status,
|
const ObLSID &id, const ObLSStatus &old_status,
|
||||||
const ObLSStatus &new_status,
|
const ObLSStatus &new_status,
|
||||||
|
const ObTenantSwitchoverStatus &switch_status,
|
||||||
ObMySQLTransaction &trans)
|
ObMySQLTransaction &trans)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
ObAllTenantInfo tenant_info;
|
||||||
if (OB_UNLIKELY(!id.is_valid()
|
if (OB_UNLIKELY(!id.is_valid()
|
||||||
|| OB_LS_EMPTY == new_status
|
|| OB_LS_EMPTY == new_status
|
||||||
|| OB_LS_EMPTY == old_status
|
|| OB_LS_EMPTY == old_status
|
||||||
|| OB_INVALID_TENANT_ID == tenant_id)) {
|
|| OB_INVALID_TENANT_ID == tenant_id
|
||||||
|
|| !switch_status.is_valid())) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("invalid_argument", KR(ret), K(id), K(new_status), K(old_status),
|
LOG_WARN("invalid_argument", KR(ret), K(id), K(new_status), K(old_status),
|
||||||
K(tenant_id));
|
K(tenant_id), K(switch_status));
|
||||||
|
} else if (OB_FAIL(ObAllTenantInfoProxy::load_tenant_info(
|
||||||
|
tenant_id, &trans, true, tenant_info))) {
|
||||||
|
LOG_WARN("failed to load tenant info", KR(ret), K(tenant_id));
|
||||||
|
} else if (switch_status != tenant_info.get_switchover_status()) {
|
||||||
|
ret = OB_NEED_RETRY;
|
||||||
|
LOG_WARN("tenant not expect switchover status", KR(ret), K(tenant_info));
|
||||||
} else {
|
} else {
|
||||||
//init_member_list is no need after create success
|
//init_member_list is no need after create success
|
||||||
common::ObSqlString sql;
|
common::ObSqlString sql;
|
||||||
@ -1641,7 +1644,7 @@ int ObLSStatusOperator::create_abort_ls_in_switch_tenant(
|
|||||||
const uint64_t tenant_id,
|
const uint64_t tenant_id,
|
||||||
const share::ObTenantSwitchoverStatus &status,
|
const share::ObTenantSwitchoverStatus &status,
|
||||||
const int64_t switchover_epoch,
|
const int64_t switchover_epoch,
|
||||||
ObISQLClient &client)
|
ObMySQLProxy &client)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
common::ObSqlString sql;
|
common::ObSqlString sql;
|
||||||
|
|||||||
@ -35,7 +35,7 @@ class ObISQLClient;
|
|||||||
class ObString;
|
class ObString;
|
||||||
class ObSqlString;
|
class ObSqlString;
|
||||||
class ObIAllocator;
|
class ObIAllocator;
|
||||||
class ObISQLClient;
|
class ObMySQLProxy;
|
||||||
namespace sqlclient
|
namespace sqlclient
|
||||||
{
|
{
|
||||||
class ObMySQLResult;
|
class ObMySQLResult;
|
||||||
@ -319,12 +319,12 @@ public:
|
|||||||
* @param[in] old_status
|
* @param[in] old_status
|
||||||
* @param[in] new_status
|
* @param[in] new_status
|
||||||
* @param[in] working_sw_status only support working on specified switchover status
|
* @param[in] working_sw_status only support working on specified switchover status
|
||||||
* @param[in] client: sql client or trans*/
|
* @param[in] client: sql client*/
|
||||||
int update_ls_status(const uint64_t tenant_id, const ObLSID &id,
|
int update_ls_status(const uint64_t tenant_id, const ObLSID &id,
|
||||||
const ObLSStatus &old_status,
|
const ObLSStatus &old_status,
|
||||||
const ObLSStatus &new_status,
|
const ObLSStatus &new_status,
|
||||||
const ObTenantSwitchoverStatus &working_sw_status,
|
const ObTenantSwitchoverStatus &working_sw_status,
|
||||||
ObISQLClient &client);
|
ObMySQLProxy &client);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* description: update ls init member list while first create ls
|
* description: update ls init member list while first create ls
|
||||||
@ -428,7 +428,7 @@ public:
|
|||||||
const uint64_t tenant_id,
|
const uint64_t tenant_id,
|
||||||
const share::ObTenantSwitchoverStatus &status,
|
const share::ObTenantSwitchoverStatus &status,
|
||||||
const int64_t switchover_epoch,
|
const int64_t switchover_epoch,
|
||||||
ObISQLClient &client);
|
ObMySQLProxy &client);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Get all ls paxos from __all_virtual_ls_status and __all_virtual_log_stat except
|
// Get all ls paxos from __all_virtual_ls_status and __all_virtual_log_stat except
|
||||||
@ -471,6 +471,22 @@ public:
|
|||||||
common::ObMySQLProxy &sql_proxy,
|
common::ObMySQLProxy &sql_proxy,
|
||||||
const uint64_t tenant_id,
|
const uint64_t tenant_id,
|
||||||
ObLSStatusInfoIArray &ls_status_info_array);
|
ObLSStatusInfoIArray &ls_status_info_array);
|
||||||
|
/*
|
||||||
|
* description: update ls's status
|
||||||
|
* @param[in] tenant_id
|
||||||
|
* @param[in] ls_id
|
||||||
|
* @param[in] old_status
|
||||||
|
* @param[in] new_status
|
||||||
|
* @param[in] working_sw_status only support working on specified switchover status
|
||||||
|
* @param[in] trans*/
|
||||||
|
int update_ls_status_in_trans(
|
||||||
|
const uint64_t tenant_id,
|
||||||
|
const ObLSID &id,
|
||||||
|
const ObLSStatus &old_status,
|
||||||
|
const ObLSStatus &new_status,
|
||||||
|
const ObTenantSwitchoverStatus &working_sw_status,
|
||||||
|
ObMySQLTransaction &trans);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<typename T> int get_list_hex_(
|
template<typename T> int get_list_hex_(
|
||||||
@ -530,20 +546,6 @@ private:
|
|||||||
common::ObIArray<ObAddr> &valid_servers);
|
common::ObIArray<ObAddr> &valid_servers);
|
||||||
int construct_ls_leader_info_sql_(common::ObSqlString &sql);
|
int construct_ls_leader_info_sql_(common::ObSqlString &sql);
|
||||||
|
|
||||||
/*
|
|
||||||
* description: update ls's status, can not do this when switchover tenant role
|
|
||||||
* @param[in] tenant_id
|
|
||||||
* @param[in] ls_id
|
|
||||||
* @param[in] old_status
|
|
||||||
* @param[in] new_status
|
|
||||||
* @param[in] trans*/
|
|
||||||
int update_ls_status_in_trans_(
|
|
||||||
const uint64_t tenant_id,
|
|
||||||
const ObLSID &id,
|
|
||||||
const ObLSStatus &old_status,
|
|
||||||
const ObLSStatus &new_status,
|
|
||||||
ObMySQLTransaction &trans);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int64_t MAX_ERROR_LOG_PRINT_SIZE = 1024;
|
const int64_t MAX_ERROR_LOG_PRINT_SIZE = 1024;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user