Skip to content

Commit 3e86ab4

Browse files
committed
MDEV-39418: Revert most of MDEV-39240 for MDEV-32188
MDEV-39240 fixed how servers before 11.5/11.4-enterprise accepted timestamps beyond Year 2038 from row-based replication, which were invalid until 11.5/11.4-enterprise’s MDEV-32188. MDEV-39240 does not apply after MDEV-32188 extended the valid range, so those versions should exclude this fix, as if MDEV-32188 already covers it. This commit reverts commits 3234045 and most of f9c34a1, keeping only the tweak to the MTR script `include/check_type` for consistency.
1 parent f48be8a commit 3e86ab4

5 files changed

Lines changed: 2 additions & 118 deletions

File tree

mysql-test/suite/binlog_encryption/rpl_typeconv.result

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
5151
# MDEV-17098 DATE <-> DATETIME
5252
#
5353
# End of MDEV-17098
54-
#
55-
# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs
56-
#
57-
# End of MDEV-39240
5854
include/rpl_reset.inc
5955
connection slave;
6056
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
@@ -71,10 +67,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
7167
# MDEV-17098 DATE <-> DATETIME
7268
#
7369
# End of MDEV-17098
74-
#
75-
# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs
76-
#
77-
# End of MDEV-39240
7870
include/rpl_reset.inc
7971
connection slave;
8072
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
@@ -91,10 +83,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
9183
# MDEV-17098 DATE <-> DATETIME
9284
#
9385
# End of MDEV-17098
94-
#
95-
# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs
96-
#
97-
# End of MDEV-39240
9886
include/rpl_reset.inc
9987
connection slave;
10088
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
@@ -111,10 +99,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
11199
# MDEV-17098 DATE <-> DATETIME
112100
#
113101
# End of MDEV-17098
114-
#
115-
# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs
116-
#
117-
# End of MDEV-39240
118102
include/rpl_reset.inc
119103
connection slave;
120104
**** Result of conversions ****
@@ -283,8 +267,6 @@ DATE DATETIME(0) <Correct error>
283267
DATETIME(6) DATE <Correct error>
284268
DATETIME(6) DATE <Correct error>
285269
DATETIME(0) DATE <Correct error>
286-
TIMESTAMP(0) TIMESTAMP(0) <Correct value>
287-
TIMESTAMP(0) TIMESTAMP(0) <Correct error>
288270
TINYBLOB TINYBLOB ALL_NON_LOSSY <Correct value>
289271
TINYBLOB BLOB ALL_NON_LOSSY <Correct value>
290272
TINYBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
@@ -449,8 +431,6 @@ DATE DATETIME(0) ALL_NON_LOSSY <Correct value>
449431
DATETIME(6) DATE ALL_NON_LOSSY <Correct error>
450432
DATETIME(6) DATE ALL_NON_LOSSY <Correct error>
451433
DATETIME(0) DATE ALL_NON_LOSSY <Correct error>
452-
TIMESTAMP(0) TIMESTAMP(0) ALL_NON_LOSSY <Correct value>
453-
TIMESTAMP(0) TIMESTAMP(0) ALL_NON_LOSSY <Correct error>
454434
TINYBLOB TINYBLOB ALL_LOSSY <Correct value>
455435
TINYBLOB BLOB ALL_LOSSY <Correct error>
456436
TINYBLOB MEDIUMBLOB ALL_LOSSY <Correct error>
@@ -615,8 +595,6 @@ DATE DATETIME(0) ALL_LOSSY <Correct error>
615595
DATETIME(6) DATE ALL_LOSSY <Correct value>
616596
DATETIME(6) DATE ALL_LOSSY <Correct value>
617597
DATETIME(0) DATE ALL_LOSSY <Correct value>
618-
TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY <Correct value>
619-
TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY <Correct error>
620598
TINYBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
621599
TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
622600
TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
@@ -781,11 +759,8 @@ DATE DATETIME(0) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
781759
DATETIME(6) DATE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
782760
DATETIME(6) DATE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
783761
DATETIME(0) DATE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
784-
TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
785-
TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY,ALL_NON_LOSSY <Correct error>
786762
DROP TABLE type_conversions;
787763
call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677");
788-
call mtr.add_suppression("Slave: Got error.*: 1030");
789764
connection master;
790765
DROP TABLE t1;
791766
connection slave;

mysql-test/suite/rpl/include/type_conversions.test

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# File containing different lossy and non-lossy type conversions.
2-
--source include/have_debug.inc
32

43
# Integral conversion testing, we do not reduce the test using
54
# transitivity of conversions since the implementation is not using a
@@ -1268,28 +1267,6 @@ let $source_temp_format=;
12681267
let $target_temp_format=;
12691268
--echo # End of MDEV-17098
12701269

1271-
--echo #
1272-
--echo # MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs
1273-
--echo #
1274-
--connection master
1275-
SET @save_dbug= @@GLOBAL.debug_dbug;
1276-
SET @@GLOBAL.debug_dbug= '+d,rpl_pack_simulate_negation';
1277-
let $source_type= TIMESTAMP(0);
1278-
let $target_type= TIMESTAMP(0);
1279-
1280-
let $source_value= '0000-00-00 00:00:00'; # ~0 = Y2106 Epochalypse II
1281-
let $target_value= FROM_UNIXTIME((1<<31) - 1); # Y2038 Epochalypse I
1282-
let $can_convert = 1;
1283-
source suite/rpl/include/check_type.inc;
1284-
1285-
let $source_value= FROM_UNIXTIME(1); # ~1 = not at an Epochalypse
1286-
let $can_convert = 0;
1287-
source suite/rpl/include/check_type.inc;
1288-
1289-
--connection master
1290-
SET @@GLOBAL.debug_dbug= @save_dbug;
1291-
--echo # End of MDEV-39240
1292-
12931270

12941271
--source include/rpl_reset.inc
12951272
enable_query_log;

mysql-test/suite/rpl/r/rpl_typeconv.result

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
5151
# MDEV-17098 DATE <-> DATETIME
5252
#
5353
# End of MDEV-17098
54-
#
55-
# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs
56-
#
57-
# End of MDEV-39240
5854
include/rpl_reset.inc
5955
connection slave;
6056
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
@@ -71,10 +67,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
7167
# MDEV-17098 DATE <-> DATETIME
7268
#
7369
# End of MDEV-17098
74-
#
75-
# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs
76-
#
77-
# End of MDEV-39240
7870
include/rpl_reset.inc
7971
connection slave;
8072
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
@@ -91,10 +83,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
9183
# MDEV-17098 DATE <-> DATETIME
9284
#
9385
# End of MDEV-17098
94-
#
95-
# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs
96-
#
97-
# End of MDEV-39240
9886
include/rpl_reset.inc
9987
connection slave;
10088
SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
@@ -111,10 +99,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
11199
# MDEV-17098 DATE <-> DATETIME
112100
#
113101
# End of MDEV-17098
114-
#
115-
# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs
116-
#
117-
# End of MDEV-39240
118102
include/rpl_reset.inc
119103
connection slave;
120104
**** Result of conversions ****
@@ -283,8 +267,6 @@ DATE DATETIME(0) <Correct error>
283267
DATETIME(6) DATE <Correct error>
284268
DATETIME(6) DATE <Correct error>
285269
DATETIME(0) DATE <Correct error>
286-
TIMESTAMP(0) TIMESTAMP(0) <Correct value>
287-
TIMESTAMP(0) TIMESTAMP(0) <Correct error>
288270
TINYBLOB TINYBLOB ALL_NON_LOSSY <Correct value>
289271
TINYBLOB BLOB ALL_NON_LOSSY <Correct value>
290272
TINYBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
@@ -449,8 +431,6 @@ DATE DATETIME(0) ALL_NON_LOSSY <Correct value>
449431
DATETIME(6) DATE ALL_NON_LOSSY <Correct error>
450432
DATETIME(6) DATE ALL_NON_LOSSY <Correct error>
451433
DATETIME(0) DATE ALL_NON_LOSSY <Correct error>
452-
TIMESTAMP(0) TIMESTAMP(0) ALL_NON_LOSSY <Correct value>
453-
TIMESTAMP(0) TIMESTAMP(0) ALL_NON_LOSSY <Correct error>
454434
TINYBLOB TINYBLOB ALL_LOSSY <Correct value>
455435
TINYBLOB BLOB ALL_LOSSY <Correct error>
456436
TINYBLOB MEDIUMBLOB ALL_LOSSY <Correct error>
@@ -615,8 +595,6 @@ DATE DATETIME(0) ALL_LOSSY <Correct error>
615595
DATETIME(6) DATE ALL_LOSSY <Correct value>
616596
DATETIME(6) DATE ALL_LOSSY <Correct value>
617597
DATETIME(0) DATE ALL_LOSSY <Correct value>
618-
TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY <Correct value>
619-
TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY <Correct error>
620598
TINYBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
621599
TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
622600
TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
@@ -781,11 +759,8 @@ DATE DATETIME(0) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
781759
DATETIME(6) DATE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
782760
DATETIME(6) DATE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
783761
DATETIME(0) DATE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
784-
TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
785-
TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY,ALL_NON_LOSSY <Correct error>
786762
DROP TABLE type_conversions;
787763
call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677");
788-
call mtr.add_suppression("Slave: Got error.*: 1030");
789764
connection master;
790765
DROP TABLE t1;
791766
connection slave;

mysql-test/suite/rpl/t/rpl_typeconv.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ enable_query_log;
6969
DROP TABLE type_conversions;
7070

7171
call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677");
72-
call mtr.add_suppression("Slave: Got error.*: 1030");
7372

7473
connection master;
7574
DROP TABLE t1;

sql/rpl_record.cc

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,11 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
100100
length is stored in little-endian format, since this is the
101101
format used for the binlog.
102102
*/
103-
#ifndef DBUG_OFF
104-
uchar *old_pack_ptr= pack_ptr;
103+
#if !defined DBUG_OFF && defined DBUG_TRACE
104+
const uchar *old_pack_ptr= pack_ptr;
105105
#endif
106106
pack_ptr= field->pack(pack_ptr, field->ptr + offset,
107107
field->max_data_length());
108-
DBUG_EXECUTE_IF("rpl_pack_simulate_negation",
109-
for (uchar *byte= old_pack_ptr; byte < pack_ptr; ++byte)
110-
*byte= ~*byte;
111-
);
112108
DBUG_PRINT("debug", ("field: %s; real_type: %d, pack_ptr: %p;"
113109
" pack_ptr':%p; bytes: %d",
114110
field->field_name.str, field->real_type(),
@@ -340,8 +336,6 @@ static void convert_field(Field *f, Field *result_field, Field *conv_field)
340336
A generic, internal, error caused the unpacking to fail.
341337
@retval HA_ERR_CORRUPT_EVENT
342338
Found error when trying to unpack fields.
343-
@retval HA_ERR_ROWS_EVENT_APPLY
344-
Found error when validating field values.
345339
*/
346340

347341
int unpack_row(const rpl_group_info *rgi, TABLE *table, uint const colcnt,
@@ -414,42 +408,6 @@ int unpack_row(const rpl_group_info *rgi, TABLE *table, uint const colcnt,
414408
DBUG_RETURN(HA_ERR_CORRUPT_EVENT);
415409
}
416410

417-
// Validate this external data
418-
switch (f->type()) {
419-
case MYSQL_TYPE_TIMESTAMP:
420-
{
421-
ulong microseconds;
422-
my_time_t seconds= f->get_timestamp(&microseconds);
423-
if (likely(microseconds <= TIME_MAX_SECOND_PART))
424-
{
425-
if (likely(seconds >= 0 && seconds <= TIMESTAMP_MAX_VALUE))
426-
break;
427-
/*
428-
`my_time_t` is signed, whereas `UINT_MAX32` is
429-
unsigned if `long` is 32-bit and signed otherwise.
430-
*/
431-
else if (likely(seconds == static_cast<my_time_t>(UINT_MAX32)))
432-
{
433-
// Normalize MariaDB 11.5.1+ Epochalypse
434-
f->store_timestamp(TIMESTAMP_MAX_VALUE, microseconds);
435-
break;
436-
}
437-
}
438-
static const char unixtime_format[]=
439-
"FROM_UNIXTIME(%ld + %lu/1""000""000)";
440-
// + strlen("2147483648""16777215") - strlen("%ld""%lu")
441-
char unixtime[sizeof(unixtime_format) + 12];
442-
snprintf(unixtime, sizeof(unixtime), unixtime_format,
443-
seconds, microseconds);
444-
rgi->rli->report(ERROR_LEVEL, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
445-
rgi->gtid_info(), ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
446-
f->type_handler()->name().ptr(), unixtime, table->s->db.str,
447-
table->s->table_name.str, f->field_name.str, 0lu);
448-
DBUG_RETURN(HA_ERR_ROWS_EVENT_APPLY);
449-
}
450-
default:;
451-
}
452-
453411
/*
454412
If conv_field is set, then we are doing a conversion. In this
455413
case, we have unpacked the master data to the conversion

0 commit comments

Comments
 (0)