[CP] wait remove tenant_io_manager until ref_cnt = 1
This commit is contained in:
@ -611,7 +611,7 @@ int ObTenantIOManager::mtl_init(ObTenantIOManager *&io_service)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObTenantIOManager::mtl_destroy(ObTenantIOManager *&io_service)
|
||||
void ObTenantIOManager::mtl_stop(ObTenantIOManager *&io_service)
|
||||
{
|
||||
const uint64_t tenant_id = MTL_ID();
|
||||
int ret = OB_SUCCESS;
|
||||
@ -624,6 +624,34 @@ void ObTenantIOManager::mtl_destroy(ObTenantIOManager *&io_service)
|
||||
}
|
||||
}
|
||||
|
||||
void ObTenantIOManager::mtl_wait(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) {
|
||||
break;
|
||||
} else {
|
||||
if (REACH_TIME_INTERVAL(1000L * 1000L)) { //1s
|
||||
LOG_INFO("wait tenant io manager quit", K(MTL_ID()), K(start_ts), K(io_service->get_ref_cnt()));
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
ObTenantIOManager::ObTenantIOManager()
|
||||
: is_inited_(false),
|
||||
is_working_(false),
|
||||
@ -1337,9 +1365,5 @@ void ObTenantIOManager::dec_ref()
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("bug: ref_cnt < 0", K(ret), K(tmp_ref), KCSTRING(lbt()));
|
||||
abort();
|
||||
} else if (0 == tmp_ref) {
|
||||
// destroy will be called when free
|
||||
this->~ObTenantIOManager();
|
||||
OB_IO_MANAGER.allocator_.free(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,6 +101,8 @@ 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();
|
||||
@ -150,6 +152,7 @@ public:
|
||||
const ObTenantIOConfig &get_io_config();
|
||||
int trace_request_if_need(const ObIORequest *req, const char* msg, ObIOTracer::TraceType trace_type);
|
||||
int64_t get_group_num();
|
||||
int64_t get_ref_cnt() { return ATOMIC_LOAD(&ref_cnt_); }
|
||||
uint64_t get_usage_index(const int64_t group_id);
|
||||
ObIOAllocator *get_tenant_io_allocator() { return &io_allocator_; }
|
||||
void print_io_status();
|
||||
|
||||
Reference in New Issue
Block a user