当升级的时候禁止transfer
This commit is contained in:
@ -831,7 +831,7 @@ int ObTabletTableUpdater::do_batch_update_(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_INFO("REPORT: batch update tablets finished", KR(ret), K(replicas.count()), K(tasks),
|
LOG_TRACE("REPORT: batch update tablets finished", KR(ret), K(replicas.count()), K(tasks),
|
||||||
"cost_time", ObTimeUtility::current_time() - batch_update_start_time);
|
"cost_time", ObTimeUtility::current_time() - batch_update_start_time);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -305,14 +305,25 @@ int ObTenantBalanceService::is_ls_balance_finished(const uint64_t &tenant_id, bo
|
|||||||
LOG_WARN("GCTX.sql_proxy_ is null", KR(ret), KP(GCTX.sql_proxy_));
|
LOG_WARN("GCTX.sql_proxy_ is null", KR(ret), KP(GCTX.sql_proxy_));
|
||||||
} else if (ObAllTenantInfoProxy::is_primary_tenant(GCTX.sql_proxy_, tenant_id, is_primary)) {
|
} else if (ObAllTenantInfoProxy::is_primary_tenant(GCTX.sql_proxy_, tenant_id, is_primary)) {
|
||||||
LOG_WARN("fail to execute is_primary_tenant", KR(ret), K(tenant_id));
|
LOG_WARN("fail to execute is_primary_tenant", KR(ret), K(tenant_id));
|
||||||
} else if (is_primary && ObShareUtil::is_tenant_enable_transfer(tenant_id)) {
|
} else if (is_primary) {
|
||||||
if (OB_FAIL(is_primary_tenant_ls_balance_finished_(tenant_id, is_finished))) {
|
if (!ObShareUtil::is_tenant_enable_rebalance(tenant_id)) {
|
||||||
LOG_WARN("fail to execute is_primary_tenant_ls_balance_finished_", KR(ret), K(tenant_id));
|
// enable_rebalance = false
|
||||||
|
is_finished = true;
|
||||||
|
} else if (ObShareUtil::is_tenant_enable_transfer(tenant_id)) {
|
||||||
|
// primary tenant and enable_rebalance = true and enable_transfer = true
|
||||||
|
if (OB_FAIL(is_primary_tenant_ls_balance_finished_(tenant_id, is_finished))) {
|
||||||
|
LOG_WARN("fail to execute is_primary_tenant_ls_balance_finished_", KR(ret), K(tenant_id));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// primary tenant and enable_rebalance = true and enable_transfer = false
|
||||||
|
if (OB_FAIL(is_standby_tenant_ls_balance_finished_(tenant_id, is_finished))) {
|
||||||
|
LOG_WARN("fail to execute is_standby_tenant_ls_balance_finished_", KR(ret), K(tenant_id), K(is_primary));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// standby & restore & primary tenant and enable_transfer=false
|
// standby & restore
|
||||||
if (OB_FAIL(is_standby_tenant_ls_balance_finished_(tenant_id, is_finished))) {
|
if (OB_FAIL(is_standby_tenant_ls_balance_finished_(tenant_id, is_finished))) {
|
||||||
LOG_WARN("fail to execute is_standby_tenant_ls_balance_finished_", KR(ret), K(tenant_id));
|
LOG_WARN("fail to execute is_standby_tenant_ls_balance_finished_", KR(ret), K(tenant_id), K(is_primary));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_TRACE("check whether the tenant has balanced ls", K(ret), K(tenant_id), K(is_primary), K(is_finished));
|
LOG_TRACE("check whether the tenant has balanced ls", K(ret), K(tenant_id), K(is_primary), K(is_finished));
|
||||||
@ -660,25 +671,27 @@ int ObTenantBalanceService::check_ls_job_need_cancel_(const share::ObBalanceJob
|
|||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("job is invalid", KR(ret), K(job));
|
LOG_WARN("job is invalid", KR(ret), K(job));
|
||||||
} else if (job.get_job_type().is_transfer_partition()) {
|
} else if (job.get_job_type().is_transfer_partition()) {
|
||||||
//手动transfer partition任务只需要看enable_transfer即可
|
//手动transfer partition任务只需要看 enable_transfer 和 没有在升级状态中 即可
|
||||||
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id_));
|
if (!ObShareUtil::is_tenant_enable_transfer(tenant_id_)) {
|
||||||
if (OB_UNLIKELY(!tenant_config.is_valid())) {
|
|
||||||
ret = OB_ERR_UNEXPECTED;
|
|
||||||
LOG_WARN("tenant config is invalid", K(tenant_id_));
|
|
||||||
} else if (!tenant_config->enable_transfer) {
|
|
||||||
need_cancel = true;
|
need_cancel = true;
|
||||||
if (OB_TMP_FAIL(comment.assign("Canceled due to tenant transfer being disabled"))) {
|
if (OB_TMP_FAIL(comment.assign("Canceled due to tenant transfer being disabled or tenant being in upgrade mode"))) {
|
||||||
LOG_WARN("failed to assign fmt", KR(tmp_ret), K(job));
|
LOG_WARN("failed to assign fmt", KR(tmp_ret), K(job));
|
||||||
}
|
}
|
||||||
ISTAT("tenant transfer is disabled, need cancel current job", K(job), K(comment));
|
ISTAT("tenant transfer is disabled or tenant is in upgrade mode; need cancel current job", K(job), K(comment));
|
||||||
}
|
}
|
||||||
} else if (!ObShareUtil::is_tenant_enable_transfer(tenant_id_)) {
|
} else if (!ObShareUtil::is_tenant_enable_rebalance(tenant_id_)) {
|
||||||
need_cancel = true;
|
need_cancel = true;
|
||||||
if (OB_TMP_FAIL(comment.assign_fmt("Canceled due to tenant balance or transfer being disabled"))) {
|
if (OB_TMP_FAIL(comment.assign_fmt("Canceled due to tenant balance being disabled"))) {
|
||||||
LOG_WARN("failed to assign fmt", KR(tmp_ret), K(job));
|
LOG_WARN("failed to assign fmt", KR(tmp_ret), K(job));
|
||||||
}
|
}
|
||||||
ISTAT("tenant balance or transfer is disabled, need cancel current job", K(job), K(comment),
|
ISTAT("tenant balance is disabled; need cancel current job", K(job), K(comment),
|
||||||
"enable_balance", ObShareUtil::is_tenant_enable_transfer(tenant_id_),
|
"enable_rebalance", ObShareUtil::is_tenant_enable_rebalance(tenant_id_));
|
||||||
|
} else if (!ObShareUtil::is_tenant_enable_transfer(tenant_id_)) {
|
||||||
|
need_cancel = true;
|
||||||
|
if (OB_TMP_FAIL(comment.assign_fmt("Canceled due to tenant transfer being disabled or tenant being in upgrade mode"))) {
|
||||||
|
LOG_WARN("failed to assign fmt", KR(tmp_ret), K(job));
|
||||||
|
}
|
||||||
|
ISTAT("tenant transfer is disabled or tenant is in upgrade mode; need cancel current job", K(job), K(comment),
|
||||||
"enable_transfer", ObShareUtil::is_tenant_enable_transfer(tenant_id_));
|
"enable_transfer", ObShareUtil::is_tenant_enable_transfer(tenant_id_));
|
||||||
} else if (job.get_primary_zone_num() != primary_zone_num_) {
|
} else if (job.get_primary_zone_num() != primary_zone_num_) {
|
||||||
need_cancel = true;
|
need_cancel = true;
|
||||||
@ -975,7 +988,6 @@ int ObTenantBalanceService::transfer_partition_(int64_t &job_cnt)
|
|||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
job_cnt = 0;
|
job_cnt = 0;
|
||||||
uint64_t data_version = 0;
|
uint64_t data_version = 0;
|
||||||
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id_));
|
|
||||||
if (OB_UNLIKELY(!inited_ || !ATOMIC_LOAD(&loaded_))) {
|
if (OB_UNLIKELY(!inited_ || !ATOMIC_LOAD(&loaded_))) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("invalid argument", KR(ret), K(inited_), K(loaded_));
|
LOG_WARN("invalid argument", KR(ret), K(inited_), K(loaded_));
|
||||||
@ -985,11 +997,8 @@ int ObTenantBalanceService::transfer_partition_(int64_t &job_cnt)
|
|||||||
//trasnsfer partition 功能提交到了4220分支,所以4220之后的42x分支不用判断兼容性
|
//trasnsfer partition 功能提交到了4220分支,所以4220之后的42x分支不用判断兼容性
|
||||||
|| (data_version >= DATA_VERSION_4_3_0_0 && DATA_VERSION_4_3_1_0 > data_version)) {
|
|| (data_version >= DATA_VERSION_4_3_0_0 && DATA_VERSION_4_3_1_0 > data_version)) {
|
||||||
LOG_TRACE("no need do transfer partition", K(data_version));
|
LOG_TRACE("no need do transfer partition", K(data_version));
|
||||||
} else if (OB_UNLIKELY(!tenant_config.is_valid())) {
|
} else if (!ObShareUtil::is_tenant_enable_transfer(tenant_id_)) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
LOG_TRACE("can not transfer partition due to transfer being disabled or tenant being in upgrade mode.");
|
||||||
LOG_WARN("tenant config is invalid", K(tenant_id_));
|
|
||||||
} else if (!tenant_config->enable_transfer) {
|
|
||||||
LOG_TRACE("can not transfer partition while can not transfer");
|
|
||||||
} else {
|
} else {
|
||||||
ObTransferPartitionHelper tp_help(tenant_id_, GCTX.sql_proxy_);
|
ObTransferPartitionHelper tp_help(tenant_id_, GCTX.sql_proxy_);
|
||||||
int64_t unit_num = 0;
|
int64_t unit_num = 0;
|
||||||
@ -1028,7 +1037,7 @@ int ObTenantBalanceService::transfer_partition_(int64_t &job_cnt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ISTAT("finish transfer partition", KR(ret), K(job_cnt),
|
ISTAT("finish transfer partition", KR(ret), K(job_cnt),
|
||||||
"enable transfer", tenant_config->enable_transfer);
|
"enable transfer", ObShareUtil::is_tenant_enable_transfer(tenant_id_));
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -226,19 +226,15 @@ int ObTransferPartitionCommand::execute_transfer_partition_(const ObTransferPart
|
|||||||
int ObTransferPartitionCommand::check_data_version_and_config_(const uint64_t tenant_id)
|
int ObTransferPartitionCommand::check_data_version_and_config_(const uint64_t tenant_id)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id));
|
|
||||||
uint64_t compat_version = 0;
|
uint64_t compat_version = 0;
|
||||||
bool bret = false;
|
bool bret = false;
|
||||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id))) {
|
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id))) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("tenant_id is invalid", KR(ret), K(tenant_id));
|
LOG_WARN("tenant_id is invalid", KR(ret), K(tenant_id));
|
||||||
} else if (OB_UNLIKELY(!tenant_config.is_valid())) {
|
} else if (!(bret = ObShareUtil::is_tenant_enable_transfer(tenant_id))) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
|
||||||
LOG_WARN("tenant config is invalid", KR(ret), K(tenant_id));
|
|
||||||
} else if (!(bret = tenant_config->enable_transfer)) {
|
|
||||||
ret = OB_OP_NOT_ALLOW;
|
ret = OB_OP_NOT_ALLOW;
|
||||||
LOG_WARN("enable_transfer is off", KR(ret));
|
LOG_WARN("transfer is disabled or tenant is in upgrade mode", KR(ret));
|
||||||
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "Transfer is disabled, transfer partition is");
|
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "Transfer is disabled or tenant is in upgrade mode, transfer partition is");
|
||||||
} else if (OB_FAIL(GET_MIN_DATA_VERSION(tenant_id, compat_version))) {
|
} else if (OB_FAIL(GET_MIN_DATA_VERSION(tenant_id, compat_version))) {
|
||||||
LOG_WARN("fail to get data version", KR(ret), K(tenant_id));
|
LOG_WARN("fail to get data version", KR(ret), K(tenant_id));
|
||||||
} else if (compat_version < DATA_VERSION_4_2_1_2
|
} else if (compat_version < DATA_VERSION_4_2_1_2
|
||||||
|
@ -432,20 +432,24 @@ bool ObShareUtil::is_tenant_enable_rebalance(const uint64_t tenant_id)
|
|||||||
bool ObShareUtil::is_tenant_enable_transfer(const uint64_t tenant_id)
|
bool ObShareUtil::is_tenant_enable_transfer(const uint64_t tenant_id)
|
||||||
{
|
{
|
||||||
bool bret = false;
|
bool bret = false;
|
||||||
if (is_valid_tenant_id(tenant_id)) {
|
if (!is_valid_tenant_id(tenant_id)) {
|
||||||
|
bret = false;
|
||||||
|
} else {
|
||||||
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id));
|
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id));
|
||||||
if (OB_UNLIKELY(!tenant_config.is_valid())) {
|
if (OB_UNLIKELY(!tenant_config.is_valid())) {
|
||||||
LOG_WARN_RET(OB_ERR_UNEXPECTED, "tenant config is invalid", K(tenant_id));
|
LOG_WARN_RET(OB_ERR_UNEXPECTED, "tenant config is invalid", K(tenant_id));
|
||||||
} else if (!tenant_config->enable_rebalance) {
|
} else if (GCONF.in_upgrade_mode()) {
|
||||||
// if enable_rebalance is disabled, transfer is not allowed
|
|
||||||
bret = false;
|
bret = false;
|
||||||
} else {
|
LOG_TRACE("in upgrade, transfer is not allowed", K(tenant_id), K(bret));
|
||||||
|
} else {
|
||||||
bret = tenant_config->enable_transfer;
|
bret = tenant_config->enable_transfer;
|
||||||
}
|
LOG_TRACE("show enable_transfer state", K(tenant_id), K(bret),
|
||||||
|
"enable_transfer", tenant_config->enable_transfer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return bret;
|
return bret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObShareUtil::check_compat_version_for_tenant(
|
int ObShareUtil::check_compat_version_for_tenant(
|
||||||
const uint64_t tenant_id,
|
const uint64_t tenant_id,
|
||||||
const uint64_t target_data_version,
|
const uint64_t target_data_version,
|
||||||
|
Reference in New Issue
Block a user