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
2f6a014f
Commit
2f6a014f
authored
May 23, 2022
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.4 into 10.5
parents
cf75793d
7d5d9ead
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
160 additions
and
4 deletions
+160
-4
mysql-test/main/multi_update.result
mysql-test/main/multi_update.result
+90
-0
mysql-test/main/multi_update.test
mysql-test/main/multi_update.test
+31
-0
mysql-test/main/partition_exchange.result
mysql-test/main/partition_exchange.result
+13
-0
mysql-test/main/partition_exchange.test
mysql-test/main/partition_exchange.test
+18
-0
sql/sql_partition_admin.cc
sql/sql_partition_admin.cc
+7
-2
sql/sql_update.cc
sql/sql_update.cc
+1
-2
No files found.
mysql-test/main/multi_update.result
View file @
2f6a014f
...
...
@@ -1161,3 +1161,93 @@ ERROR 21000: Subquery returns more than 1 row
update t1 set a= (select 2 from t1 having (a = 3));
ERROR 21000: Subquery returns more than 1 row
drop tables t1;
#
# MDEV-28246 Optimizer uses all partitions during an update in MariaDB 10.6.x but not in 10.2.x
#
CREATE TABLE t1 (
part INT(1),
a INT(1),
b INT(1),
PRIMARY KEY (a,part),
INDEX b (b,part)
) PARTITION BY LIST (part) (
PARTITION Current VALUES IN (0),
PARTITION Relevant VALUES IN (1),
PARTITION Archive VALUES IN (2)
);
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 (part,a,b) VALUES (0,0,0),(1,1,1),(2,2,2);
INSERT INTO t2 (part,a,b) VALUES (0,0,0),(1,1,1),(2,2,2);
# Expecting partition "Current"
EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=3 WHERE t2.part=0 AND t1.part=0;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t2",
"partitions": ["Current"],
"access_type": "system",
"possible_keys": ["PRIMARY"],
"rows": 1,
"filtered": 100
},
"table": {
"table_name": "t1",
"partitions": ["Current"],
"access_type": "system",
"possible_keys": ["PRIMARY"],
"rows": 1,
"filtered": 100
}
}
}
# Expecting partition "Relevant"
EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=2 WHERE t2.part=1 AND t1.part=1;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t2",
"partitions": ["Relevant"],
"access_type": "system",
"possible_keys": ["PRIMARY"],
"rows": 1,
"filtered": 100
},
"table": {
"table_name": "t1",
"partitions": ["Relevant"],
"access_type": "system",
"possible_keys": ["PRIMARY"],
"rows": 1,
"filtered": 100
}
}
}
# Expecting partition "Archive"
EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=3 WHERE t2.part=2 AND t1.part=2;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t2",
"partitions": ["Archive"],
"access_type": "system",
"possible_keys": ["PRIMARY"],
"rows": 1,
"filtered": 100
},
"table": {
"table_name": "t1",
"partitions": ["Archive"],
"access_type": "system",
"possible_keys": ["PRIMARY"],
"rows": 1,
"filtered": 100
}
}
}
DROP TABLES t1, t2;
mysql-test/main/multi_update.test
View file @
2f6a014f
...
...
@@ -1098,3 +1098,34 @@ select a from t1 where a= (select 2 from t1 having (a = 3));
--
error
ER_SUBQUERY_NO_1_ROW
update
t1
set
a
=
(
select
2
from
t1
having
(
a
=
3
));
drop
tables
t1
;
--
echo
#
--
echo
# MDEV-28246 Optimizer uses all partitions during an update in MariaDB 10.6.x but not in 10.2.x
--
echo
#
--
source
include
/
have_partition
.
inc
CREATE
TABLE
t1
(
part
INT
(
1
),
a
INT
(
1
),
b
INT
(
1
),
PRIMARY
KEY
(
a
,
part
),
INDEX
b
(
b
,
part
)
)
PARTITION
BY
LIST
(
part
)
(
PARTITION
Current
VALUES
IN
(
0
),
PARTITION
Relevant
VALUES
IN
(
1
),
PARTITION
Archive
VALUES
IN
(
2
)
);
CREATE
TABLE
t2
LIKE
t1
;
INSERT
INTO
t1
(
part
,
a
,
b
)
VALUES
(
0
,
0
,
0
),(
1
,
1
,
1
),(
2
,
2
,
2
);
INSERT
INTO
t2
(
part
,
a
,
b
)
VALUES
(
0
,
0
,
0
),(
1
,
1
,
1
),(
2
,
2
,
2
);
--
echo
# Expecting partition "Current"
EXPLAIN
FORMAT
=
JSON
UPDATE
t2
JOIN
t1
USING
(
a
)
SET
t2
.
part
=
3
WHERE
t2
.
part
=
0
AND
t1
.
part
=
0
;
--
echo
# Expecting partition "Relevant"
EXPLAIN
FORMAT
=
JSON
UPDATE
t2
JOIN
t1
USING
(
a
)
SET
t2
.
part
=
2
WHERE
t2
.
part
=
1
AND
t1
.
part
=
1
;
--
echo
# Expecting partition "Archive"
EXPLAIN
FORMAT
=
JSON
UPDATE
t2
JOIN
t1
USING
(
a
)
SET
t2
.
part
=
3
WHERE
t2
.
part
=
2
AND
t1
.
part
=
2
;
DROP
TABLES
t1
,
t2
;
mysql-test/main/partition_exchange.result
View file @
2f6a014f
...
...
@@ -1308,3 +1308,16 @@ ALTER TABLE t2 REMOVE PARTITIONING;
ALTER TABLE t1 EXCHANGE PARTITION pm WITH TABLE t2;
ERROR HY000: Non matching attribute 'TABLESPACE' between partition and table
DROP TABLE t1, t2;
#
# MDEV-14642 Assertion `table->s->db_create_options == part_table->s->db_create_options' failed in compare_table_with_partition
#
CREATE TABLE t1 (a INT) ROW_FORMAT=DYNAMIC PARTITION BY KEY(a) PARTITIONS 2;
CREATE TABLE t2 (a INT) ;
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
ERROR HY000: Tables have different definitions
DROP TABLE t1, t2;
CREATE TABLE t1 (a INT, PRIMARY KEY(a)) ENGINE=InnoDB PARTITION BY KEY(a) PARTITIONS 2;
CREATE TABLE t2 (a INT, PRIMARY KEY(a)) CHECKSUM=1, ENGINE=InnoDB;
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Tables have different definitions
DROP TABLE t1, t2;
mysql-test/main/partition_exchange.test
View file @
2f6a014f
...
...
@@ -536,3 +536,21 @@ ALTER TABLE t2 REMOVE PARTITIONING;
ALTER
TABLE
t1
EXCHANGE
PARTITION
pm
WITH
TABLE
t2
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# MDEV-14642 Assertion `table->s->db_create_options == part_table->s->db_create_options' failed in compare_table_with_partition
--
echo
#
CREATE
TABLE
t1
(
a
INT
)
ROW_FORMAT
=
DYNAMIC
PARTITION
BY
KEY
(
a
)
PARTITIONS
2
;
CREATE
TABLE
t2
(
a
INT
)
;
--
error
ER_TABLES_DIFFERENT_METADATA
ALTER
TABLE
t1
EXCHANGE
PARTITION
p1
WITH
TABLE
t2
;
# Cleanup
DROP
TABLE
t1
,
t2
;
CREATE
TABLE
t1
(
a
INT
,
PRIMARY
KEY
(
a
))
ENGINE
=
InnoDB
PARTITION
BY
KEY
(
a
)
PARTITIONS
2
;
CREATE
TABLE
t2
(
a
INT
,
PRIMARY
KEY
(
a
))
CHECKSUM
=
1
,
ENGINE
=
InnoDB
;
--
error
ER_TABLES_DIFFERENT_METADATA
ALTER
TABLE
t1
EXCHANGE
PARTITION
p0
WITH
TABLE
t2
;
# Cleanup
DROP
TABLE
t1
,
t2
;
sql/sql_partition_admin.cc
View file @
2f6a014f
...
...
@@ -249,8 +249,13 @@ static bool compare_table_with_partition(THD *thd, TABLE *table,
my_error
(
ER_TABLES_DIFFERENT_METADATA
,
MYF
(
0
));
DBUG_RETURN
(
TRUE
);
}
DBUG_ASSERT
(
table
->
s
->
db_create_options
==
part_table
->
s
->
db_create_options
);
if
(
table
->
s
->
db_create_options
!=
part_table
->
s
->
db_create_options
)
{
my_error
(
ER_TABLES_DIFFERENT_METADATA
,
MYF
(
0
));
DBUG_RETURN
(
TRUE
);
}
DBUG_ASSERT
(
table
->
s
->
db_options_in_use
==
part_table
->
s
->
db_options_in_use
);
...
...
sql/sql_update.cc
View file @
2f6a014f
...
...
@@ -2115,10 +2115,9 @@ int multi_update::prepare(List<Item> ¬_used_values,
if
(
!
tl
)
DBUG_RETURN
(
1
);
update
.
link_in_list
(
tl
,
&
tl
->
next_local
);
tl
->
shared
=
table_count
++
;
t
able_ref
->
shared
=
t
l
->
shared
=
table_count
++
;
table
->
no_keyread
=
1
;
table
->
covering_keys
.
clear_all
();
table
->
pos_in_table_list
=
tl
;
table
->
prepare_triggers_for_update_stmt_or_event
();
table
->
reset_default_fields
();
}
...
...
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