mariadb/mysql-test/suite
Marko Mäkelä 0381921e26 MDEV-33277 In-place upgrade causes invalid AUTO_INCREMENT values
MDEV-33308 CHECK TABLE is modifying .frm file even if --read-only

As noted in commit d0ef1aaf61,
MySQL as well as older versions of MariaDB server would during
ALTER TABLE ... IMPORT TABLESPACE write bogus values to the
PAGE_MAX_TRX_ID field to pages of the clustered index, instead of
letting that field remain 0.
In commit 8777458a6e this field
was repurposed for PAGE_ROOT_AUTO_INC in the clustered index root page.

To avoid trouble when upgrading from MySQL or older versions of MariaDB,
we will try to detect and correct bogus values of PAGE_ROOT_AUTO_INC
when opening a table for the first time from the SQL layer.

btr_read_autoinc_with_fallback(): Add the parameters to mysql_version,max
to indicate the TABLE_SHARE::mysql_version of the .frm file and the
maximum value allowed for the type of the AUTO_INCREMENT column.
In case the table was originally created in MySQL or an older version of
MariaDB, read also the maximum value of the AUTO_INCREMENT column from
the table and reset the PAGE_ROOT_AUTO_INC if it is above the limit.

dict_table_t::get_index(const dict_col_t &) const: Find an index that
starts with the specified column.

ha_innobase::check_for_upgrade(): Return HA_ADMIN_FAILED if InnoDB
needs upgrading but is in read-only mode. In this way, the call to
update_frm_version() will be skipped.

row_import_autoinc(): Adjust the AUTO_INCREMENT column at the end of
ALTER TABLE...IMPORT TABLESPACE. This refinement was suggested by
Debarun Banerjee.

The changes outside InnoDB were developed by Michael 'Monty' Widenius:

Added print_check_msg() service for easy reporting of check/repair messages
in ENGINE=Aria and ENGINE=InnoDB.
Fixed that CHECK TABLE do not update the .frm file under --read-only.
Added 'handler_flags' to HA_CHECK_OPT as a way for storage engines to
store state from handler::check_for_upgrade().

Reviewed by: Debarun Banerjee
2024-02-08 10:35:45 +02:00
..
archive Fix compression tests for s390x 2023-09-05 12:34:39 +03:00
binlog MDEV-27666 User variable not parsed as geometry variable in geometry function 2024-01-16 18:53:23 +04:00
binlog_encryption Merge 10.4 into 10.5 2023-12-19 18:30:58 +02:00
client
compat Merge branch '10.4' into 10.5 2024-01-31 17:32:53 +01:00
csv
encryption MDEV-33274 The test encryption.innodb-redo-nokeys often fails 2024-02-08 08:13:16 +05:30
engines Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
federated MDEV-31361 Wrong result on 2nd execution of PS for query with derived table 2024-02-04 12:05:36 -08:00
funcs_1 Merge branch '10.4' into 10.5 2024-01-31 17:32:53 +01:00
funcs_2 MDEV-30233 DROP DATABASE test fails: Directory not empty 2022-12-15 11:14:23 +02:00
galera MDEV-33355 Add a Galera-2-node-to-MariaDB replication MTR test cloning the slave with mariadb-backup 2024-02-01 18:28:32 +04:00
galera_3nodes Merge 10.4 into 10.5 2024-01-03 12:07:51 +02:00
galera_3nodes_sr Merge 10.4 into 10.5 2024-01-03 12:07:51 +02:00
galera_sr Merge 10.4 into 10.5 2024-01-03 12:07:51 +02:00
gcol Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
handler Merge branch '10.4' into 10.5 2023-07-27 15:43:21 +02:00
heap Merge remote-tracking branch 'origin/10.4' into 10.5 2022-09-14 16:24:51 +04:00
innodb MDEV-33277 In-place upgrade causes invalid AUTO_INCREMENT values 2024-02-08 10:35:45 +02:00
innodb_fts Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
innodb_gis Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
innodb_i_s Merge remote-tracking branch '10.4' into 10.5 2023-03-31 21:32:41 +02:00
innodb_zip Merge branch '10.4' into 10.5 2024-01-31 17:32:53 +01:00
jp MDEV-29446 Change SHOW CREATE TABLE to display default collation 2022-09-12 22:10:39 +04:00
json
large_tests
maria Merge branch '10.4' into 10.5 2023-11-08 12:59:00 +01:00
mariabackup MDEV-33023 Crash in mariadb-backup --prepare --export after --prepare 2024-02-07 23:12:15 +05:30
mtr/t
mtr2
multi_source Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
optimizer_unfixed_bugs MDEV-29710: Disable some slow tests on Valgrind 2022-10-06 08:42:26 +03:00
parts Merge branch '10.4' into 10.5 2023-07-27 15:43:21 +02:00
perfschema Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
perfschema_stress
period MDEV-25370 Update for portion changes autoincrement key in bi-temp table 2024-01-31 16:03:38 +01:00
plugins Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
roles MDEV-26875: Wrong user in SET DEFAULT ROLE error 2023-10-30 18:39:56 +01:00
rpl Merge branch '10.4' into 10.5 2024-01-31 17:32:53 +01:00
s3 A cleanup for MDEV-29446 Change SHOW CREATE TABLE to display default collation 2022-09-15 12:20:50 +04:00
sql_sequence Merge branch '10.4' into 10.5 2024-01-10 18:01:46 +11:00
storage_engine
stress MDEV-29710: Skip some more tests on Valgrind 2022-10-05 20:37:54 +03:00
sys_vars MDEV-33341 innodb.undo_space_dblwr test case fails with Unknown Storage Engine InnoDB 2024-02-07 12:35:18 +02:00
unit
vcol Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
versioning Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
wsrep Merge 10.4 into 10.5 2023-12-21 11:30:32 +02:00