Commit 13e77930 authored by Daniel Black's avatar Daniel Black

MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases

The --skip-write-binlog message was confusing that it only had
an effect if the galera was enabled. There are uses beyond galera
so we apply SET SESSION SQL_LOG_BIN=0 as implied by the option
without being conditional on the wsrep status.

We also with --skip-write-binlog actually check the session @@WSREP_ON
variable rather than the global server variable.

Since 10.6, the wsrep_mode could replicate Aria and MyISAM, in which
case no change to innodb and back is needed.

By removing the conditions, we can use LOCK TABLES in a general case
improving the load speed of Aria (MDEV-23326), regardless of the
skip-write-binlog flag. The only case where we don't use LOCK TABLES is
when we are replicating via Innodb, because wsrep_on=1 and wsrep_mode
doesn't contain REPLICATE_ARIA{,MYISAM}. This uses an Innodb transaction
instead. When replicating via InnoDB we change the table engine type
back to what it was originally.

By removing the \d and other syntax that requires parsing by
the mariadb client, we can use the generated SQL more generally, like
in the embedded server.

We also save and restore the SQL_LOG_BIN and WSREP_ON session server
variables so this can be included in the same session as other data
without taking into changes in state.

Remove wsrep.mysql_tzinfo_to_sql_symlink{,_skip} tests as they offered
no additional coverage beyond main.mysql_tzinfo_to_sql_symlink (no
server testing was done).

Add galera.mariadb_tzinfo_to_sql to actually test the replication
of tzinfo data through galera.

The conditional executable comment around /*M!100602 ...
START TRANSACTION .. LOCK TABLES.. */ is so that we can provide tzinfo
files (MDEV-27113, MDBF-389) and in the case that a user uses it on a
pre-10.6 server version it will still work. Both START TRANSACTION and
LOCK TABLES are not supported in prepared statements in MariaDB versions
earlier than 10.6.2.

Reviewed by Brandon Nesterenko
parent d91c2680
# Disable in mtr --ps-protocol
--disable_abort_on_error
--disable_result_log
--disable_query_log
/*M!100202 execute immediate 'select 1' */;
--enable_query_log
--enable_result_log
--enable_abort_on_error
let $error = $mysql_errno;
# ER_UNSUPPORTED_PS
if ($error == 1295)
{
--skip Test is not supported in the prepared statement protocol yet
}
--source include/have_innodb.inc
--source include/have_symlink.inc
--source include/not_windows.inc
--source include/not_embedded.inc
--source include/not_psprotocol.inc
use mysql;
RENAME TABLE time_zone TO time_zone_orig,
time_zone_name TO time_zone_name_orig,
time_zone_transition TO time_zone_transition_orig,
time_zone_transition_type TO time_zone_transition_type_orig,
time_zone_leap_second TO time_zone_leap_second_orig;
CREATE TABLE time_zone LIKE time_zone_orig;
CREATE TABLE time_zone_name LIKE time_zone_name_orig;
CREATE TABLE time_zone_transition LIKE time_zone_transition_orig;
CREATE TABLE time_zone_transition_type LIKE time_zone_transition_type_orig;
CREATE TABLE time_zone_leap_second LIKE time_zone_leap_second_orig;
CREATE TABLE time_zone LIKE mysql.time_zone;
CREATE TABLE time_zone_name LIKE mysql.time_zone_name;
CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition;
CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type;
CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
--echo #
--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
......@@ -27,16 +22,18 @@ CREATE TABLE time_zone_leap_second LIKE time_zone_leap_second_orig;
--echo # Verbose run
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --verbose $MYSQLTEST_VARDIR/zoneinfo 2>&1
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
--echo #
--echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
--echo #
--echo # Run on zoneinfo directory
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null | $MYSQL -S $MASTER_MYSOCK -u root mysql
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo > $MYSQL_TMP_DIR/tz.sql
--disable_query_log
--source $MYSQL_TMP_DIR/tz.sql
--enable_query_log
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
......@@ -49,13 +46,27 @@ SELECT COUNT(*) FROM time_zone_leap_second;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>&1
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null | $MYSQL -S $MASTER_MYSOCK -u root mysql
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql
--disable_query_log
CREATE TEMPORARY TABLE baseline AS
SELECT VARIABLE_NAME,VARIABLE_VALUE
FROM information_schema.global_status
WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE');
--source $MYSQL_TMP_DIR/tz.sql
--enable_query_log
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
# Below tests don't include TRUNCATE TABLE so clear them.
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
......@@ -69,13 +80,27 @@ TRUNCATE TABLE time_zone_leap_second;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>/dev/null | $MYSQL -S $MASTER_MYSOCK -u root mysql
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>/dev/null > $MYSQL_TMP_DIR/tz.sql
--disable_query_log
CREATE OR REPLACE TEMPORARY TABLE baseline AS
SELECT VARIABLE_NAME,VARIABLE_VALUE
FROM information_schema.global_status
WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE');
--source $MYSQL_TMP_DIR/tz.sql
--enable_query_log
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
......@@ -87,13 +112,27 @@ TRUNCATE TABLE time_zone_leap_second;
--echo #
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT 2>/dev/null | $MYSQL -S $MASTER_MYSOCK -u root mysql
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>/dev/null > $MYSQL_TMP_DIR/tz.sql
--disable_query_log
CREATE OR REPLACE TEMPORARY TABLE baseline AS
SELECT VARIABLE_NAME,VARIABLE_VALUE
FROM information_schema.global_status
WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE');
--source $MYSQL_TMP_DIR/tz.sql
--enable_query_log
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
......@@ -105,13 +144,27 @@ TRUNCATE TABLE time_zone_leap_second;
--echo #
--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>/dev/null | $MYSQL -S $MASTER_MYSOCK -u root mysql
--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>/dev/null > $MYSQL_TMP_DIR/tz.sql
--disable_query_log
CREATE OR REPLACE TEMPORARY TABLE baseline AS
SELECT VARIABLE_NAME,VARIABLE_VALUE
FROM information_schema.global_status
WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE');
--source $MYSQL_TMP_DIR/tz.sql
--enable_query_log
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
......@@ -123,37 +176,51 @@ TRUNCATE TABLE time_zone_leap_second;
--echo #
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>/dev/null | $MYSQL -S $MASTER_MYSOCK -u root mysql
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog --leap $MYSQLTEST_VARDIR/zoneinfo/GMT > $MYSQL_TMP_DIR/tz.sql
--disable_query_log
CREATE OR REPLACE TEMPORARY TABLE baseline AS
SELECT VARIABLE_NAME,VARIABLE_VALUE
FROM information_schema.global_status
WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE');
--source $MYSQL_TMP_DIR/tz.sql
--enable_query_log
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
#
#
# Cleanup
#
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
--echo #
--echo # MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL
--echo #
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/Factory
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1
#
#
# Cleanup
#
--remove_file $MYSQL_TMP_DIR/tz.sql
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
DROP TABLE baseline;
DROP TABLE time_zone;
DROP TABLE time_zone_name;
DROP TABLE time_zone_transition;
DROP TABLE time_zone_transition_type;
DROP TABLE time_zone_leap_second;
RENAME TABLE time_zone_orig TO time_zone,
time_zone_name_orig TO time_zone_name,
time_zone_transition_orig TO time_zone_transition,
time_zone_transition_type_orig TO time_zone_transition_type,
time_zone_leap_second_orig TO time_zone_leap_second;
--echo #
--echo # End of 10.6 tests
--echo #
connection node_2;
connection node_1;
#
# MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
#
# On node_1
connection node_1;
CREATE TABLE time_zone LIKE mysql.time_zone;
CREATE TABLE time_zone_name LIKE mysql.time_zone_name;
CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition;
CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type;
CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
ALTER TABLE time_zone_name ENGINE=MyISAM;
Warnings:
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1'
ALTER TABLE time_zone_transition_type ENGINE=MyISAM;
Warnings:
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1'
SET @save_wsrep_mode=@@WSREP_MODE;
#
# Run on zoneinfo directory --skip-write-binlog
#
# Apply on node_1
Warnings:
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1'
'binlog stationary as expected'
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN;
@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN
1 1 1 1 1 1
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
VARIABLE_NAME diff
COM_ALTER_TABLE 2
COM_BEGIN 0
COM_INSERT 6
COM_LOCK_TABLES 1
COM_TRUNCATE 4
SELECT COUNT(*) FROM time_zone;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
# On node_2 (not replicated)
connection node_2;
SELECT COUNT(*) FROM time_zone;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
# Apply on node_1
connection node_1;
SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM';
Warnings:
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1'
'binlog stationary as expected'
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN;
@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN
1 0 1 1 1 1
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
VARIABLE_NAME diff
COM_ALTER_TABLE 2
COM_BEGIN 0
COM_INSERT 6
COM_LOCK_TABLES 1
COM_TRUNCATE 4
SELECT COUNT(*) FROM time_zone;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
# On node_2 (not replicated)
connection node_2;
SELECT COUNT(*) FROM time_zone;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
#
# Run on zoneinfo directory without --skip-write-binlog
#
# Apply on node_1
connection node_1;
Warnings:
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1'
'binlog advanced as expected'
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN;
@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN
1 0 1 1 1 1
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
VARIABLE_NAME diff
COM_ALTER_TABLE 2
COM_BEGIN 0
COM_INSERT 6
COM_LOCK_TABLES 1
COM_TRUNCATE 4
SELECT COUNT(*) FROM time_zone;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
# On node_2 (replicated via ARIA)
connection node_2;
SELECT COUNT(*) FROM time_zone;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
TRUNCATE TABLE time_zone_leap_second;
# Apply on node_1
connection node_1;
SET GLOBAL WSREP_MODE='';
Warnings:
Warning 1105 ORDER BY ignored as there is a user-defined clustered index in the table 'time_zone_transition'
Warnings:
Warning 1105 ORDER BY ignored as there is a user-defined clustered index in the table 'time_zone_transition_type'
Warnings:
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1'
Warnings:
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1'
'binlog advanced as expected'
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN;
@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN
1 1 1 1 1 1
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
VARIABLE_NAME diff
COM_ALTER_TABLE 10
COM_BEGIN 1
COM_INSERT 6
COM_LOCK_TABLES 0
COM_TRUNCATE 4
SELECT COUNT(*) FROM time_zone;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES
WHERE
TABLE_SCHEMA = DATABASE()
AND TABLE_NAME LIKE 'time_zone%' ORDER BY TABLE_NAME;
TABLE_NAME ENGINE
time_zone Aria
time_zone_leap_second Aria
time_zone_name MyISAM
time_zone_transition Aria
time_zone_transition_type MyISAM
# On node_2 (replicated via InnoDB)
connection node_2;
SELECT COUNT(*) FROM time_zone;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
connection node_1;
SET GLOBAL WSREP_MODE=@save_wsrep_mode;
DROP TABLE baseline;
DROP TABLE time_zone;
DROP TABLE time_zone_name;
DROP TABLE time_zone_transition;
DROP TABLE time_zone_transition_type;
DROP TABLE time_zone_leap_second;
#
# End of 10.6 tests
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/not_psprotocol.inc
--echo #
--echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
--echo #
--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
--exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix
--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT
--echo
--echo # On node_1
--connection node_1
CREATE TABLE time_zone LIKE mysql.time_zone;
CREATE TABLE time_zone_name LIKE mysql.time_zone_name;
CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition;
CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type;
CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition_type ENGINE=MyISAM;
SET @save_wsrep_mode=@@WSREP_MODE;
--echo #
--echo # Run on zoneinfo directory --skip-write-binlog
--echo #
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql
--echo
--echo # Apply on node_1
--echo
--let $snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
--disable_query_log
CREATE TEMPORARY TABLE baseline AS
SELECT VARIABLE_NAME,VARIABLE_VALUE
FROM information_schema.global_status
WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE');
--source $MYSQL_TMP_DIR/tz.sql
--enable_query_log
--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
if ($snap_pos == $new_snap_pos)
{
--echo 'binlog stationary as expected'
}
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
--echo
--echo # On node_2 (not replicated)
--echo
--connection node_2
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
--echo
--echo # Apply on node_1
--echo
--connection node_1
SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM';
--disable_query_log
CREATE OR REPLACE TEMPORARY TABLE baseline AS
SELECT VARIABLE_NAME,VARIABLE_VALUE
FROM information_schema.global_status
WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE');
--source $MYSQL_TMP_DIR/tz.sql
--enable_query_log
--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
if ($snap_pos == $new_snap_pos)
{
--echo 'binlog stationary as expected'
}
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
--echo
--echo # On node_2 (not replicated)
--echo
--connection node_2
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
--echo #
--echo # Run on zoneinfo directory without --skip-write-binlog
--echo #
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql
--echo
--echo # Apply on node_1
--echo
--connection node_1
--disable_query_log
CREATE OR REPLACE TEMPORARY TABLE baseline AS
SELECT VARIABLE_NAME,VARIABLE_VALUE
FROM information_schema.global_status
WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE');
--source $MYSQL_TMP_DIR/tz.sql
--enable_query_log
--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
if ($snap_pos < $new_snap_pos)
{
--echo 'binlog advanced as expected'
}
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
--echo
--echo # On node_2 (replicated via ARIA)
--echo
--connection node_2
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
TRUNCATE TABLE time_zone_leap_second;
--echo
--echo # Apply on node_1
--echo
--connection node_1
SET GLOBAL WSREP_MODE='';
--let $snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
--disable_query_log
CREATE OR REPLACE TEMPORARY TABLE baseline AS
SELECT VARIABLE_NAME,VARIABLE_VALUE
FROM information_schema.global_status
WHERE VARIABLE_NAME IN ('COM_BEGIN', 'COM_INSERT', 'COM_LOCK_TABLES', 'COM_ALTER_TABLE', 'COM_TRUNCATE');
--source $MYSQL_TMP_DIR/tz.sql
--enable_query_log
--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
if ($snap_pos < $new_snap_pos)
{
--echo 'binlog advanced as expected'
}
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN;
SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
FROM information_schema.global_status g
JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES
WHERE
TABLE_SCHEMA = DATABASE()
AND TABLE_NAME LIKE 'time_zone%' ORDER BY TABLE_NAME;
--echo
--echo # On node_2 (replicated via InnoDB)
--echo
--connection node_2
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
#
# Cleanup
#
--connection node_1
--remove_file $MYSQL_TMP_DIR/tz.sql
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
SET GLOBAL WSREP_MODE=@save_wsrep_mode;
DROP TABLE baseline;
DROP TABLE time_zone;
DROP TABLE time_zone_name;
DROP TABLE time_zone_transition;
DROP TABLE time_zone_transition_type;
DROP TABLE time_zone_leap_second;
--echo #
--echo # End of 10.6 tests
--echo #
--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_on=1 --binlog_format=ROW
--source include/have_wsrep.inc
--source include/have_symlink.inc
--source include/not_windows.inc
--source include/have_innodb.inc
--echo #
--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
--echo #
--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
--exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix
--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT
--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/garbage
--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/ignored.tab
--echo # Verbose run
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --verbose $MYSQLTEST_VARDIR/zoneinfo 2>&1
--echo # Silent run
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1
--echo #
--echo # Testing with explicit timezonefile
--echo #
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
--echo #
--echo # Testing --leap
--echo #
--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
#
# Cleanup
#
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_on=1 --binlog_format=ROW
--source include/have_wsrep.inc
--source include/have_symlink.inc
--source include/not_windows.inc
--source include/have_innodb.inc
--echo #
--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
--echo #
--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
--exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix
--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT
--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/garbage
--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/ignored.tab
--echo # Verbose run
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --verbose --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>&1
--echo # Silent run
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>&1
--echo #
--echo # Testing with explicit timezonefile
--echo #
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
--echo #
--echo # Testing --leap
--echo #
--exec $MYSQL_TZINFO_TO_SQL --leap --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
#
# Cleanup
#
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
......@@ -2428,6 +2428,11 @@ print_tz_as_sql(const char* tz_name, const TIME_ZONE_INFO *sp)
}
#define SAVE_ENGINE(e) \
"\"select ENGINE into @" e "_engine" \
" from information_schema.TABLES" \
" where TABLE_SCHEMA=DATABASE() and TABLE_NAME='" e "'\""
/*
Print info about leap seconds in time zone as SQL statements
populating mysql.time_zone_leap_second table.
......@@ -2446,12 +2451,11 @@ print_tz_leaps_as_sql(const TIME_ZONE_INFO *sp)
For all timezones.
*/
if (!opt_skip_write_binlog)
printf("\\d |\n"
"IF (select count(*) from information_schema.global_variables where\n"
"variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n"
"ALTER TABLE time_zone_leap_second ENGINE=InnoDB;\n"
"END IF|\n"
"\\d ;\n");
printf(
"execute immediate if(@wsrep_cannot_replicate_tz, "
SAVE_ENGINE("time_zone_leap_second") ", 'do 0');\n"
"execute immediate if(@wsrep_cannot_replicate_tz, "
"'ALTER TABLE time_zone_leap_second ENGINE=InnoDB', 'do 0');\n");
printf("TRUNCATE TABLE time_zone_leap_second;\n");
......@@ -2466,12 +2470,10 @@ print_tz_leaps_as_sql(const TIME_ZONE_INFO *sp)
}
if (!opt_skip_write_binlog)
printf("\\d |\n"
"IF (select count(*) from information_schema.global_variables where\n"
"variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n"
"ALTER TABLE time_zone_leap_second ENGINE=Aria;\n"
"END IF|\n"
"\\d ;\n");
printf(
"execute immediate if(@wsrep_cannot_replicate_tz, "
"concat('ALTER TABLE time_zone_leap_second ENGINE=', "
"@time_zone_leap_second_engine), 'do 0');\n");
printf("ALTER TABLE time_zone_leap_second ORDER BY Transition_time;\n");
}
......@@ -2650,7 +2652,7 @@ static struct my_option my_long_options[] =
&opt_verbose, &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-write-binlog", 'S', "Do not replicate changes to time zone tables to the binary log, or to other nodes in a Galera cluster (if wsrep_on=ON).",
{"skip-write-binlog", 'S', "Do not replicate changes to time zone tables to the binary log, or to other nodes in a Galera cluster.",
&opt_skip_write_binlog,&opt_skip_write_binlog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
......@@ -2727,17 +2729,23 @@ static const char *lock_tables=
" time_zone_leap_second WRITE,\n"
" time_zone_name WRITE,\n"
" time_zone_transition WRITE,\n"
" time_zone_transition_type WRITE;\n";
" time_zone_transition_type WRITE";
static const char *trunc_tables_const=
"TRUNCATE TABLE time_zone;\n"
"TRUNCATE TABLE time_zone_name;\n"
"TRUNCATE TABLE time_zone_transition;\n"
"TRUNCATE TABLE time_zone_transition_type;\n";
static const char *wsrep_is_on=
"select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON')"
" from information_schema.SYSTEM_VARIABLES";
static const char *wsrep_cannot_replicate_tz=
"select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt)"
" from information_schema.SYSTEM_VARIABLES";
int
main(int argc, char **argv)
{
const char *trunc_tables;
const char *trunc_tables= "";
MY_INIT(argv[0]);
load_defaults_or_exit("my", load_default_groups, &argc, &argv);
......@@ -2753,38 +2761,46 @@ main(int argc, char **argv)
return 1;
}
if (!(argc == 1 && !opt_leap))
trunc_tables= "SELECT 'skip truncate tables';\n"; // No-op - needed for ELSE clause
else
if (argc == 1 && !opt_leap)
trunc_tables= trunc_tables_const;
printf("set @wsrep_is_on=(%s);\n", wsrep_is_on);
printf("SELECT concat('%%', GROUP_CONCAT(OPTION), '%%') INTO @replicate_opt "
" FROM"
" (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION"
" FROM information_schema.TABLES"
" WHERE TABLE_SCHEMA=DATABASE()"
" AND TABLE_NAME IN ('time_zone',"
" 'time_zone_name',"
" 'time_zone_transition',"
" 'time_zone_transition_type',"
" 'time_zone_leap_second')"
" AND ENGINE in ('MyISAM',"
" 'Aria')) AS o"
" ORDER BY OPTION DESC;\n");
printf("set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (%s);\n", wsrep_cannot_replicate_tz);
if (opt_skip_write_binlog)
/* If skip_write_binlog is set and wsrep is compiled in we disable
sql_log_bin and wsrep_on to avoid Galera replicating below
TRUNCATE TABLE clauses. This will allow user to set different
time zones to nodes in Galera cluster. */
printf("set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');\n"
"prepare set_wsrep_write_binlog from @prep1;\n"
"set @toggle=0; execute set_wsrep_write_binlog using @toggle;\n"
"%s%s", trunc_tables, lock_tables);
/* If turn off session wsrep if we cannot replicate using galera.
Disable sql_log_bin as the name implies. */
printf("execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0');\n"
"SET @save_sql_log_bin=@@SQL_LOG_BIN;\n"
"SET SESSION SQL_LOG_BIN=0;\n"
"%s%s;\n", trunc_tables, lock_tables);
else
// Alter time zone tables to InnoDB if wsrep_on is enabled
// to allow changes to them to replicate with Galera
printf("\\d |\n"
"IF (select count(*) from information_schema.global_variables where\n"
"variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n"
"ALTER TABLE time_zone ENGINE=InnoDB;\n"
"ALTER TABLE time_zone_name ENGINE=InnoDB;\n"
"ALTER TABLE time_zone_transition ENGINE=InnoDB;\n"
"ALTER TABLE time_zone_transition_type ENGINE=InnoDB;\n"
printf(
"execute immediate if(@wsrep_cannot_replicate_tz, " SAVE_ENGINE("time_zone") ", 'do 0');\n"
"execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');\n"
"execute immediate if(@wsrep_cannot_replicate_tz, " SAVE_ENGINE("time_zone_name") ", 'do 0');\n"
"execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0');\n"
"execute immediate if(@wsrep_cannot_replicate_tz, " SAVE_ENGINE("time_zone_transition") ", 'do 0');\n"
"execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0');\n"
"execute immediate if(@wsrep_cannot_replicate_tz, " SAVE_ENGINE("time_zone_transition_type") ", 'do 0');\n"
"execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0');\n"
"%s"
"START TRANSACTION;\n"
"ELSE\n%s"
"END IF|\n"
"\\d ;\n",
trunc_tables, trunc_tables);
// Ideally we'd like to put lock_tables in the ELSE branch however
// "ERROR 1314 (0A000) at line 2: LOCK is not allowed in stored procedures"
"/*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', '%s')*/;\n"
, trunc_tables, lock_tables);
if (argc == 1 && !opt_leap)
{
......@@ -2832,17 +2848,22 @@ main(int argc, char **argv)
free_root(&tz_storage, MYF(0));
}
if(!opt_skip_write_binlog)
// Fall back to Aria
printf("\\d |\n"
"IF (select count(*) from information_schema.global_variables where\n"
"variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n"
"ALTER TABLE time_zone ENGINE=Aria;\n"
"ALTER TABLE time_zone_name ENGINE=Aria;\n"
"ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_time;\n"
"ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id;\n"
"END IF|\n"
"\\d ;\n");
if(opt_skip_write_binlog)
printf("SET SESSION SQL_LOG_BIN=@save_sql_log_bin;\n"
"execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0');\n");
else
// Change back to what it was before
printf(
"execute immediate if(@wsrep_cannot_replicate_tz, "
"concat('ALTER TABLE time_zone ENGINE=', @time_zone_engine), 'do 0');\n"
"execute immediate if(@wsrep_cannot_replicate_tz, "
"concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0');\n"
"execute immediate if(@wsrep_cannot_replicate_tz, "
"concat('ALTER TABLE time_zone_transition ENGINE=', "
"@time_zone_transition_engine, ', ORDER BY Time_zone_id, Transition_time'), 'do 0');\n"
"execute immediate if(@wsrep_cannot_replicate_tz, "
"concat('ALTER TABLE time_zone_transition_type ENGINE=', "
"@time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0');\n");
free_allocated_data();
my_end(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment