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
0063a8c9
Commit
0063a8c9
authored
7 months ago
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10.5' into 10.6
parents
811614d4
fdda8171
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
926 additions
and
84 deletions
+926
-84
mysql-test/main/derived_cond_pushdown.result
mysql-test/main/derived_cond_pushdown.result
+495
-0
mysql-test/main/derived_cond_pushdown.test
mysql-test/main/derived_cond_pushdown.test
+87
-0
mysql-test/main/item_types.result
mysql-test/main/item_types.result
+16
-0
mysql-test/main/item_types.test
mysql-test/main/item_types.test
+15
-0
mysql-test/main/join_cache.result
mysql-test/main/join_cache.result
+20
-0
mysql-test/main/join_cache.test
mysql-test/main/join_cache.test
+22
-0
mysql-test/main/json_debug_nonembedded_noasan.result
mysql-test/main/json_debug_nonembedded_noasan.result
+0
-0
mysql-test/main/json_debug_nonembedded_noasan.test
mysql-test/main/json_debug_nonembedded_noasan.test
+0
-0
mysql-test/main/win.result
mysql-test/main/win.result
+51
-6
mysql-test/main/win.test
mysql-test/main/win.test
+39
-7
mysql-test/suite/encryption/r/tempfiles_encrypted.result
mysql-test/suite/encryption/r/tempfiles_encrypted.result
+51
-6
mysql-test/suite/innodb/r/import_bugs.result
mysql-test/suite/innodb/r/import_bugs.result
+26
-0
mysql-test/suite/innodb/t/import_bugs.test
mysql-test/suite/innodb/t/import_bugs.test
+20
-0
mysys/crc32/crc32c_x86.cc
mysys/crc32/crc32c_x86.cc
+22
-7
sql/item.cc
sql/item.cc
+12
-12
sql/item.h
sql/item.h
+27
-31
sql/key.cc
sql/key.cc
+8
-6
sql/sql_derived.cc
sql/sql_derived.cc
+1
-0
sql/sql_select.cc
sql/sql_select.cc
+2
-2
sql/sql_window.cc
sql/sql_window.cc
+4
-1
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/handler0alter.cc
+6
-4
storage/innobase/include/mach0data.inl
storage/innobase/include/mach0data.inl
+2
-2
No files found.
mysql-test/main/derived_cond_pushdown.result
View file @
0063a8c9
This diff is collapsed.
Click to expand it.
mysql-test/main/derived_cond_pushdown.test
View file @
0063a8c9
...
...
@@ -4103,3 +4103,90 @@ eval $q;
DROP
TABLE
t1
,
t2
;
--
echo
# End of 10.4 tests
--
echo
# MDEV-34506 2nd execution name resolution problem with pushdown into
--
echo
# unions
--
echo
#
--
echo
# Statements affected by this bug need all the following to be true
--
echo
# 1) a derived table table or view whose specification contains a set
--
echo
# operation at the top level.
--
echo
# 2) a grouping operator (group by/having) operating on a column alias
--
echo
# other than in the first select of the union/intersect
--
echo
# 3) an outer condition that will be pushed into all selects in this
--
echo
# union/intersect, either into the where or having clause
--
echo
#
--
echo
# When pushing a condition into all selects of a unit with more than one
--
echo
# select, pushdown_cond_for_derived() renames items so we can re-use the
--
echo
# condition being pushed.
--
echo
# These names need to be saved and reset for correct name resolution on
--
echo
# second execution of prepared statements.
create
table
t1
(
c1
int
,
c2
int
,
c3
int
);
insert
into
t1
values
(
1
,
2
,
3
),(
1
,
2
,
2
),(
4
,
5
,
6
);
insert
into
t1
values
(
17
,
8
,
9
),(
11
,
11
,
12
);
create
table
t2
(
c4
int
,
c5
int
,
c6
int
);
insert
into
t2
values
(
7
,
8
,
9
),(
10
,
11
,
12
);
let
$q
=
select
*
from
(
select
c1
,
sum
(
c3
)
as
s
from
t1
group
by
c1
union
select
c4
as
c
,
sum
(
c6
)
as
u
from
t2
group
by
c
)
dt
where
c1
>
6
;
eval
prepare
stmt
from
'$q'
;
execute
stmt
;
execute
stmt
;
eval
prepare
stmt
from
'explain format=json $q'
;
--
source
include
/
analyze
-
format
.
inc
execute
stmt
;
--
source
include
/
analyze
-
format
.
inc
execute
stmt
;
let
$q
=
select
*
from
(
select
c1
,
c2
,
sum
(
c3
)
as
s
from
t1
group
by
c1
,
c2
having
s
>
2
union
select
c4
,
c5
,
sum
(
c6
)
as
u
from
t2
group
by
c4
,
c5
having
u
>
3
)
dt
where
c2
>
5
;
eval
prepare
stmt
from
'$q'
;
execute
stmt
;
execute
stmt
;
eval
prepare
stmt
from
'explain format=json $q'
;
--
source
include
/
analyze
-
format
.
inc
execute
stmt
;
--
source
include
/
analyze
-
format
.
inc
execute
stmt
;
let
$q
=
select
*
from
(
select
c1
,
c2
,
max
(
c3
)
as
max_c
,
avg
(
c3
)
as
avg_c
from
t1
group
by
c1
,
c2
having
max_c
<
7
union
select
c4
,
c5
,
max
(
c6
)
as
u
,
avg
(
c6
)
as
w
from
t2
group
by
c4
,
c5
having
u
<
10
)
dt
,
t2
where
dt
.
max_c
>
6
and
t2
.
c6
>
dt
.
c1
;
eval
prepare
stmt
from
'$q'
;
execute
stmt
;
execute
stmt
;
eval
prepare
stmt
from
'explain format=json $q'
;
--
source
include
/
analyze
-
format
.
inc
execute
stmt
;
--
source
include
/
analyze
-
format
.
inc
execute
stmt
;
drop
table
t1
,
t2
;
--
echo
# End of 10.5 tests
This diff is collapsed.
Click to expand it.
mysql-test/main/item_types.result
0 → 100644
View file @
0063a8c9
#
# MDEV-34634 Types mismatch when cloning items causes debug assertion
#
CREATE TABLE t1 (a DATETIME);
SET optimizer_switch='derived_merge=off';
SELECT * FROM (SELECT * FROM t1) AS t1 WHERE a='';
a
Warnings:
Warning 1292 Truncated incorrect datetime value: ''
DROP TABLE t1;
CREATE TABLE t1 (c YEAR);
CREATE TABLE t2 (c INT);
SELECT * FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.c<=>5;
c c
DROP TABLE t1, t2;
SET optimizer_switch=default;
This diff is collapsed.
Click to expand it.
mysql-test/main/item_types.test
0 → 100644
View file @
0063a8c9
--
echo
#
--
echo
# MDEV-34634 Types mismatch when cloning items causes debug assertion
--
echo
#
CREATE
TABLE
t1
(
a
DATETIME
);
SET
optimizer_switch
=
'derived_merge=off'
;
SELECT
*
FROM
(
SELECT
*
FROM
t1
)
AS
t1
WHERE
a
=
''
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
c
YEAR
);
CREATE
TABLE
t2
(
c
INT
);
SELECT
*
FROM
t1
JOIN
t2
ON
t1
.
c
=
t2
.
c
WHERE
t1
.
c
<=>
5
;
DROP
TABLE
t1
,
t2
;
SET
optimizer_switch
=
default
;
This diff is collapsed.
Click to expand it.
mysql-test/main/join_cache.result
View file @
0063a8c9
...
...
@@ -6420,3 +6420,23 @@ DROP TABLE t1,t2,t3;
#
# End of 10.4 tests
#
#
# MDEV-34580: Assertion `(key_part->key_part_flag & 4) == 0' failed key_hashnr
#
SET join_cache_level=3;
CREATE TABLE t1 ( a TIMESTAMP , b varchar(100), c varchar(10) ) ;
INSERT INTO t1 (b,c) VALUES ('GHOBS','EMLCG'),('t','p');
CREATE TABLE t2 (a varchar(100), b varchar(100), c varchar(10) , KEY b (b(66))) ;
insert into t2 select seq, seq, seq from seq_1_to_20;
explain
SELECT t1.a FROM t1 JOIN t2 ON t1.b = t2.b ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t2 hash_ALL b #hash#b 69 test.t1.b 20 Using where; Using join buffer (flat, BNLH join)
SELECT t1.a FROM t1 JOIN t2 ON t1.b = t2.b ;
a
set join_cache_level=default;
DROP TABLE t1, t2;
#
# End of 10.5 tests
#
This diff is collapsed.
Click to expand it.
mysql-test/main/join_cache.test
View file @
0063a8c9
...
...
@@ -4299,3 +4299,25 @@ DROP TABLE t1,t2,t3;
--
echo
#
--
echo
# End of 10.4 tests
--
echo
#
--
echo
#
--
echo
# MDEV-34580: Assertion `(key_part->key_part_flag & 4) == 0' failed key_hashnr
--
echo
#
--
source
include
/
have_sequence
.
inc
SET
join_cache_level
=
3
;
CREATE
TABLE
t1
(
a
TIMESTAMP
,
b
varchar
(
100
),
c
varchar
(
10
)
)
;
INSERT
INTO
t1
(
b
,
c
)
VALUES
(
'GHOBS'
,
'EMLCG'
),(
't'
,
'p'
);
CREATE
TABLE
t2
(
a
varchar
(
100
),
b
varchar
(
100
),
c
varchar
(
10
)
,
KEY
b
(
b
(
66
)))
;
insert
into
t2
select
seq
,
seq
,
seq
from
seq_1_to_20
;
explain
SELECT
t1
.
a
FROM
t1
JOIN
t2
ON
t1
.
b
=
t2
.
b
;
SELECT
t1
.
a
FROM
t1
JOIN
t2
ON
t1
.
b
=
t2
.
b
;
set
join_cache_level
=
default
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# End of 10.5 tests
--
echo
#
This diff is collapsed.
Click to expand it.
mysql-test/main/json_debug_nonembedded.result
→
mysql-test/main/json_debug_nonembedded
_noasan
.result
View file @
0063a8c9
File moved
This diff is collapsed.
Click to expand it.
mysql-test/main/json_debug_nonembedded.test
→
mysql-test/main/json_debug_nonembedded
_noasan
.test
View file @
0063a8c9
File moved
This diff is collapsed.
Click to expand it.
mysql-test/main/win.result
View file @
0063a8c9
...
...
@@ -1247,15 +1247,10 @@ insert into t1 values (1,1,'foo');
insert into t1 values (2,2,'bar');
select
count(*) over (order by a,b
range between
unbounded
preceding and current row) as count
range between
1
preceding and current row) as count
from t1;
ERROR HY000: RANGE-type frame requires ORDER BY clause with single sort key
select
count(*) over (order by c
range between unbounded preceding and current row) as count
from t1;
ERROR HY000: Numeric datatype is required for RANGE-type frame
select
count(*) over (order by a
range between 'abcd' preceding and current row) as count
from t1;
...
...
@@ -1277,6 +1272,56 @@ rows between current row and 3.14 following) as count
from t1;
ERROR HY000: Integer is required for ROWS-type frame
#
# MDEV-19052 Range-type window frame supports only numeric datatype
#
select
count(*) over (order by c
range between unbounded preceding and current row) as r
from t1;
r
1
2
select
count(*) over (order by c
range between current row and unbounded following) as r
from t1;
r
2
1
select
count(*) over (order by c
range between unbounded preceding and unbounded following) as r
from t1;
r
2
2
create table t2 (a int, b varchar(5));
insert into t2 values (1,'a'), (2, 'b'), (3, 'c');
select sum(a) over (order by b range between unbounded preceding and current row) as r from t2;
r
1
3
6
insert into t1 values (3,3,'goo');
insert into t1 values (3,1,'har');
insert into t1 values (1,4,'har');
select a, b, sum(b) over (order by a, b desc range between unbounded preceding and current row) as r from t1;
a b r
1 4 4
1 1 5
2 2 7
3 3 10
3 1 11
select a, b, sum(b) over (order by a desc, b range between unbounded preceding and current row) as r from t1;
a b r
3 1 1
3 3 4
2 2 6
1 1 7
1 4 11
drop table t2;
delete from t1 where a >= 3 or b = 4;
#
# EXCLUDE clause is parsed but not supported
#
select
...
...
This diff is collapsed.
Click to expand it.
mysql-test/main/win.test
View file @
0063a8c9
...
...
@@ -784,13 +784,7 @@ insert into t1 values (2,2,'bar');
--
error
ER_RANGE_FRAME_NEEDS_SIMPLE_ORDERBY
select
count
(
*
)
over
(
order
by
a
,
b
range
between
unbounded
preceding
and
current
row
)
as
count
from
t1
;
--
error
ER_WRONG_TYPE_FOR_RANGE_FRAME
select
count
(
*
)
over
(
order
by
c
range
between
unbounded
preceding
and
current
row
)
as
count
range
between
1
preceding
and
current
row
)
as
count
from
t1
;
--
error
ER_WRONG_TYPE_FOR_RANGE_FRAME
...
...
@@ -818,6 +812,41 @@ select
rows
between
current
row
and
3.14
following
)
as
count
from
t1
;
--
echo
#
--
echo
# MDEV-19052 Range-type window frame supports only numeric datatype
--
echo
#
select
count
(
*
)
over
(
order
by
c
range
between
unbounded
preceding
and
current
row
)
as
r
from
t1
;
select
count
(
*
)
over
(
order
by
c
range
between
current
row
and
unbounded
following
)
as
r
from
t1
;
select
count
(
*
)
over
(
order
by
c
range
between
unbounded
preceding
and
unbounded
following
)
as
r
from
t1
;
create
table
t2
(
a
int
,
b
varchar
(
5
));
insert
into
t2
values
(
1
,
'a'
),
(
2
,
'b'
),
(
3
,
'c'
);
select
sum
(
a
)
over
(
order
by
b
range
between
unbounded
preceding
and
current
row
)
as
r
from
t2
;
insert
into
t1
values
(
3
,
3
,
'goo'
);
insert
into
t1
values
(
3
,
1
,
'har'
);
insert
into
t1
values
(
1
,
4
,
'har'
);
select
a
,
b
,
sum
(
b
)
over
(
order
by
a
,
b
desc
range
between
unbounded
preceding
and
current
row
)
as
r
from
t1
;
select
a
,
b
,
sum
(
b
)
over
(
order
by
a
desc
,
b
range
between
unbounded
preceding
and
current
row
)
as
r
from
t1
;
drop
table
t2
;
delete
from
t1
where
a
>=
3
or
b
=
4
;
--
echo
#
--
echo
# EXCLUDE clause is parsed but not supported
--
echo
#
...
...
@@ -843,6 +872,9 @@ select
exclude
group
)
as
count
from
t1
;
# EXCLUDE NO OTHERS means 'don't exclude anything'
select
count
(
*
)
over
(
order
by
a
...
...
This diff is collapsed.
Click to expand it.
mysql-test/suite/encryption/r/tempfiles_encrypted.result
View file @
0063a8c9
...
...
@@ -1253,15 +1253,10 @@ insert into t1 values (1,1,'foo');
insert into t1 values (2,2,'bar');
select
count(*) over (order by a,b
range between
unbounded
preceding and current row) as count
range between
1
preceding and current row) as count
from t1;
ERROR HY000: RANGE-type frame requires ORDER BY clause with single sort key
select
count(*) over (order by c
range between unbounded preceding and current row) as count
from t1;
ERROR HY000: Numeric datatype is required for RANGE-type frame
select
count(*) over (order by a
range between 'abcd' preceding and current row) as count
from t1;
...
...
@@ -1283,6 +1278,56 @@ rows between current row and 3.14 following) as count
from t1;
ERROR HY000: Integer is required for ROWS-type frame
#
# MDEV-19052 Range-type window frame supports only numeric datatype
#
select
count(*) over (order by c
range between unbounded preceding and current row) as r
from t1;
r
1
2
select
count(*) over (order by c
range between current row and unbounded following) as r
from t1;
r
2
1
select
count(*) over (order by c
range between unbounded preceding and unbounded following) as r
from t1;
r
2
2
create table t2 (a int, b varchar(5));
insert into t2 values (1,'a'), (2, 'b'), (3, 'c');
select sum(a) over (order by b range between unbounded preceding and current row) as r from t2;
r
1
3
6
insert into t1 values (3,3,'goo');
insert into t1 values (3,1,'har');
insert into t1 values (1,4,'har');
select a, b, sum(b) over (order by a, b desc range between unbounded preceding and current row) as r from t1;
a b r
1 4 4
1 1 5
2 2 7
3 3 10
3 1 11
select a, b, sum(b) over (order by a desc, b range between unbounded preceding and current row) as r from t1;
a b r
3 1 1
3 3 4
2 2 6
1 1 7
1 4 11
drop table t2;
delete from t1 where a >= 3 or b = 4;
#
# EXCLUDE clause is parsed but not supported
#
select
...
...
This diff is collapsed.
Click to expand it.
mysql-test/suite/innodb/r/import_bugs.result
View file @
0063a8c9
...
...
@@ -65,6 +65,32 @@ id
4
5
DROP TABLE t2;
#
# MDEV-34181 Instant table aborts after discard tablespace
#
CREATE TABLE t1(c3 INT, c2 INT, c1 INT KEY)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 1, 1), (2, 2, 2);
CREATE TABLE t2 (c1 INT KEY) ENGINE=InnoDB;
INSERT INTO t2 VALUES(1);
ALTER TABLE t2 ADD c2 INT;
FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
ALTER TABLE t2 DISCARD TABLESPACE;
ALTER TABLE t2 ADD c3 INT FIRST;
Warnings:
Warning 1814 Tablespace has been discarded for table `t2`
ALTER TABLE t2 IMPORT TABLESPACE;
Warnings:
Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t2.cfg', will attempt to import without schema verification
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c3` int(11) DEFAULT NULL,
`c1` int(11) NOT NULL,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t2, t1;
# End of 10.5 tests
#
# MDEV-27006 Assertion `!lock_trx_has_sys_table_locks(trx)'
...
...
This diff is collapsed.
Click to expand it.
mysql-test/suite/innodb/t/import_bugs.test
View file @
0063a8c9
...
...
@@ -82,6 +82,26 @@ INSERT INTO t2() VALUES();
SELECT
*
FROM
t2
ORDER
BY
id
;
DROP
TABLE
t2
;
--
echo
#
--
echo
# MDEV-34181 Instant table aborts after discard tablespace
--
echo
#
CREATE
TABLE
t1
(
c3
INT
,
c2
INT
,
c1
INT
KEY
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),
(
2
,
2
,
2
);
CREATE
TABLE
t2
(
c1
INT
KEY
)
ENGINE
=
InnoDB
;
INSERT
INTO
t2
VALUES
(
1
);
ALTER
TABLE
t2
ADD
c2
INT
;
FLUSH
TABLES
t1
FOR
EXPORT
;
let
$datadir
=
`select @@datadir`
;
--
copy_file
$datadir
/
test
/
t1
.
ibd
$datadir
/
test
/
imp_t1
.
ibd
UNLOCK
TABLES
;
ALTER
TABLE
t2
DISCARD
TABLESPACE
;
ALTER
TABLE
t2
ADD
c3
INT
FIRST
;
--
copy_file
$datadir
/
test
/
imp_t1
.
ibd
$datadir
/
test
/
t2
.
ibd
--
replace_regex
/
opening
'.*\/test\//opening '
.
\
/
test
\
//
ALTER
TABLE
t2
IMPORT
TABLESPACE
;
SHOW
CREATE
TABLE
t2
;
DROP
TABLE
t2
,
t1
;
--
echo
# End of 10.5 tests
--
echo
#
...
...
This diff is collapsed.
Click to expand it.
mysys/crc32/crc32c_x86.cc
View file @
0063a8c9
...
...
@@ -28,7 +28,8 @@
# elif __GNUC__ >= 14 || (defined __clang_major__ && __clang_major__ >= 18)
# define TARGET "pclmul,evex512,avx512f,avx512dq,avx512bw,avx512vl,vpclmulqdq"
# define USE_VPCLMULQDQ __attribute__((target(TARGET)))
# elif __GNUC__ >= 11 || (defined __clang_major__ && __clang_major__ >= 8)
# elif __GNUC__ >= 11 || (defined __clang_major__ && __clang_major__ >= 9)
/* clang 8 does not support _xgetbv(), which we also need */
# define TARGET "pclmul,avx512f,avx512dq,avx512bw,avx512vl,vpclmulqdq"
# define USE_VPCLMULQDQ __attribute__((target(TARGET)))
# endif
...
...
@@ -38,6 +39,7 @@ extern "C" unsigned crc32c_sse42(unsigned crc, const void* buf, size_t size);
constexpr
uint32_t
cpuid_ecx_SSE42
=
1U
<<
20
;
constexpr
uint32_t
cpuid_ecx_SSE42_AND_PCLMUL
=
cpuid_ecx_SSE42
|
1U
<<
1
;
constexpr
uint32_t
cpuid_ecx_XSAVE
=
1U
<<
26
;
static
uint32_t
cpuid_ecx
()
{
...
...
@@ -382,8 +384,19 @@ static unsigned crc32_avx512(unsigned crc, const char *buf, size_t size,
}
}
static
ATTRIBUTE_NOINLINE
int
have_vpclmulqdq
()
#ifdef __GNUC__
__attribute__
((
target
(
"xsave"
)))
#endif
static
bool
os_have_avx512
()
{
// The following flags must be set: SSE, AVX, OPMASK, ZMM_HI256, HI16_ZMM
return
!
(
~
_xgetbv
(
0
/*_XCR_XFEATURE_ENABLED_MASK*/
)
&
0xe6
);
}
static
ATTRIBUTE_NOINLINE
bool
have_vpclmulqdq
(
uint32_t
cpuid_ecx
)
{
if
(
!
(
cpuid_ecx
&
cpuid_ecx_XSAVE
)
||
!
os_have_avx512
())
return
false
;
# ifdef _MSC_VER
int
regs
[
4
];
__cpuidex
(
regs
,
7
,
0
);
...
...
@@ -410,10 +423,11 @@ static unsigned crc32c_vpclmulqdq(unsigned crc, const void *buf, size_t size)
extern
"C"
my_crc32_t
crc32_pclmul_enabled
(
void
)
{
if
(
~
cpuid_ecx
()
&
cpuid_ecx_SSE42_AND_PCLMUL
)
const
uint32_t
ecx
=
cpuid_ecx
();
if
(
~
ecx
&
cpuid_ecx_SSE42_AND_PCLMUL
)
return
nullptr
;
#ifdef USE_VPCLMULQDQ
if
(
have_vpclmulqdq
())
if
(
have_vpclmulqdq
(
ecx
))
return
crc32_vpclmulqdq
;
#endif
return
crc32_pclmul
;
...
...
@@ -421,19 +435,20 @@ extern "C" my_crc32_t crc32_pclmul_enabled(void)
extern
"C"
my_crc32_t
crc32c_x86_available
(
void
)
{
const
uint32_t
ecx
=
cpuid_ecx
();
#ifdef USE_VPCLMULQDQ
if
(
have_vpclmulqdq
())
if
(
have_vpclmulqdq
(
ecx
))
return
crc32c_vpclmulqdq
;
#endif
#if SIZEOF_SIZE_T == 8
switch
(
cpuid_ecx
()
&
cpuid_ecx_SSE42_AND_PCLMUL
)
{
switch
(
ecx
&
cpuid_ecx_SSE42_AND_PCLMUL
)
{
case
cpuid_ecx_SSE42_AND_PCLMUL
:
return
crc32c_3way
;
case
cpuid_ecx_SSE42
:
return
crc32c_sse42
;
}
#else
if
(
cpuid_ecx
()
&
cpuid_ecx_SSE42
)
if
(
ecx
&
cpuid_ecx_SSE42
)
return
crc32c_sse42
;
#endif
return
nullptr
;
...
...
This diff is collapsed.
Click to expand it.
sql/item.cc
View file @
0063a8c9
...
...
@@ -3906,7 +3906,7 @@ void Item_decimal::set_decimal_value(my_decimal *value_par)
}
Item
*
Item_decimal
::
do_clone_const
_item
(
THD
*
thd
)
const
Item
*
Item_decimal
::
clone
_item
(
THD
*
thd
)
const
{
return
new
(
thd
->
mem_root
)
Item_decimal
(
thd
,
name
.
str
,
&
decimal_value
,
decimals
,
max_length
);
...
...
@@ -3927,7 +3927,7 @@ my_decimal *Item_float::val_decimal(my_decimal *decimal_value)
}
Item
*
Item_float
::
do_clone_const
_item
(
THD
*
thd
)
const
Item
*
Item_float
::
clone
_item
(
THD
*
thd
)
const
{
return
new
(
thd
->
mem_root
)
Item_float
(
thd
,
name
.
str
,
value
,
decimals
,
max_length
);
...
...
@@ -4091,7 +4091,7 @@ Item *Item_null::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
return
this
;
}
Item
*
Item_null
::
do_clone_const
_item
(
THD
*
thd
)
const
Item
*
Item_null
::
clone
_item
(
THD
*
thd
)
const
{
return
new
(
thd
->
mem_root
)
Item_null
(
thd
,
name
.
str
);
}
...
...
@@ -4933,7 +4933,7 @@ Item *Item_param::value_clone_item(THD *thd) const
/* see comments in the header file */
Item
*
Item_param
::
do_clone_const
_item
(
THD
*
thd
)
const
Item_param
::
clone
_item
(
THD
*
thd
)
const
{
// There's no "default". See comments in Item_param::save_in_field().
switch
(
state
)
{
...
...
@@ -7023,7 +7023,7 @@ int Item_string::save_in_field(Field *field, bool no_conversions)
}
Item
*
Item_string
::
do_clone_const
_item
(
THD
*
thd
)
const
Item
*
Item_string
::
clone
_item
(
THD
*
thd
)
const
{
LEX_CSTRING
val
;
str_value
.
get_value
(
&
val
);
...
...
@@ -7087,7 +7087,7 @@ int Item_int::save_in_field(Field *field, bool no_conversions)
}
Item
*
Item_int
::
do_clone_const
_item
(
THD
*
thd
)
const
Item
*
Item_int
::
clone
_item
(
THD
*
thd
)
const
{
return
new
(
thd
->
mem_root
)
Item_int
(
thd
,
name
.
str
,
value
,
max_length
,
unsigned_flag
);
}
...
...
@@ -7116,7 +7116,7 @@ int Item_decimal::save_in_field(Field *field, bool no_conversions)
}
Item
*
Item_int_with_ref
::
do_clone_const
_item
(
THD
*
thd
)
const
Item
*
Item_int_with_ref
::
clone
_item
(
THD
*
thd
)
const
{
DBUG_ASSERT
(
ref
->
const_item
());
/*
...
...
@@ -7212,7 +7212,7 @@ Item *Item_uint::neg(THD *thd)
}
Item
*
Item_uint
::
do_clone_const
_item
(
THD
*
thd
)
const
Item
*
Item_uint
::
clone
_item
(
THD
*
thd
)
const
{
return
new
(
thd
->
mem_root
)
Item_uint
(
thd
,
name
.
str
,
value
,
max_length
);
}
...
...
@@ -7450,7 +7450,7 @@ void Item_date_literal::print(String *str, enum_query_type query_type)
}
Item
*
Item_date_literal
::
do_clone_const
_item
(
THD
*
thd
)
const
Item
*
Item_date_literal
::
clone
_item
(
THD
*
thd
)
const
{
return
new
(
thd
->
mem_root
)
Item_date_literal
(
thd
,
&
cached_time
);
}
...
...
@@ -7475,7 +7475,7 @@ void Item_datetime_literal::print(String *str, enum_query_type query_type)
}
Item
*
Item_datetime_literal
::
do_clone_const
_item
(
THD
*
thd
)
const
Item
*
Item_datetime_literal
::
clone
_item
(
THD
*
thd
)
const
{
return
new
(
thd
->
mem_root
)
Item_datetime_literal
(
thd
,
&
cached_time
,
decimals
);
}
...
...
@@ -7500,7 +7500,7 @@ void Item_time_literal::print(String *str, enum_query_type query_type)
}
Item
*
Item_time_literal
::
do_clone_const
_item
(
THD
*
thd
)
const
Item
*
Item_time_literal
::
clone
_item
(
THD
*
thd
)
const
{
return
new
(
thd
->
mem_root
)
Item_time_literal
(
thd
,
&
cached_time
,
decimals
);
}
...
...
@@ -10456,7 +10456,7 @@ void Item_cache_temporal::store_packed(longlong val_arg, Item *example_arg)
}
Item
*
Item_cache_temporal
::
do_clone_const
_item
(
THD
*
thd
)
const
Item
*
Item_cache_temporal
::
clone
_item
(
THD
*
thd
)
const
{
Item_cache
*
tmp
=
type_handler
()
->
Item_get_cache
(
thd
,
this
);
Item_cache_temporal
*
item
=
static_cast
<
Item_cache_temporal
*>
(
tmp
);
...
...
This diff is collapsed.
Click to expand it.
sql/item.h
View file @
0063a8c9
...
...
@@ -1906,21 +1906,17 @@ class Item :public Value_source,
}
/*
Clones the constant item
Clones the constant item
(not necessary returning the same item type)
Return value:
- pointer to a clone of the Item
- nullptr if the item is not clonable */
Item
*
clone_const_item
(
THD
*
thd
)
const
{
Item
*
clone
=
do_clone_const_item
(
thd
);
if
(
clone
)
{
// Make sure the clone is of same type as this item
DBUG_ASSERT
(
typeid
(
*
clone
)
==
typeid
(
*
this
));
}
return
clone
;
}
- nullptr if the item is not clonable
Note: the clone may have item type different from this
(i.e., instance of another basic constant class may be returned).
For real clones look at build_clone()/get_copy() methods
*/
virtual
Item
*
clone_item
(
THD
*
thd
)
const
{
return
nullptr
;
}
virtual
cond_result
eq_cmp_result
()
const
{
return
COND_OK
;
}
inline
uint
float_length
(
uint
decimals_par
)
const
...
...
@@ -2789,12 +2785,6 @@ class Item :public Value_source,
deep copies (clones) of the item where possible
*/
virtual
Item
*
do_build_clone
(
THD
*
thd
)
const
=
0
;
/*
Service function for public method clone_const_item(). See comments for
clone_const_item() above
*/
virtual
Item
*
do_clone_const_item
(
THD
*
thd
)
const
{
return
nullptr
;
}
};
MEM_ROOT
*
get_thd_memroot
(
THD
*
thd
);
...
...
@@ -3975,7 +3965,7 @@ class Item_null :public Item_basic_constant
const
Type_handler
*
type_handler
()
const
override
{
return
&
type_handler_null
;
}
bool
basic_const_item
()
const
override
{
return
true
;
}
Item
*
do_clone_const
_item
(
THD
*
thd
)
const
override
;
Item
*
clone
_item
(
THD
*
thd
)
const
override
;
bool
const_is_null
()
const
override
{
return
true
;
}
bool
is_null
()
override
{
return
true
;
}
...
...
@@ -4426,7 +4416,7 @@ class Item_param :public Item_basic_value,
basic_const_item returned TRUE.
*/
Item
*
safe_charset_converter
(
THD
*
thd
,
CHARSET_INFO
*
tocs
)
override
;
Item
*
do_clone_const
_item
(
THD
*
thd
)
const
override
;
Item
*
clone
_item
(
THD
*
thd
)
const
override
;
void
set_param_type_and_swap_value
(
Item_param
*
from
);
Rewritable_query_parameter
*
get_rewritable_query_parameter
()
override
...
...
@@ -4528,7 +4518,7 @@ class Item_int :public Item_num
String
*
val_str
(
String
*
)
override
;
int
save_in_field
(
Field
*
field
,
bool
no_conversions
)
override
;
bool
is_order_clause_position
()
const
override
{
return
true
;
}
Item
*
do_clone_const
_item
(
THD
*
thd
)
const
override
;
Item
*
clone
_item
(
THD
*
thd
)
const
override
;
void
print
(
String
*
str
,
enum_query_type
query_type
)
override
;
Item
*
neg
(
THD
*
thd
)
override
;
decimal_digits_t
decimal_precision
()
const
override
...
...
@@ -4591,8 +4581,8 @@ class Item_uint :public Item_int
Item_uint
(
THD
*
thd
,
const
char
*
str_arg
,
size_t
length
);
Item_uint
(
THD
*
thd
,
ulonglong
i
)
:
Item_int
(
thd
,
i
,
10
)
{}
Item_uint
(
THD
*
thd
,
const
char
*
str_arg
,
longlong
i
,
uint
length
);
double
val_real
()
override
{
return
ulonglong2double
((
ulonglong
)
value
);
}
Item
*
do_clone_const
_item
(
THD
*
thd
)
const
override
;
double
val_real
()
override
{
return
ulonglong2double
((
ulonglong
)
value
);
}
Item
*
clone
_item
(
THD
*
thd
)
const
override
;
Item
*
neg
(
THD
*
thd
)
override
;
decimal_digits_t
decimal_precision
()
const
override
{
return
decimal_digits_t
(
max_length
);
}
...
...
@@ -4647,7 +4637,7 @@ class Item_decimal :public Item_num
const
my_decimal
*
const_ptr_my_decimal
()
const
override
{
return
&
decimal_value
;
}
int
save_in_field
(
Field
*
field
,
bool
no_conversions
)
override
;
Item
*
do_clone_const
_item
(
THD
*
thd
)
const
override
;
Item
*
clone
_item
(
THD
*
thd
)
const
override
;
void
print
(
String
*
str
,
enum_query_type
query_type
)
override
{
decimal_value
.
to_string
(
&
str_value
);
...
...
@@ -4701,7 +4691,7 @@ class Item_float :public Item_num
}
String
*
val_str
(
String
*
)
override
;
my_decimal
*
val_decimal
(
my_decimal
*
)
override
;
Item
*
do_clone_const
_item
(
THD
*
thd
)
const
override
;
Item
*
clone
_item
(
THD
*
thd
)
const
override
;
Item
*
neg
(
THD
*
thd
)
override
;
void
print
(
String
*
str
,
enum_query_type
query_type
)
override
;
Item
*
do_get_copy
(
THD
*
thd
)
const
override
...
...
@@ -4822,7 +4812,7 @@ class Item_string :public Item_literal
int
save_in_field
(
Field
*
field
,
bool
no_conversions
)
override
;
const
Type_handler
*
type_handler
()
const
override
{
return
&
type_handler_varchar
;
}
Item
*
do_clone_const
_item
(
THD
*
thd
)
const
override
;
Item
*
clone
_item
(
THD
*
thd
)
const
override
;
Item
*
safe_charset_converter
(
THD
*
thd
,
CHARSET_INFO
*
tocs
)
override
{
return
const_charset_converter
(
thd
,
tocs
,
true
);
...
...
@@ -5246,7 +5236,7 @@ class Item_date_literal: public Item_temporal_literal
{
return
cached_time
.
get_mysql_time
();
}
Item
*
do_clone_const
_item
(
THD
*
thd
)
const
override
;
Item
*
clone
_item
(
THD
*
thd
)
const
override
;
longlong
val_int
()
override
{
return
update_null
()
?
0
:
cached_time
.
to_longlong
();
...
...
@@ -5296,7 +5286,7 @@ class Item_time_literal final: public Item_temporal_literal
{
return
cached_time
.
get_mysql_time
();
}
Item
*
do_clone_const
_item
(
THD
*
thd
)
const
override
;
Item
*
clone
_item
(
THD
*
thd
)
const
override
;
longlong
val_int
()
override
{
return
cached_time
.
to_longlong
();
}
double
val_real
()
override
{
return
cached_time
.
to_double
();
}
String
*
val_str
(
String
*
to
)
override
...
...
@@ -5350,7 +5340,7 @@ class Item_datetime_literal: public Item_temporal_literal
{
return
cached_time
.
get_mysql_time
();
}
Item
*
do_clone_const
_item
(
THD
*
thd
)
const
override
;
Item
*
clone
_item
(
THD
*
thd
)
const
override
;
longlong
val_int
()
override
{
return
update_null
()
?
0
:
cached_time
.
to_longlong
();
...
...
@@ -5439,6 +5429,9 @@ class Item_datetime_literal_for_invalid_dates final: public Item_datetime_litera
cached_time
.
copy_to_mysql_time
(
ltime
);
return
(
null_value
=
false
);
}
Item
*
do_get_copy
(
THD
*
thd
)
const
override
{
return
get_item_copy
<
Item_datetime_literal_for_invalid_dates
>
(
thd
,
this
);
}
Item
*
do_build_clone
(
THD
*
thd
)
const
override
{
return
get_copy
(
thd
);
}
};
...
...
@@ -6507,8 +6500,11 @@ class Item_int_with_ref :public Item_int
{
return
ref
->
save_in_field
(
field
,
no_conversions
);
}
Item
*
do_clone_const
_item
(
THD
*
thd
)
const
override
;
Item
*
clone
_item
(
THD
*
thd
)
const
override
;
Item
*
real_item
()
override
{
return
ref
;
}
Item
*
do_get_copy
(
THD
*
thd
)
const
override
{
return
get_item_copy
<
Item_int_with_ref
>
(
thd
,
this
);
}
Item
*
do_build_clone
(
THD
*
thd
)
const
override
{
return
get_copy
(
thd
);
}
};
#ifdef MYSQL_SERVER
...
...
@@ -7422,7 +7418,7 @@ class Item_cache_temporal: public Item_cache_int
is a constant and need not be optimized further.
Important when storing packed datetime values.
*/
Item
*
do_clone_const
_item
(
THD
*
thd
)
const
override
;
Item
*
clone
_item
(
THD
*
thd
)
const
override
;
Item
*
convert_to_basic_const_item
(
THD
*
thd
)
override
;
virtual
Item
*
make_literal
(
THD
*
)
=
0
;
};
...
...
This diff is collapsed.
Click to expand it.
sql/key.cc
View file @
0063a8c9
...
...
@@ -755,10 +755,12 @@ ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key)
if
(
is_string
)
{
/*
Prefix keys are not possible in BNLH joins.
Use the whole string to calculate the hash.
Surprisingly, BNL-H joins may use prefix keys. This may happen
when there is a real index on the column used in equi-join.
In this case, the passed key tuple is already a prefix, no
special handling is required.
*/
DBUG_ASSERT
((
key_part
->
key_part_flag
&
HA_PART_KEY_SEG
)
==
0
);
cs
->
hash_sort
(
pos
+
pack_length
,
length
,
&
nr
,
&
nr2
);
key
+=
pack_length
;
}
...
...
@@ -862,10 +864,10 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts,
if
(
is_string
)
{
/*
Prefix keys are not possible in BNLH joins.
Compare whole strings.
Surprisingly, BNL-H joins may use prefix keys. This may happen
when there is a real index on the column used in equi-join.
In this case, we get properly truncated prefixes here.
*/
DBUG_ASSERT
((
key_part
->
key_part_flag
&
HA_PART_KEY_SEG
)
==
0
);
if
(
cs
->
strnncollsp
(
pos1
+
pack_length
,
length1
,
pos2
+
pack_length
,
length2
))
return
true
;
...
...
This diff is collapsed.
Click to expand it.
sql/sql_derived.cc
View file @
0063a8c9
...
...
@@ -1574,6 +1574,7 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
if
(
sl
!=
first_sl
)
{
DBUG_ASSERT
(
sl
->
item_list
.
elements
==
first_sl
->
item_list
.
elements
);
sl
->
save_item_list_names
(
thd
);
List_iterator_fast
<
Item
>
it
(
sl
->
item_list
);
List_iterator_fast
<
Item
>
nm_it
(
unit
->
types
);
while
(
Item
*
item
=
it
++
)
...
...
This diff is collapsed.
Click to expand it.
sql/sql_select.cc
View file @
0063a8c9
...
...
@@ -17317,7 +17317,7 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
if (can_change_cond_ref_to_const(func, right_item, left_item,
field_value_owner, field, value))
{
Item *tmp=value->clone_
const_
item(thd);
Item *tmp=value->clone_item(thd);
if (tmp)
{
tmp->collation.set(right_item->collation);
...
...
@@ -17347,7 +17347,7 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
else if (can_change_cond_ref_to_const(func, left_item, right_item,
field_value_owner, field, value))
{
Item *tmp= value->clone_
const_
item(thd);
Item *tmp= value->clone_item(thd);
if (tmp)
{
tmp->collation.set(left_item->collation);
This diff is collapsed.
Click to expand it.
sql/sql_window.cc
View file @
0063a8c9
...
...
@@ -262,9 +262,12 @@ setup_windows(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables,
For "win_func() OVER (ORDER BY order_list RANGE BETWEEN ...)",
- ORDER BY order_list must not be ommitted
- the list must have a single element.
But it really only matters if the frame is bounded.
*/
if
(
win_spec
->
window_frame
&&
win_spec
->
window_frame
->
units
==
Window_frame
::
UNITS_RANGE
)
win_spec
->
window_frame
->
units
==
Window_frame
::
UNITS_RANGE
&&
!
(
win_spec
->
window_frame
->
top_bound
->
is_unbounded
()
&&
win_spec
->
window_frame
->
bottom_bound
->
is_unbounded
()))
{
if
(
win_spec
->
order_list
->
elements
!=
1
)
{
...
...
This diff is collapsed.
Click to expand it.
storage/innobase/handler/handler0alter.cc
View file @
0063a8c9
...
...
@@ -374,10 +374,12 @@ inline void dict_table_t::prepare_instant(const dict_table_t& old,
}
}
/* In case of discarded tablespace, InnoDB can't
read the root page. So assign the null bytes based
on nullabled fields */
if
(
!
oindex
.
table
->
space
)
{
/* Discard tablespace doesn't remove the instantness
from the table definition. if n_core_null_bytes wasn't
initialized then assign it based on nullable fields */
if
(
!
oindex
.
table
->
space
&&
oindex
.
n_core_null_bytes
==
dict_index_t
::
NO_CORE_NULL_BYTES
)
{
oindex
.
n_core_null_bytes
=
static_cast
<
uint8_t
>
(
UT_BITS_IN_BYTES
(
unsigned
(
oindex
.
n_nullable
)));
}
...
...
This diff is collapsed.
Click to expand it.
storage/innobase/include/mach0data.inl
View file @
0063a8c9
...
...
@@ -39,7 +39,7 @@ mach_write_to_1(
byte* b, /*!< in: pointer to byte where to store */
ulint n) /*!< in: ulint integer to be stored, >= 0, < 256 */
{
#if
ndef HAVE_valgrind
#if
!defined HAVE_valgrind || __has_feature(memory_sanitizer)
ut_ad((n & ~0xFFUL) == 0);
#endif
...
...
@@ -58,7 +58,7 @@ mach_write_to_2(
byte* b, /*!< in: pointer to two bytes where to store */
ulint n) /*!< in: ulint integer to be stored */
{
#if
ndef HAVE_valgrind
#if
!defined HAVE_valgrind || __has_feature(memory_sanitizer)
ut_ad((n & ~0xFFFFUL) == 0);
#endif
...
...
This diff is collapsed.
Click to expand it.
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