Commit c1f3eff5 authored by Sergei Golubchik's avatar Sergei Golubchik

Merge branch '10.5' into 10.6

parents 52f6df99 267dd5a9
......@@ -264,8 +264,6 @@ IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND
MY_CHECK_AND_SET_COMPILER_FLAG("-D_FORTIFY_SOURCE=2" RELEASE RELWITHDEBINFO)
ENDIF()
INCLUDE(wsrep)
OPTION(WITH_DBUG_TRACE "Enable DBUG_ENTER()/DBUG_RETURN()/DBUG_PRINT()" ON)
IF(WITH_DBUG_TRACE)
FOREACH(LANG C CXX)
......@@ -277,6 +275,11 @@ ENDIF()
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
IF(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10")
# Enable extra checks when using a recent enough version of GNU libstdc++
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_ASSERTIONS")
ENDIF()
OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF)
IF (ENABLE_GCOV)
MY_CHECK_AND_SET_COMPILER_FLAG("-DHAVE_gcov -fprofile-arcs -ftest-coverage -lgcov" DEBUG)
......@@ -337,6 +340,8 @@ ELSEIF(TRASH_FREED_MEMORY MATCHES "AUTO" AND NOT WIN32 AND NOT WITH_VALGRIND AND
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTRASH_FREED_MEMORY")
ENDIF()
INCLUDE(wsrep)
# Set commonly used variables
IF(WIN32)
SET(DEFAULT_MYSQL_HOME "C:/Program Files/MariaDB ${MYSQL_BASE_VERSION}")
......
......@@ -3024,7 +3024,8 @@ int main(int argc, char** argv)
{
if (!opt_version)
{
usage();
error("Please provide the log file(s). Run with '--help' for usage "
"instructions.");
retval= ERROR_STOP;
}
goto err;
......
......@@ -3068,8 +3068,9 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
}
else
dynstr_set_checked(&select_field_names, "");
insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " :
delayed ? " DELAYED " : opt_ignore ? " IGNORE " : "");
insert_option= ((delayed && opt_ignore) ? "DELAYED IGNORE " :
delayed ? "DELAYED " : opt_ignore ? "IGNORE " : "");
verbose_msg("-- Retrieving table structure for table %s...\n", table);
......
......@@ -49,16 +49,16 @@ MACRO(BUNDLE_PCRE2)
SET(pcre2_flags${v} "${pcre2_flags${v}} -std=c99 ")
IF(MSVC)
# Suppress a warning
STRING(APPEND pcre2_flags${v} " /wd4244 " )
STRING(APPEND pcre2_flags${v} " /wd4244 /wd4267 " )
# Disable asan support
STRING(REPLACE "-fsanitize=address" "" pcre2_flags${v} "${CMAKE_C_FLAGS${v}}")
STRING(REPLACE "-fsanitize=address" "" pcre2_flags${v} "${pcre2_flags${v}}")
ENDIF()
ENDFOREACH()
ExternalProject_Add(
pcre2
PREFIX "${dir}"
URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.zip"
URL_MD5 fe90992fbfb03f854bd9f344074f49eb
URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.43/pcre2-10.43.zip"
URL_MD5 b58f050f2fdd6f2ca5774a2975377a85
INSTALL_COMMAND ""
CMAKE_ARGS
"-DCMAKE_WARN_DEPRECATED=FALSE"
......
......@@ -37,10 +37,14 @@ MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
IF(WITH_ZLIB STREQUAL "bundled")
MYSQL_USE_BUNDLED_ZLIB()
ELSE()
INCLUDE(FindZLIB)
FIND_PACKAGE(PkgConfig QUIET)
IF(PKG_CONFIG_FOUND AND (COMMAND PKG_GET_VARIABLE) AND (NOT WIN32))
PKG_GET_VARIABLE(ZLIB_ROOT zlib prefix)
ENDIF()
FIND_PACKAGE(ZLIB)
IF(ZLIB_FOUND)
INCLUDE(CheckFunctionExists)
SET(CMAKE_REQUIRED_LIBRARIES z)
SET(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES})
CHECK_FUNCTION_EXISTS(crc32 HAVE_CRC32)
CHECK_FUNCTION_EXISTS(compressBound HAVE_COMPRESSBOUND)
CHECK_FUNCTION_EXISTS(deflateBound HAVE_DEFLATEBOUND)
......
......@@ -3,6 +3,11 @@
# will be skipped unless innodb is enabled
#
--disable_query_log
if (`select version() like '%debug%'`)
{
SET STATEMENT sql_log_bin=0 FOR
call mtr.add_suppression("InnoDB: Trying to delete tablespace.*pending operations");
}
if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like 'MSAN%'`)
{
SET STATEMENT sql_log_bin=0 FOR
......
......@@ -4313,5 +4313,30 @@ ERROR HY000: Illegal parameter data types bigint unsigned and row for operation
SELECT @@max_allowed_packet=ROW(1,1);
ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '='
#
# MDEV-21034 GREATEST() and LEAST() malfunction for NULL
#
SELECT 5 AS c1 FROM dual WHERE GREATEST(1, NULL);
c1
SELECT 5 AS c1 FROM dual WHERE LEAST(1, NULL);
c1
CREATE TABLE t0 (c0 INT);
INSERT INTO t0 VALUES (1);
SELECT * FROM t0 WHERE GREATEST(c0, NULL);
c0
SELECT * FROM t0 WHERE LEAST(c0, NULL);
c0
DROP TABLE t0;
SELECT 5 AS c1 FROM dual WHERE GREATEST(1e0, NULL);
c1
SELECT 5 AS c1 FROM dual WHERE LEAST(1e0, NULL);
c1
CREATE TABLE t0 (c0 DOUBLE);
INSERT INTO t0 VALUES (1);
SELECT * FROM t0 WHERE GREATEST(c0, NULL);
c0
SELECT * FROM t0 WHERE LEAST(c0, NULL);
c0
DROP TABLE t0;
#
# End of 10.5 tests
#
......@@ -1115,6 +1115,29 @@ SELECT 0x20+ROW(1,1);
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT @@max_allowed_packet=ROW(1,1);
--echo #
--echo # MDEV-21034 GREATEST() and LEAST() malfunction for NULL
--echo #
SELECT 5 AS c1 FROM dual WHERE GREATEST(1, NULL);
SELECT 5 AS c1 FROM dual WHERE LEAST(1, NULL);
CREATE TABLE t0 (c0 INT);
INSERT INTO t0 VALUES (1);
SELECT * FROM t0 WHERE GREATEST(c0, NULL);
SELECT * FROM t0 WHERE LEAST(c0, NULL);
DROP TABLE t0;
SELECT 5 AS c1 FROM dual WHERE GREATEST(1e0, NULL);
SELECT 5 AS c1 FROM dual WHERE LEAST(1e0, NULL);
CREATE TABLE t0 (c0 DOUBLE);
INSERT INTO t0 VALUES (1);
SELECT * FROM t0 WHERE GREATEST(c0, NULL);
SELECT * FROM t0 WHERE LEAST(c0, NULL);
DROP TABLE t0;
--echo #
--echo # End of 10.5 tests
--echo #
......@@ -3617,5 +3617,20 @@ SELECT CRC32(ExtractValue('<a><b/></a>', '/a/b')) AS f;
f
0
#
# MDEV-33534 UBSAN: Negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_double_round from sql/item_func.cc|
#
SELECT TRUNCATE(EXP(-1.e-2),-1.e+30) AS c1;
c1
0
SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) AS c1;
c1
0
SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1;
c1
0
SELECT(ASIN(-1)+ LN(-1)) % (ATAN(-1) MOD FLOOR(1)) * (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1;
c1
NULL
#
# End of 10.5 tests
#
......@@ -1929,6 +1929,16 @@ DROP TABLE t2, t1;
SELECT CRC32(ExtractValue('<a><b/></a>', '/a/b')) AS f;
--echo #
--echo # MDEV-33534 UBSAN: Negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_double_round from sql/item_func.cc|
--echo #
SELECT TRUNCATE(EXP(-1.e-2),-1.e+30) AS c1;
SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) AS c1;
SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1;
SELECT(ASIN(-1)+ LN(-1)) % (ATAN(-1) MOD FLOOR(1)) * (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1;
--echo #
--echo # End of 10.5 tests
--echo #
......@@ -178,4 +178,18 @@ select 'foo' regexp x from t1 order by x desc;
0
1
drop table t1;
#
# MDEV-21076 NOT NULL and UNIQUE constraints cause SUM() to yield an incorrect result
#
CREATE TABLE t0(c0 INT NOT NULL, c1 CHAR UNIQUE);
INSERT INTO t0 VALUES (0, 1);
INSERT INTO t0 VALUES (0, '');
SELECT (c1 RLIKE c1), (c0 IS NULL) FROM t0;
(c1 RLIKE c1) (c0 IS NULL)
1 0
1 0
SELECT SUM(a.t) FROM (SELECT (c1 RLIKE c1) = (c0 IS NULL) as t FROM t0) as a;
SUM(a.t)
0
DROP TABLE t0;
# End of 10.5 tests
......@@ -121,4 +121,16 @@ select 'foo' regexp x from t1 order by x asc;
select 'foo' regexp x from t1 order by x desc;
drop table t1;
--echo #
--echo # MDEV-21076 NOT NULL and UNIQUE constraints cause SUM() to yield an incorrect result
--echo #
CREATE TABLE t0(c0 INT NOT NULL, c1 CHAR UNIQUE);
INSERT INTO t0 VALUES (0, 1);
INSERT INTO t0 VALUES (0, '');
SELECT (c1 RLIKE c1), (c0 IS NULL) FROM t0;
SELECT SUM(a.t) FROM (SELECT (c1 RLIKE c1) = (c0 IS NULL) as t FROM t0) as a;
DROP TABLE t0;
--echo # End of 10.5 tests
......@@ -18,7 +18,7 @@ SHOW WARNINGS;
SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
--let $start_mysqld_params = ""
--let $start_mysqld_params =
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
......
......@@ -50,12 +50,12 @@ SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
--let $start_mysqld_params = "--wsrep-new-cluster"
--let $start_mysqld_params =--wsrep-new-cluster
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/start_mysqld.inc
--connection node_2
--let $start_mysqld_params = ""
--let $start_mysqld_params =
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
......
......@@ -30,7 +30,7 @@
--echo Starting server ...
--let $restart_noprint=2
--let $start_mysqld_params="--wsrep-new-cluster"
--let $start_mysqld_params=--wsrep-new-cluster
--source include/start_mysqld.inc
--source include/wait_until_ready.inc
......
......@@ -19,5 +19,4 @@ galera_ipv6_mariabackup_section : temporarily disabled at the request of Codersh
# Opensuse/suse/rocky9/rocky84/rhel9/rhel8-ppc64le .. - all same IPv6 isn't configured right or skipping or galera
galera_ipv6_rsync : Can't connect to server on '::1' (115)
galera_ipv6_rsync_section : Can't connect to server on '::1' (115)
MDEV-29171 : MDEV-33842 galera_3nodes.MDEV-29171 fails on shutdown_server
GCF-354 : MDEV-25614 Galera test failure on GCF-354
......@@ -19,20 +19,40 @@ connection node_2;
connection node_1;
connection node_1;
# restart: --wsrep_new_cluster --wsrep_gtid_domain_id=200
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE
Primary
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE
Synced
show variables like 'wsrep_gtid_domain_id';
Variable_name Value
wsrep_gtid_domain_id 200
connection node_2;
# restart
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE
Primary
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE
Synced
show variables like 'wsrep_gtid_domain_id';
Variable_name Value
wsrep_gtid_domain_id 200
connection node_1;
connection node_3;
# restart: --wsrep_sst_donor=node2
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE
Primary
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE
Synced
show variables like 'wsrep_gtid_domain_id';
Variable_name Value
wsrep_gtid_domain_id 200
connection node_1;
connection node_1;
set global wsrep_gtid_domain_id=100;
connection node_2;
set global wsrep_gtid_domain_id=100;
......
......@@ -50,6 +50,16 @@ select @@wsrep_gtid_domain_id,@@wsrep_node_name;
--connection node_1
--let $restart_parameters = --wsrep_new_cluster --wsrep_gtid_domain_id=200
--source include/start_mysqld.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'
--source include/wait_condition.inc
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
show variables like 'wsrep_gtid_domain_id';
#
......@@ -59,8 +69,21 @@ show variables like 'wsrep_gtid_domain_id';
--let $restart_parameters =
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'
--source include/wait_condition.inc
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
show variables like 'wsrep_gtid_domain_id';
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
#
# Restart node_3, select node_2 as donor
......@@ -70,9 +93,23 @@ show variables like 'wsrep_gtid_domain_id';
--let $restart_parameters = --wsrep_sst_donor="node2"
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
--source include/start_mysqld.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'
--source include/wait_condition.inc
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
# Expect domain id 200
show variables like 'wsrep_gtid_domain_id';
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
#
# Cleanup
......
......@@ -33,3 +33,6 @@ log_slave_updates=ON
log_bin=mariadb-bin-log
binlog-format=row
wsrep-gtid-mode=ON
[sst]
transferfmt=@ENV.MTR_GALERA_TFMT
......@@ -38,12 +38,12 @@ SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
--let $start_mysqld_params = "--wsrep-new-cluster"
--let $start_mysqld_params =--wsrep-new-cluster
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/start_mysqld.inc
--connection node_2
--let $start_mysqld_params = ""
--let $start_mysqld_params =
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
......
......@@ -7,6 +7,12 @@ if (!$EXAMPLE_KEY_MANAGEMENT_SO)
}
call mtr.add_suppression("InnoDB: New log files created");
if (`select @@innodb_page_size=65536`)
{
# this needs too much memory for 32bit
source include/have_64bit.inc;
}
let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
......
......@@ -121,12 +121,23 @@ begin
where thread_id = my_thread_id
and nesting_event_id = my_statement_id
order by event_id asc;
# Ignore query cache as it may not be enabled
select username, event_name, nesting_event_type
# 1. Ignore query cache as it may not be enabled
# 2. MDL wait consists of short 1 second waits (this is not configurable)
# repeated until lock_wait_timeout is reached. The stage is changed
# to Waiting and back every second. To have predictable result here
# the query filters all sequences of X, "Waiting for MDL", X,
# leaving just X.
with h as (
select event_id, username, event_name, nesting_event_type,
lag(event_name) over (order by event_id) = lead(event_name) over (order by event_id)
and event_name = "stage/sql/Waiting for stored function metadata lock" as v1,
lag(event_name, 2) over (order by event_id) = event_name
and lag(event_name, 1) over (order by event_id) = "stage/sql/Waiting for stored function metadata lock" as v2
from performance_schema.events_stages_history
where thread_id = my_thread_id
and nesting_event_id = my_statement_id and
event_name not like "%query cache%"
) select username, event_name, nesting_event_type from h where v1 is not true and v2 is not true
order by event_id asc;
end;
else
......
......@@ -112,6 +112,10 @@ a
6
7
*** MDEV-4486: Allow to start old-style replication even if mysql.gtid_slave_pos is unavailable
connection server_1;
INSERT INTO t1 VALUES (8);
DELETE FROM t1 WHERE a=8;
connection server_2;
connection server_2;
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid= no;
......
......@@ -174,6 +174,24 @@ SELECT * FROM t1 ORDER BY a;
--echo *** MDEV-4486: Allow to start old-style replication even if mysql.gtid_slave_pos is unavailable
# In GTID mode, the old-style replication position is also updated. But during
# GTID connect, the old-style position is not known until receiving the fake
# GTID list event, which contains the required position value. If we happened
# to stop the slave above before this fake GTID list event, the test could fail
# with duplicate key errors due to switching to non-GTID mode at a wrong
# position too far back in the binlog.
#
# Work-around this by injecting an extra dummt event and syncing the slave to
# it, ensuring the old-style position will be updated.
#
# This work-around could be removed after MDEV-33996 is fixed.
--connection server_1
INSERT INTO t1 VALUES (8);
DELETE FROM t1 WHERE a=8;
--save_master_pos
--connection server_2
--sync_with_master
--connection server_2
--source include/stop_slave.inc
CHANGE MASTER TO master_use_gtid= no;
......
......@@ -2632,12 +2632,12 @@ void Item_func_round::fix_arg_hex_hybrid()
}
double my_double_round(double value, longlong dec, bool dec_unsigned,
double my_double_round(double value, longlong dec_value, bool dec_unsigned,
bool truncate)
{
double tmp;
bool dec_negative= (dec < 0) && !dec_unsigned;
ulonglong abs_dec= dec_negative ? -dec : dec;
const Longlong_hybrid dec(dec_value, dec_unsigned);
const ulonglong abs_dec= dec.abs();
/*
tmp2 is here to avoid return the value with 80 bit precision
This will fix that the test round(0.1,1) = round(0.1,1) is true
......@@ -2652,22 +2652,24 @@ double my_double_round(double value, longlong dec, bool dec_unsigned,
volatile double value_div_tmp= value / tmp;
volatile double value_mul_tmp= value * tmp;
if (!dec_negative && std::isinf(tmp)) // "dec" is too large positive number
if (!dec.neg() && std::isinf(tmp)) // "dec" is a too large positive number
return value;
if (dec_negative && std::isinf(tmp))
tmp2= 0.0;
else if (!dec_negative && std::isinf(value_mul_tmp))
if (dec.neg() && std::isinf(tmp)) // "dec" is a too small negative number
return 0.0;
// Handle "dec" with a reasonably small absolute value
if (!dec.neg() && std::isinf(value_mul_tmp))
tmp2= value;
else if (truncate)
{
if (value >= 0.0)
tmp2= dec < 0 ? floor(value_div_tmp) * tmp : floor(value_mul_tmp) / tmp;
tmp2= dec.neg() ? floor(value_div_tmp) * tmp : floor(value_mul_tmp) / tmp;
else
tmp2= dec < 0 ? ceil(value_div_tmp) * tmp : ceil(value_mul_tmp) / tmp;
tmp2= dec.neg() ? ceil(value_div_tmp) * tmp : ceil(value_mul_tmp) / tmp;
}
else
tmp2=dec < 0 ? rint(value_div_tmp) * tmp : rint(value_mul_tmp) / tmp;
tmp2=dec.neg() ? rint(value_div_tmp) * tmp : rint(value_mul_tmp) / tmp;
return tmp2;
}
......@@ -3016,7 +3018,7 @@ double Item_func_min_max::val_real_native()
value=tmp;
}
if ((null_value= args[i]->null_value))
break;
return 0;
}
return value;
}
......@@ -3037,7 +3039,7 @@ longlong Item_func_min_max::val_int_native()
value=tmp;
}
if ((null_value= args[i]->null_value))
break;
return 0;
}
return value;
}
......
......@@ -276,7 +276,6 @@ void mtr_t::commit_shrink(fil_space_t &space, uint32_t size)
ut_ad(!is_inside_ibuf());
ut_ad(!high_level_read_only);
ut_ad(m_modifications);
ut_ad(m_made_dirty);
ut_ad(!m_memo.empty());
ut_ad(!recv_recovery_is_on());
ut_ad(m_log_mode == MTR_LOG_ALL);
......
......@@ -124,7 +124,7 @@ ENDIF()
IF (CURL_FOUND)
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
MYSQL_ADD_PLUGIN(s3 ha_s3.cc ${S3_SOURCES} COMPONENT s3-engine
LINK_LIBRARIES ${CURL_LIBRARIES} z STORAGE_ENGINE NOT_EMBEDDED CONFIG s3.cnf)
LINK_LIBRARIES ${CURL_LIBRARIES} ${ZLIB_LIBRARY} STORAGE_ENGINE NOT_EMBEDDED CONFIG s3.cnf)
ENDIF()
SET(CPACK_RPM_s3-engine_PACKAGE_SUMMARY "Amazon S3 archival storage engine for MariaDB" PARENT_SCOPE)
......
CREATE FUNCTION spider_direct_sql RETURNS INT SONAME 'ha_spider.so';
SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"');
ERROR HY000: Plugin 'SPIDER' is not loaded
CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so';
SELECT spider_bg_direct_sql ('SELECT * FROM s','a','srv "b"');
ERROR HY000: Plugin 'SPIDER' is not loaded
CREATE FUNCTION spider_copy_tables RETURNS INT SONAME 'ha_spider.so';
SELECT spider_copy_tables ('t', '0', '0');
ERROR HY000: Plugin 'SPIDER' is not loaded
CREATE FUNCTION spider_flush_table_mon_cache RETURNS INT SONAME 'ha_spider.so';
SELECT spider_flush_table_mon_cache ();
spider_flush_table_mon_cache ()
1
install soname 'ha_spider';
SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"');
ERROR HY000: The foreign server name you are trying to reference does not exist. Data source error: b
call mtr.add_suppression(".*\\[Error\\] (mysqld|mariadbd): Can't find record in 'spider_tables'");
SELECT spider_copy_tables ('t', '0', '0');
ERROR HY000: Can't find record in 'spider_tables'
SELECT spider_flush_table_mon_cache ();
spider_flush_table_mon_cache ()
1
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
CREATE FUNCTION spider_direct_sql RETURNS INT SONAME 'ha_spider.so';
--error ER_PLUGIN_IS_NOT_LOADED
SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"');
CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so';
--error ER_PLUGIN_IS_NOT_LOADED
SELECT spider_bg_direct_sql ('SELECT * FROM s','a','srv "b"');
CREATE FUNCTION spider_copy_tables RETURNS INT SONAME 'ha_spider.so';
--error ER_PLUGIN_IS_NOT_LOADED
SELECT spider_copy_tables ('t', '0', '0');
# spider_flush_table_mon_cache does not require spider init to function
CREATE FUNCTION spider_flush_table_mon_cache RETURNS INT SONAME 'ha_spider.so';
SELECT spider_flush_table_mon_cache ();
# The function functions properly after the plugin is installed
install soname 'ha_spider';
--error ER_FOREIGN_SERVER_DOESNT_EXIST
SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"');
call mtr.add_suppression(".*\\[Error\\] (mysqld|mariadbd): Can't find record in 'spider_tables'");
--error ER_KEY_NOT_FOUND
SELECT spider_copy_tables ('t', '0', '0');
SELECT spider_flush_table_mon_cache ();
--disable_query_log
--source ../../include/clean_up_spider.inc
......@@ -1154,12 +1154,20 @@ long long spider_copy_tables_body(
DBUG_RETURN(0);
}
#undef my_error
extern "C" void my_error(unsigned int nr, unsigned long MyFlags, ...);
my_bool spider_copy_tables_init_body(
UDF_INIT *initid,
UDF_ARGS *args,
char *message
) {
DBUG_ENTER("spider_copy_tables_init_body");
if (!spider_hton_ptr)
{
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), "SPIDER");
goto error;
}
if (args->arg_count != 3 && args->arg_count != 4)
{
strcpy(message, "spider_copy_tables() requires 3 or 4 arguments");
......
......@@ -1879,6 +1879,9 @@ long long spider_direct_sql_body(
DBUG_RETURN(0);
}
#undef my_error
extern "C" void my_error(unsigned int nr, unsigned long MyFlags, ...);
my_bool spider_direct_sql_init_body(
UDF_INIT *initid,
UDF_ARGS *args,
......@@ -1887,6 +1890,11 @@ my_bool spider_direct_sql_init_body(
) {
SPIDER_BG_DIRECT_SQL *bg_direct_sql;
DBUG_ENTER("spider_direct_sql_init_body");
if (!spider_hton_ptr)
{
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), "SPIDER");
goto error;
}
if (args->arg_count != 3)
{
strcpy(message, "spider_(bg)_direct_sql() requires 3 arguments");
......
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