Commit ac9b818c authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.3 into 10.4

parents e7924a85 69290ce3
......@@ -29,7 +29,7 @@ env:
- CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
- CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
- CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
- CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb
- CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb,versioning
- CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
- CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
......@@ -109,7 +109,7 @@ matrix:
env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption
- os: osx
compiler: clang
env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb
env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb,versioning
- os: osx
compiler: clang
env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles
......@@ -165,7 +165,7 @@ addons:
before_install:
- if [[ "${TRAVIS_OS_NAME}" == 'osx' ]]; then
brew update;
brew install gnutls lz4 lzo xz snappy ccache jemalloc curl ossp-uuid pcre;
brew install gnutls lz4 lzo xz snappy ccache jemalloc curl ossp-uuid pcre zstd;
brew link ccache;
export PATH="/usr/local/opt/ccache/libexec:$PATH";
fi
......
Code status:
------------
* [![tests status](https://secure.travis-ci.org/MariaDB/server.png?branch=10.4)](https://travis-ci.org/MariaDB/server) travis-ci.org (10.4 branch)
* [![Travis CI status](https://secure.travis-ci.org/MariaDB/server.png?branch=10.4)](https://travis-ci.org/MariaDB/server) travis-ci.org (10.4 branch)
* [![Appveyor CI status](https://ci.appveyor.com/api/projects/status/4u6pexmtpuf8jq66?svg=true)](https://ci.appveyor.com/project/rasmushoj/server) ci.appveyor.com
## MariaDB: drop-in replacement for MySQL
......
......@@ -3,7 +3,7 @@ version: build-{build}~branch-{branch}
before_build:
- md %APPVEYOR_BUILD_FOLDER%\win_build
- cd %APPVEYOR_BUILD_FOLDER%\win_build
- cmake .. -G "Visual Studio 15 2017 Win64" -DWITH_UNIT_TESTS=0
- cmake .. -G "Visual Studio 15 2017 Win64" -DWITH_UNIT_TESTS=0 -DWITH_MARIABACKUP=0 -DMYSQL_MAINTAINER_MODE=ERR -DPLUGIN_ROCKSDB=NO -DPLUGIN_CONNECT=NO -DBISON_EXECUTABLE=C:\cygwin64\bin\bison
build:
project: win_build\MySQL.sln
......@@ -16,6 +16,6 @@ platform: x64
test_script:
- set PATH=%PATH%;C:\Program Files (x86)\Windows Kits\10\Debuggers\x64
- cd %APPVEYOR_BUILD_FOLDER%\win_build\mysql-test
- perl mysql-test-run.pl --force --max-test-fail=10 --parallel=auto --testcase-timeout=10 --skip-test-list=unstable-tests --suite=main,innodb,plugins,mariabackup
- perl mysql-test-run.pl --force --max-test-fail=10 --parallel=4 --testcase-timeout=10 --skip-test-list=unstable-tests --suite=main
image: Visual Studio 2017
......@@ -1316,5 +1316,12 @@ t2 CREATE TABLE `t2` (
DROP TABLE t1, t2;
SET sql_mode=DEFAULT;
#
# MDEV-18150 Assertion `decimals_to_set <= 38' failed in Item_func_round::fix_length_and_dec_decimal
#
CREATE TABLE t1 (i INT(23));
SELECT ROUND( i, 18446744073709551594 ) AS f FROM t1;
f
DROP TABLE t1;
#
# End of 10.3 tests
#
......@@ -919,6 +919,14 @@ DROP TABLE t1, t2;
SET sql_mode=DEFAULT;
--echo #
--echo # MDEV-18150 Assertion `decimals_to_set <= 38' failed in Item_func_round::fix_length_and_dec_decimal
--echo #
CREATE TABLE t1 (i INT(23));
SELECT ROUND( i, 18446744073709551594 ) AS f FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.3 tests
--echo #
......@@ -51,6 +51,12 @@ FLUSH TABLES;
--let $shutdown_timeout=60
--source include/restart_mysqld.inc
# Perform a slow shutdown in order to roll back all recovered transactions
# and to avoid locking conflicts with the DROP TABLE below.
--disable_query_log
SET GLOBAL innodb_fast_shutdown=0;
--source include/restart_mysqld.inc
--disable_query_log
let $c = $trx;
while ($c)
......
......@@ -1249,20 +1249,6 @@ class Item: public Value_source,
unsigned_flag to check the sign of the item.
*/
inline ulonglong val_uint() { return (ulonglong) val_int(); }
/*
Adjust the result of val_int() to an unsigned number:
- NULL value is converted to 0. The caller can check "null_value"
to distinguish between 0 and NULL when necessary.
- Negative numbers are converted to 0.
- Positive numbers bigger than upper_bound are converted to upper_bound.
- Other numbers are returned as is.
*/
ulonglong val_uint_from_val_int(ulonglong upper_bound)
{
longlong nr= val_int();
return (null_value || (nr < 0 && !unsigned_flag)) ? 0 :
(ulonglong) nr > upper_bound ? upper_bound : (ulonglong) nr;
}
/*
Return string representation of this item object.
......
......@@ -2272,11 +2272,11 @@ void Item_func_round::fix_arg_decimal()
{
if (args[1]->const_item())
{
uint dec= (uint) args[1]->val_uint_from_val_int(DECIMAL_MAX_SCALE);
Longlong_hybrid dec= args[1]->to_longlong_hybrid();
if (args[1]->null_value)
fix_length_and_dec_double(NOT_FIXED_DEC);
else
fix_length_and_dec_decimal(dec);
fix_length_and_dec_decimal(dec.to_uint(DECIMAL_MAX_SCALE));
}
else
{
......@@ -2292,8 +2292,9 @@ void Item_func_round::fix_arg_double()
{
if (args[1]->const_item())
{
uint dec= (uint) args[1]->val_uint_from_val_int(NOT_FIXED_DEC);
fix_length_and_dec_double(args[1]->null_value ? NOT_FIXED_DEC : dec);
Longlong_hybrid dec= args[1]->to_longlong_hybrid();
fix_length_and_dec_double(args[1]->null_value ? NOT_FIXED_DEC :
dec.to_uint(NOT_FIXED_DEC));
}
else
fix_length_and_dec_double(args[0]->decimals);
......@@ -2304,17 +2305,14 @@ void Item_func_round::fix_arg_int()
{
if (args[1]->const_item())
{
longlong val1= args[1]->val_int();
bool val1_is_negative= val1 < 0 && !args[1]->unsigned_flag;
uint decimals_to_set= val1_is_negative ?
0 : (uint) MY_MIN(val1, DECIMAL_MAX_SCALE);
Longlong_hybrid val1= args[1]->to_longlong_hybrid();
if (args[1]->null_value)
fix_length_and_dec_double(NOT_FIXED_DEC);
else if ((!decimals_to_set && truncate) ||
else if ((!val1.to_uint(DECIMAL_MAX_SCALE) && truncate) ||
args[0]->decimal_precision() < DECIMAL_LONGLONG_DIGITS)
{
// Length can increase in some cases: ROUND(9,-1) -> 10
int length_can_increase= MY_TEST(!truncate && val1_is_negative);
int length_can_increase= MY_TEST(!truncate && val1.neg());
max_length= args[0]->max_length + length_can_increase;
// Here we can keep INT_RESULT
unsigned_flag= args[0]->unsigned_flag;
......@@ -2322,7 +2320,7 @@ void Item_func_round::fix_arg_int()
set_handler(type_handler_long_or_longlong());
}
else
fix_length_and_dec_decimal(decimals_to_set);
fix_length_and_dec_decimal(val1.to_uint(DECIMAL_MAX_SCALE));
}
else
fix_length_and_dec_double(args[0]->decimals);
......
......@@ -78,6 +78,22 @@ class Longlong_hybrid: public Longlong
return ((ulonglong) LONGLONG_MAX) + 1;
return m_value < 0 ? -m_value : m_value;
}
/*
Convert to an unsigned number:
- Negative numbers are converted to 0.
- Positive numbers bigger than upper_bound are converted to upper_bound.
- Other numbers are returned as is.
*/
ulonglong to_ulonglong(ulonglong upper_bound) const
{
return neg() ? 0 :
(ulonglong) m_value > upper_bound ? upper_bound :
(ulonglong) m_value;
}
uint to_uint(uint upper_bound) const
{
return (uint) to_ulonglong(upper_bound);
}
int cmp(const Longlong_hybrid& other) const
{
if (m_unsigned == other.m_unsigned)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment