Commit 98eb9518 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

Merge remote-tracking branch 'origin/10.1' into 10.2

parents b0c43d0c 0a534348
...@@ -2723,7 +2723,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end) ...@@ -2723,7 +2723,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
init_dynamic_string(&ds_query, 0, (end - query) + 32, 256); init_dynamic_string(&ds_query, 0, (end - query) + 32, 256);
do_eval(&ds_query, query, end, FALSE); do_eval(&ds_query, query, end, FALSE);
if (mysql_real_query(mysql, ds_query.str, ds_query.length)) if (mysql_real_query(mysql, ds_query.str, ds_query.length) || !(res= mysql_store_result(mysql)))
{ {
handle_error(curr_command, mysql_errno(mysql), mysql_error(mysql), handle_error(curr_command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), &ds_res); mysql_sqlstate(mysql), &ds_res);
...@@ -2733,13 +2733,6 @@ void var_query_set(VAR *var, const char *query, const char** query_end) ...@@ -2733,13 +2733,6 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
if (!(res= mysql_store_result(mysql)))
{
report_or_die("Query '%s' didn't return a result set", ds_query.str);
dynstr_free(&ds_query);
eval_expr(var, "", 0);
DBUG_VOID_RETURN;
}
dynstr_free(&ds_query); dynstr_free(&ds_query);
if ((row= mysql_fetch_row(res)) && row[0]) if ((row= mysql_fetch_row(res)) && row[0])
......
...@@ -1022,6 +1022,9 @@ CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H) ...@@ -1022,6 +1022,9 @@ CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H)
IF(NOT HAVE_UCONTEXT_H) IF(NOT HAVE_UCONTEXT_H)
CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_UCONTEXT_H) CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_UCONTEXT_H)
ENDIF() ENDIF()
IF(HAVE_UCONTEXT_H)
CHECK_FUNCTION_EXISTS(makecontext HAVE_UCONTEXT_H)
ENDIF()
CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec "time.h" STRUCT_TIMESPEC_HAS_TV_SEC) CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec "time.h" STRUCT_TIMESPEC_HAS_TV_SEC)
CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_nsec "time.h" STRUCT_TIMESPEC_HAS_TV_NSEC) CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_nsec "time.h" STRUCT_TIMESPEC_HAS_TV_NSEC)
......
...@@ -34,8 +34,8 @@ Build-Depends: bison, ...@@ -34,8 +34,8 @@ Build-Depends: bison,
zlib1g-dev (>= 1:1.1.3-5~) zlib1g-dev (>= 1:1.1.3-5~)
Standards-Version: 3.8.2 Standards-Version: 3.8.2
Homepage: http://mariadb.org/ Homepage: http://mariadb.org/
Vcs-Git: https://github.com/MariaDB/server.git
Vcs-Browser: https://github.com/MariaDB/server/ Vcs-Browser: https://github.com/MariaDB/server/
Vcs-Git: https://github.com/MariaDB/server.git
Package: libmariadb3 Package: libmariadb3
Architecture: any Architecture: any
......
...@@ -39,7 +39,7 @@ let $wait_timeout= 0; ...@@ -39,7 +39,7 @@ let $wait_timeout= 0;
let $wait_condition_reps= 0; let $wait_condition_reps= 0;
while ($wait_counter) while ($wait_counter)
{ {
--error 0,ER_NO_SUCH_TABLE,ER_LOCK_WAIT_TIMEOUT,ER_UNKNOWN_COM_ERROR --error 0,ER_NO_SUCH_TABLE,ER_LOCK_WAIT_TIMEOUT,ER_UNKNOWN_COM_ERROR,ER_LOCK_DEADLOCK
let $success= `$wait_condition`; let $success= `$wait_condition`;
inc $wait_condition_reps; inc $wait_condition_reps;
if ($success) if ($success)
......
...@@ -102,6 +102,57 @@ select * from t1 where case a when adddate( '2012-12-12', 7 ) then true end; ...@@ -102,6 +102,57 @@ select * from t1 where case a when adddate( '2012-12-12', 7 ) then true end;
a a
drop table t1; drop table t1;
End of 5.5 tests End of 5.5 tests
#
# Start of 10.1 tests
#
#
# MDEV-14452 Precision in INTERVAL xxx DAY_MICROSECOND parsed wrong?
#
SELECT
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5' DAY_MICROSECOND) c1,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50' DAY_MICROSECOND) c2,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500' DAY_MICROSECOND) c3,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000' DAY_MICROSECOND) c4,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000' DAY_MICROSECOND) c5,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000' DAY_MICROSECOND) c6,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000' DAY_MICROSECOND) c7,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000' DAY_MICROSECOND) c8,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000000' DAY_MICROSECOND) c9,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000000' DAY_MICROSECOND) c10,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000000' DAY_MICROSECOND) c11,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000000000' DAY_MICROSECOND) c12,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000000000' DAY_MICROSECOND) c13,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000000000' DAY_MICROSECOND) c14,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000000000000' DAY_MICROSECOND) c15,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000000000000' DAY_MICROSECOND) c16,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000000000000' DAY_MICROSECOND) c17,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000000000000000' DAY_MICROSECOND) c18,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000000000000000' DAY_MICROSECOND) c19,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000000000000000' DAY_MICROSECOND) c20
;
c1 1000-01-01 00:00:01.500000
c2 1000-01-01 00:00:01.500000
c3 1000-01-01 00:00:01.500000
c4 1000-01-01 00:00:01.500000
c5 1000-01-01 00:00:01.500000
c6 1000-01-01 00:00:01.500000
c7 1000-01-01 00:00:01.500000
c8 1000-01-01 00:00:01.500000
c9 1000-01-01 00:00:01.500000
c10 1000-01-01 00:00:01.500000
c11 1000-01-01 00:00:01.500000
c12 1000-01-01 00:00:01.500000
c13 1000-01-01 00:00:01.500000
c14 1000-01-01 00:00:01.500000
c15 1000-01-01 00:00:01.500000
c16 1000-01-01 00:00:01.500000
c17 1000-01-01 00:00:01.500000
c18 1000-01-01 00:00:01.500000
c19 1000-01-01 00:00:01.500000
c20 NULL
#
# End of 10.1 tests
#
create or replace view v1 as select 3 & 20010101 + interval 2 day as x; create or replace view v1 as select 3 & 20010101 + interval 2 day as x;
show create view v1; show create view v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
......
...@@ -2905,6 +2905,30 @@ NULL ...@@ -2905,6 +2905,30 @@ NULL
Warnings: Warnings:
Warning 1441 Datetime function: datetime field overflow Warning 1441 Datetime function: datetime field overflow
# #
# MDEV-13202 Assertion `ltime->neg == 0' failed in date_to_datetime
#
CREATE TABLE t1 (i INT, d DATE);
INSERT INTO t1 VALUES (1, '1970-01-01');
SELECT MAX(NULLIF(i,1)) FROM t1 ORDER BY DATE_SUB(d,INTERVAL 17300000 HOUR);
MAX(NULLIF(i,1))
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
DROP TABLE t1;
CREATE TABLE t1 (i INT, d DATE);
INSERT INTO t1 VALUES (1, '1970-01-01');
SELECT CONCAT(DATE_SUB(d, INTERVAL 17300000 HOUR)) FROM t1;
CONCAT(DATE_SUB(d, INTERVAL 17300000 HOUR))
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
DROP TABLE t1;
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR));
CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR))
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
#
# End of 10.0 tests # End of 10.0 tests
# #
# #
......
...@@ -2757,6 +2757,21 @@ a b sq ...@@ -2757,6 +2757,21 @@ a b sq
4 2 1 4 2 1
drop table t1, t2; drop table t1, t2;
# #
# MDEV-15235: Assertion `length > 0' failed in create_ref_for_key
#
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f CHAR(1));
INSERT INTO t2 VALUES ('a'),('b');
explain
SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
f
DROP TABLE t1, t2;
#
# MDEV-9489: Assertion `0' failed in Protocol::end_statement() on # MDEV-9489: Assertion `0' failed in Protocol::end_statement() on
# UNION ALL # UNION ALL
# #
......
...@@ -9,18 +9,15 @@ ...@@ -9,18 +9,15 @@
# Do not use any TAB characters for whitespace. # Do not use any TAB characters for whitespace.
# #
############################################################################## ##############################################################################
MW-336 : MDEV-13549 Galera test failures
galera_gra_log : MDEV-13549 Galera test failures galera_gra_log : MDEV-13549 Galera test failures
galera_flush_local : MDEV-13549 Galera test failures galera_flush_local : MDEV-13549 Galera test failures
galera_flush : MDEV-13549 Galera test failures galera_flush : MDEV-13549 Galera test failures
MW-329 : MDEV-13549 Galera test failures
galera_account_management : MariaDB 10.0 does not support ALTER USER galera_account_management : MariaDB 10.0 does not support ALTER USER
galera_binlog_row_image : MariaDB 10.0 does not support binlog_row_image galera_binlog_row_image : MariaDB 10.0 does not support binlog_row_image
galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events
GAL-419 : MDEV-13549 Galera test failures GAL-419 : MDEV-13549 Galera test failures
galera_toi_ddl_fk_insert : MDEV-13549 Galera test failures galera_toi_ddl_fk_insert : MDEV-13549 Galera test failures
galera_var_notify_cmd : MDEV-13549 Galera test failures galera_var_notify_cmd : MDEV-13549 Galera test failures
galera_var_slave_threads : MDEV-13549 Galera test failures
mysql-wsrep#90 : MDEV-13549 Galera test failures mysql-wsrep#90 : MDEV-13549 Galera test failures
galera_as_master_gtid : Requires MySQL GTID galera_as_master_gtid : Requires MySQL GTID
galera_as_master_gtid_change_master : Requires MySQL GTID galera_as_master_gtid_change_master : Requires MySQL GTID
...@@ -34,7 +31,6 @@ galera_ist_mysqldump : MDEV-13549 Galera test failures ...@@ -34,7 +31,6 @@ galera_ist_mysqldump : MDEV-13549 Galera test failures
mysql-wsrep#31 : MDEV-13549 Galera test failures mysql-wsrep#31 : MDEV-13549 Galera test failures
galera_migrate : MariaDB 10.0 does not support START SLAVE USER galera_migrate : MariaDB 10.0 does not support START SLAVE USER
galera_concurrent_ctas : MDEV-13549 Galera test failures galera_concurrent_ctas : MDEV-13549 Galera test failures
galera_bf_abort_for_update : MDEV-13549 Galera test failures
galera_wsrep_desync_wsrep_on : MDEV-13549 Galera test failures galera_wsrep_desync_wsrep_on : MDEV-13549 Galera test failures
galera_ssl_upgrade : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures
mysql-wsrep#33 : MDEV-13549 Galera test failures mysql-wsrep#33 : MDEV-13549 Galera test failures
...@@ -47,8 +43,6 @@ lp1376747 : MDEV-13549 Galera test failures ...@@ -47,8 +43,6 @@ lp1376747 : MDEV-13549 Galera test failures
galera_toi_ddl_nonconflicting : MDEV-13549 Galera test failures galera_toi_ddl_nonconflicting : MDEV-13549 Galera test failures
galera_parallel_simple : MDEV-13549 Galera test failures galera_parallel_simple : MDEV-13549 Galera test failures
galera_admin : MDEV-13549 Galera test failures galera_admin : MDEV-13549 Galera test failures
galera_var_max_ws_rows : MDEV-13549 Galera test failures 10.1
MW-286 : MDEV-13549 Galera test failures 10.1
galera_as_master: MDEV-13549 Galera test failures 10.1 galera_as_master: MDEV-13549 Galera test failures 10.1
galera_pc_ignore_sb : MDEV-13549 Galera test failures 10.1 galera_pc_ignore_sb : MDEV-13549 Galera test failures 10.1
galera_lock_table : MDEV-13549 Galera test failures 10.1 galera_lock_table : MDEV-13549 Galera test failures 10.1
......
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
connection node_1;
SET GLOBAL wsrep_slave_threads = 10; SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
connection node_2;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
connection node_1;
SET GLOBAL wsrep_slave_threads = 10; SET GLOBAL wsrep_slave_threads = 10;
SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
COUNT(*) = 11
1
SET GLOBAL wsrep_slave_threads = 20; SET GLOBAL wsrep_slave_threads = 20;
SELECT COUNT(*) = 21 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
COUNT(*) = 21
1
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
connection node_2;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3); INSERT INTO t1 VALUES (3);
...@@ -20,10 +18,12 @@ INSERT INTO t1 VALUES (6); ...@@ -20,10 +18,12 @@ INSERT INTO t1 VALUES (6);
INSERT INTO t1 VALUES (7); INSERT INTO t1 VALUES (7);
INSERT INTO t1 VALUES (8); INSERT INTO t1 VALUES (8);
INSERT INTO t1 VALUES (9); INSERT INTO t1 VALUES (9);
connection node_1;
SET GLOBAL wsrep_slave_threads = 10; SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 0; SET GLOBAL wsrep_slave_threads = 0;
Warnings: Warnings:
Warning 1292 Truncated incorrect wsrep_slave_threads value: '0' Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
connection node_2;
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
INSERT INTO t1 VALUES (11); INSERT INTO t1 VALUES (11);
INSERT INTO t1 VALUES (12); INSERT INTO t1 VALUES (12);
...@@ -35,8 +35,6 @@ INSERT INTO t1 VALUES (17); ...@@ -35,8 +35,6 @@ INSERT INTO t1 VALUES (17);
INSERT INTO t1 VALUES (18); INSERT INTO t1 VALUES (18);
INSERT INTO t1 VALUES (19); INSERT INTO t1 VALUES (19);
INSERT INTO t1 VALUES (20); INSERT INTO t1 VALUES (20);
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user'; connection node_1;
COUNT(*) = 2
1
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF; INSERT INTO t1 VALUES (1, 10);
START TRANSACTION; connection node_1;
INSERT INTO t1 VALUES (1); BEGIN;
INSERT INTO t1 VALUES (1);
SELECT * FROM t1 FOR UPDATE; SELECT * FROM t1 FOR UPDATE;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction f1 f2
wsrep_local_aborts_increment 1 10
connection node_2;
UPDATE t1 SET f1 = 2;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1;
COMMIT;
ERROR 40001: Deadlock: wsrep aborted transaction
wsrep_local_bf_aborts_diff
1
connection node_1;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
f1 f2
2 10
connection node_2;
UPDATE t1 SET f2 = 20;
connection node_1a;
connection node_1;
COMMIT;
ERROR 40001: Deadlock: wsrep aborted transaction
wsrep_local_bf_aborts_diff
1 1
DROP TABLE t1; DROP TABLE t1;
CALL mtr.add_suppression("WSREP: Refusing exit for the last slave thread.");
connection node_1; connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB; CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB; CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB;
connection node_2; connection node_2;
CALL mtr.add_suppression("WSREP: Refusing exit for the last slave thread.");
SET GLOBAL wsrep_slave_threads = 0; SET GLOBAL wsrep_slave_threads = 0;
Warnings: Warnings:
Warning 1292 Truncated incorrect wsrep_slave_threads value: '0' Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
...@@ -13,10 +13,6 @@ SELECT @@wsrep_slave_threads = 1; ...@@ -13,10 +13,6 @@ SELECT @@wsrep_slave_threads = 1;
@@wsrep_slave_threads = 1 @@wsrep_slave_threads = 1
1 1
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
COUNT(*)
2
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%'; SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
COUNT(*) COUNT(*)
1 1
...@@ -24,16 +20,6 @@ SET GLOBAL wsrep_slave_threads = 64; ...@@ -24,16 +20,6 @@ SET GLOBAL wsrep_slave_threads = 64;
connection node_1; connection node_1;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
connection node_2; connection node_2;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SELECT COUNT(*) - @@wsrep_slave_threads FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
COUNT(*) - @@wsrep_slave_threads
1
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
COUNT(*)
1
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
connection node_1; connection node_1;
INSERT INTO t2 VALUES (DEFAULT); INSERT INTO t2 VALUES (DEFAULT);
...@@ -104,10 +90,6 @@ connection node_2; ...@@ -104,10 +90,6 @@ connection node_2;
SELECT COUNT(*) FROM t2; SELECT COUNT(*) FROM t2;
COUNT(*) COUNT(*)
64 64
SELECT COUNT(*) - @@wsrep_slave_threads FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
COUNT(*) - @@wsrep_slave_threads
1
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%'; SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
COUNT(*) COUNT(*)
1 1
...@@ -122,5 +104,13 @@ CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY) ENGINE=INNODB; ...@@ -122,5 +104,13 @@ CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY) ENGINE=INNODB;
connection node_2; connection node_2;
SET GLOBAL wsrep_slave_threads = 4; SET GLOBAL wsrep_slave_threads = 4;
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
connection node_1;
INSERT INTO t1 VALUES (DEFAULT);
INSERT INTO t1 VALUES (DEFAULT);
INSERT INTO t1 VALUES (DEFAULT);
DROP TABLE t1; DROP TABLE t1;
connection node_2;
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
COUNT(*) = 1
1
# End of tests # End of tests
...@@ -25,7 +25,6 @@ SET wsrep_on = FALSE; ...@@ -25,7 +25,6 @@ SET wsrep_on = FALSE;
--error ER_QUERY_INTERRUPTED --error ER_QUERY_INTERRUPTED
ALTER TABLE t1 ADD PRIMARY KEY (f1); ALTER TABLE t1 ADD PRIMARY KEY (f1);
SET SESSION wsrep_sync_wait = 0;
SET wsrep_on = TRUE; SET wsrep_on = TRUE;
SET GLOBAL wsrep_desync = FALSE; SET GLOBAL wsrep_desync = FALSE;
......
...@@ -10,20 +10,20 @@ CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; ...@@ -10,20 +10,20 @@ CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
--connection node_1 --connection node_1
SET GLOBAL wsrep_slave_threads = 10; SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
--let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
--connection node_2 --connection node_2
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
--connection node_1 --connection node_1
--sleep 0.5
SET GLOBAL wsrep_slave_threads = 10; SET GLOBAL wsrep_slave_threads = 10;
--sleep 0.5 --let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user'; --source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 20; SET GLOBAL wsrep_slave_threads = 20;
--sleep 0.5 --let $wait_condition = SELECT COUNT(*) = 21 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
SELECT COUNT(*) = 21 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user'; --source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
...@@ -40,6 +40,9 @@ INSERT INTO t1 VALUES (9); ...@@ -40,6 +40,9 @@ INSERT INTO t1 VALUES (9);
--connection node_1 --connection node_1
--let $wait_condition = SELECT COUNT(*) = 12 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 10; SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 0; SET GLOBAL wsrep_slave_threads = 0;
...@@ -57,8 +60,8 @@ INSERT INTO t1 VALUES (19); ...@@ -57,8 +60,8 @@ INSERT INTO t1 VALUES (19);
INSERT INTO t1 VALUES (20); INSERT INTO t1 VALUES (20);
--connection node_1 --connection node_1
--sleep 0.5 --let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user'; --source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
DROP TABLE t1; DROP TABLE t1;
...@@ -5,25 +5,52 @@ ...@@ -5,25 +5,52 @@
# Test a local transaction being aborted by a slave one while it is running a SELECT FOR UPDATE # Test a local transaction being aborted by a slave one while it is running a SELECT FOR UPDATE
# #
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT) ENGINE=InnoDB;
--connection node_2 INSERT INTO t1 VALUES (1, 10);
--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
SET AUTOCOMMIT=OFF; # Test updating the PK
START TRANSACTION;
INSERT INTO t1 VALUES (1);
--connection node_1 --connection node_1
INSERT INTO t1 VALUES (1); --let $wsrep_local_bf_aborts_before = `SELECT variable_value FROM information_schema.global_status WHERE variable_name = 'wsrep_local_bf_aborts'`
BEGIN;
SELECT * FROM t1 FOR UPDATE;
--connection node_2 --connection node_2
UPDATE t1 SET f1 = 2;
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--let $wait_condition = SELECT COUNT(*) FROM t1 WHERE f1 = 2
--source include/wait_condition.inc
--connection node_1
--error ER_LOCK_DEADLOCK --error ER_LOCK_DEADLOCK
COMMIT;
--disable_query_log
--eval SELECT variable_value - $wsrep_local_bf_aborts_before AS wsrep_local_bf_aborts_diff FROM information_schema.global_status WHERE variable_name = 'wsrep_local_bf_aborts'
--enable_query_log
# Test updating non-indexed column
--connection node_1
--let $wsrep_local_bf_aborts_before = `SELECT variable_value FROM information_schema.global_status WHERE variable_name = 'wsrep_local_bf_aborts'`
BEGIN;
SELECT * FROM t1 FOR UPDATE; SELECT * FROM t1 FOR UPDATE;
--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` --connection node_2
UPDATE t1 SET f2 = 20;
--connection node_1a
--let $wait_condition = SELECT COUNT(*) FROM t1 WHERE f2 = 20
--source include/wait_condition.inc
--connection node_1
--error ER_LOCK_DEADLOCK
COMMIT;
--disable_query_log --disable_query_log
--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment; --eval SELECT variable_value - $wsrep_local_bf_aborts_before AS wsrep_local_bf_aborts_diff FROM information_schema.global_status WHERE variable_name = 'wsrep_local_bf_aborts'
--enable_query_log --enable_query_log
DROP TABLE t1; DROP TABLE t1;
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
--source include/galera_cluster.inc --source include/galera_cluster.inc
--source include/have_innodb.inc --source include/have_innodb.inc
CALL mtr.add_suppression("WSREP: Refusing exit for the last slave thread.");
--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` --let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
--connection node_1 --connection node_1
...@@ -14,7 +13,7 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB; ...@@ -14,7 +13,7 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB; CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB;
--connection node_2 --connection node_2
CALL mtr.add_suppression("WSREP: Refusing exit for the last slave thread.");
# Setting wsrep_slave_threads to zero triggers a warning # Setting wsrep_slave_threads to zero triggers a warning
SET GLOBAL wsrep_slave_threads = 0; SET GLOBAL wsrep_slave_threads = 0;
SHOW WARNINGS; SHOW WARNINGS;
...@@ -22,8 +21,6 @@ SELECT @@wsrep_slave_threads = 1; ...@@ -22,8 +21,6 @@ SELECT @@wsrep_slave_threads = 1;
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
# There is a separate wsrep_aborter thread at all times # There is a separate wsrep_aborter thread at all times
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%'; SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
# #
...@@ -31,17 +28,13 @@ SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' A ...@@ -31,17 +28,13 @@ SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' A
# #
SET GLOBAL wsrep_slave_threads = 64; SET GLOBAL wsrep_slave_threads = 64;
--sleep 0.5
--connection node_1 --connection node_1
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
--connection node_2 --connection node_2
SELECT COUNT(*) FROM t1; --let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
SELECT COUNT(*) - @@wsrep_slave_threads FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%';
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
# #
# Reduce the number of slave threads. The change is not immediate -- a thread will only exit after a replication event # Reduce the number of slave threads. The change is not immediate -- a thread will only exit after a replication event
...@@ -62,8 +55,8 @@ while ($count) ...@@ -62,8 +55,8 @@ while ($count)
--connection node_2 --connection node_2
SELECT COUNT(*) FROM t2; SELECT COUNT(*) FROM t2;
SELECT COUNT(*) - @@wsrep_slave_threads FROM INFORMATION_SCHEMA.PROCESSLIST --let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%')
WHERE USER = 'system user' AND STATE NOT LIKE 'InnoDB%'; --source include/wait_condition.inc
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%'; SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
...@@ -81,7 +74,23 @@ CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY) ENGINE=INNODB; ...@@ -81,7 +74,23 @@ CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY) ENGINE=INNODB;
--connection node_2 --connection node_2
SET GLOBAL wsrep_slave_threads = 4; SET GLOBAL wsrep_slave_threads = 4;
--let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%')
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
--connection node_1
INSERT INTO t1 VALUES (DEFAULT);
INSERT INTO t1 VALUES (DEFAULT);
INSERT INTO t1 VALUES (DEFAULT);
DROP TABLE t1; DROP TABLE t1;
--connection node_2
#
# make sure that we are left with exactly one applier thread before we leaving the test
#
--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%')
--source include/wait_condition.inc
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
--echo # End of tests --echo # End of tests
...@@ -100,6 +100,44 @@ drop table t1; ...@@ -100,6 +100,44 @@ drop table t1;
--echo End of 5.5 tests --echo End of 5.5 tests
--echo #
--echo # Start of 10.1 tests
--echo #
--echo #
--echo # MDEV-14452 Precision in INTERVAL xxx DAY_MICROSECOND parsed wrong?
--echo #
--vertical_results
SELECT
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5' DAY_MICROSECOND) c1,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50' DAY_MICROSECOND) c2,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500' DAY_MICROSECOND) c3,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000' DAY_MICROSECOND) c4,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000' DAY_MICROSECOND) c5,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000' DAY_MICROSECOND) c6,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000' DAY_MICROSECOND) c7,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000' DAY_MICROSECOND) c8,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000000' DAY_MICROSECOND) c9,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000000' DAY_MICROSECOND) c10,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000000' DAY_MICROSECOND) c11,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000000000' DAY_MICROSECOND) c12,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000000000' DAY_MICROSECOND) c13,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000000000' DAY_MICROSECOND) c14,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000000000000' DAY_MICROSECOND) c15,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000000000000' DAY_MICROSECOND) c16,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000000000000' DAY_MICROSECOND) c17,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000000000000000' DAY_MICROSECOND) c18,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000000000000000' DAY_MICROSECOND) c19,
DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000000000000000' DAY_MICROSECOND) c20
;
--horizontal_results
--echo #
--echo # End of 10.1 tests
--echo #
# #
# how + interval is printed # how + interval is printed
# #
......
...@@ -1763,6 +1763,22 @@ SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND) ...@@ -1763,6 +1763,22 @@ SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND); SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND); SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND);
--echo #
--echo # MDEV-13202 Assertion `ltime->neg == 0' failed in date_to_datetime
--echo #
CREATE TABLE t1 (i INT, d DATE);
INSERT INTO t1 VALUES (1, '1970-01-01');
SELECT MAX(NULLIF(i,1)) FROM t1 ORDER BY DATE_SUB(d,INTERVAL 17300000 HOUR);
DROP TABLE t1;
CREATE TABLE t1 (i INT, d DATE);
INSERT INTO t1 VALUES (1, '1970-01-01');
SELECT CONCAT(DATE_SUB(d, INTERVAL 17300000 HOUR)) FROM t1;
DROP TABLE t1;
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR));
--echo # --echo #
--echo # End of 10.0 tests --echo # End of 10.0 tests
......
...@@ -255,6 +255,19 @@ FROM t1; ...@@ -255,6 +255,19 @@ FROM t1;
drop table t1, t2; drop table t1, t2;
--echo #
--echo # MDEV-15235: Assertion `length > 0' failed in create_ref_for_key
--echo #
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f CHAR(1));
INSERT INTO t2 VALUES ('a'),('b');
explain
SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
DROP TABLE t1, t2;
--echo # --echo #
--echo # MDEV-9489: Assertion `0' failed in Protocol::end_statement() on --echo # MDEV-9489: Assertion `0' failed in Protocol::end_statement() on
--echo # UNION ALL --echo # UNION ALL
......
...@@ -5676,29 +5676,6 @@ bool handler::check_table_binlog_row_based_internal(bool binlog_row) ...@@ -5676,29 +5676,6 @@ bool handler::check_table_binlog_row_based_internal(bool binlog_row)
{ {
THD *thd= table->in_use; THD *thd= table->in_use;
#ifdef WITH_WSREP
/* only InnoDB tables will be replicated through binlog emulation */
if (binlog_row &&
((WSREP_EMULATE_BINLOG(thd) &&
table->file->partition_ht()->db_type != DB_TYPE_INNODB) ||
(thd->wsrep_ignore_table == true)))
return 0;
/* enforce wsrep_max_ws_rows */
if (WSREP(thd) && table->s->tmp_table == NO_TMP_TABLE)
{
thd->wsrep_affected_rows++;
if (wsrep_max_ws_rows &&
thd->wsrep_exec_mode != REPL_RECV &&
thd->wsrep_affected_rows > wsrep_max_ws_rows)
{
trans_rollback_stmt(thd) || trans_rollback(thd);
my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
return ER_ERROR_DURING_COMMIT;
}
}
#endif
return (table->s->cached_row_logging_check && return (table->s->cached_row_logging_check &&
thd->is_current_stmt_binlog_format_row() && thd->is_current_stmt_binlog_format_row() &&
/* /*
...@@ -5809,8 +5786,6 @@ static int write_locked_table_maps(THD *thd) ...@@ -5809,8 +5786,6 @@ static int write_locked_table_maps(THD *thd)
typedef bool Log_func(THD*, TABLE*, bool, const uchar*, const uchar*); typedef bool Log_func(THD*, TABLE*, bool, const uchar*, const uchar*);
static int check_wsrep_max_ws_rows();
static int binlog_log_row_internal(TABLE* table, static int binlog_log_row_internal(TABLE* table,
const uchar *before_record, const uchar *before_record,
const uchar *after_record, const uchar *after_record,
...@@ -5838,13 +5813,6 @@ static int binlog_log_row_internal(TABLE* table, ...@@ -5838,13 +5813,6 @@ static int binlog_log_row_internal(TABLE* table,
bool const has_trans= thd->lex->sql_command == SQLCOM_CREATE_TABLE || bool const has_trans= thd->lex->sql_command == SQLCOM_CREATE_TABLE ||
table->file->has_transactions(); table->file->has_transactions();
error= (*log_func)(thd, table, has_trans, before_record, after_record); error= (*log_func)(thd, table, has_trans, before_record, after_record);
/*
Now that the record has been logged, increment wsrep_affected_rows and
also check whether its within the allowable limits (wsrep_max_ws_rows).
*/
if (error == 0)
error= check_wsrep_max_ws_rows();
} }
return error ? HA_ERR_RBR_LOGGING_FAILED : 0; return error ? HA_ERR_RBR_LOGGING_FAILED : 0;
} }
...@@ -5854,6 +5822,30 @@ static inline int binlog_log_row(TABLE* table, ...@@ -5854,6 +5822,30 @@ static inline int binlog_log_row(TABLE* table,
const uchar *after_record, const uchar *after_record,
Log_func *log_func) Log_func *log_func)
{ {
THD *const thd= table->in_use;
#ifdef WITH_WSREP
/* only InnoDB tables will be replicated through binlog emulation */
if ((WSREP_EMULATE_BINLOG(thd) &&
table->file->partition_ht()->db_type != DB_TYPE_INNODB) ||
(thd->wsrep_ignore_table == true))
return 0;
/* enforce wsrep_max_ws_rows */
if (WSREP(thd) && table->s->tmp_table == NO_TMP_TABLE)
{
thd->wsrep_affected_rows++;
if (wsrep_max_ws_rows &&
thd->wsrep_exec_mode != REPL_RECV &&
thd->wsrep_affected_rows > wsrep_max_ws_rows)
{
trans_rollback_stmt(thd) || trans_rollback(thd);
my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
return ER_ERROR_DURING_COMMIT;
}
}
#endif
if (!table->file->check_table_binlog_row_based(1)) if (!table->file->check_table_binlog_row_based(1))
return 0; return 0;
return binlog_log_row_internal(table, before_record, after_record, log_func); return binlog_log_row_internal(table, before_record, after_record, log_func);
...@@ -5963,30 +5955,6 @@ int handler::ha_reset() ...@@ -5963,30 +5955,6 @@ int handler::ha_reset()
} }
static int check_wsrep_max_ws_rows()
{
#ifdef WITH_WSREP
if (wsrep_max_ws_rows)
{
THD *thd= current_thd;
if (!WSREP(thd))
return 0;
thd->wsrep_affected_rows++;
if (thd->wsrep_exec_mode != REPL_RECV &&
thd->wsrep_affected_rows > wsrep_max_ws_rows)
{
trans_rollback_stmt(thd) || trans_rollback(thd);
my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
return ER_ERROR_DURING_COMMIT;
}
}
#endif /* WITH_WSREP */
return 0;
}
int handler::ha_write_row(uchar *buf) int handler::ha_write_row(uchar *buf)
{ {
int error; int error;
......
...@@ -714,7 +714,7 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs, ...@@ -714,7 +714,7 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
{ {
const char *end=str+length; const char *end=str+length;
uint i; uint i;
int msec_length= 0; size_t field_length= 0;
while (str != end && !my_isdigit(cs,*str)) while (str != end && !my_isdigit(cs,*str))
str++; str++;
...@@ -725,7 +725,8 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs, ...@@ -725,7 +725,8 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
const char *start= str; const char *start= str;
for (value= 0; str != end && my_isdigit(cs, *str); str++) for (value= 0; str != end && my_isdigit(cs, *str); str++)
value= value*10 + *str - '0'; value= value*10 + *str - '0';
msec_length= 6 - (int)(str - start); if ((field_length= (size_t)(str - start)) >= 20)
return true;
values[i]= value; values[i]= value;
while (str != end && !my_isdigit(cs,*str)) while (str != end && !my_isdigit(cs,*str))
str++; str++;
...@@ -740,8 +741,13 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs, ...@@ -740,8 +741,13 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
} }
} }
if (transform_msec && msec_length > 0) if (transform_msec && field_length > 0)
values[count - 1] *= (long) log_10_int[msec_length]; {
if (field_length < 6)
values[count - 1] *= log_10_int[6 - field_length];
else if (field_length > 6)
values[count - 1] /= log_10_int[field_length - 6];
}
return (str != end); return (str != end);
} }
......
...@@ -877,8 +877,10 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs) ...@@ -877,8 +877,10 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs)
Make sure that create_tmp_table will not fail due to too long keys. Make sure that create_tmp_table will not fail due to too long keys.
See MDEV-7122. This check is performed inside create_tmp_table also and See MDEV-7122. This check is performed inside create_tmp_table also and
we must do it so that we know the table has keys created. we must do it so that we know the table has keys created.
Make sure that the length of the key for the temp_table is atleast
greater than 0.
*/ */
if (total_key_length > tmp_table_max_key_length() || if (!total_key_length || total_key_length > tmp_table_max_key_length() ||
elements > tmp_table_max_key_parts()) elements > tmp_table_max_key_parts())
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
......
...@@ -7733,7 +7733,6 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, ...@@ -7733,7 +7733,6 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
thd->wsrep_conflict_state == CERT_FAILURE) thd->wsrep_conflict_state == CERT_FAILURE)
{ {
thd->reset_for_next_command(); thd->reset_for_next_command();
thd->reset_killed();
if (is_autocommit && if (is_autocommit &&
thd->lex->sql_command != SQLCOM_SELECT && thd->lex->sql_command != SQLCOM_SELECT &&
(thd->wsrep_retry_counter < thd->variables.wsrep_retry_autocommit)) (thd->wsrep_retry_counter < thd->variables.wsrep_retry_autocommit))
...@@ -7763,17 +7762,18 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, ...@@ -7763,17 +7762,18 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
thd->variables.wsrep_retry_autocommit, thd->query()); thd->variables.wsrep_retry_autocommit, thd->query());
my_message(ER_LOCK_DEADLOCK, "Deadlock: wsrep aborted transaction", my_message(ER_LOCK_DEADLOCK, "Deadlock: wsrep aborted transaction",
MYF(0)); MYF(0));
thd->reset_killed();
thd->wsrep_conflict_state= NO_CONFLICT; thd->wsrep_conflict_state= NO_CONFLICT;
if (thd->wsrep_conflict_state != REPLAYING) if (thd->wsrep_conflict_state != REPLAYING)
thd->wsrep_retry_counter= 0; // reset thd->wsrep_retry_counter= 0; // reset
} }
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
thd->reset_killed();
} }
else else
{ {
set_if_smaller(thd->wsrep_retry_counter, 0); // reset; eventually ok set_if_smaller(thd->wsrep_retry_counter, 0); // reset; eventually ok
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
} }
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
} }
/* If retry is requested clean up explain structure */ /* If retry is requested clean up explain structure */
......
...@@ -959,6 +959,8 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type, ...@@ -959,6 +959,8 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
ltime->day= 0; ltime->day= 0;
return 0; return 0;
} }
else if (ltime->neg)
goto invalid_date;
if (int_type != INTERVAL_DAY) if (int_type != INTERVAL_DAY)
ltime->time_type= MYSQL_TIMESTAMP_DATETIME; // Return full date ltime->time_type= MYSQL_TIMESTAMP_DATETIME; // Return full date
......
...@@ -2381,7 +2381,7 @@ extern "C" void wsrep_thd_set_query_state( ...@@ -2381,7 +2381,7 @@ extern "C" void wsrep_thd_set_query_state(
void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state) void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state)
{ {
thd->wsrep_conflict_state= state; if (WSREP(thd)) thd->wsrep_conflict_state= state;
} }
......
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