mariadb/mysql-test
Jon Olav Hauglid 0db0e64f33 Bug #11755431 (former 47205)
MAP 'REPAIR TABLE' TO RECREATE +ANALYZE FOR ENGINES NOT
SUPPORTING NATIVE REPAIR

Executing 'mysqlcheck --check-upgrade --auto-repair ...' will first issue
'CHECK TABLE FOR UPGRADE' for all tables in the database in order to check if the
tables are compatible with the current version of MySQL. Any tables that are
found incompatible are then upgraded using 'REPAIR TABLE'.

The problem was that some engines (e.g. InnoDB) do not support 'REPAIR TABLE'.
This caused any such tables to be left incompatible. As a result such tables were
not properly fixed by the mysql_upgrade tool.

This patch fixes the problem by first changing 'CHECK TABLE FOR UPGRADE' to return
a different error message if the engine does not support REPAIR. Instead of
"Table upgrade required. Please do "REPAIR TABLE ..." it will report
"Table rebuild required. Please do "ALTER TABLE ... FORCE ..."

Second, the patch changes mysqlcheck to do 'ALTER TABLE ... FORCE' instead of
'REPAIR TABLE' in these cases.

This patch also fixes 'ALTER TABLE ... FORCE' to actually rebuild the table.
This change should be reflected in the documentation. Before this patch,
'ALTER TABLE ... FORCE' was unused (See Bug#11746162)

Test case added to mysqlcheck.test


client/mysqlcheck.c:
  Changed mysqlcheck to do 'ALTER TABLE ... FORCE' if
  'CHECK TABLE FOR UPGRADE' reports ER_TABLE_NEEDS_REBUILD
  and not ER_TABLE_NEEDS_UPGRADE.
mysql-test/r/mysqlcheck.result:
  Added regression test.
mysql-test/std_data/bug47205.frm:
  InnoDB 5.0 FRM which contains a varchar primary key using
  utf8_general_ci. This is an incompatible FRM for 5.5.
mysql-test/t/mysqlcheck.test:
  Added regression test.
sql/handler.h:
  Added new HA_CAN_REPAIR flag.
sql/share/errmsg-utf8.txt:
  Added new error message ER_TABLE_NEEDS_REBUILD
sql/sql_admin.cc:
  Changed 'CHECK TABLE FOR UPDATE' to give ER_TABLE_NEEDS_REBUILD
  instead of ER_TABLE_NEEDS_UPGRADE if the engine does not support
  REPAIR (as indicated by the new HA_CAN_REPAIR flag).
sql/sql_lex.h:
  Remove unused ALTER_FORCE flag.
sql/sql_yacc.yy:
  Make sure ALTER TABLE ... FORCE recreates the table
  by setting the ALTER_RECREATE flag as the ALTER_FORCE
  flag was unused.
storage/archive/ha_archive.h:
  Added new HA_CAN_REPAIR flag to Archive
storage/csv/ha_tina.h:
  Added new HA_CAN_REPAIR flag to CSV
storage/federated/ha_federated.h:
  Added new HA_CAN_REPAIR flag to Federated
storage/myisam/ha_myisam.cc:
  Added new HA_CAN_REPAIR flag to MyISAM
2011-03-08 09:41:57 +01:00
..
collections Bug#11769332 : These tests crash on windows which leads to cdb hang. This results in very long runtime. Disable till the bug is fixed 2011-03-03 12:18:04 +05:30
extra BUG#11754075: BUG#45621: A FEW TEST FILES ARE DISABLED DUE TO WL#4284 2011-02-15 11:59:12 +00:00
include Bug#54820. Remove test cases from experimental 2011-02-27 23:23:44 +03:00
lib Bug #59489 Enable setting of env. variables for mysqld from mtr 2011-01-27 14:42:08 +01:00
r Bug #11755431 (former 47205) 2011-03-08 09:41:57 +01:00
std_data Bug #11755431 (former 47205) 2011-03-08 09:41:57 +01:00
suite merge from mysql-5.1 -> mysql-5.5 2011-03-01 21:33:00 +05:30
t Bug #11755431 (former 47205) 2011-03-08 09:41:57 +01:00
CMakeLists.txt add missing COMPONENT to all CMake INSTALL commands 2010-11-13 23:16:52 +01:00
mtr.out-of-source
mysql-stress-test.pl Fixed copyright headers in mtr src files 2011-01-18 11:21:37 +01:00
mysql-test-run.pl Bug #11751935 42969: PLEASE ADD A MANIFEST TO EACH BUILD 2011-02-16 13:44:28 +01:00
purify.supp - Added/updated copyright headers 2010-12-28 19:57:23 +01:00
README
README.gcov
README.stress
valgrind.supp Merge mysql-5.5-innodb -> mysql-5.5 2011-02-17 13:57:26 +02:00

This directory contains a test suite for the MySQL daemon. To run
the currently existing test cases, simply execute ./mysql-test-run in
this directory. It will fire up the newly built mysqld and test it.

Note that you do not have to have to do "make install", and you could
actually have a co-existing MySQL installation. The tests will not
conflict with it.

All tests must pass. If one or more of them fail on your system, please
read the following manual section for instructions on how to report the
problem:

http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html

If you want to use an already running MySQL server for specific tests,
use the --extern option to mysql-test-run. Please note that in this mode,
the test suite expects you to provide the names of the tests to run.
For example, here is the command to run the "alias" and "analyze" tests
with an external server:

mysql-test-run --extern alias analyze

To match your setup, you might also need to provide --socket, --user, and
other relevant options.

With no test cases named on the command line, mysql-test-run falls back
to the normal "non-extern" behavior. The reason for this is that some
tests cannot run with an external server.


You can create your own test cases. To create a test case, create a new
file in the t subdirectory using a text editor. The file should have a .test
extension. For example:

 xemacs t/test_case_name.test

 In the file, put a set of SQL statements that create some tables,
 load test data, and run some queries to manipulate it.

 We would appreciate it if you name your test tables t1, t2, t3 ... (to not
 conflict too much with existing tables).

 Your test should begin by dropping the tables you are going to create and
 end by dropping them again.  This ensures that you can run the test over
 and over again.
 
 If you are using mysqltest commands (like result file names) in your
 test case, you should create the result file as follows:

 mysql-test-run --record test_case_name

 or

 mysqltest --record < t/test_case_name.test

 If you only have a simple test cases consisting of SQL statements and
 comments, you can create the test case in one of the following ways:

 mysql-test-run --record test_case_name

 mysql test < t/test_case_name.test > r/test_case_name.result

 mysqltest --record --record-file=r/test_case_name.result < t/test_case_name.test

 When this is done, take a look at r/test_case_name.result
 - If the result is incorrect, you have found a bug. In this case, you should
   edit the test result to the correct results so that we can verify
   that the bug is corrected in future releases.

To submit your test case, put your .test file and .result file(s) into
a tar.gz archive, add a README that explains the problem, ftp the 
archive to ftp://support.mysql.com/pub/mysql/secret/ and send a mail
to bugs@lists.mysql.com