From a75bcfeb1b1966cb738308ba3d07ab17eefa219b Mon Sep 17 00:00:00 2001 From: zhangxuan_hw Date: Thu, 14 Nov 2024 16:45:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20dirty=5Fclose=20?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8A=A0=E9=94=81=E5=A4=B1=E8=B4=A5=E9=87=8D?= =?UTF-8?q?=E5=8F=91=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- storage/ctc/ha_ctc.cc | 7 ++++++- storage/ctc/ha_ctc.h | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/storage/ctc/ha_ctc.cc b/storage/ctc/ha_ctc.cc index 6032249..a60afa9 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 43244b3..620453f 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 -- Gitee