summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/galera/r/binlog_checksum.result36
-rw-r--r--mysql-test/suite/galera/t/binlog_checksum.test36
-rw-r--r--mysql-test/suite/wsrep/r/mdev_7798.result13
-rw-r--r--mysql-test/suite/wsrep/t/mdev_7798.opt1
-rw-r--r--mysql-test/suite/wsrep/t/mdev_7798.test17
-rw-r--r--sql/log.cc70
-rw-r--r--sql/log_event.cc1
-rw-r--r--sql/mysqld.cc3
-rw-r--r--sql/sql_class.cc2
-rw-r--r--sql/sql_class.h1
-rw-r--r--sql/wsrep_applier.cc11
-rw-r--r--sql/wsrep_mysqld.cc6
12 files changed, 115 insertions, 82 deletions
diff --git a/mysql-test/suite/galera/r/binlog_checksum.result b/mysql-test/suite/galera/r/binlog_checksum.result
new file mode 100644
index 00000000000..5c1981fc17f
--- /dev/null
+++ b/mysql-test/suite/galera/r/binlog_checksum.result
@@ -0,0 +1,36 @@
+# On node_1
+SET @binlog_checksum_saved= @@GLOBAL.BINLOG_CHECKSUM;
+SET @@GLOBAL.BINLOG_CHECKSUM=CRC32;
+# On node_2
+SET @binlog_checksum_saved= @@GLOBAL.BINLOG_CHECKSUM;
+SET @@GLOBAL.BINLOG_CHECKSUM=CRC32;
+USE test;
+CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+SELECT * FROM t1;
+c1
+1
+2
+3
+4
+5
+SELECT * FROM test.t1;
+c1
+1
+2
+3
+4
+5
+
+# On node_2
+SELECT * FROM test.t1;
+c1
+1
+2
+3
+4
+5
+DROP TABLE t1;
+SET @@GLOBAL.BINLOG_CHECKSUM = @binlog_checksum_saved;
+SET @@GLOBAL.BINLOG_CHECKSUM = @binlog_checksum_saved;
+# End of test
diff --git a/mysql-test/suite/galera/t/binlog_checksum.test b/mysql-test/suite/galera/t/binlog_checksum.test
new file mode 100644
index 00000000000..5aab68a7746
--- /dev/null
+++ b/mysql-test/suite/galera/t/binlog_checksum.test
@@ -0,0 +1,36 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--echo # On node_1
+--connection node_1
+SET @binlog_checksum_saved= @@GLOBAL.BINLOG_CHECKSUM;
+SET @@GLOBAL.BINLOG_CHECKSUM=CRC32;
+
+--echo # On node_2
+--connection node_2
+SET @binlog_checksum_saved= @@GLOBAL.BINLOG_CHECKSUM;
+SET @@GLOBAL.BINLOG_CHECKSUM=CRC32;
+
+USE test;
+CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+SELECT * FROM t1;
+SELECT * FROM test.t1;
+
+--echo
+--echo # On node_2
+--connection node_2
+SELECT * FROM test.t1;
+
+--let $galera_diff_statement = SELECT * FROM t1
+--source include/galera_diff.inc
+
+# Cleanup
+DROP TABLE t1;
+--connection node_1
+SET @@GLOBAL.BINLOG_CHECKSUM = @binlog_checksum_saved;
+--connection node_2
+SET @@GLOBAL.BINLOG_CHECKSUM = @binlog_checksum_saved;
+
+--source include/galera_end.inc
+--echo # End of test
diff --git a/mysql-test/suite/wsrep/r/mdev_7798.result b/mysql-test/suite/wsrep/r/mdev_7798.result
new file mode 100644
index 00000000000..83a02f3a606
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/mdev_7798.result
@@ -0,0 +1,13 @@
+#
+# MDEV-7798: mysql.server init script can't stop mysqld when WSREP is
+# turned off
+#
+SELECT @@GLOBAL.WSREP_ON;
+@@GLOBAL.WSREP_ON
+1
+SET GLOBAL WSREP_ON= 0;
+Restart the node.
+SELECT @@GLOBAL.WSREP_ON;
+@@GLOBAL.WSREP_ON
+1
+# End of test.
diff --git a/mysql-test/suite/wsrep/t/mdev_7798.opt b/mysql-test/suite/wsrep/t/mdev_7798.opt
new file mode 100644
index 00000000000..459a9702707
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_7798.opt
@@ -0,0 +1 @@
+--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1 --wsrep_causal_reads=ON
diff --git a/mysql-test/suite/wsrep/t/mdev_7798.test b/mysql-test/suite/wsrep/t/mdev_7798.test
new file mode 100644
index 00000000000..9dfff0959bc
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_7798.test
@@ -0,0 +1,17 @@
+--source include/have_wsrep_provider.inc
+--source include/have_binlog_format_row.inc
+
+--echo #
+--echo # MDEV-7798: mysql.server init script can't stop mysqld when WSREP is
+--echo # turned off
+--echo #
+
+SELECT @@GLOBAL.WSREP_ON;
+SET GLOBAL WSREP_ON= 0;
+
+--echo Restart the node.
+--source include/restart_mysqld.inc
+
+SELECT @@GLOBAL.WSREP_ON;
+
+--echo # End of test.
diff --git a/sql/log.cc b/sql/log.cc
index 37e19dac564..b6b5ea67f20 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -582,76 +582,6 @@ void thd_binlog_rollback_stmt(THD * thd)
if (cache_mngr) cache_mngr->trx_cache.set_prev_position(MY_OFF_T_UNDEF);
}
-#ifdef REMOVED
-/*
- Write the contents of a cache to memory buffer.
-
- This function quite the same as MYSQL_BIN_LOG::write_cache(),
- with the exception that here we write in buffer instead of log file.
- */
-
-int wsrep_write_cache(IO_CACHE *cache, uchar **buf, int *buf_len)
-{
-
- if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
- return ER_ERROR_ON_WRITE;
- uint length= my_b_bytes_in_cache(cache);
- long long total_length = 0;
- uchar *buf_ptr = NULL;
-
- do
- {
- /* bail out if buffer grows too large
- This is a temporary fix to avoid flooding replication
- TODO: remove this check for 0.7.4 release
- */
- if (total_length > wsrep_max_ws_size)
- {
- WSREP_WARN("transaction size limit (%lld) exceeded: %lld",
- wsrep_max_ws_size, total_length);
- if (reinit_io_cache(cache, WRITE_CACHE, 0, 0, 0))
- {
- WSREP_WARN("failed to initialize io-cache");
- }
- if (buf_ptr) my_free(*buf);
- *buf_len = 0;
- return ER_ERROR_ON_WRITE;
- }
- if (total_length > 0)
- {
- *buf_len += length;
- *buf = (uchar *)my_realloc(*buf, total_length+length,
- MYF(MY_ALLOW_ZERO_PTR));
- if (!*buf)
- {
- WSREP_ERROR("io cache write problem: %d %d", *buf_len, length);
- return ER_ERROR_ON_WRITE;
- }
- buf_ptr = *buf+total_length;
- }
- else
- {
- if (buf_ptr != NULL)
- {
- WSREP_ERROR("io cache alloc error: %d %d", *buf_len, length);
- my_free(*buf);
- }
- if (length > 0)
- {
- *buf = (uchar *) my_malloc(length, MYF(0));
- buf_ptr = *buf;
- *buf_len = length;
- }
- }
- total_length += length;
-
- memcpy(buf_ptr, cache->read_pos, length);
- cache->read_pos=cache->read_end;
- } while ((cache->file >= 0) && (length= my_b_fill(cache)));
-
- return 0;
-}
-#endif /* REMOVED */
#endif
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 31abf461f58..733b30f837b 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -12723,7 +12723,6 @@ void Incident_log_event::pack_info(THD *thd, Protocol *protocol)
}
#endif
#if WITH_WSREP && !defined(MYSQL_CLIENT)
-Format_description_log_event *wsrep_format_desc; // TODO: free them at the end
/*
read the first event from (*buf). The size of the (*buf) is (*buf_len).
At the end (*buf) is shitfed to point to the following event or NULL and
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 6faa52abb7a..eb5c233af41 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1954,7 +1954,8 @@ static void __cdecl kill_server(int sig_ptr)
}
#endif
#ifdef WITH_WSREP
- if (WSREP_ON) wsrep_stop_replication(NULL);
+ /* Stop wsrep threads in case they are running. */
+ wsrep_stop_replication(NULL);
#endif
close_connections();
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 01871494d5b..8106eb95cb0 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1605,7 +1605,6 @@ void THD::init(void)
wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED;
wsrep_converted_lock_session= false;
wsrep_retry_counter= 0;
- wsrep_rli= NULL;
wsrep_rgi= NULL;
wsrep_PA_safe= true;
wsrep_consistency_check = NO_CONSISTENCY_CHECK;
@@ -1820,7 +1819,6 @@ THD::~THD()
mysql_mutex_lock(&LOCK_wsrep_thd);
mysql_mutex_unlock(&LOCK_wsrep_thd);
mysql_mutex_destroy(&LOCK_wsrep_thd);
- if (wsrep_rli) delete wsrep_rli;
if (wsrep_rgi) delete wsrep_rgi;
if (wsrep_status_vars) wsrep->stats_free(wsrep, wsrep_status_vars);
#endif
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 2119312c71a..9b42f31c1f8 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2777,7 +2777,6 @@ public:
// wsrep_seqno_t wsrep_trx_seqno;
wsrep_trx_meta_t wsrep_trx_meta;
uint32 wsrep_rand;
- Relay_log_info* wsrep_rli;
rpl_group_info* wsrep_rgi;
bool wsrep_converted_lock_session;
wsrep_ws_handle_t wsrep_ws_handle;
diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc
index f8e82f6b805..8e5c49332a7 100644
--- a/sql/wsrep_applier.cc
+++ b/sql/wsrep_applier.cc
@@ -76,13 +76,10 @@ static inline Format_description_log_event*
wsrep_get_apply_format(THD* thd)
{
if (thd->wsrep_apply_format)
- return (Format_description_log_event*) thd->wsrep_apply_format;
- /* TODO: mariadb does not support rli->get_rli_description_event()
- * => look for alternative way to remember last FDE in replication
- */
- //return thd->wsrep_rli->get_rli_description_event();
- thd->wsrep_apply_format = new Format_description_log_event(4);
- return (Format_description_log_event*) thd->wsrep_apply_format;
+ {
+ return (Format_description_log_event*) thd->wsrep_apply_format;
+ }
+ return thd->wsrep_rgi->rli->relay_log.description_event_for_exec;
}
static wsrep_cb_status_t wsrep_apply_events(THD* thd,
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index c5036d5e83a..9ac688953fe 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -738,6 +738,7 @@ void wsrep_deinit(bool free_options)
provider_name[0]= '\0';
provider_version[0]= '\0';
provider_vendor[0]= '\0';
+
wsrep_inited= 0;
if (free_options)
@@ -1134,6 +1135,11 @@ int wsrep_to_buf_helper(
return 1;
int ret(0);
+ Format_description_log_event *tmp_fd= new Format_description_log_event(4);
+ tmp_fd->checksum_alg= binlog_checksum_options;
+ tmp_fd->write(&tmp_io_cache);
+ delete tmp_fd;
+
#ifdef GTID_SUPPORT
if (thd->variables.gtid_next.type == GTID_GROUP)
{