Skip to content

Commit 24ad467

Browse files
author
Nirbhay Choubey
committed
MDEV#6077 : mysqldump sst fails on maria-10.0-galera
* As @@have_csv has been removed from 10.0, this patch uses I_S instead to check for the availablilty of CSV engine. * Fixed the client version.
1 parent 4a6f27a commit 24ad467

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

scripts/wsrep_sst_mysqldump.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ then
5454
fi
5555

5656
# Check client version
57-
if ! mysql --version | grep 'Distrib 5.5' >/dev/null
57+
if ! mysql --version | grep 'Distrib 10.0' >/dev/null
5858
then
5959
mysql --version >&2
60-
wsrep_log_error "this operation requires MySQL client version 5.5.x"
60+
wsrep_log_error "this operation requires MySQL client version 10.0.x"
6161
exit $EINVAL
6262
fi
6363

@@ -78,15 +78,17 @@ set sql_mode='';
7878
7979
USE mysql;
8080
81-
SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, thread_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, command_type VARCHAR(64) NOT NULL,argument MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment=\"General log\"', 'SET @dummy = 0');
81+
SET @cond = (SELECT (SUPPORT = 'YES' or SUPPORT = 'DEFAULT') FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE = 'csv');
8282
83-
PREPARE stmt FROM @str;
83+
SET @stmt = IF (@cond = '1', 'CREATE TABLE IF NOT EXISTS general_log ( event_time timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), user_host mediumtext NOT NULL, thread_id bigint(21) unsigned NOT NULL, server_id int(10) unsigned NOT NULL, command_type varchar(64) NOT NULL, argument mediumtext NOT NULL) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT=\"General log\"', 'SET @dummy = 0');
84+
85+
PREPARE stmt FROM @stmt;
8486
EXECUTE stmt;
8587
DROP PREPARE stmt;
8688
87-
SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment=\"Slow log\"', 'SET @dummy = 0');
89+
SET @stmt = IF (@cond = '1', 'CREATE TABLE IF NOT EXISTS slow_log ( start_time timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), user_host mediumtext NOT NULL, query_time time(6) NOT NULL, lock_time time(6) NOT NULL, rows_sent int(11) NOT NULL, rows_examined int(11) NOT NULL, db varchar(512) NOT NULL, last_insert_id int(11) NOT NULL, insert_id int(11) NOT NULL, server_id int(10) unsigned NOT NULL, sql_text mediumtext NOT NULL, thread_id bigint(21) unsigned NOT NULL) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT=\"Slow log\"', 'SET @dummy = 0');
8890
89-
PREPARE stmt FROM @str;
91+
PREPARE stmt FROM @stmt;
9092
EXECUTE stmt;
9193
DROP PREPARE stmt;"
9294

0 commit comments

Comments
 (0)