-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-18778: mysql_tzinfo_to_sql does not work correctly in MariaDB Ga…
…lera There were two problems: (1) If user wanted same time zone information on all nodes in the Galera cluster all updates were not replicated as time zone information was stored on MyISAM tables. This is fixed on Galera by altering time zone tables to InnoDB while they are modified. (2) If user wanted different time zone information to nodes in the Galera cluster TRUNCATE TABLE for time zone tables was replicated by Galera destroying time zone information from other nodes. This is fixed on Galera by introducing new option for mysql_tzinfo_to_sql_symlink tool --skip-write-binlog to disable Galera replication while time zone tables are modified. Changes to be committed: modified: mysql-test/r/mysql_tzinfo_to_sql_symlink.result modified: mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result new file: mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result new file: mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test modified: sql/tztime.cc
- Loading branch information
Jan Lindström
committed
Aug 16, 2019
1 parent
1c75ad6
commit fa74088
Showing
5 changed files
with
319 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# | ||
# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above | ||
# | ||
# Verbose run | ||
set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?'); | ||
prepare set_wsrep_write_binlog from @prep1; | ||
set @toggle=0; execute set_wsrep_write_binlog using @toggle; | ||
TRUNCATE TABLE time_zone; | ||
TRUNCATE TABLE time_zone_name; | ||
TRUNCATE TABLE time_zone_transition; | ||
TRUNCATE TABLE time_zone_transition_type; | ||
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); | ||
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_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES | ||
(@time_zone_id, 0, 0, 0, 'GMT') | ||
; | ||
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it. | ||
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/ignored.tab' as time zone. Skipping it. | ||
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); | ||
SET @time_zone_id= LAST_INSERT_ID(); | ||
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id); | ||
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES | ||
(@time_zone_id, 0, 0, 0, 'GMT') | ||
; | ||
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. | ||
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it. | ||
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. | ||
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; | ||
# Silent run | ||
set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?'); | ||
prepare set_wsrep_write_binlog from @prep1; | ||
set @toggle=0; execute set_wsrep_write_binlog using @toggle; | ||
TRUNCATE TABLE time_zone; | ||
TRUNCATE TABLE time_zone_name; | ||
TRUNCATE TABLE time_zone_transition; | ||
TRUNCATE TABLE time_zone_transition_type; | ||
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); | ||
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_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES | ||
(@time_zone_id, 0, 0, 0, 'GMT') | ||
; | ||
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it. | ||
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); | ||
SET @time_zone_id= LAST_INSERT_ID(); | ||
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id); | ||
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES | ||
(@time_zone_id, 0, 0, 0, 'GMT') | ||
; | ||
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. | ||
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; | ||
# | ||
# Testing with explicit timezonefile | ||
# | ||
set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?'); | ||
prepare set_wsrep_write_binlog from @prep1; | ||
set @toggle=0; execute set_wsrep_write_binlog using @toggle; | ||
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); | ||
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_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES | ||
(@time_zone_id, 0, 0, 0, 'GMT') | ||
; | ||
# | ||
# Testing --leap | ||
# | ||
set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?'); | ||
prepare set_wsrep_write_binlog from @prep1; | ||
set @toggle=0; execute set_wsrep_write_binlog using @toggle; | ||
TRUNCATE TABLE time_zone_leap_second; | ||
ALTER TABLE time_zone_leap_second ORDER BY Transition_time; |
40 changes: 40 additions & 0 deletions
40
mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--source include/have_wsrep.inc | ||
--source include/have_symlink.inc | ||
--source include/not_windows.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 |
Oops, something went wrong.