summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-02-14 15:18:55 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-02-15 09:59:03 +0200
commit5fe9b4a7ae914b916a84170ac614761795f50c86 (patch)
tree76da2060b7d0815579d85459e7eafca09183cc5f /sql/sql_load.cc
parent8db54f1ad55fad7396fb51850c7266352785ed6c (diff)
downloadmariadb-git-5fe9b4a7ae914b916a84170ac614761795f50c86.tar.gz
MDEV-14648 Restore fix for MySQL BUG#39053 - UNINSTALL PLUGIN does not allow the storage engine to cleanup open connections
Also, allow the MariaDB 10.2 server to link InnoDB dynamically against ha_innodb.so (which is what mysql-test-run.pl expects to exist, instead of the default name ha_innobase.so). wsrep_load_data_split(): Instead of referring to innodb_hton_ptr, check the handlerton::db_type. This was recently broken by me in MDEV-11415. innodb_lock_schedule_algorithm: Define as a weak global symbol, so that WITH_WSREP will not depend on InnoDB being linked statically. I tested this manually. Notably, running a test that only does SET GLOBAL wsrep_on=1; with a static or dynamic InnoDB and ./mtr --mysqld=--loose-innodb-lock-schedule-algorithm=fcfs will crash with SIGSEGV at shutdown. With the default VATS combination the wsrep_on is properly refused for both the static and dynamic InnoDB. ha_close_connection(): Do invoke the method also for plugins for which UNINSTALL PLUGIN was deferred due to open connections. Thanks to @svoj for pointing this out. thd_to_trx(): Return a pointer, not a reference to a pointer. check_trx_exists(): Invoke thd_set_ha_data() for assigning a transaction. log_write_checkpoint_info(): Remove an unused DEBUG_SYNC point that would cause an assertion failure on shutdown after deferred UNINSTALL PLUGIN. This was tested as follows: cmake -DWITH_WSREP=1 -DPLUGIN_INNOBASE:STRING=DYNAMIC \ -DWITH_MARIABACKUP:BOOL=OFF ... make cd mysql-test ./mtr innodb.innodb_uninstall
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r--sql/sql_load.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index e15d4d2fec5..70a6787d63b 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -104,23 +104,25 @@ the transaction after every 10,000 inserted rows. */
static bool wsrep_load_data_split(THD *thd, const TABLE *table,
const COPY_INFO &info)
{
- extern struct handlerton* innodb_hton_ptr;
-
DBUG_ENTER("wsrep_load_data_split");
- if (wsrep_load_data_splitting && wsrep_on(thd)
- && info.records && !(info.records % 10000)
- && thd->transaction.stmt.ha_list
- && thd->transaction.stmt.ha_list->ht() == binlog_hton
- && thd->transaction.stmt.ha_list->next()
- && thd->transaction.stmt.ha_list->next()->ht() == innodb_hton_ptr
- && !thd->transaction.stmt.ha_list->next()->next())
+ if (!wsrep_load_data_splitting || !wsrep_on(thd)
+ || !info.records || (info.records % 10000)
+ || !thd->transaction.stmt.ha_list
+ || thd->transaction.stmt.ha_list->ht() != binlog_hton
+ || !thd->transaction.stmt.ha_list->next()
+ || thd->transaction.stmt.ha_list->next()->next())
+ DBUG_RETURN(false);
+
+ if (handlerton* hton= thd->transaction.stmt.ha_list->next()->ht())
{
+ if (hton->db_type != DB_TYPE_INNODB)
+ DBUG_RETURN(false);
WSREP_DEBUG("intermediate transaction commit in LOAD DATA");
if (wsrep_run_wsrep_commit(thd, true) != WSREP_TRX_OK) DBUG_RETURN(true);
if (binlog_hton->commit(binlog_hton, thd, true)) DBUG_RETURN(true);
wsrep_post_commit(thd, true);
- innodb_hton_ptr->commit(innodb_hton_ptr, thd, true);
+ hton->commit(hton, thd, true);
table->file->extra(HA_EXTRA_FAKE_START_STMT);
}