From 649ca104291ff6b23fce46e899e3c87d139bfccc Mon Sep 17 00:00:00 2001 From: Gagan Goel Date: Wed, 4 Aug 2021 23:54:02 +0000 Subject: [PATCH] MCOL-4805 Follow up. --- dbcon/mysql/ha_mcs_impl.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dbcon/mysql/ha_mcs_impl.cpp b/dbcon/mysql/ha_mcs_impl.cpp index 747a7d46d..459365ae4 100644 --- a/dbcon/mysql/ha_mcs_impl.cpp +++ b/dbcon/mysql/ha_mcs_impl.cpp @@ -2228,8 +2228,6 @@ int ha_mcs::impl_rnd_init(TABLE* table, const std::vector& condStack) thd_set_ha_data(thd, mcs_hton, reinterpret_cast(0x42)); } - cal_connection_info* ci = reinterpret_cast(get_fe_conn_info_ptr()); - #if 0 if (thd->rgi_slave && thd->rgi_slave->m_table_map.count() != 0) { @@ -2264,6 +2262,8 @@ int ha_mcs::impl_rnd_init(TABLE* table, const std::vector& condStack) if (get_fe_conn_info_ptr() == nullptr) set_fe_conn_info_ptr((void*)new cal_connection_info()); + cal_connection_info* ci = reinterpret_cast(get_fe_conn_info_ptr()); + idbassert(ci != 0); if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD) @@ -2582,8 +2582,6 @@ int ha_mcs_impl_rnd_next(uchar* buf, TABLE* table) thd->lex->sql_command == SQLCOM_LOAD)) return HA_ERR_END_OF_FILE; - cal_connection_info* ci = reinterpret_cast(get_fe_conn_info_ptr()); - if (isUpdateOrDeleteStatement(thd->lex->sql_command, !isForeignTableUpdate(thd))) return HA_ERR_END_OF_FILE; @@ -2595,6 +2593,8 @@ int ha_mcs_impl_rnd_next(uchar* buf, TABLE* table) if (get_fe_conn_info_ptr() == nullptr) set_fe_conn_info_ptr((void*)new cal_connection_info()); + cal_connection_info* ci = reinterpret_cast(get_fe_conn_info_ptr()); + if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD) { force_close_fep_conn(thd, ci); @@ -4627,6 +4627,12 @@ int ha_mcs_impl_group_by_end(TABLE* table) if (get_fe_conn_info_ptr() != NULL) ci = reinterpret_cast(get_fe_conn_info_ptr()); + if (!ci) + { + set_fe_conn_info_ptr((void*)new cal_connection_info()); + ci = reinterpret_cast(get_fe_conn_info_ptr()); + } + if (((thd->lex)->sql_command == SQLCOM_INSERT) || ((thd->lex)->sql_command == SQLCOM_INSERT_SELECT) ) { @@ -4634,12 +4640,6 @@ int ha_mcs_impl_group_by_end(TABLE* table) return rc; } - if (!ci) - { - set_fe_conn_info_ptr((void*)new cal_connection_info()); - ci = reinterpret_cast(get_fe_conn_info_ptr()); - } - if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD) { force_close_fep_conn(thd, ci);