summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Goryavsky <julius.goryavsky@mariadb.com>2021-03-19 03:24:55 +0100
committerJulius Goryavsky <julius.goryavsky@mariadb.com>2021-03-19 15:24:06 +0100
commita74fa579b94bb35127ae8f55a50541ad8e558284 (patch)
treeab8169adf739079ccb2aa51f04d706104f8f67f7
parent4e825b0e8ae07e1e847cbbc3c5b7203ae5b96a89 (diff)
downloadmariadb-git-a74fa579b94bb35127ae8f55a50541ad8e558284.tar.gz
MDEV-24903: mariabackup SST fails while adding --log-bin in startup command
Mariabackup SST fails if "--log-bin" option is added with no value to command line parameters at server startup. This is because the SST scripts do not correctly interpret the "--- log-bin" option without a value. This patch adds correct handling of the "--log-bin" parameter without value to the general part of the parameter parsing (for SST scripts) and fixes the problem. Also added a test that checks the correct operation of the server after the fix.
-rw-r--r--mysql-test/suite/galera/r/galera_log_bin_opt.result73
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin.inc42
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin.test43
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_opt-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_opt.cnf15
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_opt.test2
-rw-r--r--scripts/wsrep_sst_common.sh3
7 files changed, 137 insertions, 42 deletions
diff --git a/mysql-test/suite/galera/r/galera_log_bin_opt.result b/mysql-test/suite/galera/r/galera_log_bin_opt.result
new file mode 100644
index 00000000000..eb009a620e0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_log_bin_opt.result
@@ -0,0 +1,73 @@
+connection node_1;
+reset master;
+connection node_2;
+reset master;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 2 FROM t2;
+COUNT(*) = 2
+1
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+connection node_2;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+DROP TABLE t1;
+DROP TABLE t2;
+#cleanup
+connection node_1;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/t/galera_log_bin.inc b/mysql-test/suite/galera/t/galera_log_bin.inc
new file mode 100644
index 00000000000..f1d2a12b9de
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin.inc
@@ -0,0 +1,42 @@
+--source include/galera_cluster.inc
+--source include/force_restart.inc
+
+--connection node_1
+reset master;
+--connection node_2
+reset master;
+
+#
+# Test Galera with --log-bin --log-slave-updates .
+# This way the actual MySQL binary log is used,
+# rather than Galera's own implementation
+#
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) = 2 FROM t2;
+
+--connection node_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+--let $MASTER_MYPORT=$NODE_MYPORT_1
+--source include/show_binlog_events.inc
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+--let $MASTER_MYPORT=$NODE_MYPORT_2
+--source include/show_binlog_events.inc
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+--echo #cleanup
+--connection node_1
+RESET MASTER;
+
diff --git a/mysql-test/suite/galera/t/galera_log_bin.test b/mysql-test/suite/galera/t/galera_log_bin.test
index f1d2a12b9de..923bd623a8a 100644
--- a/mysql-test/suite/galera/t/galera_log_bin.test
+++ b/mysql-test/suite/galera/t/galera_log_bin.test
@@ -1,42 +1 @@
---source include/galera_cluster.inc
---source include/force_restart.inc
-
---connection node_1
-reset master;
---connection node_2
-reset master;
-
-#
-# Test Galera with --log-bin --log-slave-updates .
-# This way the actual MySQL binary log is used,
-# rather than Galera's own implementation
-#
-
-CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1);
-
-CREATE TABLE t2 (id INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1);
-INSERT INTO t2 VALUES (1);
-
---connection node_2
-SELECT COUNT(*) = 1 FROM t1;
-SELECT COUNT(*) = 2 FROM t2;
-
---connection node_1
-ALTER TABLE t1 ADD COLUMN f2 INTEGER;
---let $MASTER_MYPORT=$NODE_MYPORT_1
---source include/show_binlog_events.inc
-
---connection node_2
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
---let $MASTER_MYPORT=$NODE_MYPORT_2
---source include/show_binlog_events.inc
-
-DROP TABLE t1;
-DROP TABLE t2;
-
---echo #cleanup
---connection node_1
-RESET MASTER;
-
+--source galera_log_bin.inc
diff --git a/mysql-test/suite/galera/t/galera_log_bin_opt-master.opt b/mysql-test/suite/galera/t/galera_log_bin_opt-master.opt
new file mode 100644
index 00000000000..03fcb5d040d
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin_opt-master.opt
@@ -0,0 +1 @@
+--log-slave-updates --log-bin
diff --git a/mysql-test/suite/galera/t/galera_log_bin_opt.cnf b/mysql-test/suite/galera/t/galera_log_bin_opt.cnf
new file mode 100644
index 00000000000..a09efd2e011
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin_opt.cnf
@@ -0,0 +1,15 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=mariabackup
+wsrep_sst_auth="root:"
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'
+
+[sst]
+transferfmt=@ENV.MTR_GALERA_TFMT
+streamfmt=xbstream
diff --git a/mysql-test/suite/galera/t/galera_log_bin_opt.test b/mysql-test/suite/galera/t/galera_log_bin_opt.test
new file mode 100644
index 00000000000..f3d0afbc8bc
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin_opt.test
@@ -0,0 +1,2 @@
+--source include/have_mariabackup.inc
+--source galera_log_bin.inc
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh
index f5adf0b0fd8..443cb26ab64 100644
--- a/scripts/wsrep_sst_common.sh
+++ b/scripts/wsrep_sst_common.sh
@@ -212,6 +212,9 @@ case "$1" in
"$option" != "--port" && \
"$option" != "--socket" ]]; then
value=${1#*=}
+ if [ "$value" == "$1" ]; then
+ value=""
+ fi
case "$option" in
'--innodb-data-home-dir')
if [ -z "$INNODB_DATA_HOME_DIR_ARG" ]; then