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
d63e1980
Commit
d63e1980
authored
Nov 05, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.0 into 10.1
parents
6472c5c0
03977e82
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
378 additions
and
63 deletions
+378
-63
include/mysql/service_kill_statement.h
include/mysql/service_kill_statement.h
+2
-2
mysql-test/r/ctype_latin1.result
mysql-test/r/ctype_latin1.result
+9
-0
mysql-test/r/index_merge_myisam.result
mysql-test/r/index_merge_myisam.result
+50
-0
mysql-test/suite/innodb/r/innodb-alter.result
mysql-test/suite/innodb/r/innodb-alter.result
+131
-7
mysql-test/suite/innodb/t/innodb-alter.test
mysql-test/suite/innodb/t/innodb-alter.test
+98
-3
mysql-test/t/ctype_latin1.test
mysql-test/t/ctype_latin1.test
+12
-0
mysql-test/t/index_merge_myisam.test
mysql-test/t/index_merge_myisam.test
+35
-0
sql/opt_range.cc
sql/opt_range.cc
+6
-0
storage/innobase/dict/dict0mem.cc
storage/innobase/dict/dict0mem.cc
+1
-3
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/handler0alter.cc
+15
-15
storage/xtradb/dict/dict0mem.cc
storage/xtradb/dict/dict0mem.cc
+1
-3
storage/xtradb/handler/ha_innodb.cc
storage/xtradb/handler/ha_innodb.cc
+1
-9
storage/xtradb/handler/ha_innodb.h
storage/xtradb/handler/ha_innodb.h
+0
-4
storage/xtradb/handler/handler0alter.cc
storage/xtradb/handler/handler0alter.cc
+15
-15
strings/ctype-simple.c
strings/ctype-simple.c
+2
-2
No files found.
include/mysql/service_kill_statement.h
View file @
d63e1980
/* Copyright (c) 2013,
Monty Program Ab.
/* Copyright (c) 2013,
2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -27,7 +27,7 @@
time-consuming loops, and gracefully abort the operation if it is
non-zero.
thd_
is_
killed(thd)
thd_killed(thd)
@return 0 - no KILL statement was issued, continue normally
@return 1 - there was a KILL statement, abort the execution.
...
...
mysql-test/r/ctype_latin1.result
View file @
d63e1980
...
...
@@ -8013,6 +8013,15 @@ ABCDEFGHI-ABCDEFGHI
DROP TABLE t1;
SET optimizer_switch=@save_optimizer_switch;
#
# MDEV-17298 ASAN unknown-crash / READ of size 1 in my_strntoul_8bit upon INSERT .. SELECT
#
SET NAMES latin1;
CREATE TABLE t1 (a CHAR);
CREATE TABLE t2 (b ENUM('foo','bar'));
INSERT INTO t1 VALUES ('1');
INSERT INTO t2 SELECT * FROM t1;
DROP TABLE t1, t2;
#
# End of 10.0 tests
#
#
...
...
mysql-test/r/index_merge_myisam.result
View file @
d63e1980
...
...
@@ -1712,3 +1712,53 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY,c1,i,c2 NULL NULL NULL 69 Using where
DROP TABLE t1;
set optimizer_switch= @optimizer_switch_save;
#
# MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union
#
create table t0
(
key1 int not null,
INDEX i1(key1)
);
insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8);
set @d=8;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
insert into t0 select key1+ @d from t0;
set @d=@d*2;
alter table t0 add key2 int not null, add index i2(key2);
alter table t0 add key3 int not null, add index i3(key3);
alter table t0 add key8 int not null, add index i8(key8);
update t0 set key2=key1,key3=key1,key8=1024-key1;
analyze table t0;
Table Op Msg_type Msg_text
test.t0 analyze status OK
set @optimizer_switch_save=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where
2 DERIVED t0 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
key1 key2 key3 key8
3 3 3 1021
set optimizer_use_condition_selectivity=2;
explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where
2 DERIVED t0 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
key1 key2 key3 key8
3 3 3 1021
set @@optimizer_switch= @optimizer_switch_save;
drop table t0;
mysql-test/suite/innodb/r/innodb-alter.result
View file @
d63e1980
...
...
@@ -714,6 +714,7 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t1 CHANGE COLUMN c1 C1 INT;
ALTER TABLE t2 CHANGE COLUMN c2 C2 INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
@@ -723,24 +724,147 @@ t1 CREATE TABLE `t1` (
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`
c2` int(11) NO
T NULL,
KEY `c2` (`
c
2`),
`
C2` int(11) DEFAUL
T NULL,
KEY `c2` (`
C
2`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
ALTER TABLE t2 CHANGE COLUMN C2 c6 INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`
C1
` int(11) NOT NULL,
PRIMARY KEY (`
C1
`)
`
c5
` int(11) NOT NULL,
PRIMARY KEY (`
c5
`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c
2` int(11) NO
T NULL,
KEY `c2` (`c
2
`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c
2`) REFERENCES `t1` (`c1
`)
`c
6` int(11) DEFAUL
T NULL,
KEY `c2` (`c
6
`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c
6`) REFERENCES `t1` (`c5
`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1';
NAME
c5
SELECT F.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS F INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_INDEXES I ON F.INDEX_ID=I.INDEX_ID INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON I.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1' AND I.NAME='PRIMARY';
NAME
c5
SELECT C.REF_COL_NAME, C.FOR_COL_NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_FOREIGN F ON C.ID=F.ID
WHERE F.FOR_NAME='test/t2';
REF_COL_NAME FOR_COL_NAME
c5 c6
DROP TABLE t2, t1;
# virtual columns case too
CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB;
ALTER TABLE t1 CHANGE COLUMN a A INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`A` int(11) DEFAULT NULL,
`b` int(11) AS (a) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1';
NAME
a
DROP TABLE t1;
# different FOREIGN KEY cases
CREATE TABLE t1 (
a INT UNIQUE KEY,
b INT UNIQUE KEY,
c INT UNIQUE KEY,
d INT UNIQUE KEY
) ENGINE=INNODB;
CREATE TABLE t2 (
aa INT,
bb INT,
cc INT,
dd INT
) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, 1, 1, 1);
INSERT INTO t2 VALUES (1, 1, 1, 1);
ALTER TABLE t1 CHANGE a A INT, ALGORITHM=INPLACE;
ALTER TABLE t1 CHANGE c C INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE cc CC INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE dd DD INT, ALGORITHM=INPLACE;
SET foreign_key_checks=0;
ALTER TABLE t2
ADD FOREIGN KEY(aa) REFERENCES t1(a),
ADD FOREIGN KEY(bb) REFERENCES t1(b),
ADD FOREIGN KEY(cc) REFERENCES t1(c),
ADD FOREIGN KEY(dd) REFERENCES t1(d),
ALGORITHM=INPLACE;
ALTER TABLE t1 CHANGE b B INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE aa AA INT, ALGORITHM=INPLACE;
ALTER TABLE t1 CHANGE d D INT, ALGORITHM=INPLACE;
ALTER TABLE t2 CHANGE bb BB INT, ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`A` int(11) DEFAULT NULL,
`B` int(11) DEFAULT NULL,
`C` int(11) DEFAULT NULL,
`D` int(11) DEFAULT NULL,
UNIQUE KEY `a` (`A`),
UNIQUE KEY `b` (`B`),
UNIQUE KEY `c` (`C`),
UNIQUE KEY `d` (`D`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`AA` int(11) DEFAULT NULL,
`BB` int(11) DEFAULT NULL,
`CC` int(11) DEFAULT NULL,
`DD` int(11) DEFAULT NULL,
KEY `aa` (`AA`),
KEY `bb` (`BB`),
KEY `CC` (`CC`),
KEY `DD` (`DD`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`),
CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`bb`) REFERENCES `t1` (`b`),
CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`cc`) REFERENCES `t1` (`c`),
CONSTRAINT `t2_ibfk_4` FOREIGN KEY (`dd`) REFERENCES `t1` (`d`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DELETE FROM t1 WHERE a=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE A=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE b=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE B=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE c=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE C=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE d=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DELETE FROM t1 WHERE D=1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
DROP TABLE t2, t1;
# virtual columns case too
CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB;
ALTER TABLE t1 CHANGE COLUMN a A INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`A` int(11) DEFAULT NULL,
`b` int(11) AS (a) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
WHERE T.NAME='test/t1';
NAME
a
DROP TABLE t1;
#
# BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
# DICT_MEM_TABLE_COL_RENAME_LOW
...
...
mysql-test/suite/innodb/t/innodb-alter.test
View file @
d63e1980
...
...
@@ -419,15 +419,110 @@ CREATE TABLE t2(c2 INT NOT NULL, FOREIGN KEY(c2) REFERENCES t1(c1))ENGINE=INNODB
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t2
;
ALTER
TABLE
t1
CHANGE
COLUMN
c1
C1
INT
;
ALTER
TABLE
t2
CHANGE
COLUMN
c2
C2
INT
;
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t2
;
# FIXME: MDEV-13671 InnoDB should use case-insensitive column name comparisons
# like the rest of the server
#ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
ALTER
TABLE
t1
CHANGE
COLUMN
C1
c5
INT
;
ALTER
TABLE
t2
CHANGE
COLUMN
C2
c6
INT
;
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t2
;
SELECT
C
.
NAME
FROM
INFORMATION_SCHEMA
.
INNODB_SYS_COLUMNS
C
INNER
JOIN
INFORMATION_SCHEMA
.
INNODB_SYS_TABLES
T
ON
C
.
TABLE_ID
=
T
.
TABLE_ID
WHERE
T
.
NAME
=
'test/t1'
;
SELECT
F
.
NAME
FROM
INFORMATION_SCHEMA
.
INNODB_SYS_FIELDS
F
INNER
JOIN
INFORMATION_SCHEMA
.
INNODB_SYS_INDEXES
I
ON
F
.
INDEX_ID
=
I
.
INDEX_ID
INNER
JOIN
INFORMATION_SCHEMA
.
INNODB_SYS_TABLES
T
ON
I
.
TABLE_ID
=
T
.
TABLE_ID
WHERE
T
.
NAME
=
'test/t1'
AND
I
.
NAME
=
'PRIMARY'
;
SELECT
C
.
REF_COL_NAME
,
C
.
FOR_COL_NAME
FROM
INFORMATION_SCHEMA
.
INNODB_SYS_FOREIGN_COLS
C
INNER
JOIN
INFORMATION_SCHEMA
.
INNODB_SYS_FOREIGN
F
ON
C
.
ID
=
F
.
ID
WHERE
F
.
FOR_NAME
=
'test/t2'
;
DROP
TABLE
t2
,
t1
;
--
echo
# virtual columns case too
CREATE
TABLE
t1
(
a
INT
,
b
INT
GENERATED
ALWAYS
AS
(
a
)
VIRTUAL
)
ENGINE
=
InnoDB
;
ALTER
TABLE
t1
CHANGE
COLUMN
a
A
INT
;
SHOW
CREATE
TABLE
t1
;
SELECT
C
.
NAME
FROM
INFORMATION_SCHEMA
.
INNODB_SYS_COLUMNS
C
INNER
JOIN
INFORMATION_SCHEMA
.
INNODB_SYS_TABLES
T
ON
C
.
TABLE_ID
=
T
.
TABLE_ID
WHERE
T
.
NAME
=
'test/t1'
;
DROP
TABLE
t1
;
--
echo
# different FOREIGN KEY cases
CREATE
TABLE
t1
(
a
INT
UNIQUE
KEY
,
b
INT
UNIQUE
KEY
,
c
INT
UNIQUE
KEY
,
d
INT
UNIQUE
KEY
)
ENGINE
=
INNODB
;
CREATE
TABLE
t2
(
aa
INT
,
bb
INT
,
cc
INT
,
dd
INT
)
ENGINE
=
INNODB
;
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
,
1
);
INSERT
INTO
t2
VALUES
(
1
,
1
,
1
,
1
);
ALTER
TABLE
t1
CHANGE
a
A
INT
,
ALGORITHM
=
INPLACE
;
ALTER
TABLE
t1
CHANGE
c
C
INT
,
ALGORITHM
=
INPLACE
;
ALTER
TABLE
t2
CHANGE
cc
CC
INT
,
ALGORITHM
=
INPLACE
;
ALTER
TABLE
t2
CHANGE
dd
DD
INT
,
ALGORITHM
=
INPLACE
;
SET
foreign_key_checks
=
0
;
ALTER
TABLE
t2
ADD
FOREIGN
KEY
(
aa
)
REFERENCES
t1
(
a
),
ADD
FOREIGN
KEY
(
bb
)
REFERENCES
t1
(
b
),
ADD
FOREIGN
KEY
(
cc
)
REFERENCES
t1
(
c
),
ADD
FOREIGN
KEY
(
dd
)
REFERENCES
t1
(
d
),
ALGORITHM
=
INPLACE
;
ALTER
TABLE
t1
CHANGE
b
B
INT
,
ALGORITHM
=
INPLACE
;
ALTER
TABLE
t2
CHANGE
aa
AA
INT
,
ALGORITHM
=
INPLACE
;
--
source
include
/
restart_mysqld
.
inc
ALTER
TABLE
t1
CHANGE
d
D
INT
,
ALGORITHM
=
INPLACE
;
ALTER
TABLE
t2
CHANGE
bb
BB
INT
,
ALGORITHM
=
INPLACE
;
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t2
;
--
error
ER_ROW_IS_REFERENCED_2
DELETE
FROM
t1
WHERE
a
=
1
;
--
error
ER_ROW_IS_REFERENCED_2
DELETE
FROM
t1
WHERE
A
=
1
;
--
error
ER_ROW_IS_REFERENCED_2
DELETE
FROM
t1
WHERE
b
=
1
;
--
error
ER_ROW_IS_REFERENCED_2
DELETE
FROM
t1
WHERE
B
=
1
;
--
error
ER_ROW_IS_REFERENCED_2
DELETE
FROM
t1
WHERE
c
=
1
;
--
error
ER_ROW_IS_REFERENCED_2
DELETE
FROM
t1
WHERE
C
=
1
;
--
error
ER_ROW_IS_REFERENCED_2
DELETE
FROM
t1
WHERE
d
=
1
;
--
error
ER_ROW_IS_REFERENCED_2
DELETE
FROM
t1
WHERE
D
=
1
;
DROP
TABLE
t2
,
t1
;
--
echo
# virtual columns case too
CREATE
TABLE
t1
(
a
INT
,
b
INT
GENERATED
ALWAYS
AS
(
a
)
VIRTUAL
)
ENGINE
=
InnoDB
;
ALTER
TABLE
t1
CHANGE
COLUMN
a
A
INT
;
SHOW
CREATE
TABLE
t1
;
SELECT
C
.
NAME
FROM
INFORMATION_SCHEMA
.
INNODB_SYS_COLUMNS
C
INNER
JOIN
INFORMATION_SCHEMA
.
INNODB_SYS_TABLES
T
ON
C
.
TABLE_ID
=
T
.
TABLE_ID
WHERE
T
.
NAME
=
'test/t1'
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
--
echo
# DICT_MEM_TABLE_COL_RENAME_LOW
...
...
mysql-test/t/ctype_latin1.test
View file @
d63e1980
...
...
@@ -264,6 +264,18 @@ SET NAMES latin1;
--
source
include
/
ctype_mdev13118
.
inc
--
echo
#
--
echo
# MDEV-17298 ASAN unknown-crash / READ of size 1 in my_strntoul_8bit upon INSERT .. SELECT
--
echo
#
SET
NAMES
latin1
;
CREATE
TABLE
t1
(
a
CHAR
);
CREATE
TABLE
t2
(
b
ENUM
(
'foo'
,
'bar'
));
INSERT
INTO
t1
VALUES
(
'1'
);
INSERT
INTO
t2
SELECT
*
FROM
t1
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# End of 10.0 tests
--
echo
#
...
...
mysql-test/t/index_merge_myisam.test
View file @
d63e1980
...
...
@@ -243,3 +243,38 @@ DROP TABLE t1;
set
optimizer_switch
=
@
optimizer_switch_save
;
--
echo
#
--
echo
# MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union
--
echo
#
create
table
t0
(
key1
int
not
null
,
INDEX
i1
(
key1
)
);
insert
into
t0
values
(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
);
let
$
1
=
7
;
set
@
d
=
8
;
while
(
$
1
)
{
eval
insert
into
t0
select
key1
+
@
d
from
t0
;
eval
set
@
d
=@
d
*
2
;
dec
$
1
;
}
alter
table
t0
add
key2
int
not
null
,
add
index
i2
(
key2
);
alter
table
t0
add
key3
int
not
null
,
add
index
i3
(
key3
);
alter
table
t0
add
key8
int
not
null
,
add
index
i8
(
key8
);
update
t0
set
key2
=
key1
,
key3
=
key1
,
key8
=
1024
-
key1
;
analyze
table
t0
;
set
@
optimizer_switch_save
=@@
optimizer_switch
;
set
optimizer_switch
=
'derived_merge=off,derived_with_keys=off'
;
explain
select
*
from
(
select
*
from
t0
where
key1
=
3
or
key2
=
3
)
as
Z
where
Z
.
key8
>
5
;
select
*
from
(
select
*
from
t0
where
key1
=
3
or
key2
=
3
)
as
Z
where
Z
.
key8
>
5
;
set
optimizer_use_condition_selectivity
=
2
;
explain
select
*
from
(
select
*
from
t0
where
key1
=
3
or
key2
=
3
)
as
Z
where
Z
.
key8
>
5
;
select
*
from
(
select
*
from
t0
where
key1
=
3
or
key2
=
3
)
as
Z
where
Z
.
key8
>
5
;
set
@@
optimizer_switch
=
@
optimizer_switch_save
;
drop
table
t0
;
sql/opt_range.cc
View file @
d63e1980
...
...
@@ -3139,6 +3139,12 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
}
if
(
quick
&&
(
quick
->
get_type
()
==
QUICK_SELECT_I
::
QS_TYPE_ROR_UNION
||
quick
->
get_type
()
==
QUICK_SELECT_I
::
QS_TYPE_INDEX_MERGE
))
{
table
->
cond_selectivity
*=
(
quick
->
records
/
table_records
);
}
bitmap_union
(
used_fields
,
&
handled_columns
);
/* Check if we can improve selectivity estimates by using sampling */
...
...
storage/innobase/dict/dict0mem.cc
View file @
d63e1980
...
...
@@ -498,9 +498,7 @@ dict_mem_table_col_rename(
s
+=
len
+
1
;
}
/* This could fail if the data dictionaries are out of sync.
Proceed with the renaming anyway. */
ut_ad
(
!
strcmp
(
from
,
s
));
ut_ad
(
!
my_strcasecmp
(
system_charset_info
,
from
,
s
));
dict_mem_table_col_rename_low
(
table
,
nth_col
,
to
,
s
);
}
...
...
storage/innobase/handler/handler0alter.cc
View file @
d63e1980
...
...
@@ -4631,7 +4631,6 @@ innobase_rename_column_try(
pars_info_add_ull_literal
(
info
,
"tableid"
,
user_table
->
id
);
pars_info_add_int4_literal
(
info
,
"nth"
,
nth_col
);
pars_info_add_str_literal
(
info
,
"old"
,
from
);
pars_info_add_str_literal
(
info
,
"new"
,
to
);
trx
->
op_info
=
"renaming column in SYS_COLUMNS"
;
...
...
@@ -4641,7 +4640,7 @@ innobase_rename_column_try(
"PROCEDURE RENAME_SYS_COLUMNS_PROC () IS
\n
"
"BEGIN
\n
"
"UPDATE SYS_COLUMNS SET NAME=:new
\n
"
"WHERE TABLE_ID=:tableid
AND NAME=:old
\n
"
"WHERE TABLE_ID=:tableid
\n
"
"AND POS=:nth;
\n
"
"END;
\n
"
,
FALSE
,
trx
);
...
...
@@ -4665,8 +4664,10 @@ innobase_rename_column_try(
index
=
dict_table_get_next_index
(
index
))
{
for
(
ulint
i
=
0
;
i
<
dict_index_get_n_fields
(
index
);
i
++
)
{
if
(
strcmp
(
dict_index_get_nth_field
(
index
,
i
)
->
name
,
from
))
{
if
(
my_strcasecmp
(
system_charset_info
,
dict_index_get_nth_field
(
index
,
i
)
->
name
,
from
))
{
continue
;
}
...
...
@@ -4674,7 +4675,6 @@ innobase_rename_column_try(
pars_info_add_ull_literal
(
info
,
"indexid"
,
index
->
id
);
pars_info_add_int4_literal
(
info
,
"nth"
,
i
);
pars_info_add_str_literal
(
info
,
"old"
,
from
);
pars_info_add_str_literal
(
info
,
"new"
,
to
);
error
=
que_eval_sql
(
...
...
@@ -4683,14 +4683,14 @@ innobase_rename_column_try(
"BEGIN
\n
"
"UPDATE SYS_FIELDS SET COL_NAME=:new
\n
"
"WHERE INDEX_ID=:indexid
AND COL_NAME=:old
\n
"
"WHERE INDEX_ID=:indexid
\n
"
"AND POS=:nth;
\n
"
/* Try again, in case there is a prefix_len
encoded in SYS_FIELDS.POS */
"UPDATE SYS_FIELDS SET COL_NAME=:new
\n
"
"WHERE INDEX_ID=:indexid
AND COL_NAME=:old
\n
"
"WHERE INDEX_ID=:indexid
\n
"
"AND POS>=65536*:nth AND POS<65536*(:nth+1);
\n
"
"END;
\n
"
,
...
...
@@ -4716,7 +4716,9 @@ innobase_rename_column_try(
foreign_modified
=
false
;
for
(
unsigned
i
=
0
;
i
<
foreign
->
n_fields
;
i
++
)
{
if
(
strcmp
(
foreign
->
foreign_col_names
[
i
],
from
))
{
if
(
my_strcasecmp
(
system_charset_info
,
foreign
->
foreign_col_names
[
i
],
from
))
{
continue
;
}
...
...
@@ -4724,7 +4726,6 @@ innobase_rename_column_try(
pars_info_add_str_literal
(
info
,
"id"
,
foreign
->
id
);
pars_info_add_int4_literal
(
info
,
"nth"
,
i
);
pars_info_add_str_literal
(
info
,
"old"
,
from
);
pars_info_add_str_literal
(
info
,
"new"
,
to
);
error
=
que_eval_sql
(
...
...
@@ -4733,8 +4734,7 @@ innobase_rename_column_try(
"BEGIN
\n
"
"UPDATE SYS_FOREIGN_COLS
\n
"
"SET FOR_COL_NAME=:new
\n
"
"WHERE ID=:id AND POS=:nth
\n
"
"AND FOR_COL_NAME=:old;
\n
"
"WHERE ID=:id AND POS=:nth;
\n
"
"END;
\n
"
,
FALSE
,
trx
);
...
...
@@ -4758,7 +4758,9 @@ innobase_rename_column_try(
dict_foreign_t
*
foreign
=
*
it
;
for
(
unsigned
i
=
0
;
i
<
foreign
->
n_fields
;
i
++
)
{
if
(
strcmp
(
foreign
->
referenced_col_names
[
i
],
from
))
{
if
(
my_strcasecmp
(
system_charset_info
,
foreign
->
referenced_col_names
[
i
],
from
))
{
continue
;
}
...
...
@@ -4766,7 +4768,6 @@ innobase_rename_column_try(
pars_info_add_str_literal
(
info
,
"id"
,
foreign
->
id
);
pars_info_add_int4_literal
(
info
,
"nth"
,
i
);
pars_info_add_str_literal
(
info
,
"old"
,
from
);
pars_info_add_str_literal
(
info
,
"new"
,
to
);
error
=
que_eval_sql
(
...
...
@@ -4775,8 +4776,7 @@ innobase_rename_column_try(
"BEGIN
\n
"
"UPDATE SYS_FOREIGN_COLS
\n
"
"SET REF_COL_NAME=:new
\n
"
"WHERE ID=:id AND POS=:nth
\n
"
"AND REF_COL_NAME=:old;
\n
"
"WHERE ID=:id AND POS=:nth;
\n
"
"END;
\n
"
,
FALSE
,
trx
);
...
...
storage/xtradb/dict/dict0mem.cc
View file @
d63e1980
...
...
@@ -499,9 +499,7 @@ dict_mem_table_col_rename(
s
+=
len
+
1
;
}
/* This could fail if the data dictionaries are out of sync.
Proceed with the renaming anyway. */
ut_ad
(
!
strcmp
(
from
,
s
));
ut_ad
(
!
my_strcasecmp
(
system_charset_info
,
from
,
s
));
dict_mem_table_col_rename_low
(
table
,
nth_col
,
to
,
s
);
}
...
...
storage/xtradb/handler/ha_innodb.cc
View file @
d63e1980
...
...
@@ -5,6 +5,7 @@ Copyright (c) 2013, 2018, MariaDB Corporation.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2018, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
...
...
@@ -22147,15 +22148,6 @@ int ha_innobase::multi_range_read_explain_info(uint mrr_mode, char *str, size_t
return
ds_mrr
.
dsmrr_explain_info
(
mrr_mode
,
str
,
size
);
}
/*
A helper function used only in index_cond_func_innodb
*/
bool
ha_innobase
::
is_thd_killed
()
{
return
thd_kill_level
(
user_thd
);
}
/**********************************************************************
Issue a warning that the row is too big. */
UNIV_INTERN
...
...
storage/xtradb/handler/ha_innodb.h
View file @
d63e1980
...
...
@@ -389,10 +389,6 @@ class ha_innobase: public handler
* @return idx_cond if pushed; NULL if not pushed
*/
class
Item
*
idx_cond_push
(
uint
keyno
,
class
Item
*
idx_cond
);
/* An helper function for index_cond_func_innodb: */
bool
is_thd_killed
();
private:
/** The multi range read session object */
DsMrr_impl
ds_mrr
;
...
...
storage/xtradb/handler/handler0alter.cc
View file @
d63e1980
...
...
@@ -4635,7 +4635,6 @@ innobase_rename_column_try(
pars_info_add_ull_literal
(
info
,
"tableid"
,
user_table
->
id
);
pars_info_add_int4_literal
(
info
,
"nth"
,
nth_col
);
pars_info_add_str_literal
(
info
,
"old"
,
from
);
pars_info_add_str_literal
(
info
,
"new"
,
to
);
trx
->
op_info
=
"renaming column in SYS_COLUMNS"
;
...
...
@@ -4645,7 +4644,7 @@ innobase_rename_column_try(
"PROCEDURE RENAME_SYS_COLUMNS_PROC () IS
\n
"
"BEGIN
\n
"
"UPDATE SYS_COLUMNS SET NAME=:new
\n
"
"WHERE TABLE_ID=:tableid
AND NAME=:old
\n
"
"WHERE TABLE_ID=:tableid
\n
"
"AND POS=:nth;
\n
"
"END;
\n
"
,
FALSE
,
trx
);
...
...
@@ -4669,8 +4668,10 @@ innobase_rename_column_try(
index
=
dict_table_get_next_index
(
index
))
{
for
(
ulint
i
=
0
;
i
<
dict_index_get_n_fields
(
index
);
i
++
)
{
if
(
strcmp
(
dict_index_get_nth_field
(
index
,
i
)
->
name
,
from
))
{
if
(
my_strcasecmp
(
system_charset_info
,
dict_index_get_nth_field
(
index
,
i
)
->
name
,
from
))
{
continue
;
}
...
...
@@ -4678,7 +4679,6 @@ innobase_rename_column_try(
pars_info_add_ull_literal
(
info
,
"indexid"
,
index
->
id
);
pars_info_add_int4_literal
(
info
,
"nth"
,
i
);
pars_info_add_str_literal
(
info
,
"old"
,
from
);
pars_info_add_str_literal
(
info
,
"new"
,
to
);
error
=
que_eval_sql
(
...
...
@@ -4687,14 +4687,14 @@ innobase_rename_column_try(
"BEGIN
\n
"
"UPDATE SYS_FIELDS SET COL_NAME=:new
\n
"
"WHERE INDEX_ID=:indexid
AND COL_NAME=:old
\n
"
"WHERE INDEX_ID=:indexid
\n
"
"AND POS=:nth;
\n
"
/* Try again, in case there is a prefix_len
encoded in SYS_FIELDS.POS */
"UPDATE SYS_FIELDS SET COL_NAME=:new
\n
"
"WHERE INDEX_ID=:indexid
AND COL_NAME=:old
\n
"
"WHERE INDEX_ID=:indexid
\n
"
"AND POS>=65536*:nth AND POS<65536*(:nth+1);
\n
"
"END;
\n
"
,
...
...
@@ -4720,7 +4720,9 @@ innobase_rename_column_try(
foreign_modified
=
false
;
for
(
unsigned
i
=
0
;
i
<
foreign
->
n_fields
;
i
++
)
{
if
(
strcmp
(
foreign
->
foreign_col_names
[
i
],
from
))
{
if
(
my_strcasecmp
(
system_charset_info
,
foreign
->
foreign_col_names
[
i
],
from
))
{
continue
;
}
...
...
@@ -4728,7 +4730,6 @@ innobase_rename_column_try(
pars_info_add_str_literal
(
info
,
"id"
,
foreign
->
id
);
pars_info_add_int4_literal
(
info
,
"nth"
,
i
);
pars_info_add_str_literal
(
info
,
"old"
,
from
);
pars_info_add_str_literal
(
info
,
"new"
,
to
);
error
=
que_eval_sql
(
...
...
@@ -4737,8 +4738,7 @@ innobase_rename_column_try(
"BEGIN
\n
"
"UPDATE SYS_FOREIGN_COLS
\n
"
"SET FOR_COL_NAME=:new
\n
"
"WHERE ID=:id AND POS=:nth
\n
"
"AND FOR_COL_NAME=:old;
\n
"
"WHERE ID=:id AND POS=:nth;
\n
"
"END;
\n
"
,
FALSE
,
trx
);
...
...
@@ -4762,7 +4762,9 @@ innobase_rename_column_try(
dict_foreign_t
*
foreign
=
*
it
;
for
(
unsigned
i
=
0
;
i
<
foreign
->
n_fields
;
i
++
)
{
if
(
strcmp
(
foreign
->
referenced_col_names
[
i
],
from
))
{
if
(
my_strcasecmp
(
system_charset_info
,
foreign
->
referenced_col_names
[
i
],
from
))
{
continue
;
}
...
...
@@ -4770,7 +4772,6 @@ innobase_rename_column_try(
pars_info_add_str_literal
(
info
,
"id"
,
foreign
->
id
);
pars_info_add_int4_literal
(
info
,
"nth"
,
i
);
pars_info_add_str_literal
(
info
,
"old"
,
from
);
pars_info_add_str_literal
(
info
,
"new"
,
to
);
error
=
que_eval_sql
(
...
...
@@ -4779,8 +4780,7 @@ innobase_rename_column_try(
"BEGIN
\n
"
"UPDATE SYS_FOREIGN_COLS
\n
"
"SET REF_COL_NAME=:new
\n
"
"WHERE ID=:id AND POS=:nth
\n
"
"AND REF_COL_NAME=:old;
\n
"
"WHERE ID=:id AND POS=:nth;
\n
"
"END;
\n
"
,
FALSE
,
trx
);
...
...
strings/ctype-simple.c
View file @
d63e1980
...
...
@@ -461,7 +461,6 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
register
uint
cutlim
;
register
uint32
i
;
register
const
char
*
s
;
register
uchar
c
;
const
char
*
save
,
*
e
;
int
overflow
;
...
...
@@ -496,8 +495,9 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
overflow
=
0
;
i
=
0
;
for
(
c
=
*
s
;
s
!=
e
;
c
=
*
++
s
)
for
(
;
s
!=
e
;
++
s
)
{
register
uchar
c
=
*
s
;
if
(
c
>=
'0'
&&
c
<=
'9'
)
c
-=
'0'
;
else
if
(
c
>=
'A'
&&
c
<=
'Z'
)
...
...
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