Add defensive programming for possible nullptr in tenant_list to DtlIntermResultMonitor
This commit is contained in:
@ -232,10 +232,10 @@ int ObAllDtlIntermResultMonitor::fill_scanner()
|
|||||||
} else {
|
} else {
|
||||||
uint64_t cur_tenant_id = MTL_ID();
|
uint64_t cur_tenant_id = MTL_ID();
|
||||||
if(is_sys_tenant(cur_tenant_id)) {
|
if(is_sys_tenant(cur_tenant_id)) {
|
||||||
omt::TenantList &list = GCTX.omt_->get_tenant_list();
|
omt::TenantIdList all_tenants;
|
||||||
uint64_t tmp_tenant_id = 0;
|
GCTX.omt_->get_tenant_ids(all_tenants);
|
||||||
for (omt::TenantList::iterator it = list.begin(); it != list.end() && OB_SUCC(ret); it++) {
|
for (int i = 0; i < all_tenants.size(); ++i) {
|
||||||
tmp_tenant_id = (*it)->id();
|
uint64_t tmp_tenant_id = all_tenants[i];
|
||||||
if(!is_virtual_tenant_id(tmp_tenant_id)) {
|
if(!is_virtual_tenant_id(tmp_tenant_id)) {
|
||||||
ObDTLIntermResultMonitorInfoGetter monitor_getter(scanner_, *allocator_, output_column_ids_,
|
ObDTLIntermResultMonitorInfoGetter monitor_getter(scanner_, *allocator_, output_column_ids_,
|
||||||
cur_row_, *addr_, ipstr, tmp_tenant_id);
|
cur_row_, *addr_, ipstr, tmp_tenant_id);
|
||||||
@ -243,6 +243,10 @@ int ObAllDtlIntermResultMonitor::fill_scanner()
|
|||||||
if (OB_FAIL(MTL(ObDTLIntermResultManager*)->generate_monitor_info_rows(monitor_getter))) {
|
if (OB_FAIL(MTL(ObDTLIntermResultManager*)->generate_monitor_info_rows(monitor_getter))) {
|
||||||
SERVER_LOG(WARN, "generate monitor info array failed", K(ret));
|
SERVER_LOG(WARN, "generate monitor info array failed", K(ret));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// During the iteration process, tenants may be deleted,
|
||||||
|
// so we need to ignore the error code of MTL_SWITCH.
|
||||||
|
ret = OB_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user