Commit 24ed08c3 authored by Eugene Kosov's avatar Eugene Kosov

fix compilation with gcc-10

../sql/sql_class.cc: In constructor ‘start_new_trans::start_new_trans(THD*)’:
../include/m_string.h:61:49: error: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct Ha_data’; use assignment or value-initialization instead [-Werror=class-memaccess]
   61 | # define bzero(A,B)             memset((A),0,(B))
      |                                                 ^
../sql/sql_class.cc:5805:3: note: in expansion of macro ‘bzero’
 5805 |   bzero(thd->ha_data, sizeof(thd->ha_data));
      |   ^~~~~
In file included from ../sql/sql_class.cc:33:
../sql/sql_class.h:2003:8: note: ‘struct Ha_data’ declared here
 2003 | struct Ha_data
      |        ^~~~~~~
parent 55c7536a
...@@ -5802,7 +5802,8 @@ start_new_trans::start_new_trans(THD *thd) ...@@ -5802,7 +5802,8 @@ start_new_trans::start_new_trans(THD *thd)
mdl_savepoint= thd->mdl_context.mdl_savepoint(); mdl_savepoint= thd->mdl_context.mdl_savepoint();
memcpy(old_ha_data, thd->ha_data, sizeof(old_ha_data)); memcpy(old_ha_data, thd->ha_data, sizeof(old_ha_data));
thd->reset_n_backup_open_tables_state(&open_tables_state_backup); thd->reset_n_backup_open_tables_state(&open_tables_state_backup);
bzero(thd->ha_data, sizeof(thd->ha_data)); for (auto &data : thd->ha_data)
data.reset();
old_transaction= thd->transaction; old_transaction= thd->transaction;
thd->transaction= &new_transaction; thd->transaction= &new_transaction;
new_transaction.on= 1; new_transaction.on= 1;
......
...@@ -2024,6 +2024,14 @@ struct Ha_data ...@@ -2024,6 +2024,14 @@ struct Ha_data
*/ */
plugin_ref lock; plugin_ref lock;
Ha_data() :ha_ptr(NULL) {} Ha_data() :ha_ptr(NULL) {}
void reset()
{
ha_ptr= nullptr;
for (auto &info : ha_info)
info.reset();
lock= nullptr;
}
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment