1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-32188 make TIMESTAMP use whole 32-bit unsigned range

This patch extends the timestamp from
2038-01-19 03:14:07.999999 to 2106-02-07 06:28:15.999999
for 64 bit hardware and OS where 'long' is 64 bits.
This is true for 64 bit Linux but not for Windows.

This is done by treating the 32 bit stored int as unsigned instead of
signed.  This is safe as MariaDB has never accepted dates before the epoch
(1970).
The benefit of this approach that for normal timestamp the storage is
compatible with earlier version.

However for tables using system versioning we before stored a
timestamp with the year 2038 as the 'max timestamp', which is used to
detect current values.  This patch stores the new 2106 year max value
as the max timestamp. This means that old tables using system
versioning needs to be updated with mariadb-upgrade when moving them
to 11.4. That will be done in a separate commit.
This commit is contained in:
Monty
2023-09-11 17:58:22 +03:00
committed by Sergei Golubchik
parent ce6cce85d4
commit dfdedd46e4
90 changed files with 1227 additions and 354 deletions

View File

@@ -1,6 +1,7 @@
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
--source include/have_innodb.inc
--source suite/versioning/sys_time.inc
--echo # MDEV-16252: MINIMAL binlog_row_image does not work for versioned tables
set @old_row_image= @@binlog_row_image;
@@ -39,6 +40,7 @@ show create table t1;
set timestamp= 12345;
--let $start_pos= query_get_value("SHOW MASTER STATUS", Position, 1)
insert t1 values (1, 1);
--replace_result $sys_timestamp_max TIMESTAMP_MAX
select *, unix_timestamp(row_start) as row_start, unix_timestamp(row_end) as row_end from t1;
--let $stop_pos= query_get_value("SHOW MASTER STATUS", Position, 1)
set timestamp= default;
@@ -46,6 +48,7 @@ set timestamp= default;
# NOTE: pipe grep is not Windows-compatible
--let grep_file= $TMP/out.txt
--let grep_regex= ^###
--let grep_filter=s{$sys_timestamp_max}{MAX_TIMESTAMP};
--exec $MYSQL_BINLOG -v -j $start_pos --stop-position=$stop_pos -o 3 $MYSQLD_DATADIR/master-bin.000001 > $grep_file
--source include/grep.inc
--sync_slave_with_master