diff --git a/storage/ctc/ha_ctc.cc b/storage/ctc/ha_ctc.cc index 6032249fe1662ecdff2860385382399a79d57d13..a60afa9b84329eb205bb44f09c84faecfd000c4a 100644 --- a/storage/ctc/ha_ctc.cc +++ b/storage/ctc/ha_ctc.cc @@ -1955,7 +1955,12 @@ static int ctc_notify_pre_event(THD *thd, handlerton *ctc_hton, ctc_handler_t &t if (is_work_flow()) { ret = ctc_lock_table(&tch, cur_db_name, lock_info, &err_code); - + int retry_count = 0; + while(ret == -1 && retry_count < LOCK_RETRY_COUNT){ + sleep(LOCK_RETRY_INTERVAL); + ctc_log_system("[CTC_MDL_LOCK]: Lock failed. Retry! lock_info=(%s, %s), sql=%s, retry_interval=%f, retry_times=%d" , lock_info->db_name, lock_info->table_name, thd->query().str, LOCK_RETRY_INTERVAL, ++retry_count); + ret = ctc_lock_table(&tch, cur_db_name, lock_info, &err_code); + } DBUG_EXECUTE_IF("ctc_lock_table_fail", { ret = -1; }); if (ret != 0) { ctc_lock_table_handle_error(err_code, lock_info, tch, thd); diff --git a/storage/ctc/ha_ctc.h b/storage/ctc/ha_ctc.h index 43244b394627e8bbfab88054ed99f7d588dcd385..620453f899527da4f021f49819da8f9608b572a2 100644 --- a/storage/ctc/ha_ctc.h +++ b/storage/ctc/ha_ctc.h @@ -134,7 +134,8 @@ again. */ #define CTC_ANALYZE_TIME_SEC 100 #define MEM_CLASS_NUM 27 - +#define LOCK_RETRY_COUNT 1 +#define LOCK_RETRY_INTERVAL 0.1 /* cond pushdown */ #define INVALID_MAX_COLUMN (uint16_t)0xFFFF