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
}
use mysql; CREATE TABLE time_zone LIKE mysql.time_zone;
RENAME TABLE time_zone TO time_zone_orig, CREATE TABLE time_zone_name LIKE mysql.time_zone_name;
time_zone_name TO time_zone_name_orig, CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition;
time_zone_transition TO time_zone_transition_orig, CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type;
time_zone_transition_type TO time_zone_transition_type_orig, CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
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;
# #
# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
# #
# Verbose run # Verbose run
\d | set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
IF (select count(*) from information_schema.global_variables where 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;
variable_name='wsrep_on' and variable_value='ON') = 1 THEN set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
ALTER TABLE time_zone ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
ALTER TABLE time_zone_name ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
ALTER TABLE time_zone_transition ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
ALTER TABLE time_zone_transition_type ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition'", 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition_type'", 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0');
TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type; TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION; /*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', 'LOCK TABLES time_zone WRITE,
ELSE time_zone_leap_second WRITE,
TRUNCATE TABLE time_zone; time_zone_name WRITE,
TRUNCATE TABLE time_zone_name; time_zone_transition WRITE,
TRUNCATE TABLE time_zone_transition; time_zone_transition_type WRITE')*/;
TRUNCATE TABLE time_zone_transition_type;
END IF|
\d ;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID(); SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
...@@ -53,50 +48,34 @@ UNLOCK TABLES; ...@@ -53,50 +48,34 @@ UNLOCK TABLES;
COMMIT; COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d | execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone ENGINE=', @time_zone_engine), 'do 0');
IF (select count(*) from information_schema.global_variables where execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0');
variable_name='wsrep_on' and variable_value='ON') = 1 THEN 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');
ALTER TABLE time_zone ENGINE=Aria; 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');
ALTER TABLE time_zone_name ENGINE=Aria; #
ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_time; # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id; #
END IF|
\d ;
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 # Run on zoneinfo directory
\d | set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
IF (select count(*) from information_schema.global_variables where 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;
variable_name='wsrep_on' and variable_value='ON') = 1 THEN set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
ALTER TABLE time_zone ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
ALTER TABLE time_zone_name ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
ALTER TABLE time_zone_transition ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
ALTER TABLE time_zone_transition_type ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0');
TRUNCATE TABLE time_zone; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition'", 'do 0');
TRUNCATE TABLE time_zone_name; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0');
TRUNCATE TABLE time_zone_transition; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition_type'", 'do 0');
TRUNCATE TABLE time_zone_transition_type; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0');
START TRANSACTION;
ELSE
TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type; TRUNCATE TABLE time_zone_transition_type;
END IF| /*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', 'LOCK TABLES time_zone WRITE,
\d ; time_zone_leap_second WRITE,
time_zone_name WRITE,
time_zone_transition WRITE,
time_zone_transition_type WRITE')*/;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID(); SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
...@@ -115,15 +94,10 @@ UNLOCK TABLES; ...@@ -115,15 +94,10 @@ UNLOCK TABLES;
COMMIT; COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d | execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone ENGINE=', @time_zone_engine), 'do 0');
IF (select count(*) from information_schema.global_variables where execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0');
variable_name='wsrep_on' and variable_value='ON') = 1 THEN 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');
ALTER TABLE time_zone ENGINE=Aria; 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');
ALTER TABLE time_zone_name ENGINE=Aria;
ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id;
END IF|
\d ;
SELECT COUNT(*) FROM time_zone; SELECT COUNT(*) FROM time_zone;
COUNT(*) COUNT(*)
2 2
...@@ -142,9 +116,12 @@ COUNT(*) ...@@ -142,9 +116,12 @@ COUNT(*)
# #
# Run on zoneinfo directory --skip-write-binlog # Run on zoneinfo directory --skip-write-binlog
# #
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 ?'); set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
prepare set_wsrep_write_binlog from @prep1; 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;
set @toggle=0; execute set_wsrep_write_binlog using @toggle; set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0');
SET @save_sql_log_bin=@@SQL_LOG_BIN;
SET SESSION SQL_LOG_BIN=0;
TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
...@@ -172,6 +149,8 @@ UNLOCK TABLES; ...@@ -172,6 +149,8 @@ UNLOCK TABLES;
COMMIT; COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
SET SESSION SQL_LOG_BIN=@save_sql_log_bin;
execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0');
SELECT COUNT(*) FROM time_zone; SELECT COUNT(*) FROM time_zone;
COUNT(*) COUNT(*)
2 2
...@@ -187,6 +166,19 @@ COUNT(*) ...@@ -187,6 +166,19 @@ COUNT(*)
SELECT COUNT(*) FROM time_zone_leap_second; SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*) COUNT(*)
0 0
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@SQL_LOG_BIN
0 0 NULL 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
TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
...@@ -195,19 +187,22 @@ TRUNCATE TABLE time_zone_leap_second; ...@@ -195,19 +187,22 @@ TRUNCATE TABLE time_zone_leap_second;
# #
# Testing with explicit timezonefile # Testing with explicit timezonefile
# #
\d | set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
IF (select count(*) from information_schema.global_variables where 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;
variable_name='wsrep_on' and variable_value='ON') = 1 THEN set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
ALTER TABLE time_zone ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
ALTER TABLE time_zone_name ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
ALTER TABLE time_zone_transition ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
ALTER TABLE time_zone_transition_type ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0');
SELECT 'skip truncate tables'; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition'", 'do 0');
START TRANSACTION; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0');
ELSE execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition_type'", 'do 0');
SELECT 'skip truncate tables'; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0');
END IF| /*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', 'LOCK TABLES time_zone WRITE,
\d ; time_zone_leap_second WRITE,
time_zone_name WRITE,
time_zone_transition WRITE,
time_zone_transition_type WRITE')*/;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID(); SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id);
...@@ -216,17 +211,10 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset ...@@ -216,17 +211,10 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset
; ;
UNLOCK TABLES; UNLOCK TABLES;
COMMIT; COMMIT;
\d | execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone ENGINE=', @time_zone_engine), 'do 0');
IF (select count(*) from information_schema.global_variables where execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0');
variable_name='wsrep_on' and variable_value='ON') = 1 THEN 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');
ALTER TABLE time_zone ENGINE=Aria; 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');
ALTER TABLE time_zone_name ENGINE=Aria;
ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id;
END IF|
\d ;
skip truncate tables
skip truncate tables
SELECT COUNT(*) FROM time_zone; SELECT COUNT(*) FROM time_zone;
COUNT(*) COUNT(*)
1 1
...@@ -242,6 +230,19 @@ COUNT(*) ...@@ -242,6 +230,19 @@ COUNT(*)
SELECT COUNT(*) FROM time_zone_leap_second; SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*) COUNT(*)
0 0
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@SQL_LOG_BIN
0 0 NULL 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 0
COM_BEGIN 0
COM_INSERT 3
COM_LOCK_TABLES 1
COM_TRUNCATE 0
TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
...@@ -250,10 +251,12 @@ TRUNCATE TABLE time_zone_leap_second; ...@@ -250,10 +251,12 @@ TRUNCATE TABLE time_zone_leap_second;
# #
# Testing with explicit timezonefile --skip-write-binlog # Testing with explicit timezonefile --skip-write-binlog
# #
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 ?'); set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
prepare set_wsrep_write_binlog from @prep1; 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;
set @toggle=0; execute set_wsrep_write_binlog using @toggle; set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
SELECT 'skip truncate tables'; execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0');
SET @save_sql_log_bin=@@SQL_LOG_BIN;
SET SESSION SQL_LOG_BIN=0;
LOCK TABLES time_zone WRITE, LOCK TABLES time_zone WRITE,
time_zone_leap_second WRITE, time_zone_leap_second WRITE,
time_zone_name WRITE, time_zone_name WRITE,
...@@ -267,21 +270,36 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset ...@@ -267,21 +270,36 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, `Offset
; ;
UNLOCK TABLES; UNLOCK TABLES;
COMMIT; COMMIT;
SET SESSION SQL_LOG_BIN=@save_sql_log_bin;
execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0');
SELECT COUNT(*) FROM time_zone; SELECT COUNT(*) FROM time_zone;
COUNT(*) COUNT(*)
0 1
SELECT COUNT(*) FROM time_zone_name; SELECT COUNT(*) FROM time_zone_name;
COUNT(*) COUNT(*)
0 1
SELECT COUNT(*) FROM time_zone_transition; SELECT COUNT(*) FROM time_zone_transition;
COUNT(*) COUNT(*)
0 0
SELECT COUNT(*) FROM time_zone_transition_type; SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*) COUNT(*)
0 1
SELECT COUNT(*) FROM time_zone_leap_second; SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*) COUNT(*)
0 0
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@SQL_LOG_BIN
0 0 NULL 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 0
COM_BEGIN 0
COM_INSERT 3
COM_LOCK_TABLES 1
COM_TRUNCATE 0
TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
...@@ -290,46 +308,33 @@ TRUNCATE TABLE time_zone_leap_second; ...@@ -290,46 +308,33 @@ TRUNCATE TABLE time_zone_leap_second;
# #
# Testing --leap # Testing --leap
# #
\d | set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
IF (select count(*) from information_schema.global_variables where 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;
variable_name='wsrep_on' and variable_value='ON') = 1 THEN set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
ALTER TABLE time_zone ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
ALTER TABLE time_zone_name ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
ALTER TABLE time_zone_transition ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
ALTER TABLE time_zone_transition_type ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0');
SELECT 'skip truncate tables'; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition'", 'do 0');
START TRANSACTION; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0');
ELSE execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition_type'", 'do 0');
SELECT 'skip truncate tables'; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0');
END IF| /*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', 'LOCK TABLES time_zone WRITE,
\d ; time_zone_leap_second WRITE,
\d | time_zone_name WRITE,
IF (select count(*) from information_schema.global_variables where time_zone_transition WRITE,
variable_name='wsrep_on' and variable_value='ON') = 1 THEN time_zone_transition_type WRITE')*/;
ALTER TABLE time_zone_leap_second ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_leap_second_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_leap_second'", 'do 0');
END IF| execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_leap_second ENGINE=InnoDB', 'do 0');
\d ;
TRUNCATE TABLE time_zone_leap_second; TRUNCATE TABLE time_zone_leap_second;
\d | execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_leap_second ENGINE=', @time_zone_leap_second_engine), 'do 0');
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone_leap_second ENGINE=Aria;
END IF|
\d ;
ALTER TABLE time_zone_leap_second ORDER BY Transition_time; ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
UNLOCK TABLES; UNLOCK TABLES;
COMMIT; COMMIT;
\d | execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone ENGINE=', @time_zone_engine), 'do 0');
IF (select count(*) from information_schema.global_variables where execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0');
variable_name='wsrep_on' and variable_value='ON') = 1 THEN 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');
ALTER TABLE time_zone ENGINE=Aria; 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');
ALTER TABLE time_zone_name ENGINE=Aria;
ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id;
END IF|
\d ;
skip truncate tables
skip truncate tables
SELECT COUNT(*) FROM time_zone; SELECT COUNT(*) FROM time_zone;
COUNT(*) COUNT(*)
0 0
...@@ -345,6 +350,19 @@ COUNT(*) ...@@ -345,6 +350,19 @@ COUNT(*)
SELECT COUNT(*) FROM time_zone_leap_second; SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*) COUNT(*)
0 0
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@SQL_LOG_BIN
0 0 NULL 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 1
COM_BEGIN 0
COM_INSERT 0
COM_LOCK_TABLES 1
COM_TRUNCATE 1
TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
...@@ -353,10 +371,12 @@ TRUNCATE TABLE time_zone_leap_second; ...@@ -353,10 +371,12 @@ TRUNCATE TABLE time_zone_leap_second;
# #
# Testing --skip-write-binlog --leap # Testing --skip-write-binlog --leap
# #
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 ?'); set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
prepare set_wsrep_write_binlog from @prep1; 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;
set @toggle=0; execute set_wsrep_write_binlog using @toggle; set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
SELECT 'skip truncate tables'; execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0');
SET @save_sql_log_bin=@@SQL_LOG_BIN;
SET SESSION SQL_LOG_BIN=0;
LOCK TABLES time_zone WRITE, LOCK TABLES time_zone WRITE,
time_zone_leap_second WRITE, time_zone_leap_second WRITE,
time_zone_name WRITE, time_zone_name WRITE,
...@@ -366,8 +386,8 @@ TRUNCATE TABLE time_zone_leap_second; ...@@ -366,8 +386,8 @@ TRUNCATE TABLE time_zone_leap_second;
ALTER TABLE time_zone_leap_second ORDER BY Transition_time; ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
UNLOCK TABLES; UNLOCK TABLES;
COMMIT; COMMIT;
skip truncate tables SET SESSION SQL_LOG_BIN=@save_sql_log_bin;
skip truncate tables execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0');
SELECT COUNT(*) FROM time_zone; SELECT COUNT(*) FROM time_zone;
COUNT(*) COUNT(*)
0 0
...@@ -383,48 +403,56 @@ COUNT(*) ...@@ -383,48 +403,56 @@ COUNT(*)
SELECT COUNT(*) FROM time_zone_leap_second; SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*) COUNT(*)
0 0
SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@SQL_LOG_BIN;
@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@SQL_LOG_BIN
0 0 NULL 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 1
COM_BEGIN 0
COM_INSERT 0
COM_LOCK_TABLES 1
COM_TRUNCATE 1
# #
# MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL # MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL
# #
\d | set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
IF (select count(*) from information_schema.global_variables where 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;
variable_name='wsrep_on' and variable_value='ON') = 1 THEN set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
ALTER TABLE time_zone ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
ALTER TABLE time_zone_name ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
ALTER TABLE time_zone_transition ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
ALTER TABLE time_zone_transition_type ENGINE=InnoDB; execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition'", 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition_type'", 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0');
TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type; TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION; /*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', 'LOCK TABLES time_zone WRITE,
ELSE time_zone_leap_second WRITE,
TRUNCATE TABLE time_zone; time_zone_name WRITE,
TRUNCATE TABLE time_zone_name; time_zone_transition WRITE,
TRUNCATE TABLE time_zone_transition; time_zone_transition_type WRITE')*/;
TRUNCATE TABLE time_zone_transition_type;
END IF|
\d ;
UNLOCK TABLES; UNLOCK TABLES;
COMMIT; COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d | execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone ENGINE=', @time_zone_engine), 'do 0');
IF (select count(*) from information_schema.global_variables where execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0');
variable_name='wsrep_on' and variable_value='ON') = 1 THEN 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');
ALTER TABLE time_zone ENGINE=Aria; 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');
ALTER TABLE time_zone_name ENGINE=Aria; DROP TABLE baseline;
ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id;
END IF|
\d ;
DROP TABLE time_zone; DROP TABLE time_zone;
DROP TABLE time_zone_name; DROP TABLE time_zone_name;
DROP TABLE time_zone_transition; DROP TABLE time_zone_transition;
DROP TABLE time_zone_transition_type; DROP TABLE time_zone_transition_type;
DROP TABLE time_zone_leap_second; DROP TABLE time_zone_leap_second;
RENAME TABLE time_zone_orig TO time_zone, #
time_zone_name_orig TO time_zone_name, # End of 10.6 tests
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;
--source include/have_innodb.inc
--source include/have_symlink.inc --source include/have_symlink.inc
--source include/not_windows.inc --source include/not_windows.inc
--source include/not_embedded.inc --source include/not_psprotocol.inc
use mysql; CREATE TABLE time_zone LIKE mysql.time_zone;
RENAME TABLE time_zone TO time_zone_orig, CREATE TABLE time_zone_name LIKE mysql.time_zone_name;
time_zone_name TO time_zone_name_orig, CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition;
time_zone_transition TO time_zone_transition_orig, CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type;
time_zone_transition_type TO time_zone_transition_type_orig, CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
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;
--echo # --echo #
--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above --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; ...@@ -27,16 +22,18 @@ CREATE TABLE time_zone_leap_second LIKE time_zone_leap_second_orig;
--echo # Verbose run --echo # Verbose run
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --verbose $MYSQLTEST_VARDIR/zoneinfo 2>&1 --exec $MYSQL_TZINFO_TO_SQL --verbose $MYSQLTEST_VARDIR/zoneinfo 2>&1
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name; --echo #
SELECT COUNT(*) FROM time_zone_transition; --echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
SELECT COUNT(*) FROM time_zone_transition_type; --echo #
SELECT COUNT(*) FROM time_zone_leap_second;
--echo # Run on zoneinfo directory --echo # Run on zoneinfo directory
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --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>&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;
SELECT COUNT(*) FROM time_zone_name; SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition; SELECT COUNT(*) FROM time_zone_transition;
...@@ -49,13 +46,27 @@ SELECT COUNT(*) FROM time_zone_leap_second; ...@@ -49,13 +46,27 @@ SELECT COUNT(*) FROM time_zone_leap_second;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --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>&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;
SELECT COUNT(*) FROM time_zone_name; SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition; SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type; SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second; 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. # Below tests don't include TRUNCATE TABLE so clear them.
TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
...@@ -69,13 +80,27 @@ TRUNCATE TABLE time_zone_leap_second; ...@@ -69,13 +80,27 @@ TRUNCATE TABLE time_zone_leap_second;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --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>&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;
SELECT COUNT(*) FROM time_zone_name; SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition; SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type; SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second; 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;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
...@@ -87,13 +112,27 @@ TRUNCATE TABLE time_zone_leap_second; ...@@ -87,13 +112,27 @@ TRUNCATE TABLE time_zone_leap_second;
--echo # --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 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;
SELECT COUNT(*) FROM time_zone_name; SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition; SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type; SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second; 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;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
...@@ -105,13 +144,27 @@ TRUNCATE TABLE time_zone_leap_second; ...@@ -105,13 +144,27 @@ TRUNCATE TABLE time_zone_leap_second;
--echo # --echo #
--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1 --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;
SELECT COUNT(*) FROM time_zone_name; SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition; SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type; SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second; 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;
TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition;
...@@ -123,37 +176,51 @@ TRUNCATE TABLE time_zone_leap_second; ...@@ -123,37 +176,51 @@ TRUNCATE TABLE time_zone_leap_second;
--echo # --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>&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;
SELECT COUNT(*) FROM time_zone_name; SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition; SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type; SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second; 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
# Cleanup FROM information_schema.global_status g
# JOIN baseline b USING (VARIABLE_NAME)
ORDER BY g.VARIABLE_NAME;
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
--echo # --echo #
--echo # MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL --echo # MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL
--echo # --echo #
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
--exec mkdir $MYSQLTEST_VARDIR/zoneinfo --exec mkdir $MYSQLTEST_VARDIR/zoneinfo
--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/Factory --copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/Factory
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --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>&1
#
#
# Cleanup
#
--remove_file $MYSQL_TMP_DIR/tz.sql
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo --exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
DROP TABLE baseline;
DROP TABLE time_zone; DROP TABLE time_zone;
DROP TABLE time_zone_name; DROP TABLE time_zone_name;
DROP TABLE time_zone_transition; DROP TABLE time_zone_transition;
DROP TABLE time_zone_transition_type; DROP TABLE time_zone_transition_type;
DROP TABLE time_zone_leap_second; DROP TABLE time_zone_leap_second;
RENAME TABLE time_zone_orig TO time_zone,
time_zone_name_orig TO time_zone_name, --echo #
time_zone_transition_orig TO time_zone_transition, --echo # End of 10.6 tests
time_zone_transition_type_orig TO time_zone_transition_type, --echo #
time_zone_leap_second_orig TO time_zone_leap_second;
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) ...@@ -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 Print info about leap seconds in time zone as SQL statements
populating mysql.time_zone_leap_second table. populating mysql.time_zone_leap_second table.
...@@ -2446,12 +2451,11 @@ print_tz_leaps_as_sql(const TIME_ZONE_INFO *sp) ...@@ -2446,12 +2451,11 @@ print_tz_leaps_as_sql(const TIME_ZONE_INFO *sp)
For all timezones. For all timezones.
*/ */
if (!opt_skip_write_binlog) if (!opt_skip_write_binlog)
printf("\\d |\n" printf(
"IF (select count(*) from information_schema.global_variables where\n" "execute immediate if(@wsrep_cannot_replicate_tz, "
"variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n" SAVE_ENGINE("time_zone_leap_second") ", 'do 0');\n"
"ALTER TABLE time_zone_leap_second ENGINE=InnoDB;\n" "execute immediate if(@wsrep_cannot_replicate_tz, "
"END IF|\n" "'ALTER TABLE time_zone_leap_second ENGINE=InnoDB', 'do 0');\n");
"\\d ;\n");
printf("TRUNCATE TABLE time_zone_leap_second;\n"); printf("TRUNCATE TABLE time_zone_leap_second;\n");
...@@ -2466,12 +2470,10 @@ print_tz_leaps_as_sql(const TIME_ZONE_INFO *sp) ...@@ -2466,12 +2470,10 @@ print_tz_leaps_as_sql(const TIME_ZONE_INFO *sp)
} }
if (!opt_skip_write_binlog) if (!opt_skip_write_binlog)
printf("\\d |\n" printf(
"IF (select count(*) from information_schema.global_variables where\n" "execute immediate if(@wsrep_cannot_replicate_tz, "
"variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n" "concat('ALTER TABLE time_zone_leap_second ENGINE=', "
"ALTER TABLE time_zone_leap_second ENGINE=Aria;\n" "@time_zone_leap_second_engine), 'do 0');\n");
"END IF|\n"
"\\d ;\n");
printf("ALTER TABLE time_zone_leap_second ORDER BY Transition_time;\n"); printf("ALTER TABLE time_zone_leap_second ORDER BY Transition_time;\n");
} }
...@@ -2650,7 +2652,7 @@ static struct my_option my_long_options[] = ...@@ -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}, &opt_verbose, &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", {"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 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}, &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} { 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= ...@@ -2727,17 +2729,23 @@ static const char *lock_tables=
" time_zone_leap_second WRITE,\n" " time_zone_leap_second WRITE,\n"
" time_zone_name WRITE,\n" " time_zone_name WRITE,\n"
" time_zone_transition WRITE,\n" " time_zone_transition WRITE,\n"
" time_zone_transition_type WRITE;\n"; " time_zone_transition_type WRITE";
static const char *trunc_tables_const= static const char *trunc_tables_const=
"TRUNCATE TABLE time_zone;\n" "TRUNCATE TABLE time_zone;\n"
"TRUNCATE TABLE time_zone_name;\n" "TRUNCATE TABLE time_zone_name;\n"
"TRUNCATE TABLE time_zone_transition;\n" "TRUNCATE TABLE time_zone_transition;\n"
"TRUNCATE TABLE time_zone_transition_type;\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 int
main(int argc, char **argv) main(int argc, char **argv)
{ {
const char *trunc_tables; const char *trunc_tables= "";
MY_INIT(argv[0]); MY_INIT(argv[0]);
load_defaults_or_exit("my", load_default_groups, &argc, &argv); load_defaults_or_exit("my", load_default_groups, &argc, &argv);
...@@ -2753,38 +2761,46 @@ main(int argc, char **argv) ...@@ -2753,38 +2761,46 @@ main(int argc, char **argv)
return 1; return 1;
} }
if (!(argc == 1 && !opt_leap)) if (argc == 1 && !opt_leap)
trunc_tables= "SELECT 'skip truncate tables';\n"; // No-op - needed for ELSE clause
else
trunc_tables= trunc_tables_const; 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 (opt_skip_write_binlog)
/* If skip_write_binlog is set and wsrep is compiled in we disable /* If turn off session wsrep if we cannot replicate using galera.
sql_log_bin and wsrep_on to avoid Galera replicating below Disable sql_log_bin as the name implies. */
TRUNCATE TABLE clauses. This will allow user to set different printf("execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF', 'do 0');\n"
time zones to nodes in Galera cluster. */ "SET @save_sql_log_bin=@@SQL_LOG_BIN;\n"
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" "SET SESSION SQL_LOG_BIN=0;\n"
"prepare set_wsrep_write_binlog from @prep1;\n" "%s%s;\n", trunc_tables, lock_tables);
"set @toggle=0; execute set_wsrep_write_binlog using @toggle;\n"
"%s%s", trunc_tables, lock_tables);
else else
// Alter time zone tables to InnoDB if wsrep_on is enabled // Alter time zone tables to InnoDB if wsrep_on is enabled
// to allow changes to them to replicate with Galera // to allow changes to them to replicate with Galera
printf("\\d |\n" printf(
"IF (select count(*) from information_schema.global_variables where\n" "execute immediate if(@wsrep_cannot_replicate_tz, " SAVE_ENGINE("time_zone") ", 'do 0');\n"
"variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n" "execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');\n"
"ALTER TABLE time_zone ENGINE=InnoDB;\n" "execute immediate if(@wsrep_cannot_replicate_tz, " SAVE_ENGINE("time_zone_name") ", 'do 0');\n"
"ALTER TABLE time_zone_name ENGINE=InnoDB;\n" "execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0');\n"
"ALTER TABLE time_zone_transition ENGINE=InnoDB;\n" "execute immediate if(@wsrep_cannot_replicate_tz, " SAVE_ENGINE("time_zone_transition") ", 'do 0');\n"
"ALTER TABLE time_zone_transition_type ENGINE=InnoDB;\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" "%s"
"START TRANSACTION;\n" "/*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', '%s')*/;\n"
"ELSE\n%s" , trunc_tables, lock_tables);
"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"
if (argc == 1 && !opt_leap) if (argc == 1 && !opt_leap)
{ {
...@@ -2832,17 +2848,22 @@ main(int argc, char **argv) ...@@ -2832,17 +2848,22 @@ main(int argc, char **argv)
free_root(&tz_storage, MYF(0)); free_root(&tz_storage, MYF(0));
} }
if(!opt_skip_write_binlog) if(opt_skip_write_binlog)
// Fall back to Aria printf("SET SESSION SQL_LOG_BIN=@save_sql_log_bin;\n"
printf("\\d |\n" "execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0');\n");
"IF (select count(*) from information_schema.global_variables where\n" else
"variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n" // Change back to what it was before
"ALTER TABLE time_zone ENGINE=Aria;\n" printf(
"ALTER TABLE time_zone_name ENGINE=Aria;\n" "execute immediate if(@wsrep_cannot_replicate_tz, "
"ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_time;\n" "concat('ALTER TABLE time_zone ENGINE=', @time_zone_engine), 'do 0');\n"
"ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id;\n" "execute immediate if(@wsrep_cannot_replicate_tz, "
"END IF|\n" "concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0');\n"
"\\d ;\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(); free_allocated_data();
my_end(0); 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