Commit b99c3b20 authored by Daniel Black's avatar Daniel Black Committed by Monty

Fixed test failure in parts.partition_debug_innodb/myisam

MDEV-22488 test failures: parts.partition_debug_innodb /
           parts.partition_debug_myisam

The reason for the failure was a wrong printf() that accessed not existing
things on the stack.
The reason the falure was hard to find was that the partition_debug_...
tests disables core dumps, so there was no trace that the server had
crashed in the logs.

Fixed by fixing the faulty push_warning_printf() and splitting the tests
into two parts, one that test failures (with core dumps enabled) and one
part that test crash recovery.

The review and test splitting was done by Monty
parent 72c7b4eb
......@@ -19,16 +19,34 @@ let $insert_statement= INSERT INTO t1 VALUES (1, "Original from partition p0"),
let $crash_statement= ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
if ($do_crash)
{
--source suite/parts/inc/partition_crash_add.inc
}
let $fail_statement= $crash_statement;
if ($do_fail)
{
--source suite/parts/inc/partition_fail_add.inc
}
let $crash_statement= ALTER TABLE t1 DROP PARTITION p10;
if ($do_crash)
{
--source suite/parts/inc/partition_crash_drop.inc
}
let $fail_statement= $crash_statement;
if ($do_fail)
{
--source suite/parts/inc/partition_fail_drop.inc
}
let $crash_statement= ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
if ($do_crash)
{
--source suite/parts/inc/partition_crash_change.inc
}
let $fail_statement= $crash_statement;
if ($do_fail)
{
--source suite/parts/inc/partition_fail_change.inc
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
--loose-innodb-file-per-table=1 --skip-stack-trace --skip-core-file --loose-innodb-buffer-pool-size=32M
# Partitioning test that require debug features and InnoDB
--source include/have_debug.inc
--source include/have_innodb.inc
--source include/have_partition.inc
--source include/not_valgrind.inc
--source include/not_embedded.inc
# Checking with #innodb what this is...
call mtr.add_suppression("InnoDB: Warning: allocated tablespace .*, old maximum was");
# If there is a crash or failure between the ddl_log is written and the
# operation is completed, mysql will try to drop a not yet created partition
call mtr.add_suppression("table .* does not exist in the InnoDB internal");
call mtr.add_suppression("InnoDB: Warning: MySQL is trying to drop table ");
--let $DATADIR= `SELECT @@datadir;`
let $engine= 'InnoDB';
--echo # Test crash recovery in fast_alter_partition_table.
let $do_crash=1;
--source suite/parts/inc/partition_mgm_crash.inc
--loose-innodb-file-per-table=1 --loose-innodb-buffer-pool-size=32M
# Partitioning test that require debug features and InnoDB
--source include/have_debug.inc
--source include/have_innodb.inc
--source include/have_partition.inc
--source include/not_embedded.inc
# Checking with #innodb what this is...
call mtr.add_suppression("InnoDB: Warning: allocated tablespace .*, old maximum was");
# If there is a crash or failure between the ddl_log is written and the
# operation is completed, mysql will try to drop a not yet created partition
call mtr.add_suppression("table .* does not exist in the InnoDB internal");
call mtr.add_suppression("InnoDB: Warning: MySQL is trying to drop table ");
--let $DATADIR= `SELECT @@datadir;`
let $engine= 'InnoDB';
--echo # Test failure recovery in fast_alter_partition_table.
let $do_fail=1;
--source suite/parts/inc/partition_mgm_crash.inc
......@@ -10,5 +10,6 @@
let $engine= 'MyISAM';
--echo # Test crash and failure recovery in fast_alter_partition_table.
--echo # Test crash in fast_alter_partition_table.
let $do_crash=1;
--source suite/parts/inc/partition_mgm_crash.inc
# Partitioning test that require debug features
# including crashing tests.
--source include/have_debug.inc
--source include/have_partition.inc
--source include/not_embedded.inc
--let $DATADIR= `SELECT @@datadir;`
let $engine= 'MyISAM';
--echo # Test failures in fast_alter_partition_table.
let $do_fail=1;
--source suite/parts/inc/partition_mgm_crash.inc
......@@ -58,13 +58,11 @@ call mtr.add_suppression("InnoDB: Warning: allocated tablespace .*, old maximum
# operation is completed, mysql will try to drop a not yet created partition
call mtr.add_suppression("InnoDB: Error: table .* does not exist in the InnoDB internal");
call mtr.add_suppression("InnoDB: Warning: MySQL is trying to drop table ");
call mtr.add_suppression("table .* does not exist in the InnoDB internal");
let $engine= 'InnoDB';
--echo # Test crash and failure recovery in fast_alter_partition_table.
--source suite/parts/inc/partition_mgm_crash.inc
--echo #
--echo # WL#4445: EXCHANGE PARTITION WITH TABLE
--echo # Verify ddl_log and InnoDB in case of crashing.
......
......@@ -6886,22 +6886,20 @@ static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
if (drop_partition)
{
/* Table is still ok, but we left a shadow frm file behind. */
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, 1,
"%s %s",
"Operation was unsuccessful, table is still "
"intact, but it is possible that a shadow frm "
"file was left behind");
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 1,
"Operation was unsuccessful, table is still "
"intact, but it is possible that a shadow frm "
"file was left behind");
}
else
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, 1,
"%s %s %s %s",
"Operation was unsuccessful, table is still "
"intact, but it is possible that a shadow frm "
"file was left behind.",
"It is also possible that temporary partitions "
"are left behind, these could be empty or more "
"or less filled with records");
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 1,
"Operation was unsuccessful, table is still "
"intact, but it is possible that a shadow frm "
"file was left behind. "
"It is also possible that temporary partitions "
"are left behind, these could be empty or more "
"or less filled with records");
}
}
else
......@@ -6912,12 +6910,11 @@ static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
Failed during install of shadow frm file, table isn't intact
and dropped partitions are still there
*/
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, 1,
"%s %s %s",
"Failed during alter of partitions, table is no "
"longer intact.",
"The frm file is in an unknown state, and a "
"backup is required.");
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 1,
"Failed during alter of partitions, table is no "
"longer intact. "
"The frm file is in an unknown state, and a "
"backup is required.");
}
else if (drop_partition)
{
......@@ -6927,11 +6924,10 @@ static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
ask the user to perform the action manually. We remove the log
records and ask the user to perform the action manually.
*/
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, 1,
"%s %s",
"Failed during drop of partitions, table is "
"intact.",
"Manual drop of remaining partitions is required");
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 1,
"Failed during drop of partitions, table is "
"intact. "
"Manual drop of remaining partitions is required");
}
else
{
......@@ -6940,12 +6936,11 @@ static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
certainly in a very bad state so we give user warning and disable
the table by writing an ancient frm version into it.
*/
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, 1,
"%s %s %s",
"Failed during renaming of partitions. We are now "
"in a position where table is not reusable",
"Table is disabled by writing ancient frm file "
"version into it");
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 1,
"Failed during renaming of partitions. We are now "
"in a position where table is not reusable "
"Table is disabled by writing ancient frm file "
"version into it");
}
}
}
......@@ -6970,9 +6965,9 @@ static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
even though we reported an error the operation was successfully
completed.
*/
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, 1,"%s %s",
"Operation was successfully completed by failure "
"handling, after failure of normal operation");
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 1,
"Operation was successfully completed by failure "
"handling, after failure of normal operation");
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment