[CP] [CP] [DATA_DICT] Fix dict retry query schema schema and cpu hang

This commit is contained in:
SanmuWangZJU
2023-11-28 04:46:48 +00:00
committed by ob-robot
parent 40e7ab3e01
commit d5f6865767
2 changed files with 31 additions and 1 deletions

View File

@ -444,6 +444,7 @@ int ObDataDictService::get_tenant_schema_guard_(
const bool is_force_fallback)
{
int ret = OB_SUCCESS;
const int64_t sleep_ts_on_schema_err = 100 * _MSEC_;
ObMultiVersionSchemaService::RefreshSchemaMode refresh_mode = ObMultiVersionSchemaService::RefreshSchemaMode::NORMAL;
if (is_force_fallback) {
@ -452,7 +453,7 @@ int ObDataDictService::get_tenant_schema_guard_(
refresh_mode = ObMultiVersionSchemaService::RefreshSchemaMode::FORCE_LAZY;
}
RETRY_FUNC_ON_ERROR(OB_SCHEMA_EAGAIN, stop_flag_, *schema_service_, get_tenant_schema_guard,
RETRY_FUNC_ON_ERROR_WITH_SLEEP(OB_SCHEMA_EAGAIN, sleep_ts_on_schema_err, stop_flag_, *schema_service_, get_tenant_schema_guard,
tenant_id_,
schema_guard,
schema_version,

View File

@ -44,6 +44,35 @@ namespace datadict
bret; \
})
#define RETRY_FUNC_ON_ERROR_WITH_SLEEP(err_no, sleep_us, stop_flag, var, func, args...) \
do {\
if (OB_SUCC(ret)) \
{ \
int64_t _retry_func_on_error_last_print_time = common::ObClockGenerator::getClock();\
int64_t _retry_func_on_error_cur_print_time = 0;\
const int64_t _PRINT_RETRY_FUNC_INTERVAL = 10 * _SEC_;\
ret = (err_no); \
while ((err_no) == ret && ! (stop_flag)) \
{ \
ret = ::oceanbase::common::OB_SUCCESS; \
ret = (var).func(args); \
if (err_no == ret) { \
ob_usleep(sleep_us); \
}\
_retry_func_on_error_cur_print_time = common::ObClockGenerator::getClock();\
if (_retry_func_on_error_cur_print_time - _retry_func_on_error_last_print_time >= _PRINT_RETRY_FUNC_INTERVAL) {\
_DDLOG(INFO, "It has been %ld us since last print, last_print_time=%ld, func_name=%s", \
_PRINT_RETRY_FUNC_INTERVAL, _retry_func_on_error_last_print_time, #func);\
_retry_func_on_error_last_print_time = _retry_func_on_error_cur_print_time;\
}\
} \
if ((stop_flag)) \
{ \
ret = OB_IN_STOP_STATE; \
} \
} \
} while (0)
/*
* Memory size.
*/