Skip to content

Commit 5482155

Browse files
committed
MDEV-34703 followup - reenable Innodb bulk load in mariadb-import
Since bulk load is fixed, in some newer versions of the server, reenable it, after checking whether MDEV-34703 was really fixed in server.
1 parent 11a6c1b commit 5482155

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

client/mysqlimport.cc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,17 @@ static void lock_table(MYSQL *mysql, int tablecount, char **raw_tablename)
760760
}
761761

762762

763-
763+
/*
764+
Check server version, and return true if bulk load can be enabled
765+
Works around MDEV-34703 (fixed in 10.11.11, 11.4.5, 11.7.2)
766+
*/
767+
static bool can_enable_innodb_bulk_load(MYSQL* mysql)
768+
{
769+
auto ver = mysql_get_server_version(mysql);
770+
return ver >= 110702 ||
771+
(ver >= 110405 && ver < 110500) ||
772+
(ver >= 101111 && ver < 101200);
773+
}
764774

765775
static MYSQL *db_connect(char *host, char *database,
766776
char *user, char *passwd)
@@ -822,6 +832,11 @@ static MYSQL *db_connect(char *host, char *database,
822832
if (ignore_foreign_keys)
823833
mysql_query(mysql, "set foreign_key_checks= 0;");
824834

835+
if (can_enable_innodb_bulk_load(mysql))
836+
{
837+
if (mysql_query(mysql, "set unique_checks=0;"))
838+
db_error(mysql);
839+
}
825840
if (mysql_query(mysql, "/*!40101 set @@character_set_database=binary */;"))
826841
db_error(mysql);
827842
if (mysql_query(mysql, "set @save_tz=@@session.time_zone"))

0 commit comments

Comments
 (0)