You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MDEV-33044 Loading time zones does not work with alter_algorithm INPLACE
$MYSQL_TZINFO_TO_SQL works by truncating tables. Truncation is an
operation that cannot be done in-place and therefore is fundamentally
incompatible with alter_algorithm='INPLACE'. As a result, we override
the default alter_algorithm setting in tztime.cc to
alter_algorithm='COPY' so that timezones can be loaded regardless
of the previously set alter_algorithm.
All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer
Amazon Web Services, Inc.
Copy file name to clipboardExpand all lines: mysql-test/main/mysql_tzinfo_to_sql_symlink.result
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -20,12 +20,16 @@ ALTER TABLE time_zone ENGINE=InnoDB;
20
20
ALTER TABLE time_zone_name ENGINE=InnoDB;
21
21
ALTER TABLE time_zone_transition ENGINE=InnoDB;
22
22
ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
23
+
SET @old_alter_alg=@@SESSION.alter_algorithm;
24
+
SET session alter_algorithm='COPY';
23
25
TRUNCATE TABLE time_zone;
24
26
TRUNCATE TABLE time_zone_name;
25
27
TRUNCATE TABLE time_zone_transition;
26
28
TRUNCATE TABLE time_zone_transition_type;
27
29
START TRANSACTION;
28
30
ELSE
31
+
SET @old_alter_alg=@@SESSION.alter_algorithm;
32
+
SET session alter_algorithm='COPY';
29
33
TRUNCATE TABLE time_zone;
30
34
TRUNCATE TABLE time_zone_name;
31
35
TRUNCATE TABLE time_zone_transition;
@@ -62,6 +66,7 @@ ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_
62
66
ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id;
63
67
END IF|
64
68
\d ;
69
+
SET session alter_algorithm=@old_alter_alg;
65
70
SELECT COUNT(*) FROM time_zone;
66
71
COUNT(*)
67
72
0
@@ -85,12 +90,16 @@ ALTER TABLE time_zone ENGINE=InnoDB;
85
90
ALTER TABLE time_zone_name ENGINE=InnoDB;
86
91
ALTER TABLE time_zone_transition ENGINE=InnoDB;
87
92
ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
93
+
SET @old_alter_alg=@@SESSION.alter_algorithm;
94
+
SET session alter_algorithm='COPY';
88
95
TRUNCATE TABLE time_zone;
89
96
TRUNCATE TABLE time_zone_name;
90
97
TRUNCATE TABLE time_zone_transition;
91
98
TRUNCATE TABLE time_zone_transition_type;
92
99
START TRANSACTION;
93
100
ELSE
101
+
SET @old_alter_alg=@@SESSION.alter_algorithm;
102
+
SET session alter_algorithm='COPY';
94
103
TRUNCATE TABLE time_zone;
95
104
TRUNCATE TABLE time_zone_name;
96
105
TRUNCATE TABLE time_zone_transition;
@@ -124,6 +133,7 @@ ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_
124
133
ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id;
125
134
END IF|
126
135
\d ;
136
+
SET session alter_algorithm=@old_alter_alg;
127
137
SELECT COUNT(*) FROM time_zone;
128
138
COUNT(*)
129
139
2
@@ -145,6 +155,8 @@ COUNT(*)
145
155
set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION WSREP_ON=OFF', 'do 0');
146
156
SET SESSION SQL_LOG_BIN=0;
147
157
execute immediate @prep1;
158
+
SET @old_alter_alg=@@SESSION.alter_algorithm;
159
+
SET session alter_algorithm='COPY';
148
160
TRUNCATE TABLE time_zone;
149
161
TRUNCATE TABLE time_zone_name;
150
162
TRUNCATE TABLE time_zone_transition;
@@ -172,6 +184,7 @@ UNLOCK TABLES;
172
184
COMMIT;
173
185
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
174
186
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
187
+
SET session alter_algorithm=@old_alter_alg;
175
188
SELECT COUNT(*) FROM time_zone;
176
189
COUNT(*)
177
190
2
@@ -432,12 +445,16 @@ ALTER TABLE time_zone ENGINE=InnoDB;
432
445
ALTER TABLE time_zone_name ENGINE=InnoDB;
433
446
ALTER TABLE time_zone_transition ENGINE=InnoDB;
434
447
ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
448
+
SET @old_alter_alg=@@SESSION.alter_algorithm;
449
+
SET session alter_algorithm='COPY';
435
450
TRUNCATE TABLE time_zone;
436
451
TRUNCATE TABLE time_zone_name;
437
452
TRUNCATE TABLE time_zone_transition;
438
453
TRUNCATE TABLE time_zone_transition_type;
439
454
START TRANSACTION;
440
455
ELSE
456
+
SET @old_alter_alg=@@SESSION.alter_algorithm;
457
+
SET session alter_algorithm='COPY';
441
458
TRUNCATE TABLE time_zone;
442
459
TRUNCATE TABLE time_zone_name;
443
460
TRUNCATE TABLE time_zone_transition;
@@ -457,6 +474,7 @@ ALTER TABLE time_zone_transition ENGINE=Aria, ORDER BY Time_zone_id, Transition_
457
474
ALTER TABLE time_zone_transition_type ENGINE=Aria, ORDER BY Time_zone_id, Transition_type_id;
0 commit comments