Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
c0c1c803
Commit
c0c1c803
authored
Jan 08, 2024
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-22164 log a warning when WITHOUT VALIDATION was used
parent
4089296a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
2 deletions
+30
-2
mysql-test/suite/parts/r/alter_table.result
mysql-test/suite/parts/r/alter_table.result
+9
-0
mysql-test/suite/parts/t/alter_table.test
mysql-test/suite/parts/t/alter_table.test
+11
-0
sql/sql_partition.cc
sql/sql_partition.cc
+10
-2
No files found.
mysql-test/suite/parts/r/alter_table.result
View file @
c0c1c803
...
@@ -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
...
...
mysql-test/suite/parts/t/alter_table.test
View file @
c0c1c803
...
@@ -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
;
...
...
sql/sql_partition.cc
View file @
c0c1c803
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment