From 3e86ab4d00f4b20904f378bcaa66132a77a5093f Mon Sep 17 00:00:00 2001 From: ParadoxV5 Date: Wed, 6 May 2026 19:00:16 -0600 Subject: [PATCH] MDEV-39418: Revert most of MDEV-39240 for MDEV-32188 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 3234045953 and most of f9c34a1442, keeping only the tweak to the MTR script `include/check_type` for consistency. --- .../binlog_encryption/rpl_typeconv.result | 25 ---------- .../suite/rpl/include/type_conversions.test | 23 ---------- mysql-test/suite/rpl/r/rpl_typeconv.result | 25 ---------- mysql-test/suite/rpl/t/rpl_typeconv.test | 1 - sql/rpl_record.cc | 46 +------------------ 5 files changed, 2 insertions(+), 118 deletions(-) diff --git a/mysql-test/suite/binlog_encryption/rpl_typeconv.result b/mysql-test/suite/binlog_encryption/rpl_typeconv.result index 101a31290fc51..173addd63fb87 100644 --- a/mysql-test/suite/binlog_encryption/rpl_typeconv.result +++ b/mysql-test/suite/binlog_encryption/rpl_typeconv.result @@ -51,10 +51,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; # MDEV-17098 DATE <-> DATETIME # # End of MDEV-17098 -# -# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs -# -# End of MDEV-39240 include/rpl_reset.inc connection slave; SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; @@ -71,10 +67,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; # MDEV-17098 DATE <-> DATETIME # # End of MDEV-17098 -# -# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs -# -# End of MDEV-39240 include/rpl_reset.inc connection slave; SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; @@ -91,10 +83,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; # MDEV-17098 DATE <-> DATETIME # # End of MDEV-17098 -# -# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs -# -# End of MDEV-39240 include/rpl_reset.inc connection slave; SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; @@ -111,10 +99,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; # MDEV-17098 DATE <-> DATETIME # # End of MDEV-17098 -# -# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs -# -# End of MDEV-39240 include/rpl_reset.inc connection slave; **** Result of conversions **** @@ -283,8 +267,6 @@ DATE DATETIME(0) DATETIME(6) DATE DATETIME(6) DATE DATETIME(0) DATE -TIMESTAMP(0) TIMESTAMP(0) -TIMESTAMP(0) TIMESTAMP(0) TINYBLOB TINYBLOB ALL_NON_LOSSY TINYBLOB BLOB ALL_NON_LOSSY TINYBLOB MEDIUMBLOB ALL_NON_LOSSY @@ -449,8 +431,6 @@ DATE DATETIME(0) ALL_NON_LOSSY DATETIME(6) DATE ALL_NON_LOSSY DATETIME(6) DATE ALL_NON_LOSSY DATETIME(0) DATE ALL_NON_LOSSY -TIMESTAMP(0) TIMESTAMP(0) ALL_NON_LOSSY -TIMESTAMP(0) TIMESTAMP(0) ALL_NON_LOSSY TINYBLOB TINYBLOB ALL_LOSSY TINYBLOB BLOB ALL_LOSSY TINYBLOB MEDIUMBLOB ALL_LOSSY @@ -615,8 +595,6 @@ DATE DATETIME(0) ALL_LOSSY DATETIME(6) DATE ALL_LOSSY DATETIME(6) DATE ALL_LOSSY DATETIME(0) DATE ALL_LOSSY -TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY -TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY TINYBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY @@ -781,11 +759,8 @@ DATE DATETIME(0) ALL_LOSSY,ALL_NON_LOSSY DATETIME(6) DATE ALL_LOSSY,ALL_NON_LOSSY DATETIME(6) DATE ALL_LOSSY,ALL_NON_LOSSY DATETIME(0) DATE ALL_LOSSY,ALL_NON_LOSSY -TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY,ALL_NON_LOSSY -TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY,ALL_NON_LOSSY DROP TABLE type_conversions; call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677"); -call mtr.add_suppression("Slave: Got error.*: 1030"); connection master; DROP TABLE t1; connection slave; diff --git a/mysql-test/suite/rpl/include/type_conversions.test b/mysql-test/suite/rpl/include/type_conversions.test index 76e52a9171106..edd46f14ba9a9 100644 --- a/mysql-test/suite/rpl/include/type_conversions.test +++ b/mysql-test/suite/rpl/include/type_conversions.test @@ -1,5 +1,4 @@ # File containing different lossy and non-lossy type conversions. ---source include/have_debug.inc # Integral conversion testing, we do not reduce the test using # transitivity of conversions since the implementation is not using a @@ -1268,28 +1267,6 @@ let $source_temp_format=; let $target_temp_format=; --echo # End of MDEV-17098 ---echo # ---echo # MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs ---echo # ---connection master -SET @save_dbug= @@GLOBAL.debug_dbug; -SET @@GLOBAL.debug_dbug= '+d,rpl_pack_simulate_negation'; -let $source_type= TIMESTAMP(0); -let $target_type= TIMESTAMP(0); - -let $source_value= '0000-00-00 00:00:00'; # ~0 = Y2106 Epochalypse II -let $target_value= FROM_UNIXTIME((1<<31) - 1); # Y2038 Epochalypse I -let $can_convert = 1; -source suite/rpl/include/check_type.inc; - -let $source_value= FROM_UNIXTIME(1); # ~1 = not at an Epochalypse -let $can_convert = 0; -source suite/rpl/include/check_type.inc; - ---connection master -SET @@GLOBAL.debug_dbug= @save_dbug; ---echo # End of MDEV-39240 - --source include/rpl_reset.inc enable_query_log; diff --git a/mysql-test/suite/rpl/r/rpl_typeconv.result b/mysql-test/suite/rpl/r/rpl_typeconv.result index 101a31290fc51..173addd63fb87 100644 --- a/mysql-test/suite/rpl/r/rpl_typeconv.result +++ b/mysql-test/suite/rpl/r/rpl_typeconv.result @@ -51,10 +51,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; # MDEV-17098 DATE <-> DATETIME # # End of MDEV-17098 -# -# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs -# -# End of MDEV-39240 include/rpl_reset.inc connection slave; SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; @@ -71,10 +67,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; # MDEV-17098 DATE <-> DATETIME # # End of MDEV-17098 -# -# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs -# -# End of MDEV-39240 include/rpl_reset.inc connection slave; SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; @@ -91,10 +83,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; # MDEV-17098 DATE <-> DATETIME # # End of MDEV-17098 -# -# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs -# -# End of MDEV-39240 include/rpl_reset.inc connection slave; SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; @@ -111,10 +99,6 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; # MDEV-17098 DATE <-> DATETIME # # End of MDEV-17098 -# -# MDEV-39240 Invalid / MDEV-32188-only TIMESTAMPs -# -# End of MDEV-39240 include/rpl_reset.inc connection slave; **** Result of conversions **** @@ -283,8 +267,6 @@ DATE DATETIME(0) DATETIME(6) DATE DATETIME(6) DATE DATETIME(0) DATE -TIMESTAMP(0) TIMESTAMP(0) -TIMESTAMP(0) TIMESTAMP(0) TINYBLOB TINYBLOB ALL_NON_LOSSY TINYBLOB BLOB ALL_NON_LOSSY TINYBLOB MEDIUMBLOB ALL_NON_LOSSY @@ -449,8 +431,6 @@ DATE DATETIME(0) ALL_NON_LOSSY DATETIME(6) DATE ALL_NON_LOSSY DATETIME(6) DATE ALL_NON_LOSSY DATETIME(0) DATE ALL_NON_LOSSY -TIMESTAMP(0) TIMESTAMP(0) ALL_NON_LOSSY -TIMESTAMP(0) TIMESTAMP(0) ALL_NON_LOSSY TINYBLOB TINYBLOB ALL_LOSSY TINYBLOB BLOB ALL_LOSSY TINYBLOB MEDIUMBLOB ALL_LOSSY @@ -615,8 +595,6 @@ DATE DATETIME(0) ALL_LOSSY DATETIME(6) DATE ALL_LOSSY DATETIME(6) DATE ALL_LOSSY DATETIME(0) DATE ALL_LOSSY -TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY -TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY TINYBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY @@ -781,11 +759,8 @@ DATE DATETIME(0) ALL_LOSSY,ALL_NON_LOSSY DATETIME(6) DATE ALL_LOSSY,ALL_NON_LOSSY DATETIME(6) DATE ALL_LOSSY,ALL_NON_LOSSY DATETIME(0) DATE ALL_LOSSY,ALL_NON_LOSSY -TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY,ALL_NON_LOSSY -TIMESTAMP(0) TIMESTAMP(0) ALL_LOSSY,ALL_NON_LOSSY DROP TABLE type_conversions; call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677"); -call mtr.add_suppression("Slave: Got error.*: 1030"); connection master; DROP TABLE t1; connection slave; diff --git a/mysql-test/suite/rpl/t/rpl_typeconv.test b/mysql-test/suite/rpl/t/rpl_typeconv.test index e839b51f02d5a..68e32e0dff96d 100644 --- a/mysql-test/suite/rpl/t/rpl_typeconv.test +++ b/mysql-test/suite/rpl/t/rpl_typeconv.test @@ -69,7 +69,6 @@ enable_query_log; DROP TABLE type_conversions; call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677"); -call mtr.add_suppression("Slave: Got error.*: 1030"); connection master; DROP TABLE t1; diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index 7be43e67cf67f..32f7c992f4417 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -100,15 +100,11 @@ pack_row(TABLE *table, MY_BITMAP const* cols, length is stored in little-endian format, since this is the format used for the binlog. */ -#ifndef DBUG_OFF - uchar *old_pack_ptr= pack_ptr; +#if !defined DBUG_OFF && defined DBUG_TRACE + const uchar *old_pack_ptr= pack_ptr; #endif pack_ptr= field->pack(pack_ptr, field->ptr + offset, field->max_data_length()); - DBUG_EXECUTE_IF("rpl_pack_simulate_negation", - for (uchar *byte= old_pack_ptr; byte < pack_ptr; ++byte) - *byte= ~*byte; - ); DBUG_PRINT("debug", ("field: %s; real_type: %d, pack_ptr: %p;" " pack_ptr':%p; bytes: %d", field->field_name.str, field->real_type(), @@ -340,8 +336,6 @@ static void convert_field(Field *f, Field *result_field, Field *conv_field) A generic, internal, error caused the unpacking to fail. @retval HA_ERR_CORRUPT_EVENT Found error when trying to unpack fields. - @retval HA_ERR_ROWS_EVENT_APPLY - Found error when validating field values. */ 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, DBUG_RETURN(HA_ERR_CORRUPT_EVENT); } - // Validate this external data - switch (f->type()) { - case MYSQL_TYPE_TIMESTAMP: - { - ulong microseconds; - my_time_t seconds= f->get_timestamp(µseconds); - if (likely(microseconds <= TIME_MAX_SECOND_PART)) - { - if (likely(seconds >= 0 && seconds <= TIMESTAMP_MAX_VALUE)) - break; - /* - `my_time_t` is signed, whereas `UINT_MAX32` is - unsigned if `long` is 32-bit and signed otherwise. - */ - else if (likely(seconds == static_cast(UINT_MAX32))) - { - // Normalize MariaDB 11.5.1+ Epochalypse - f->store_timestamp(TIMESTAMP_MAX_VALUE, microseconds); - break; - } - } - static const char unixtime_format[]= - "FROM_UNIXTIME(%ld + %lu/1""000""000)"; - // + strlen("2147483648""16777215") - strlen("%ld""%lu") - char unixtime[sizeof(unixtime_format) + 12]; - snprintf(unixtime, sizeof(unixtime), unixtime_format, - seconds, microseconds); - rgi->rli->report(ERROR_LEVEL, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, - rgi->gtid_info(), ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), - f->type_handler()->name().ptr(), unixtime, table->s->db.str, - table->s->table_name.str, f->field_name.str, 0lu); - DBUG_RETURN(HA_ERR_ROWS_EVENT_APPLY); - } - default:; - } - /* If conv_field is set, then we are doing a conversion. In this case, we have unpacked the master data to the conversion