Commit c0c1c803 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-22164 log a warning when WITHOUT VALIDATION was used

parent 4089296a
...@@ -361,6 +361,7 @@ drop database db; ...@@ -361,6 +361,7 @@ drop database db;
# #
# MDEV-22164 without validation for exchange partition/convert in # MDEV-22164 without validation for exchange partition/convert in
# #
call mtr.add_suppression('was altered WITHOUT');
create table validation(x int); create table validation(x int);
drop table validation; drop table validation;
create table t (a int primary key); create table t (a int primary key);
...@@ -406,6 +407,7 @@ ERROR HY000: Found a row that does not match the partition ...@@ -406,6 +407,7 @@ ERROR HY000: Found a row that does not match the partition
alter table tp exchange partition p1 with table t with validation; alter table tp exchange partition p1 with table t with validation;
ERROR HY000: Found a row that does not match the partition ERROR HY000: Found a row that does not match the partition
alter table tp exchange partition p1 with table t without validation; alter table tp exchange partition p1 with table t without validation;
FOUND 1 /Table `test`.`tp` was altered WITHOUT VALIDATION: the table might be corrupted/ in mysqld.1.err
select * from t order by a; select * from t order by a;
a a
200 200
...@@ -438,10 +440,12 @@ alter table tp exchange partition p1 with table t without validation; ...@@ -438,10 +440,12 @@ alter table tp exchange partition p1 with table t without validation;
call validation; call validation;
ERROR HY000: Found a row that does not match the partition ERROR HY000: Found a row that does not match the partition
call without_validation; call without_validation;
FOUND 2 /Table `test`.`tp` was altered WITHOUT VALIDATION: the table might be corrupted/ in mysqld.1.err
call validation; call validation;
call validation; call validation;
ERROR HY000: Found a row that does not match the partition ERROR HY000: Found a row that does not match the partition
call without_validation; call without_validation;
FOUND 3 /Table `test`.`tp` was altered WITHOUT VALIDATION: the table might be corrupted/ in mysqld.1.err
select * from t order by a; select * from t order by a;
a a
200 200
...@@ -464,10 +468,12 @@ prepare without_validation from "alter table tp exchange partition p1 with table ...@@ -464,10 +468,12 @@ prepare without_validation from "alter table tp exchange partition p1 with table
execute validation; execute validation;
ERROR HY000: Found a row that does not match the partition ERROR HY000: Found a row that does not match the partition
execute without_validation; execute without_validation;
FOUND 4 /Table `test`.`tp` was altered WITHOUT VALIDATION: the table might be corrupted/ in mysqld.1.err
execute validation; execute validation;
execute validation; execute validation;
ERROR HY000: Found a row that does not match the partition ERROR HY000: Found a row that does not match the partition
execute without_validation; execute without_validation;
FOUND 5 /Table `test`.`tp` was altered WITHOUT VALIDATION: the table might be corrupted/ in mysqld.1.err
select * from t order by a; select * from t order by a;
a a
200 200
...@@ -490,6 +496,7 @@ ERROR HY000: Found a row that does not match the partition ...@@ -490,6 +496,7 @@ ERROR HY000: Found a row that does not match the partition
alter table tp convert table t to partition p2 values less than (maxvalue) with validation; alter table tp convert table t to partition p2 values less than (maxvalue) with validation;
ERROR HY000: Found a row that does not match the partition ERROR HY000: Found a row that does not match the partition
alter table tp convert table t to partition p2 values less than (maxvalue) without validation; alter table tp convert table t to partition p2 values less than (maxvalue) without validation;
FOUND 6 /Table `test`.`tp` was altered WITHOUT VALIDATION: the table might be corrupted/ in mysqld.1.err
select * from tp partition (p0) order by a; select * from tp partition (p0) order by a;
a a
2 2
...@@ -508,6 +515,7 @@ insert tp values (1), (2), (3), (4); ...@@ -508,6 +515,7 @@ insert tp values (1), (2), (3), (4);
alter table tp exchange partition p0 with table t; alter table tp exchange partition p0 with table t;
ERROR HY000: Found a row that does not match the partition ERROR HY000: Found a row that does not match the partition
alter table tp exchange partition p0 with table t without validation; alter table tp exchange partition p0 with table t without validation;
FOUND 7 /Table `test`.`tp` was altered WITHOUT VALIDATION: the table might be corrupted/ in mysqld.1.err
select * from t; select * from t;
a a
2 2
...@@ -523,6 +531,7 @@ insert tp values (12), (2), (3), (4); ...@@ -523,6 +531,7 @@ insert tp values (12), (2), (3), (4);
alter table tp exchange partition p0 with table t; alter table tp exchange partition p0 with table t;
ERROR HY000: Table has no partition for value 0 ERROR HY000: Table has no partition for value 0
alter table tp exchange partition p0 with table t without validation; alter table tp exchange partition p0 with table t without validation;
FOUND 8 /Table `test`.`tp` was altered WITHOUT VALIDATION: the table might be corrupted/ in mysqld.1.err
select * from t; select * from t;
a a
2 2
......
...@@ -323,6 +323,9 @@ drop database db; ...@@ -323,6 +323,9 @@ drop database db;
--echo # --echo #
--echo # MDEV-22164 without validation for exchange partition/convert in --echo # MDEV-22164 without validation for exchange partition/convert in
--echo # --echo #
call mtr.add_suppression('was altered WITHOUT');
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=Table `test`.`tp` was altered WITHOUT VALIDATION: the table might be corrupted;
create table validation(x int); create table validation(x int);
drop table validation; drop table validation;
...@@ -355,6 +358,7 @@ alter table tp exchange partition p1 with table t; ...@@ -355,6 +358,7 @@ alter table tp exchange partition p1 with table t;
--error ER_ROW_DOES_NOT_MATCH_PARTITION --error ER_ROW_DOES_NOT_MATCH_PARTITION
alter table tp exchange partition p1 with table t with validation; alter table tp exchange partition p1 with table t with validation;
alter table tp exchange partition p1 with table t without validation; alter table tp exchange partition p1 with table t without validation;
source include/search_pattern_in_file.inc;
select * from t order by a; select * from t order by a;
select * from tp partition (p1) order by a; select * from tp partition (p1) order by a;
alter table tp check partition p0; alter table tp check partition p0;
...@@ -374,10 +378,12 @@ alter table tp exchange partition p1 with table t without validation; ...@@ -374,10 +378,12 @@ alter table tp exchange partition p1 with table t without validation;
--error ER_ROW_DOES_NOT_MATCH_PARTITION --error ER_ROW_DOES_NOT_MATCH_PARTITION
call validation; call validation;
call without_validation; call without_validation;
source include/search_pattern_in_file.inc;
call validation; call validation;
--error ER_ROW_DOES_NOT_MATCH_PARTITION --error ER_ROW_DOES_NOT_MATCH_PARTITION
call validation; call validation;
call without_validation; call without_validation;
source include/search_pattern_in_file.inc;
select * from t order by a; select * from t order by a;
select * from tp partition (p1) order by a; select * from tp partition (p1) order by a;
call validation; call validation;
...@@ -392,10 +398,12 @@ prepare without_validation from "alter table tp exchange partition p1 with table ...@@ -392,10 +398,12 @@ prepare without_validation from "alter table tp exchange partition p1 with table
--error ER_ROW_DOES_NOT_MATCH_PARTITION --error ER_ROW_DOES_NOT_MATCH_PARTITION
execute validation; execute validation;
execute without_validation; execute without_validation;
source include/search_pattern_in_file.inc;
execute validation; execute validation;
--error ER_ROW_DOES_NOT_MATCH_PARTITION --error ER_ROW_DOES_NOT_MATCH_PARTITION
execute validation; execute validation;
execute without_validation; execute without_validation;
source include/search_pattern_in_file.inc;
select * from t order by a; select * from t order by a;
select * from tp partition (p1) order by a; select * from tp partition (p1) order by a;
execute validation; execute validation;
...@@ -410,6 +418,7 @@ alter table tp convert table t to partition p2 values less than (maxvalue); ...@@ -410,6 +418,7 @@ alter table tp convert table t to partition p2 values less than (maxvalue);
--error ER_ROW_DOES_NOT_MATCH_PARTITION --error ER_ROW_DOES_NOT_MATCH_PARTITION
alter table tp convert table t to partition p2 values less than (maxvalue) with validation; alter table tp convert table t to partition p2 values less than (maxvalue) with validation;
alter table tp convert table t to partition p2 values less than (maxvalue) without validation; alter table tp convert table t to partition p2 values less than (maxvalue) without validation;
source include/search_pattern_in_file.inc;
select * from tp partition (p0) order by a; select * from tp partition (p0) order by a;
select * from tp partition (p1) order by a; select * from tp partition (p1) order by a;
select * from tp partition (p2) order by a; select * from tp partition (p2) order by a;
...@@ -425,6 +434,7 @@ insert tp values (1), (2), (3), (4); ...@@ -425,6 +434,7 @@ insert tp values (1), (2), (3), (4);
--error ER_ROW_DOES_NOT_MATCH_PARTITION --error ER_ROW_DOES_NOT_MATCH_PARTITION
alter table tp exchange partition p0 with table t; alter table tp exchange partition p0 with table t;
alter table tp exchange partition p0 with table t without validation; alter table tp exchange partition p0 with table t without validation;
source include/search_pattern_in_file.inc;
select * from t; select * from t;
alter table tp exchange partition p0 with table t; alter table tp exchange partition p0 with table t;
drop table tp; drop table tp;
...@@ -441,6 +451,7 @@ insert tp values (12), (2), (3), (4); ...@@ -441,6 +451,7 @@ insert tp values (12), (2), (3), (4);
--error ER_NO_PARTITION_FOR_GIVEN_VALUE --error ER_NO_PARTITION_FOR_GIVEN_VALUE
alter table tp exchange partition p0 with table t; alter table tp exchange partition p0 with table t;
alter table tp exchange partition p0 with table t without validation; alter table tp exchange partition p0 with table t without validation;
source include/search_pattern_in_file.inc;
select * from t; select * from t;
alter table tp exchange partition p0 with table t; alter table tp exchange partition p0 with table t;
......
...@@ -4104,11 +4104,19 @@ bool verify_data_with_partition(TABLE *table, TABLE *part_table, ...@@ -4104,11 +4104,19 @@ bool verify_data_with_partition(TABLE *table, TABLE *part_table,
uchar *old_rec; uchar *old_rec;
partition_info *part_info; partition_info *part_info;
DBUG_ENTER("verify_data_with_partition"); DBUG_ENTER("verify_data_with_partition");
DBUG_ASSERT(table && table->file && part_table && part_table->part_info && DBUG_ASSERT(table);
part_table->file); DBUG_ASSERT(table->file);
DBUG_ASSERT(part_table);
DBUG_ASSERT(part_table->file);
DBUG_ASSERT(part_table->part_info);
if (table->in_use->lex->without_validation) if (table->in_use->lex->without_validation)
{
sql_print_warning("Table %`s.%`s was altered WITHOUT VALIDATION: "
"the table might be corrupted",
part_table->s->db.str, part_table->s->table_name.str);
DBUG_RETURN(false); DBUG_RETURN(false);
}
/* /*
Verify all table rows. Verify all table rows.
......
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