fix: there is a gap tenant config maybe dropped when create tenant

This commit is contained in:
obdev
2023-01-04 10:12:03 +00:00
committed by ob-robot
parent 846f7ad6a1
commit e8d80ceea0
2 changed files with 16 additions and 14 deletions

View File

@ -20,6 +20,7 @@
#include "ob_tenant.h"
#include "share/ob_rpc_struct.h"
#include "share/inner_table/ob_inner_table_schema_constants.h"
#include "share/schema/ob_multi_version_schema_service.h"
using namespace oceanbase::common;
using namespace oceanbase::share;
@ -302,12 +303,13 @@ int ObTenantConfigMgr::del_tenant_config(uint64_t tenant_id)
DRWLock::RDLockGuard lguard(ObConfigManager::get_serialize_lock());
DRWLock::WRLockGuard guard(rwlock_);
ObTenant *tenant = NULL;
bool has_dropped = false;
if (is_virtual_tenant_id(tenant_id)) {
} else if (OB_FAIL(config_map_.get_refactored(ObTenantID(tenant_id), config))) {
LOG_WARN("get tenant config failed", K(tenant_id), K(ret));
} else if (OB_SUCC(GCTX.omt_->get_tenant(tenant_id, tenant))) {
// https://work.aone.alibaba-inc.com/issue/31717023
// 判断租户是否在这台机器上,避免启动时没有刷到租户时删掉了租户配置项
} else if (OB_FAIL(GSCHEMASERVICE.check_if_tenant_has_been_dropped(tenant_id, has_dropped))) {
LOG_WARN("failed to check tenant has been dropped", K(tenant_id));
} else if (!has_dropped) {
LOG_WARN("tenant still exist, try to delete tenant config later...", K(tenant_id));
} else {
static const int DEL_TRY_TIMES = 30;

View File

@ -27,9 +27,9 @@ class ObObj;
namespace observer
{
class ObInfoSchemaKvCacheTable : public common::ObVirtualTableScannerIterator
{
class ObInfoSchemaKvCacheTable : public common::ObVirtualTableScannerIterator
{
public:
ObInfoSchemaKvCacheTable();
virtual ~ObInfoSchemaKvCacheTable();
@ -50,9 +50,9 @@ private:
{
TENANT_ID = common::OB_APP_MIN_COLUMN_ID,
SVR_IP,
SVR_PORT,
CACHE_NAME,
CACHE_ID,
SVR_PORT,
CACHE_NAME,
CACHE_ID,
PRIORITY,
CACHE_SIZE,
CACHE_STORE_SIZE,
@ -63,9 +63,9 @@ private:
TOTAL_HIT_CNT,
TOTAL_MISS_CNT,
HOLD_SIZE
};
common::ObAddr *addr_;
common::ObString ipstr_;
};
common::ObAddr *addr_;
common::ObString ipstr_;
int32_t port_;
common::ObSEArray<common::ObKVCacheInstHandle, 100 > inst_handles_;
int16_t cache_iter_;
@ -79,5 +79,5 @@ private:
}
}
#endif /* OCEANBASE_OBSERVER_VIRTUAL_TABLE_OB_INFORMATION_KVCACHE_TABLE */
#endif /* OCEANBASE_OBSERVER_VIRTUAL_TABLE_OB_INFORMATION_KVCACHE_TABLE */