[bugfix]remove tenant_io_manager from map until mtl_destroy
This commit is contained in:
@ -664,7 +664,7 @@ int MockTenantModuleEnv::init()
|
||||
STORAGE_LOG(ERROR, "init_before_start_mtl failed", K(ret));
|
||||
} else {
|
||||
oceanbase::ObClusterVersion::get_instance().update_data_version(DATA_CURRENT_VERSION);
|
||||
MTL_BIND2(nullptr, ObTenantIOManager::mtl_init, nullptr, ObTenantIOManager::mtl_stop, ObTenantIOManager::mtl_wait, ObTenantIOManager::mtl_destroy);
|
||||
MTL_BIND(ObTenantIOManager::mtl_init, ObTenantIOManager::mtl_destroy);
|
||||
MTL_BIND2(mtl_new_default, ObTenantSchemaService::mtl_init, nullptr, nullptr, nullptr, mtl_destroy_default);
|
||||
MTL_BIND2(mtl_new_default, ObStorageLogger::mtl_init, ObStorageLogger::mtl_start, ObStorageLogger::mtl_stop, ObStorageLogger::mtl_wait, mtl_destroy_default);
|
||||
MTL_BIND2(ObTenantMetaMemMgr::mtl_new, mtl_init_default, mtl_start_default, mtl_stop_default, mtl_wait_default, mtl_destroy_default);
|
||||
|
||||
@ -401,7 +401,7 @@ int ObMultiTenant::init(ObAddr myaddr,
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret) && mtl_bind_flag) {
|
||||
MTL_BIND2(nullptr, ObTenantIOManager::mtl_init, nullptr, ObTenantIOManager::mtl_stop, ObTenantIOManager::mtl_wait, ObTenantIOManager::mtl_destroy);
|
||||
MTL_BIND(ObTenantIOManager::mtl_init, ObTenantIOManager::mtl_destroy);
|
||||
|
||||
// base mtl
|
||||
MTL_BIND2(mtl_new_default, storage::mds::ObTenantMdsService::mtl_init, storage::mds::ObTenantMdsService::mtl_start, storage::mds::ObTenantMdsService::mtl_stop, storage::mds::ObTenantMdsService::mtl_wait, mtl_destroy_default);
|
||||
|
||||
@ -611,25 +611,12 @@ int ObTenantIOManager::mtl_init(ObTenantIOManager *&io_service)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObTenantIOManager::mtl_stop(ObTenantIOManager *&io_service)
|
||||
{
|
||||
const uint64_t tenant_id = MTL_ID();
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(OB_IO_MANAGER.remove_tenant_io_manager(tenant_id))) {
|
||||
if (OB_HASH_NOT_EXIST != ret) {
|
||||
LOG_WARN("remove tenant io manager failed", K(ret), K(tenant_id));
|
||||
} else {
|
||||
ret = OB_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ObTenantIOManager::mtl_wait(ObTenantIOManager *&io_service)
|
||||
void ObTenantIOManager::mtl_destroy(ObTenantIOManager *&io_service)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const int64_t start_ts = ObTimeUtility::current_time();
|
||||
while (OB_NOT_NULL(io_service) && OB_SUCC(ret)) {
|
||||
if (io_service->get_ref_cnt() == 0) {
|
||||
if (io_service->get_ref_cnt() == 1) {
|
||||
break;
|
||||
} else {
|
||||
if (REACH_TIME_INTERVAL(1000L * 1000L)) { //1s
|
||||
@ -638,17 +625,24 @@ void ObTenantIOManager::mtl_wait(ObTenantIOManager *&io_service)
|
||||
ob_usleep((useconds_t)10L * 1000L); //10ms
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ObTenantIOManager::mtl_destroy(ObTenantIOManager *&io_service)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_NOT_NULL(io_service) && io_service->get_ref_cnt() == 0) {
|
||||
io_service->~ObTenantIOManager();
|
||||
OB_IO_MANAGER.allocator_.free(io_service);
|
||||
} else if (OB_NOT_NULL(io_service) && io_service->get_ref_cnt() != 0) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("ERROR: tenant io manager ref_cnt is not zero", K(ret));
|
||||
const uint64_t tenant_id = MTL_ID();
|
||||
if (OB_FAIL(OB_IO_MANAGER.remove_tenant_io_manager(tenant_id))) {
|
||||
if (OB_HASH_NOT_EXIST != ret) {
|
||||
LOG_WARN("remove tenant io manager failed", K(ret), K(tenant_id));
|
||||
} else {
|
||||
ret = OB_SUCCESS;
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_NOT_NULL(io_service) && io_service->get_ref_cnt() == 0) {
|
||||
io_service->~ObTenantIOManager();
|
||||
OB_IO_MANAGER.allocator_.free(io_service);
|
||||
io_service = nullptr;
|
||||
} else if (OB_NOT_NULL(io_service) && io_service->get_ref_cnt() != 0) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("ERROR: tenant io manager ref_cnt is not zero", K(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -101,8 +101,6 @@ class ObTenantIOManager final
|
||||
{
|
||||
public:
|
||||
static int mtl_init(ObTenantIOManager *&io_service);
|
||||
static void mtl_stop(ObTenantIOManager *&io_service);
|
||||
static void mtl_wait(ObTenantIOManager *&io_service);
|
||||
static void mtl_destroy(ObTenantIOManager *&io_service);
|
||||
public:
|
||||
ObTenantIOManager();
|
||||
|
||||
Reference in New Issue
Block a user