mirror of
https://github.com/MariaDB/server.git
synced 2025-11-28 17:36:30 +03:00
The --skip-write-binary-log added to mysql_tzinfo_to_sql in
MDEV-18778 was only effective if galera was enabled on the server.
This is because it tied together three concepts under one option:
1. binary logging
2. wsrep replication, and
3. using innodb as a transitional table type.
Change 1: small change in help option to reflect this.
To solve the performance problem with Aria tables, LOCK TABLES WRITE
is used to eliminate the need to fdatasync until the UNLOCK TABLES.
If galera isn't enabled, then we also want to use the LOCK TABLE WRITE
mechanism.
The START TRANSACTION added in MDEV-23440 needed to be moved to
before LOCK TABLES otherwise it would cancel their effect.
TRUNCATE TABLE statements also need to be before the LOCK TABLES.
When changing back from InnoDB to Aria, include the ORDER BY that
was originally there in 6aaccbcbf7 and matching the final ALTER
TABLE in the timezonedir branch.
Running: mariadb-tzinfo-to-sql --skip-write-binlog /usr/share/zoneinfo
now generates 16 Aria_transaction_log_syncs from 7053.
175 lines
6.8 KiB
Plaintext
175 lines
6.8 KiB
Plaintext
#
|
|
# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
|
|
#
|
|
# Verbose run
|
|
\d |
|
|
IF (select count(*) from information_schema.global_variables where
|
|
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
|
|
ALTER TABLE time_zone ENGINE=InnoDB;
|
|
ALTER TABLE time_zone_name ENGINE=InnoDB;
|
|
ALTER TABLE time_zone_transition ENGINE=InnoDB;
|
|
ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
|
|
TRUNCATE TABLE time_zone;
|
|
TRUNCATE TABLE time_zone_name;
|
|
TRUNCATE TABLE time_zone_transition;
|
|
TRUNCATE TABLE time_zone_transition_type;
|
|
START TRANSACTION;
|
|
ELSE
|
|
TRUNCATE TABLE time_zone;
|
|
TRUNCATE TABLE time_zone_name;
|
|
TRUNCATE TABLE time_zone_transition;
|
|
TRUNCATE TABLE time_zone_transition_type;
|
|
END IF|
|
|
\d ;
|
|
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.
|
|
UNLOCK TABLES;
|
|
COMMIT;
|
|
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;
|
|
\d |
|
|
IF (select count(*) from information_schema.global_variables where
|
|
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
|
|
ALTER TABLE time_zone ENGINE=Aria;
|
|
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 ;
|
|
# Silent run
|
|
\d |
|
|
IF (select count(*) from information_schema.global_variables where
|
|
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
|
|
ALTER TABLE time_zone ENGINE=InnoDB;
|
|
ALTER TABLE time_zone_name ENGINE=InnoDB;
|
|
ALTER TABLE time_zone_transition ENGINE=InnoDB;
|
|
ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
|
|
TRUNCATE TABLE time_zone;
|
|
TRUNCATE TABLE time_zone_name;
|
|
TRUNCATE TABLE time_zone_transition;
|
|
TRUNCATE TABLE time_zone_transition_type;
|
|
START TRANSACTION;
|
|
ELSE
|
|
TRUNCATE TABLE time_zone;
|
|
TRUNCATE TABLE time_zone_name;
|
|
TRUNCATE TABLE time_zone_transition;
|
|
TRUNCATE TABLE time_zone_transition_type;
|
|
END IF|
|
|
\d ;
|
|
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.
|
|
UNLOCK TABLES;
|
|
COMMIT;
|
|
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;
|
|
\d |
|
|
IF (select count(*) from information_schema.global_variables where
|
|
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
|
|
ALTER TABLE time_zone ENGINE=Aria;
|
|
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 ;
|
|
#
|
|
# Testing with explicit timezonefile
|
|
#
|
|
\d |
|
|
IF (select count(*) from information_schema.global_variables where
|
|
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
|
|
ALTER TABLE time_zone ENGINE=InnoDB;
|
|
ALTER TABLE time_zone_name ENGINE=InnoDB;
|
|
ALTER TABLE time_zone_transition ENGINE=InnoDB;
|
|
ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
|
|
SELECT 'skip truncate tables';
|
|
START TRANSACTION;
|
|
ELSE
|
|
SELECT 'skip truncate tables';
|
|
END IF|
|
|
\d ;
|
|
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')
|
|
;
|
|
UNLOCK TABLES;
|
|
COMMIT;
|
|
\d |
|
|
IF (select count(*) from information_schema.global_variables where
|
|
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
|
|
ALTER TABLE time_zone ENGINE=Aria;
|
|
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 ;
|
|
#
|
|
# Testing --leap
|
|
#
|
|
\d |
|
|
IF (select count(*) from information_schema.global_variables where
|
|
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
|
|
ALTER TABLE time_zone ENGINE=InnoDB;
|
|
ALTER TABLE time_zone_name ENGINE=InnoDB;
|
|
ALTER TABLE time_zone_transition ENGINE=InnoDB;
|
|
ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
|
|
SELECT 'skip truncate tables';
|
|
START TRANSACTION;
|
|
ELSE
|
|
SELECT 'skip truncate tables';
|
|
END IF|
|
|
\d ;
|
|
\d |
|
|
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=InnoDB;
|
|
END IF|
|
|
\d ;
|
|
TRUNCATE TABLE time_zone_leap_second;
|
|
\d |
|
|
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;
|
|
UNLOCK TABLES;
|
|
COMMIT;
|
|
\d |
|
|
IF (select count(*) from information_schema.global_variables where
|
|
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
|
|
ALTER TABLE time_zone ENGINE=Aria;
|
|
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 ;
|