diff --git a/storage/ctc/ha_ctc.cc b/storage/ctc/ha_ctc.cc index 772d26c38408e05517b3e065c42b18b105b4caf1..ddbda3bdb166e2c78b04094e13b28ade02faf0bd 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