Browse Source
MDEV-33277 In-place upgrade causes invalid AUTO_INCREMENT values
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 commitpull/3022/headd0ef1aaf61
, 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 commit8777458a6e
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
20 changed files with 725 additions and 146 deletions
-
44include/mysql/service_print_check_msg.h
-
1include/service_versions.h
-
1libservices/CMakeLists.txt
-
18libservices/print_check_msg_service.c
-
BINmysql-test/std_data/autoinc_import_101.frm
-
BINmysql-test/std_data/autoinc_import_57.frm
-
232mysql-test/suite/innodb/r/autoinc_import.result
-
168mysql-test/suite/innodb/t/autoinc_import.test
-
6sql/handler.cc
-
1sql/handler.h
-
34sql/sql_class.cc
-
7sql/sql_plugin_services.inl
-
97storage/innobase/btr/btr0btr.cc
-
146storage/innobase/handler/ha_innodb.cc
-
7storage/innobase/handler/ha_innodb.h
-
17storage/innobase/handler/handler0alter.cc
-
17storage/innobase/include/btr0btr.h
-
3storage/innobase/include/dict0mem.h
-
44storage/innobase/row/row0import.cc
-
28storage/maria/ha_maria.cc
@ -0,0 +1,44 @@ |
|||
/* Copyright (c) 2019, MariaDB Corporation. |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program; if not, write to the Free Software |
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ |
|||
|
|||
#pragma once |
|||
|
|||
/** |
|||
@file include/mysql/service_print_check_msg.h |
|||
This service provides functions to write messages for check or repair |
|||
*/ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
|
|||
extern struct print_check_msg_service_st { |
|||
void (*print_check_msg)(MYSQL_THD, const char *db_name, const char *table_name, |
|||
const char *op, const char *msg_type, const char *message, |
|||
my_bool print_to_log); |
|||
} *print_check_msg_service; |
|||
|
|||
#ifdef MYSQL_DYNAMIC_PLUGIN |
|||
# define print_check_msg_context(_THD) print_check_msg_service->print_check_msg |
|||
#else |
|||
extern void print_check_msg(MYSQL_THD, const char *db_name, const char *table_name, |
|||
const char *op, const char *msg_type, const char *message, |
|||
my_bool print_to_log); |
|||
#endif |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
@ -0,0 +1,18 @@ |
|||
/* Copyright (c) 2024, MariaDB Plc |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, but |
|||
WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program; if not, write to the Free Software |
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|||
*/ |
|||
|
|||
#include <service_versions.h> |
|||
SERVICE_VERSION print_check_msg_context= (void*) VERSION_print_check_msg; |
@ -0,0 +1,232 @@ |
|||
CREATE TABLE t1 (id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; |
|||
INSERT INTO t1 VALUES(42); |
|||
CREATE TABLE t1b LIKE t1; |
|||
INSERT INTO t1b VALUES(3); |
|||
CREATE TABLE t1z LIKE t1; |
|||
CREATE TABLE t1t (id TINYINT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; |
|||
CREATE TABLE t0t LIKE t1t; |
|||
INSERT INTO t1t VALUES(123); |
|||
FLUSH TABLES t1,t1b,t1t FOR EXPORT; |
|||
UNLOCK TABLES; |
|||
CREATE TABLE t5_7 LIKE t1; |
|||
CREATE TABLE t5_7b LIKE t1b; |
|||
CREATE TABLE t10_1 LIKE t1; |
|||
CREATE TABLE t10_1b LIKE t1b; |
|||
ALTER TABLE t1 DISCARD TABLESPACE; |
|||
ALTER TABLE t1b DISCARD TABLESPACE; |
|||
ALTER TABLE t1z DISCARD TABLESPACE; |
|||
ALTER TABLE t1t DISCARD TABLESPACE; |
|||
ALTER TABLE t0t DISCARD TABLESPACE; |
|||
ALTER TABLE t5_7 DISCARD TABLESPACE; |
|||
ALTER TABLE t5_7b DISCARD TABLESPACE; |
|||
ALTER TABLE t10_1 DISCARD TABLESPACE; |
|||
ALTER TABLE t10_1b DISCARD TABLESPACE; |
|||
FLUSH TABLES; |
|||
ALTER TABLE t0t IMPORT TABLESPACE; |
|||
Warnings: |
|||
Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t0t.cfg', will attempt to import without schema verification |
|||
INSERT INTO t0t VALUES(NULL); |
|||
SELECT * FROM t0t; |
|||
id |
|||
123 |
|||
124 |
|||
DROP TABLE t0t; |
|||
ALTER TABLE t1 IMPORT TABLESPACE; |
|||
Warnings: |
|||
Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t1.cfg', will attempt to import without schema verification |
|||
ALTER TABLE t1b IMPORT TABLESPACE; |
|||
Warnings: |
|||
Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t1b.cfg', will attempt to import without schema verification |
|||
ALTER TABLE t1z IMPORT TABLESPACE; |
|||
Warnings: |
|||
Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t1z.cfg', will attempt to import without schema verification |
|||
ALTER TABLE t1t IMPORT TABLESPACE; |
|||
Warnings: |
|||
Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t1t.cfg', will attempt to import without schema verification |
|||
ALTER TABLE t5_7 IMPORT TABLESPACE; |
|||
Warnings: |
|||
Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t5_7.cfg', will attempt to import without schema verification |
|||
ALTER TABLE t5_7b IMPORT TABLESPACE; |
|||
Warnings: |
|||
Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t5_7b.cfg', will attempt to import without schema verification |
|||
ALTER TABLE t10_1 IMPORT TABLESPACE; |
|||
Warnings: |
|||
Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t10_1.cfg', will attempt to import without schema verification |
|||
ALTER TABLE t10_1b IMPORT TABLESPACE; |
|||
Warnings: |
|||
Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t10_1b.cfg', will attempt to import without schema verification |
|||
FOUND 1 /InnoDB: Resetting PAGE_ROOT_AUTO_INC from 128 to 123 on table `test`\.`t0t`/ in mysqld.1.err |
|||
FOUND 1 /InnoDB: Resetting PAGE_ROOT_AUTO_INC from 0 to 42 on table `test`\.`t1z`/ in mysqld.1.err |
|||
FOUND 1 /InnoDB: Resetting PAGE_ROOT_AUTO_INC from 128 to 123 on table `test`\.`t1t`/ in mysqld.1.err |
|||
FOUND 1 /InnoDB: Resetting PAGE_ROOT_AUTO_INC from 3 to 42 on table `test`\.`t5_7` \(created with version 50744\)/ in mysqld.1.err |
|||
FOUND 1 /InnoDB: Resetting PAGE_ROOT_AUTO_INC from 3 to 42 on table `test`\.`t10_1` \(created with version 100149\)/ in mysqld.1.err |
|||
FOUND 5 /InnoDB: Resetting PAGE_ROOT_AUTO_INC/ in mysqld.1.err |
|||
# restart: --read-only |
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 check status OK |
|||
test.t1b check status OK |
|||
test.t1t check status OK |
|||
test.t1z check status OK |
|||
test.t5_7 check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t5_7 check status OK |
|||
test.t5_7b check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t5_7b check status OK |
|||
test.t10_1 check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t10_1 check status OK |
|||
test.t10_1b check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t10_1b check status OK |
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b FOR UPGRADE; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 check status OK |
|||
test.t1b check status OK |
|||
test.t1t check status OK |
|||
test.t1z check status OK |
|||
test.t5_7 check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t5_7 check status OK |
|||
test.t5_7b check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t5_7b check status OK |
|||
test.t10_1 check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t10_1 check status OK |
|||
test.t10_1b check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t10_1b check status OK |
|||
# restart: --innodb-read-only --read-only |
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 check status OK |
|||
test.t1b check status OK |
|||
test.t1t check status OK |
|||
test.t1z check status OK |
|||
test.t5_7 check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t5_7 check status OK |
|||
test.t5_7b check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t5_7b check status OK |
|||
test.t10_1 check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t10_1 check status OK |
|||
test.t10_1b check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t10_1b check status OK |
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b FOR UPGRADE; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 check status OK |
|||
test.t1b check status OK |
|||
test.t1t check status OK |
|||
test.t1z check status OK |
|||
test.t5_7 check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t5_7 check status OK |
|||
test.t5_7b check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t5_7b check status OK |
|||
test.t10_1 check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t10_1 check status OK |
|||
test.t10_1b check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed |
|||
test.t10_1b check status OK |
|||
# restart: --innodb-read-only |
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 check status OK |
|||
test.t1b check status OK |
|||
test.t1t check status OK |
|||
test.t1z check status OK |
|||
test.t5_7 check status Operation failed |
|||
test.t5_7b check status Operation failed |
|||
test.t10_1 check status Operation failed |
|||
test.t10_1b check status Operation failed |
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b FOR UPGRADE; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 check status OK |
|||
test.t1b check status OK |
|||
test.t1t check status OK |
|||
test.t1z check status OK |
|||
test.t5_7 check status Operation failed |
|||
test.t5_7b check status Operation failed |
|||
test.t10_1 check status Operation failed |
|||
test.t10_1b check status Operation failed |
|||
SELECT COUNT(*) FROM t1; |
|||
COUNT(*) |
|||
1 |
|||
SELECT COUNT(*) FROM t1b; |
|||
COUNT(*) |
|||
1 |
|||
SELECT COUNT(*) FROM t1t; |
|||
COUNT(*) |
|||
1 |
|||
SELECT COUNT(*) FROM t1z; |
|||
COUNT(*) |
|||
1 |
|||
SELECT COUNT(*) FROM t5_7; |
|||
COUNT(*) |
|||
1 |
|||
SELECT COUNT(*) FROM t5_7b; |
|||
COUNT(*) |
|||
1 |
|||
SELECT COUNT(*) FROM t10_1; |
|||
COUNT(*) |
|||
1 |
|||
SELECT COUNT(*) FROM t10_1b; |
|||
COUNT(*) |
|||
1 |
|||
# restart |
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b FOR UPGRADE; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 check status OK |
|||
test.t1b check status OK |
|||
test.t1t check status OK |
|||
test.t1z check status OK |
|||
test.t5_7 check note Auto_increment checked and .frm file version updated |
|||
test.t5_7 check status OK |
|||
test.t5_7b check note Auto_increment checked and .frm file version updated |
|||
test.t5_7b check status OK |
|||
test.t10_1 check note Auto_increment checked and .frm file version updated |
|||
test.t10_1 check status OK |
|||
test.t10_1b check note Auto_increment checked and .frm file version updated |
|||
test.t10_1b check status OK |
|||
INSERT INTO t1 VALUES(NULL); |
|||
INSERT INTO t1b VALUES(NULL); |
|||
INSERT INTO t1t VALUES(NULL); |
|||
INSERT INTO t1z VALUES(NULL); |
|||
INSERT INTO t5_7 VALUES(NULL); |
|||
INSERT INTO t5_7b VALUES(NULL); |
|||
INSERT INTO t10_1 VALUES(NULL); |
|||
INSERT INTO t10_1b VALUES(NULL); |
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b FOR UPGRADE; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 check status OK |
|||
test.t1b check status OK |
|||
test.t1t check status OK |
|||
test.t1z check status OK |
|||
test.t5_7 check status OK |
|||
test.t5_7b check status OK |
|||
test.t10_1 check status OK |
|||
test.t10_1b check status OK |
|||
SELECT * FROM t1; |
|||
id |
|||
4 |
|||
42 |
|||
SELECT * FROM t1b; |
|||
id |
|||
3 |
|||
347 |
|||
SELECT * FROM t1t; |
|||
id |
|||
123 |
|||
124 |
|||
SELECT * FROM t1z; |
|||
id |
|||
42 |
|||
43 |
|||
SELECT * FROM t5_7; |
|||
id |
|||
42 |
|||
43 |
|||
SELECT * FROM t5_7b; |
|||
id |
|||
3 |
|||
347 |
|||
SELECT * FROM t10_1; |
|||
id |
|||
42 |
|||
43 |
|||
SELECT * FROM t10_1b; |
|||
id |
|||
3 |
|||
347 |
|||
DROP TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b; |
@ -0,0 +1,168 @@ |
|||
--source include/have_innodb.inc |
|||
|
|||
CREATE TABLE t1 (id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; |
|||
INSERT INTO t1 VALUES(42); |
|||
CREATE TABLE t1b LIKE t1; |
|||
INSERT INTO t1b VALUES(3); |
|||
CREATE TABLE t1z LIKE t1; |
|||
CREATE TABLE t1t (id TINYINT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; |
|||
CREATE TABLE t0t LIKE t1t; |
|||
INSERT INTO t1t VALUES(123); |
|||
--let DATADIR=`select @@datadir` |
|||
--let PAGE_SIZE=`select @@innodb_page_size` |
|||
FLUSH TABLES t1,t1b,t1t FOR EXPORT; |
|||
--copy_file $DATADIR/test/t1.ibd $DATADIR/test/t.ibd |
|||
--copy_file $DATADIR/test/t1.ibd $DATADIR/test/tz.ibd |
|||
--copy_file $DATADIR/test/t1b.ibd $DATADIR/test/tb.ibd |
|||
--copy_file $DATADIR/test/t1t.ibd $DATADIR/test/tt.ibd |
|||
UNLOCK TABLES; |
|||
CREATE TABLE t5_7 LIKE t1; |
|||
CREATE TABLE t5_7b LIKE t1b; |
|||
CREATE TABLE t10_1 LIKE t1; |
|||
CREATE TABLE t10_1b LIKE t1b; |
|||
ALTER TABLE t1 DISCARD TABLESPACE; |
|||
ALTER TABLE t1b DISCARD TABLESPACE; |
|||
ALTER TABLE t1z DISCARD TABLESPACE; |
|||
ALTER TABLE t1t DISCARD TABLESPACE; |
|||
ALTER TABLE t0t DISCARD TABLESPACE; |
|||
ALTER TABLE t5_7 DISCARD TABLESPACE; |
|||
ALTER TABLE t5_7b DISCARD TABLESPACE; |
|||
ALTER TABLE t10_1 DISCARD TABLESPACE; |
|||
ALTER TABLE t10_1b DISCARD TABLESPACE; |
|||
FLUSH TABLES; |
|||
|
|||
# Update the PAGE_ROOT_AUTO_INC field of a few files. |
|||
perl; |
|||
do "$ENV{MTR_SUITE_DIR}/include/crc32.pl"; |
|||
sub update_autoinc |
|||
{ |
|||
my ($file, $value) = @_; |
|||
open(FILE, "+<$file") || die "Unable to open $file"; |
|||
binmode FILE; |
|||
my $ps= $ENV{PAGE_SIZE}; |
|||
my $page; |
|||
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps; |
|||
my $full_crc32 = unpack("N",substr($page,54,4)) & 0x10; # FIL_SPACE_FLAGS |
|||
sysseek(FILE, 3*$ps, 0) || die "Unable to seek $file\n"; |
|||
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps; |
|||
substr($page,56,8)=pack("NN",0,$value); |
|||
my $polynomial = 0x82f63b78; # CRC-32C |
|||
if ($full_crc32) { |
|||
my $ck = mycrc32(substr($page, 0, $ps-4), 0, $polynomial); |
|||
substr($page, $ps-4, 4) = pack("N", $ck); |
|||
} |
|||
else |
|||
{ |
|||
my $ck= pack("N",mycrc32(substr($page, 4, 22), 0, $polynomial) ^ |
|||
mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial)); |
|||
substr($page,0,4)=$ck; |
|||
substr($page,$ps-8,4)=$ck; |
|||
} |
|||
sysseek(FILE, 3*$ps, 0) || die "Unable to rewind $file\n"; |
|||
syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n"; |
|||
close(FILE) || die "Unable to close $file"; |
|||
} |
|||
update_autoinc("$ENV{DATADIR}/test/tz.ibd", 0); |
|||
update_autoinc("$ENV{DATADIR}/test/t.ibd", 3); |
|||
update_autoinc("$ENV{DATADIR}/test/tb.ibd", 346); |
|||
update_autoinc("$ENV{DATADIR}/test/tt.ibd", 128); |
|||
EOF |
|||
|
|||
--remove_file $DATADIR/test/t5_7.frm |
|||
--remove_file $DATADIR/test/t5_7b.frm |
|||
--copy_file $MYSQL_TEST_DIR/std_data/autoinc_import_57.frm $DATADIR/test/t5_7.frm |
|||
--copy_file $MYSQL_TEST_DIR/std_data/autoinc_import_57.frm $DATADIR/test/t5_7b.frm |
|||
--remove_file $DATADIR/test/t10_1.frm |
|||
--remove_file $DATADIR/test/t10_1b.frm |
|||
--copy_file $MYSQL_TEST_DIR/std_data/autoinc_import_101.frm $DATADIR/test/t10_1.frm |
|||
--copy_file $MYSQL_TEST_DIR/std_data/autoinc_import_101.frm $DATADIR/test/t10_1b.frm |
|||
--copy_file $DATADIR/test/t.ibd $DATADIR/test/t5_7.ibd |
|||
--copy_file $DATADIR/test/tb.ibd $DATADIR/test/t5_7b.ibd |
|||
--copy_file $DATADIR/test/t.ibd $DATADIR/test/t10_1.ibd |
|||
--copy_file $DATADIR/test/tb.ibd $DATADIR/test/t10_1b.ibd |
|||
--move_file $DATADIR/test/t.ibd $DATADIR/test/t1.ibd |
|||
--move_file $DATADIR/test/tb.ibd $DATADIR/test/t1b.ibd |
|||
--copy_file $DATADIR/test/tt.ibd $DATADIR/test/t0t.ibd |
|||
--move_file $DATADIR/test/tt.ibd $DATADIR/test/t1t.ibd |
|||
--move_file $DATADIR/test/tz.ibd $DATADIR/test/t1z.ibd |
|||
|
|||
ALTER TABLE t0t IMPORT TABLESPACE; |
|||
INSERT INTO t0t VALUES(NULL); |
|||
SELECT * FROM t0t; |
|||
DROP TABLE t0t; |
|||
ALTER TABLE t1 IMPORT TABLESPACE; |
|||
ALTER TABLE t1b IMPORT TABLESPACE; |
|||
ALTER TABLE t1z IMPORT TABLESPACE; |
|||
ALTER TABLE t1t IMPORT TABLESPACE; |
|||
ALTER TABLE t5_7 IMPORT TABLESPACE; |
|||
ALTER TABLE t5_7b IMPORT TABLESPACE; |
|||
ALTER TABLE t10_1 IMPORT TABLESPACE; |
|||
ALTER TABLE t10_1b IMPORT TABLESPACE; |
|||
|
|||
--let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err |
|||
--let SEARCH_PATTERN= InnoDB: Resetting PAGE_ROOT_AUTO_INC from 128 to 123 on table `test`\.`t0t` |
|||
--source include/search_pattern_in_file.inc |
|||
--let SEARCH_PATTERN= InnoDB: Resetting PAGE_ROOT_AUTO_INC from 0 to 42 on table `test`\.`t1z` |
|||
--source include/search_pattern_in_file.inc |
|||
--let SEARCH_PATTERN= InnoDB: Resetting PAGE_ROOT_AUTO_INC from 128 to 123 on table `test`\.`t1t` |
|||
--source include/search_pattern_in_file.inc |
|||
--let SEARCH_PATTERN= InnoDB: Resetting PAGE_ROOT_AUTO_INC from 3 to 42 on table `test`\.`t5_7` \(created with version 50744\) |
|||
--source include/search_pattern_in_file.inc |
|||
--let SEARCH_PATTERN= InnoDB: Resetting PAGE_ROOT_AUTO_INC from 3 to 42 on table `test`\.`t10_1` \(created with version 100149\) |
|||
--source include/search_pattern_in_file.inc |
|||
--let SEARCH_PATTERN= InnoDB: Resetting PAGE_ROOT_AUTO_INC |
|||
--source include/search_pattern_in_file.inc |
|||
|
|||
# Restart, so that the InnoDB tables will be loaded into the data dictionary. |
|||
--let $restart_parameters=--read-only |
|||
--source include/restart_mysqld.inc |
|||
|
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b; |
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b FOR UPGRADE; |
|||
|
|||
--let $restart_parameters=--innodb-read-only --read-only |
|||
--source include/restart_mysqld.inc |
|||
|
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b; |
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b FOR UPGRADE; |
|||
|
|||
--let $restart_parameters=--innodb-read-only |
|||
--source include/restart_mysqld.inc |
|||
|
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b; |
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b FOR UPGRADE; |
|||
|
|||
SELECT COUNT(*) FROM t1; |
|||
SELECT COUNT(*) FROM t1b; |
|||
SELECT COUNT(*) FROM t1t; |
|||
SELECT COUNT(*) FROM t1z; |
|||
SELECT COUNT(*) FROM t5_7; |
|||
SELECT COUNT(*) FROM t5_7b; |
|||
SELECT COUNT(*) FROM t10_1; |
|||
SELECT COUNT(*) FROM t10_1b; |
|||
|
|||
--let $restart_parameters= |
|||
--source include/restart_mysqld.inc |
|||
|
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b FOR UPGRADE; |
|||
|
|||
INSERT INTO t1 VALUES(NULL); |
|||
INSERT INTO t1b VALUES(NULL); |
|||
INSERT INTO t1t VALUES(NULL); |
|||
INSERT INTO t1z VALUES(NULL); |
|||
INSERT INTO t5_7 VALUES(NULL); |
|||
INSERT INTO t5_7b VALUES(NULL); |
|||
INSERT INTO t10_1 VALUES(NULL); |
|||
INSERT INTO t10_1b VALUES(NULL); |
|||
|
|||
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b FOR UPGRADE; |
|||
|
|||
SELECT * FROM t1; |
|||
SELECT * FROM t1b; |
|||
SELECT * FROM t1t; |
|||
SELECT * FROM t1z; |
|||
SELECT * FROM t5_7; |
|||
SELECT * FROM t5_7b; |
|||
SELECT * FROM t10_1; |
|||
SELECT * FROM t10_1b; |
|||
DROP TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue