1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

ALTER TABLE and replication should convert old row_end timestamps to new timestamp range

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

- Added --update-history option to mariadb-dump to change 2038
  row_end timestamp to 2106.
- Updated ALTER TABLE ... to convert old row_end timestamps to
  2106 timestamp for tables created before MariaDB 11.4.0.
- Fixed bug in CHECK TABLE where we wrongly suggested to USE REPAIR
  TABLE when ALTER TABLE...FORCE is needed.
- mariadb-check printed table names that where used with REPAIR TABLE but
  did not print table names used with ALTER TABLE or with name repair.
  Fixed by always printing a table that is fixed if --silent is not
  used.
- Added TABLE::vers_fix_old_timestamp() that will change max-timestamp
  for versioned tables when replication from a pre-11.4.0 server.

A few test cases changed. This is caused by:
- CHECK TABLE now prints 'Please do ALTER TABLE... instead of
  'Please do REPAIR TABLE' when there is a problem with the information
  in the .frm file (for example a very old frm file).
- mariadb-check now prints repaired table names.
- mariadb-check also now prints nicer error message in case ALTER TABLE
  is needed to repair a table.
This commit is contained in:
Monty
2023-12-19 17:51:23 +02:00
committed by Sergei Golubchik
parent c4cad8d50c
commit 24c57165d5
37 changed files with 438 additions and 110 deletions

View File

@ -4977,6 +4977,26 @@ int handler::check_long_hash_compatibility() const
}
int handler::check_versioned_compatibility() const
{
/* Versioned timestamp extended in 11.5.0 for 64 bit systems */
if (table->s->mysql_version < 110500 && table->versioned() &&
TIMESTAMP_MAX_YEAR == 2106)
return HA_ADMIN_NEEDS_DATA_CONVERSION;
return 0;
}
int handler::check_versioned_compatibility(uint mysql_version) const
{
/* Versioned timestamp extended in 11.4.0 for 64 bit systems */
if (mysql_version < 110500 && table->versioned() &&
TIMESTAMP_MAX_YEAR == 2106)
return HA_ADMIN_NEEDS_DATA_CONVERSION;
return 0;
}
int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
{
int error;
@ -5025,6 +5045,9 @@ int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
if (unlikely((error= check_long_hash_compatibility())))
return error;
if (unlikely((error= check_versioned_compatibility())))
return error;
return check_for_upgrade(check_opt);
}
@ -5083,7 +5106,6 @@ err:
}
/**
@return
key if error because of duplicated keys
@ -5225,7 +5247,7 @@ bool non_existing_table_error(int error)
@retval
HA_ADMIN_OK Successful upgrade
@retval
HA_ADMIN_NEEDS_UPGRADE Table has structures requiring upgrade
HA_ADMIN_NEEDS_UPGRADE Table has structures requiring REPAIR TABLE
@retval
HA_ADMIN_NEEDS_ALTER Table has structures requiring ALTER TABLE
@retval