1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
|
#
# MDEV-29322 ASAN use-after-free options_written_to_bin_log
#
include/master-slave.inc
[connection master]
# A. set the master and slave explicit_defaults_for_timestamp values crisscross to (1,0)
connection master;
set @sav.explicit_defaults_for_timestamp = @@session.explicit_defaults_for_timestamp;
set @@session.explicit_defaults_for_timestamp = 1;
connection slave;
set @sav.explicit_defaults_for_timestamp = @@global.explicit_defaults_for_timestamp;
set global explicit_defaults_for_timestamp = 0;
Warnings:
Warning 1287 'explicit_defaults_for_timestamp=0' is deprecated and will be removed in a future release
set @sav.slave_parallel_workers = @@global.slave_parallel_workers;
include/stop_slave.inc
set @@global.slave_parallel_workers = 1;
include/start_slave.inc
connection slave;
include/stop_slave.inc
include/reset_slave.inc
connection master;
reset master;
create table t2 (a timestamp, b int);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` timestamp NULL DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
connection slave;
include/start_slave.inc
include/stop_slave.inc
connection master;
insert into t2 values (null, 1);
flush binary logs;
flush binary logs;
insert into t2 values (null, 2);
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1658586280/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8mb3 *//*!*/;
SET @@session.character_set_client=utf8mb3,@@session.collation_connection=33,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
create table t1 (f1 timestamp, f2 timestamp)
/*!*/;
START TRANSACTION
/*!*/;
SET TIMESTAMP=1658586288/*!*/;
insert t1 values (NULL, NULL)
/*!*/;
SET TIMESTAMP=1658586288/*!*/;
COMMIT
/*!*/;
START TRANSACTION
/*!*/;
SET TIMESTAMP=1658586335/*!*/;
insert t1 () values ()
/*!*/;
SET TIMESTAMP=1658586335/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
connection slave1;
lock table t2 write;
connection slave;
include/start_slave.inc
connection slave1;
unlock tables;
connection slave;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` timestamp NULL DEFAULT NULL,
`f2` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
set statement time_zone='+2:00' for select * from t1;
f1 f2
NULL NULL
NULL NULL
drop table t1;
connection master;
connection slave;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` timestamp NULL DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
include/diff_tables.inc [master:t2,slave:t2]
connection master;
drop table t2;
connection slave;
# B. alternate the master and slave vars' values to (0,1)
connection master;
set @@session.explicit_defaults_for_timestamp = 0;
Warnings:
Warning 1287 'explicit_defaults_for_timestamp=0' is deprecated and will be removed in a future release
connection slave;
set @@global.explicit_defaults_for_timestamp = 1;
connection slave;
include/stop_slave.inc
include/reset_slave.inc
Warnings:
Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
reset master;
create table t2 (a timestamp, b int);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
connection slave;
include/start_slave.inc
include/stop_slave.inc
connection master;
insert into t2 values (null, 1);
flush binary logs;
flush binary logs;
insert into t2 values (null, 2);
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1658586280/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8mb3 *//*!*/;
SET @@session.character_set_client=utf8mb3,@@session.collation_connection=33,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
create table t1 (f1 timestamp, f2 timestamp)
/*!*/;
START TRANSACTION
/*!*/;
SET TIMESTAMP=1658586288/*!*/;
insert t1 values (NULL, NULL)
/*!*/;
SET TIMESTAMP=1658586288/*!*/;
COMMIT
/*!*/;
START TRANSACTION
/*!*/;
SET TIMESTAMP=1658586335/*!*/;
insert t1 () values ()
/*!*/;
SET TIMESTAMP=1658586335/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
connection slave1;
lock table t2 write;
connection slave;
include/start_slave.inc
connection slave1;
unlock tables;
connection slave;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`f2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
set statement time_zone='+2:00' for select * from t1;
f1 f2
2022-07-23 16:24:48 2022-07-23 16:24:48
2022-07-23 16:25:35 0000-00-00 00:00:00
drop table t1;
connection master;
connection slave;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
include/diff_tables.inc [master:t2,slave:t2]
connection master;
drop table t2;
connection slave;
# C. the bug case on the same version binlogs also to demo on the patch's base
include/stop_slave.inc
set @@global.slave_parallel_workers = 4;
include/start_slave.inc
connection slave;
include/stop_slave.inc
include/reset_slave.inc
Warnings:
Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
reset master;
create table t2 (a timestamp, b int);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
connection slave;
include/start_slave.inc
include/stop_slave.inc
connection master;
connection slave;
include/start_slave.inc
connection slave;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
include/diff_tables.inc [master:t2,slave:t2]
connection master;
drop table t2;
connection slave;
connection master;
set @@session.explicit_defaults_for_timestamp = @sav.explicit_defaults_for_timestamp;
connection slave;
set @@global.explicit_defaults_for_timestamp = @sav.explicit_defaults_for_timestamp;
include/stop_slave.inc
set @@global.slave_parallel_workers = @sav.slave_parallel_workers;
include/start_slave.inc
include/rpl_end.inc
|