fix unit migrate and add replica concurrent, unit is wait gc and has ls leader

This commit is contained in:
obdev 2022-10-26 12:03:21 +00:00 committed by wangzelin.wzl
parent c6a74eede8
commit f553280ca1
2 changed files with 8 additions and 3 deletions

View File

@ -1213,9 +1213,7 @@ bool ObMultiTenant::is_available_tenant(uint64_t tenant_id) const
if (OB_SUCCESS == ret && NULL != tenant) {
if (tenant->get_create_status() == ObTenantCreateStatus::CREATE_COMMIT) {
ObUnitInfoGetter::ObUnitStatus unit_status = tenant->get_unit().unit_status_;
if (unit_status == ObUnitInfoGetter::UNIT_NORMAL || unit_status == ObUnitInfoGetter::UNIT_MIGRATE_IN || unit_status == ObUnitInfoGetter::UNIT_MIGRATE_OUT) {
available = true;
}
available = share::ObUnitInfoGetter::is_valid_tenant(unit_status);
}
}
return available;

View File

@ -44,6 +44,13 @@ public:
UNIT_ERROR_STAT,
};
static const char* get_unit_status_str(const ObUnitStatus status) { return unit_status_strs_[status]; }
//UNIT_NORMAL or UNIT_MIGRATE_IN or UNIT_MIGRATE_OUT is valid tenant,
//UNIT_MARK_DELETING, // mark deleting in __all_unit, unit is shrink, ls need migrate
//UNIT_WAIT_GC_IN_OBSERVER, // already deleted in __all_unit, but The migration or replica will be concurrent with the unit migration, and although RS has deemed it ready for deletion, there may be migration tasks and replica tasks executing concurrently, resulting in a log stream on the unit, so it is also valid to be in this state
static bool is_valid_tenant(const ObUnitStatus status)
{
return UNIT_DELETING_IN_OBSERVER != status && UNIT_ERROR_STAT != status;
}
struct ObTenantConfig
{