summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extra/mariabackup/backup_copy.cc6
-rw-r--r--extra/mariabackup/backup_mysql.cc109
-rw-r--r--extra/mariabackup/xtrabackup.cc27
-rw-r--r--mysql-test/suite/galera/r/galera_log_bin_1.result73
-rw-r--r--mysql-test/suite/galera/r/galera_log_bin_ext_1.result61
-rw-r--r--mysql-test/suite/galera/r/galera_log_bin_ext_mariabackup_1.result61
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin.cnf3
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin.inc2
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_1.cnf12
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_1.test1
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_ext.cnf2
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_ext_1.cnf14
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_ext_1.test1
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup.cnf2
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup_1.cnf19
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup_1.test2
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_opt.cnf1
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_sst.inc2
-rw-r--r--scripts/wsrep_sst_mariabackup.sh2
-rw-r--r--scripts/wsrep_sst_rsync.sh4
20 files changed, 328 insertions, 76 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index c21f85d48b2..67642af9be6 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -1545,10 +1545,8 @@ bool backup_start(CorruptedPages &corrupted_pages)
}
}
- bool with_binlogs = opt_binlog_info == BINLOG_INFO_ON;
-
- if (with_binlogs || opt_galera_info) {
- if (!write_current_binlog_file(mysql_connection, with_binlogs)) {
+ if (opt_binlog_info == BINLOG_INFO_ON || opt_galera_info) {
+ if (!write_current_binlog_file(mysql_connection, opt_galera_info)) {
return(false);
}
}
diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc
index cf46ca51b7f..2a20f147c47 100644
--- a/extra/mariabackup/backup_mysql.cc
+++ b/extra/mariabackup/backup_mysql.cc
@@ -1634,70 +1634,71 @@ write_current_binlog_file(MYSQL *connection, bool write_binlogs)
gtid_exists = (executed_gtid_set && *executed_gtid_set)
|| (gtid_binlog_state && *gtid_binlog_state);
- if (write_binlogs || gtid_exists) {
-
- if (opt_log_bin != NULL && strchr(opt_log_bin, FN_LIBCHAR)) {
- /* If log_bin is set, it has priority */
- if (log_bin_dir) {
- free(log_bin_dir);
- }
- log_bin_dir = strdup(opt_log_bin);
- } else if (log_bin_dir == NULL) {
- /* Default location is MySQL datadir */
- log_bin_dir = static_cast<char*>(malloc(3));
- ut_a(log_bin_dir);
- log_bin_dir[0] = '.';
- log_bin_dir[1] = FN_LIBCHAR;
- log_bin_dir[2] = 0;
+ if (opt_log_bin != NULL && strchr(opt_log_bin, FN_LIBCHAR)) {
+ /* If log_bin is set, it has priority */
+ if (log_bin_dir) {
+ free(log_bin_dir);
}
+ log_bin_dir = strdup(opt_log_bin);
+ } else if (log_bin_dir == NULL) {
+ /* Default location is MySQL datadir */
+ log_bin_dir = static_cast<char*>(malloc(3));
+ ut_a(log_bin_dir);
+ log_bin_dir[0] = '.';
+ log_bin_dir[1] = FN_LIBCHAR;
+ log_bin_dir[2] = 0;
+ }
- size_t log_bin_dir_length;
+ size_t log_bin_dir_length;
- dirname_part(log_bin_dir, log_bin_dir, &log_bin_dir_length);
+ dirname_part(log_bin_dir, log_bin_dir, &log_bin_dir_length);
- /* strip final slash if it is not the only path component */
- while (IS_TRAILING_SLASH(log_bin_dir, log_bin_dir_length)) {
- log_bin_dir_length--;
- }
- log_bin_dir[log_bin_dir_length] = 0;
+ /* strip final slash if it is not the only path component */
+ while (IS_TRAILING_SLASH(log_bin_dir, log_bin_dir_length)) {
+ log_bin_dir_length--;
+ }
+ log_bin_dir[log_bin_dir_length] = 0;
- if (log_bin_dir == NULL) {
- msg("Failed to locate binary log files");
- result = false;
- goto cleanup;
- }
+ if (log_bin_dir == NULL) {
+ msg("Failed to locate binary log files");
+ result = false;
+ goto cleanup;
+ }
- uint max_binlogs;
- max_binlogs = opt_max_binlogs;
- if (max_binlogs == 0) {
- if (gtid_exists) {
- max_binlogs = 1;
- } else {
- goto cleanup;
- }
+ uint max_binlogs;
+ max_binlogs = opt_max_binlogs;
+ if (max_binlogs == 0) {
+ if (!write_binlogs || gtid_exists) {
+ max_binlogs = 1;
+ } else {
+ goto cleanup;
}
+ }
+ if (write_binlogs) {
xb_mysql_query(connection, "FLUSH BINARY LOGS", false);
+ }
- MYSQL_RES *mysql_result;
+ MYSQL_RES *mysql_result;
- mysql_result = xb_mysql_query(connection, "SHOW BINARY LOGS", true);
+ mysql_result = xb_mysql_query(connection, "SHOW BINARY LOGS", true);
- ut_ad(mysql_num_fields(mysql_result) >= 2);
+ ut_ad(mysql_num_fields(mysql_result) >= 2);
- my_ulonglong n_rows;
- my_ulonglong start;
+ my_ulonglong n_rows;
+ my_ulonglong start;
- n_rows = mysql_num_rows(mysql_result);
+ n_rows = mysql_num_rows(mysql_result);
- start = 0;
- if (max_binlogs < n_rows) {
- start = n_rows - max_binlogs;
- }
- if (start) {
- mysql_data_seek(mysql_result, start);
- }
+ start = 0;
+ if (max_binlogs < n_rows) {
+ start = n_rows - max_binlogs;
+ }
+ if (start) {
+ mysql_data_seek(mysql_result, start);
+ }
+ if (write_binlogs) {
MYSQL_ROW row;
while ((row = mysql_fetch_row(mysql_result))) {
const char *binlog_name = row[0];
@@ -1709,15 +1710,15 @@ write_current_binlog_file(MYSQL *connection, bool write_binlogs)
if (!result) break;
}
}
+ }
- if (result) {
- write_binlog_info(connection, log_bin_dir,
- mysql_result, n_rows, start);
- }
-
- mysql_free_result(mysql_result);
+ if (result) {
+ write_binlog_info(connection, log_bin_dir,
+ mysql_result, n_rows, start);
}
+ mysql_free_result(mysql_result);
+
cleanup:
free_mysql_variables(vars);
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 4f6e48c1ee1..c4f4c0eee0f 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -348,11 +348,10 @@ uint opt_lock_wait_timeout = 0;
uint opt_lock_wait_threshold = 0;
uint opt_debug_sleep_before_unlock = 0;
uint opt_safe_slave_backup_timeout = 0;
-uint opt_max_binlogs = UINT_MAX;
+uint opt_max_binlogs = 0;
const char *opt_history = NULL;
-
char mariabackup_exe[FN_REFLEN];
char orig_argv1[FN_REFLEN];
@@ -1453,16 +1452,22 @@ struct my_option xb_client_options[]= {
&opt_log_innodb_page_corruption, &opt_log_innodb_page_corruption, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"sst_max_binlogs", OPT_MAX_BINLOGS,
- "Number of recent binary logs to be included in the backup. "
- "Setting this parameter to zero normally disables transmission "
- "of binary logs to the joiner nodes during SST using Galera. "
- "But sometimes a single current binlog can still be transmitted "
- "to the joiner even with sst_max_binlogs=0, because it is "
- "required for Galera to work properly with GTIDs support.",
+ {"sst-max-binlogs", OPT_MAX_BINLOGS,
+ "The number of recent binary logs that will be included in the "
+ "backup or transferred to another node during SST. By default, "
+ "binary logs files are not saved as part of a backup, and only "
+ "one (last) of them is transferred to the joiner node during SST "
+ "(since SST scripts use --sst_max_binlogs=1 by default). "
+ "If you set this parameter to the special value -1 or just to "
+ "a very large number, then all binary log files will be saved "
+ "or transferred. Setting this parameter to zero normally disables "
+ "transmission of binary logs to the joiner nodes during SST. But "
+ "sometimes a single current binlog file can still be transmitted "
+ "to the joiner node even with sst_max_binlogs=0, because it is "
+ "required for Galera to work properly when GTIDs are enabled.",
(G_PTR *) &opt_max_binlogs,
- (G_PTR *) &opt_max_binlogs, 0, GET_UINT, OPT_ARG,
- UINT_MAX, 0, UINT_MAX, 0, 1, 0},
+ (G_PTR *) &opt_max_binlogs, 0, GET_INT, OPT_ARG,
+ 0, -1, INT_MAX, 0, 1, 0},
#define MYSQL_CLIENT
#include "sslopt-longopts.h"
diff --git a/mysql-test/suite/galera/r/galera_log_bin_1.result b/mysql-test/suite/galera/r/galera_log_bin_1.result
new file mode 100644
index 00000000000..eb009a620e0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_log_bin_1.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/r/galera_log_bin_ext_1.result b/mysql-test/suite/galera/r/galera_log_bin_ext_1.result
new file mode 100644
index 00000000000..134ccc505bb
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_log_bin_ext_1.result
@@ -0,0 +1,61 @@
+connection node_1;
+connection node_2;
+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
+hostname1-bin.000001 # Gtid # # GTID #-#-#
+hostname1-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-#
+hostname1-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1)
+hostname1-bin.000001 # Table_map # # table_id: # (test.t1)
+hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+hostname1-bin.000001 # Xid # # COMMIT /* XID */
+hostname1-bin.000001 # Gtid # # GTID #-#-#
+hostname1-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-#
+hostname1-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+hostname1-bin.000001 # Table_map # # table_id: # (test.t2)
+hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+hostname1-bin.000001 # Xid # # COMMIT /* XID */
+hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-#
+hostname1-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+hostname1-bin.000001 # Table_map # # table_id: # (test.t2)
+hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+hostname1-bin.000001 # Xid # # COMMIT /* XID */
+hostname1-bin.000001 # Gtid # # GTID #-#-#
+hostname1-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+connection node_2;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+connection node_2;
+Starting server ...
+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
+hostname1-bin.000002 # Binlog_checkpoint # # hostname1-bin.000002
+DROP TABLE t1;
+DROP TABLE t2;
+#cleanup
+connection node_1;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_log_bin_ext_mariabackup_1.result b/mysql-test/suite/galera/r/galera_log_bin_ext_mariabackup_1.result
new file mode 100644
index 00000000000..134ccc505bb
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_log_bin_ext_mariabackup_1.result
@@ -0,0 +1,61 @@
+connection node_1;
+connection node_2;
+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
+hostname1-bin.000001 # Gtid # # GTID #-#-#
+hostname1-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-#
+hostname1-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1)
+hostname1-bin.000001 # Table_map # # table_id: # (test.t1)
+hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+hostname1-bin.000001 # Xid # # COMMIT /* XID */
+hostname1-bin.000001 # Gtid # # GTID #-#-#
+hostname1-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-#
+hostname1-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+hostname1-bin.000001 # Table_map # # table_id: # (test.t2)
+hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+hostname1-bin.000001 # Xid # # COMMIT /* XID */
+hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-#
+hostname1-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+hostname1-bin.000001 # Table_map # # table_id: # (test.t2)
+hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+hostname1-bin.000001 # Xid # # COMMIT /* XID */
+hostname1-bin.000001 # Gtid # # GTID #-#-#
+hostname1-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+connection node_2;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+connection node_2;
+Starting server ...
+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
+hostname1-bin.000002 # Binlog_checkpoint # # hostname1-bin.000002
+DROP TABLE t1;
+DROP TABLE t2;
+#cleanup
+connection node_1;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/t/galera_log_bin.cnf b/mysql-test/suite/galera/t/galera_log_bin.cnf
index 98e724fb2d0..ef92723c507 100644
--- a/mysql-test/suite/galera/t/galera_log_bin.cnf
+++ b/mysql-test/suite/galera/t/galera_log_bin.cnf
@@ -7,3 +7,6 @@ log-slave-updates
[mysqld.2]
log-bin
log-slave-updates
+
+[sst]
+sst_max_binlogs=-1
diff --git a/mysql-test/suite/galera/t/galera_log_bin.inc b/mysql-test/suite/galera/t/galera_log_bin.inc
index 12d6388615c..1600d560133 100644
--- a/mysql-test/suite/galera/t/galera_log_bin.inc
+++ b/mysql-test/suite/galera/t/galera_log_bin.inc
@@ -30,7 +30,7 @@ ALTER TABLE t1 ADD COLUMN f2 INTEGER;
--connection node_2
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
---let $MASTER_MYPORT=$NODE_MYPORT_2
+--let $MASTER_MYPORT=$NODE_MYPORT_1
--source include/show_binlog_events.inc
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_log_bin_1.cnf b/mysql-test/suite/galera/t/galera_log_bin_1.cnf
new file mode 100644
index 00000000000..96c128e99df
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin_1.cnf
@@ -0,0 +1,12 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin
+log-slave-updates
+
+[mysqld.2]
+log-bin
+log-slave-updates
+
+[sst]
+sst_max_binlogs=1
diff --git a/mysql-test/suite/galera/t/galera_log_bin_1.test b/mysql-test/suite/galera/t/galera_log_bin_1.test
new file mode 100644
index 00000000000..923bd623a8a
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin_1.test
@@ -0,0 +1 @@
+--source galera_log_bin.inc
diff --git a/mysql-test/suite/galera/t/galera_log_bin_ext.cnf b/mysql-test/suite/galera/t/galera_log_bin_ext.cnf
index ae47de90bb8..07a38bbc773 100644
--- a/mysql-test/suite/galera/t/galera_log_bin_ext.cnf
+++ b/mysql-test/suite/galera/t/galera_log_bin_ext.cnf
@@ -11,4 +11,4 @@ log-bin-index = hostname2.bdx
log-slave-updates
[sst]
-sst_max_binlogs=
+sst_max_binlogs=-1
diff --git a/mysql-test/suite/galera/t/galera_log_bin_ext_1.cnf b/mysql-test/suite/galera/t/galera_log_bin_ext_1.cnf
new file mode 100644
index 00000000000..866f6c579a8
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin_ext_1.cnf
@@ -0,0 +1,14 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin = hostname1-bin
+log-bin-index = hostname1.bdx
+log-slave-updates
+
+[mysqld.2]
+log-bin = hostname2-bin
+log-bin-index = hostname2.bdx
+log-slave-updates
+
+[sst]
+sst_max_binlogs=1
diff --git a/mysql-test/suite/galera/t/galera_log_bin_ext_1.test b/mysql-test/suite/galera/t/galera_log_bin_ext_1.test
new file mode 100644
index 00000000000..752073aecdb
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin_ext_1.test
@@ -0,0 +1 @@
+--source galera_log_bin_sst.inc
diff --git a/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup.cnf b/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup.cnf
index c988136b8fb..3e443ff51a2 100644
--- a/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup.cnf
+++ b/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup.cnf
@@ -16,4 +16,4 @@ log-slave-updates
[sst]
transferfmt=@ENV.MTR_GALERA_TFMT
-sst_max_binlogs=
+sst_max_binlogs=-1
diff --git a/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup_1.cnf b/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup_1.cnf
new file mode 100644
index 00000000000..08b609d9f33
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup_1.cnf
@@ -0,0 +1,19 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=mariabackup
+wsrep_sst_auth="root:"
+
+[mysqld.1]
+log-bin=@ENV.MYSQLTEST_VARDIR/mysqld.1/data/hostname1-bin
+log-bin-index = hostname1.bdx
+log-slave-updates
+
+[mysqld.2]
+log-bin=@ENV.MYSQLTEST_VARDIR/mysqld.2/data/hostname2-bin
+log-bin-index = hostname2.bdx
+log-slave-updates
+
+[sst]
+transferfmt=@ENV.MTR_GALERA_TFMT
+sst_max_binlogs=1
diff --git a/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup_1.test b/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup_1.test
new file mode 100644
index 00000000000..47df45b4c71
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin_ext_mariabackup_1.test
@@ -0,0 +1,2 @@
+--source include/have_mariabackup.inc
+--source galera_log_bin_sst.inc
diff --git a/mysql-test/suite/galera/t/galera_log_bin_opt.cnf b/mysql-test/suite/galera/t/galera_log_bin_opt.cnf
index 3c14cde794c..b77fad86310 100644
--- a/mysql-test/suite/galera/t/galera_log_bin_opt.cnf
+++ b/mysql-test/suite/galera/t/galera_log_bin_opt.cnf
@@ -13,3 +13,4 @@ wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore
[sst]
transferfmt=@ENV.MTR_GALERA_TFMT
streamfmt=mbstream
+sst_max_binlogs=-1
diff --git a/mysql-test/suite/galera/t/galera_log_bin_sst.inc b/mysql-test/suite/galera/t/galera_log_bin_sst.inc
index 5d543f6f8b6..4fb5214b273 100644
--- a/mysql-test/suite/galera/t/galera_log_bin_sst.inc
+++ b/mysql-test/suite/galera/t/galera_log_bin_sst.inc
@@ -70,7 +70,7 @@ let $restart_noprint=2;
--connection node_2
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
---let $MASTER_MYPORT=$NODE_MYPORT_2
+--let $MASTER_MYPORT=$NODE_MYPORT_1
--source include/show_binlog_events.inc
DROP TABLE t1;
diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh
index 5521dd51098..a47b1abe5c4 100644
--- a/scripts/wsrep_sst_mariabackup.sh
+++ b/scripts/wsrep_sst_mariabackup.sh
@@ -1153,7 +1153,7 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then
iopts="--parallel=$backup_threads${iopts:+ }$iopts"
fi
- max_binlogs=$(parse_cnf "$encgroups" 'sst-max-binlogs')
+ max_binlogs=$(parse_cnf "$encgroups" 'sst-max-binlogs' 1)
if [ -n "$max_binlogs" ]; then
iopts="--sst-max-binlogs=$max_binlogs${iopts:+ }$iopts"
fi
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index 7096bb4b330..1ff4927df53 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -433,8 +433,8 @@ EOF
# Let's check the existence of the file with the index:
if [ -f "$WSREP_SST_OPT_BINLOG_INDEX" ]; then
# Let's read the binlog index:
- max_binlogs=$(parse_cnf "$encgroups" 'sst-max-binlogs')
- if [ -n "$max_binlogs" ]; then
+ max_binlogs=$(parse_cnf "$encgroups" 'sst-max-binlogs' 1)
+ if [ "$max_binlogs" -ge 0 ]; then
binlog_files=""
if [ $max_binlogs -gt 0 ]; then
binlog_files=$(tail -n $max_binlogs \