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
c9ec1cc7
Commit
c9ec1cc7
authored
Mar 20, 2020
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.1 into 10.2
parents
a66eebf5
328edf85
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
116 additions
and
31 deletions
+116
-31
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+3
-2
mysql-test/r/func_math.result
mysql-test/r/func_math.result
+48
-0
mysql-test/t/func_math.test
mysql-test/t/func_math.test
+29
-0
sql/item_func.cc
sql/item_func.cc
+10
-23
sql/mysqld.cc
sql/mysqld.cc
+3
-3
sql/sql_class.h
sql/sql_class.h
+3
-3
sql/sql_type_int.h
sql/sql_type_int.h
+20
-0
No files found.
mysql-test/mysql-test-run.pl
View file @
c9ec1cc7
...
...
@@ -2,7 +2,7 @@
# -*- cperl -*-
# Copyright (c) 2004, 2014, Oracle and/or its affiliates.
# Copyright (c) 2009, 20
18
, MariaDB Corporation
# Copyright (c) 2009, 20
20
, MariaDB Corporation
#
# 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
...
...
@@ -614,7 +614,8 @@ sub main {
else
{
my
$sys_info
=
My::
SysInfo
->
new
();
$opt_parallel
=
$sys_info
->
num_cpus
();
$opt_parallel
=
$sys_info
->
num_cpus
()
+
int
(
$sys_info
->
min_bogomips
()
/
500
)
-
4
;
for
my
$limit
(
2000
,
1500
,
1000
,
500
){
$opt_parallel
--
if
(
$sys_info
->
min_bogomips
()
<
$limit
);
}
...
...
mysql-test/r/func_math.result
View file @
c9ec1cc7
...
...
@@ -967,6 +967,54 @@ STDDEV_SAMP(a)
NULL
DROP TABLE t1;
#
# MDEV-21977 main.func_math fails due to undefined behaviour
#
SELECT 9223372036854775808 DIV 1;
9223372036854775808 DIV 1
9223372036854775808
SELECT 9223372036854775808 DIV -1;
ERROR 22003: BIGINT UNSIGNED value is out of range in '9223372036854775808 DIV -1'
SELECT -9223372036854775808 DIV 1;
ERROR 22003: BIGINT value is out of range in '-9223372036854775808 DIV 1'
SELECT -9223372036854775808 DIV -1;
ERROR 22003: BIGINT value is out of range in '-9223372036854775808 DIV -1'
SELECT 9223372036854775808 MOD 1;
9223372036854775808 MOD 1
0
SELECT 9223372036854775808 MOD -1;
9223372036854775808 MOD -1
0
SELECT -9223372036854775808 MOD 1;
-9223372036854775808 MOD 1
0
SELECT -9223372036854775808 MOD -1;
-9223372036854775808 MOD -1
0
SELECT 1 MOD 9223372036854775808;
1 MOD 9223372036854775808
1
SELECT -1 MOD 9223372036854775808;
-1 MOD 9223372036854775808
-1
SELECT 1 MOD -9223372036854775808;
1 MOD -9223372036854775808
1
SELECT -1 MOD -9223372036854775808;
-1 MOD -9223372036854775808
-1
SELECT 9223372036854775808 MOD 9223372036854775808;
9223372036854775808 MOD 9223372036854775808
0
SELECT 9223372036854775808 MOD -9223372036854775808;
9223372036854775808 MOD -9223372036854775808
0
SELECT -9223372036854775808 MOD 9223372036854775808;
-9223372036854775808 MOD 9223372036854775808
0
SELECT -9223372036854775808 MOD -9223372036854775808;
-9223372036854775808 MOD -9223372036854775808
0
#
# End of 10.1 tests
#
#
...
...
mysql-test/t/func_math.test
View file @
c9ec1cc7
...
...
@@ -688,6 +688,35 @@ INSERT INTO t1 VALUES (0);
SELECT
STDDEV_SAMP
(
a
)
FROM
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-21977 main.func_math fails due to undefined behaviour
--
echo
#
SELECT
9223372036854775808
DIV
1
;
--
error
ER_DATA_OUT_OF_RANGE
SELECT
9223372036854775808
DIV
-
1
;
--
error
ER_DATA_OUT_OF_RANGE
SELECT
-
9223372036854775808
DIV
1
;
--
error
ER_DATA_OUT_OF_RANGE
SELECT
-
9223372036854775808
DIV
-
1
;
SELECT
9223372036854775808
MOD
1
;
SELECT
9223372036854775808
MOD
-
1
;
SELECT
-
9223372036854775808
MOD
1
;
SELECT
-
9223372036854775808
MOD
-
1
;
SELECT
1
MOD
9223372036854775808
;
SELECT
-
1
MOD
9223372036854775808
;
SELECT
1
MOD
-
9223372036854775808
;
SELECT
-
1
MOD
-
9223372036854775808
;
SELECT
9223372036854775808
MOD
9223372036854775808
;
SELECT
9223372036854775808
MOD
-
9223372036854775808
;
SELECT
-
9223372036854775808
MOD
9223372036854775808
;
SELECT
-
9223372036854775808
MOD
-
9223372036854775808
;
--
echo
#
--
echo
# End of 10.1 tests
--
echo
#
...
...
sql/item_func.cc
View file @
c9ec1cc7
...
...
@@ -1817,11 +1817,9 @@ longlong Item_func_int_div::val_int()
raise_integer_overflow
();
return
res
;
}
longlong
val0
=
args
[
0
]
->
val_int
();
longlong
val1
=
args
[
1
]
->
val_int
();
bool
val0_negative
,
val1_negative
,
res_negative
;
ulonglong
uval0
,
uval1
,
res
;
Longlong_hybrid
val0
=
args
[
0
]
->
to_longlong_hybrid
();
Longlong_hybrid
val1
=
args
[
1
]
->
to_longlong_hybrid
();
if
((
null_value
=
(
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
)))
return
0
;
if
(
val1
==
0
)
...
...
@@ -1830,12 +1828,8 @@ longlong Item_func_int_div::val_int()
return
0
;
}
val0_negative
=
!
args
[
0
]
->
unsigned_flag
&&
val0
<
0
;
val1_negative
=
!
args
[
1
]
->
unsigned_flag
&&
val1
<
0
;
res_negative
=
val0_negative
!=
val1_negative
;
uval0
=
(
ulonglong
)
(
val0_negative
?
-
val0
:
val0
);
uval1
=
(
ulonglong
)
(
val1_negative
?
-
val1
:
val1
);
res
=
uval0
/
uval1
;
bool
res_negative
=
val0
.
neg
()
!=
val1
.
neg
();
ulonglong
res
=
val0
.
abs
()
/
val1
.
abs
();
if
(
res_negative
)
{
if
(
res
>
(
ulonglong
)
LONGLONG_MAX
)
...
...
@@ -1864,11 +1858,8 @@ bool Item_func_int_div::fix_length_and_dec()
longlong
Item_func_mod
::
int_op
()
{
DBUG_ASSERT
(
fixed
==
1
);
longlong
val0
=
args
[
0
]
->
val_int
();
longlong
val1
=
args
[
1
]
->
val_int
();
bool
val0_negative
,
val1_negative
;
ulonglong
uval0
,
uval1
;
ulonglong
res
;
Longlong_hybrid
val0
=
args
[
0
]
->
to_longlong_hybrid
();
Longlong_hybrid
val1
=
args
[
1
]
->
to_longlong_hybrid
();
if
((
null_value
=
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
))
return
0
;
/* purecov: inspected */
...
...
@@ -1883,13 +1874,9 @@ longlong Item_func_mod::int_op()
LONGLONG_MIN by -1 generates SIGFPE, we calculate using unsigned values and
then adjust the sign appropriately.
*/
val0_negative
=
!
args
[
0
]
->
unsigned_flag
&&
val0
<
0
;
val1_negative
=
!
args
[
1
]
->
unsigned_flag
&&
val1
<
0
;
uval0
=
(
ulonglong
)
(
val0_negative
?
-
val0
:
val0
);
uval1
=
(
ulonglong
)
(
val1_negative
?
-
val1
:
val1
);
res
=
uval0
%
uval1
;
return
check_integer_overflow
(
val0_negative
?
-
(
longlong
)
res
:
res
,
!
val0_negative
);
ulonglong
res
=
val0
.
abs
()
%
val1
.
abs
();
return
check_integer_overflow
(
val0
.
neg
()
?
-
(
longlong
)
res
:
res
,
!
val0
.
neg
());
}
double
Item_func_mod
::
real_op
()
...
...
sql/mysqld.cc
View file @
c9ec1cc7
...
...
@@ -8525,9 +8525,9 @@ SHOW_VAR status_vars[]= {
{
"Key"
,
(
char
*
)
&
show_default_keycache
,
SHOW_FUNC
},
{
"Last_query_cost"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
last_query_cost
),
SHOW_DOUBLE_STATUS
},
{
"Max_statement_time_exceeded"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
max_statement_time_exceeded
),
SHOW_LONG_STATUS
},
{
"Master_gtid_wait_count"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
master_gtid_wait_count
),
SHOW_LONG
LONG
_STATUS
},
{
"Master_gtid_wait_timeouts"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
master_gtid_wait_timeouts
),
SHOW_LONG
LONG
_STATUS
},
{
"Master_gtid_wait_time"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
master_gtid_wait_time
),
SHOW_LONG
LONG
_STATUS
},
{
"Master_gtid_wait_count"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
master_gtid_wait_count
),
SHOW_LONG_STATUS
},
{
"Master_gtid_wait_timeouts"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
master_gtid_wait_timeouts
),
SHOW_LONG_STATUS
},
{
"Master_gtid_wait_time"
,
(
char
*
)
offsetof
(
STATUS_VAR
,
master_gtid_wait_time
),
SHOW_LONG_STATUS
},
{
"Max_used_connections"
,
(
char
*
)
&
max_used_connections
,
SHOW_LONG
},
{
"Memory_used"
,
(
char
*
)
&
show_memory_used
,
SHOW_SIMPLE_FUNC
},
{
"Not_flushed_delayed_rows"
,
(
char
*
)
&
delayed_rows_in_use
,
SHOW_LONG_NOFLUSH
},
...
...
sql/sql_class.h
View file @
c9ec1cc7
...
...
@@ -811,9 +811,9 @@ typedef struct system_status_var
ulong
feature_window_functions
;
/* +1 when window functions are used */
/* From MASTER_GTID_WAIT usage */
ulong
long
master_gtid_wait_timeouts
;
/* Number of timeouts */
ulong
long
master_gtid_wait_time
;
/* Time in microseconds */
ulong
long
master_gtid_wait_count
;
ulong
master_gtid_wait_timeouts
;
/* Number of timeouts */
ulong
master_gtid_wait_time
;
/* Time in microseconds */
ulong
master_gtid_wait_count
;
ulong
empty_queries
;
ulong
access_denied_errors
;
...
...
sql/sql_type_int.h
View file @
c9ec1cc7
...
...
@@ -67,6 +67,26 @@ class Longlong_hybrid
*/
return
cmp_signed
(
other
);
}
bool
operator
==
(
const
Longlong_hybrid
&
nr
)
const
{
return
cmp
(
nr
)
==
0
;
}
bool
operator
==
(
ulonglong
nr
)
const
{
return
cmp
(
Longlong_hybrid
((
longlong
)
nr
,
true
))
==
0
;
}
bool
operator
==
(
uint
nr
)
const
{
return
cmp
(
Longlong_hybrid
((
longlong
)
nr
,
true
))
==
0
;
}
bool
operator
==
(
longlong
nr
)
const
{
return
cmp
(
Longlong_hybrid
(
nr
,
false
))
==
0
;
}
bool
operator
==
(
int
nr
)
const
{
return
cmp
(
Longlong_hybrid
(
nr
,
false
))
==
0
;
}
};
#endif // SQL_TYPE_INT_INCLUDED
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