From 8affdf73166710f3fd4581e4661e46ceea47cadb Mon Sep 17 00:00:00 2001 From: qichang Date: Mon, 9 Jun 2025 20:27:07 +0800 Subject: [PATCH] alter copy opt --- storage/ctc/ha_ctc.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/storage/ctc/ha_ctc.cc b/storage/ctc/ha_ctc.cc index 772d26c..ddbda3b 100644 --- a/storage/ctc/ha_ctc.cc +++ b/storage/ctc/ha_ctc.cc @@ -1520,13 +1520,9 @@ bool is_dml_cmd(const String& sql) static int ctc_commit(handlerton *hton, THD *thd, bool commit_trx) { DBUG_TRACE; BEGIN_RECORD_STATS - bool is_alter_copy = false; - if (engine_ddl_passthru(thd)) { - is_alter_copy = is_alter_table_copy(thd); - if (is_alter_copy || is_create_table_check(thd) || is_lock_table(thd)) { - END_RECORD_STATS(EVENT_TYPE_COMMIT) - return 0; - } + if (engine_ddl_passthru(thd) && (is_alter_table_copy(thd) || is_create_table_check(thd) || is_lock_table(thd))) { + END_RECORD_STATS(EVENT_TYPE_COMMIT) + return 0; } ctc_handler_t tch; @@ -1603,7 +1599,7 @@ static int ctc_commit(handlerton *hton, THD *thd, bool commit_trx) { tch.sql_stat_start = 1; } - if (is_alter_copy && commit_trx) { + if (commit_trx && thd_sql_command(thd) == SQLCOM_ALTER_TABLE && is_alter_table_copy(thd)) { tch.part_id = INVALID_PART_ID; (void)ctc_analyze_table(&tch, thd->lex->query_tables->get_db_name(), thd->lex->query_tables->table_name, 100.0); // 100.0% sample-ratio -- Gitee