Skip to content

Commit 43d7de8

Browse files
author
Christopher Powers
committed
merge from mysql-trunk
2 parents 0d5f884 + a4df632 commit 43d7de8

File tree

197 files changed

+6120
-1992
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+6120
-1992
lines changed

client/mysql.cc

+11
Original file line numberDiff line numberDiff line change
@@ -1413,6 +1413,17 @@ int main(int argc,char *argv[])
14131413

14141414
void mysql_end(int sig)
14151415
{
1416+
#ifndef _WIN32
1417+
/*
1418+
Ingnoring SIGQUIT, SIGINT and SIGHUP signals when cleanup process starts.
1419+
This will help in resolving the double free issues, which occures in case
1420+
the signal handler function is started in between the clean up function.
1421+
*/
1422+
signal(SIGQUIT, SIG_IGN);
1423+
signal(SIGINT, SIG_IGN);
1424+
signal(SIGHUP, SIG_IGN);
1425+
#endif
1426+
14161427
mysql_close(&mysql);
14171428
#ifdef HAVE_READLINE
14181429
if (!status.batch && !quick && !opt_html && !opt_xml &&

include/my_pthread.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ extern native_mutexattr_t my_errorcheck_mutexattr;
214214
#define ESRCH 1
215215
#endif
216216

217-
typedef ulong my_thread_id;
217+
typedef uint32 my_thread_id;
218218

219219
extern my_bool my_thread_global_init(void);
220220
extern void my_thread_global_reinit(void);

include/mysql/psi/mysql_thread.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ static inline int inline_mysql_thread_create(
12891289
return result;
12901290
}
12911291

1292-
static inline void inline_mysql_thread_set_psi_id(ulong id)
1292+
static inline void inline_mysql_thread_set_psi_id(my_thread_id id)
12931293
{
12941294
struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)();
12951295
PSI_THREAD_CALL(set_thread_id)(psi, id);

include/prealloced_array.h

+22
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,28 @@ class Prealloced_array
289289
return std::make_pair(p.first, false);
290290
}
291291

292+
/**
293+
Similar to std::set<>::erase()
294+
Removes a single element from the array by value.
295+
The removed element is destroyed.
296+
This effectively reduces the container size by one.
297+
298+
This is generally an inefficient operation, since we need to copy
299+
elements to fill the "hole" in the array.
300+
301+
Assumes that the array is sorted with std::less<Element_type>.
302+
303+
@retval number of elements removed, 0 or 1.
304+
*/
305+
size_type erase_unique(const value_type &val)
306+
{
307+
std::pair<iterator, iterator> p= std::equal_range(begin(), end(), val);
308+
if (p.first == p.second)
309+
return 0; // Not found
310+
erase(p.first);
311+
return 1;
312+
}
313+
292314
/**
293315
Removes a single element from the array.
294316
The removed element is destroyed.

libmysqld/lib_sql.cc

+2-4
Original file line numberDiff line numberDiff line change
@@ -702,9 +702,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag)
702702
void *create_embedded_thd(int client_flag)
703703
{
704704
THD * thd= new THD;
705-
Global_THD_manager *thd_manager= Global_THD_manager::get_instance();
706-
thd->variables.pseudo_thread_id= thd_manager->get_inc_thread_id();
707-
thd->thread_id= thd->variables.pseudo_thread_id;
705+
thd->set_new_thread_id();
708706

709707
thd->thread_stack= (char*) &thd;
710708
if (thd->store_globals())
@@ -735,7 +733,7 @@ void *create_embedded_thd(int client_flag)
735733
thd->first_data= 0;
736734
thd->data_tail= &thd->first_data;
737735
memset(&thd->net, 0, sizeof(thd->net));
738-
thd_manager->add_thd(thd);
736+
Global_THD_manager::get_instance()->add_thd(thd);
739737
thd->mysys_var= 0;
740738
return thd;
741739
err:

mysql-test/collections/default.experimental

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44

55
innodb.innodb_wl6326_big # 2013-09-04 mleich Mention the test as long as I fear sporadic failures in PB2.
6+
innodb_zip.innodb_wl6501_1 # Bug#19233510 2014-07-23 anitha Test unstable after WL#7277 was pushed
67
main.func_math @freebsd # Bug#11751977 2010-05-04 alik main.func_math fails on FreeBSD in PB2
78
main.mysqlslap @windows # Bug#11761520 2010-08-10 alik mysqlslap fails sporadically starting from Dahlia
89

@@ -12,6 +13,7 @@ rpl.rpl_show_slave_running # BUG#12346048 2011-04-11 sven fails sp
1213
rpl.rpl_gtid_logs_without_rotate_or_stop_event @windows # Bug#16207800 2013-02-09 anitha Fails very frequently on windows
1314
rpl.rpl_gtid_stress_failover # Bug#18385953 2014-03-10 horst Failing very frequently on PB2
1415
rpl.rpl_parallel # Bug#17506885 2013-09-30 agopi Fails for all runs with MTS
16+
rpl.rpl_get_master_version_and_clock # Bug#18900198 2014-07-22 agopi Failes very frequently on PB2
1517

1618
perfschema.transaction_nested_events # Bug#17752288 2013-12-17 agopi Fails several times each day in PB2
1719
main.ssl-big @windows # Bug#18200216 2014-03-14 horst Fails too often in daily in PB2.

mysql-test/include/subquery_sj.inc

+80
Original file line numberDiff line numberDiff line change
@@ -6444,6 +6444,86 @@ DROP TABLE t1, t2;
64446444

64456445
--echo # End of test for bug#14064201.
64466446

6447+
--echo #
6448+
--echo # Bug#18223655:ASSERTION FAILED: (INT)IDX >= 0
6449+
--echo # && IDX < PARENT_JOIN->TABLES
6450+
--echo #
6451+
6452+
CREATE TABLE b (d INT);
6453+
CREATE TABLE c (a INT, b INT,c INT,d BLOB NOT NULL);
6454+
6455+
SELECT(SELECT 1
6456+
FROM b WHERE(SELECT 1 IN (SELECT 1 FROM b WHERE 1 NOT BETWEEN d AND 1)
6457+
FROM b) IN (SELECT d FROM c)) as cc FROM b;
6458+
6459+
INSERT INTO b VALUE(1);
6460+
INSERT INTO c VALUES(1,2,3,'1'),(2,3,4,'1'),(3,4,5,'C');
6461+
SELECT(SELECT d FROM b WHERE(SELECT d IN
6462+
(SELECT d FROM b WHERE 1 NOT BETWEEN d AND 1) FROM b) IN
6463+
(SELECT d FROM c)) as cc FROM c;
6464+
DROP TABLE b,c;
6465+
6466+
--echo #
6467+
--echo # Bug#18447874:WRONG RESULT COMING FROM SEMI-JOIN
6468+
--echo #
6469+
CREATE TABLE b (
6470+
d INT(11)
6471+
);
6472+
CREATE TABLE c (
6473+
d BLOB
6474+
) ;
6475+
CREATE TABLE d (
6476+
b INT(11)
6477+
);
6478+
6479+
INSERT INTO b VALUES(1),(2),(4);
6480+
INSERT INTO c VALUES(1),(2),(3);
6481+
SELECT 1 FROM b WHERE (SELECT 1 FROM d ) IN (SELECT d FROM c) ;
6482+
INSERT INTO d VALUES(2);
6483+
SELECT 1 FROM b WHERE (SELECT 1 FROM d ) IN (SELECT d FROM c) ;
6484+
6485+
DROP TABLE b,c,d;
6486+
6487+
--echo #
6488+
--echo # Bug#17292723:INCORRECT RESULT FOR (SELECT...) IN (SELECT...) STATEMENT
6489+
--echo #
6490+
CREATE TABLE t1 (
6491+
ID int(11) NOT NULL AUTO_INCREMENT,
6492+
id2 int(11) DEFAULT NULL,
6493+
id3 int(11) DEFAULT NULL,
6494+
id4 varchar(150) COLLATE utf8_spanish_ci NOT NULL,
6495+
id5 int(11) DEFAULT NULL,
6496+
PRIMARY KEY (ID),
6497+
KEY id2 (id2),
6498+
KEY id3 (id3),
6499+
KEY id5 (id5)
6500+
) ENGINE=InnoDB;
6501+
6502+
INSERT INTO t1 VALUES
6503+
(123,1,1,'1',NULL),
6504+
(124,1,1,'2',NULL),
6505+
(125,1,1,'4',NULL),
6506+
(126,1,1,'3',NULL),
6507+
(127,1,1,'6',NULL),
6508+
(128,1,1,'8',NULL);
6509+
6510+
CREATE TABLE t2 (
6511+
id6 int(11) NOT NULL,
6512+
id7 int(11) NOT NULL,
6513+
PRIMARY KEY (id6,id7),
6514+
KEY id7 (id7)
6515+
) ENGINE=InnoDB;
6516+
6517+
INSERT INTO t2 VALUES (126,123),(130,123),(135,123);
6518+
6519+
SELECT ID
6520+
FROM t1 p0
6521+
WHERE p0.id3=1
6522+
AND ( (SELECT p1.id FROM t1 p1 WHERE p1.id=123) IN (SELECT p3.id FROM t2
6523+
p2, t1 p3 WHERE p0.id=p2.id6 AND p2.id7=p3.id));
6524+
6525+
DROP TABLE t1,t2;
6526+
64476527
set @@optimizer_switch=@old_opt_switch;
64486528
# New tests go here.
64496529

mysql-test/include/sync_slave_sql.inc

+20-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# --connection slave
1515
# [--let $slave_timeout= X]
1616
# [--let $use_gtids= 1]
17+
# [--let $wait_for_executed_gtid_set= 1]
1718
# --source include/sync_slave.inc
1819
#
1920
# Parameters:
@@ -27,6 +28,9 @@
2728
# Forces the use of master file and position, even if $use_gtids is set.
2829
# This might be used if the slave will not have all the GTIDs of the master
2930
# but have to read and apply all master events to the end.
31+
#
32+
# $wait_for_executed_gtid_set
33+
# See include/sync_slave_sql_with_master.inc
3034

3135
--let $include_filename= sync_slave_sql.inc
3236
--source include/begin_include_file.inc
@@ -74,12 +78,24 @@ if ($ignore_gtids_on_sync)
7478

7579
if ($_sync_with_gtids)
7680
{
77-
if ($rpl_debug)
81+
if($wait_for_executed_gtid_set)
7882
{
79-
--echo debug: WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$_saved_gtids', $_sss_slave_timeout)
83+
if ($rpl_debug)
84+
{
85+
--echo debug: WAIT_FOR_EXECUTED_GTID_SET('$_saved_gtids', $_sss_slave_timeout)
86+
}
87+
--let $_sss_result= `SELECT -WAIT_FOR_EXECUTED_GTID_SET('$_saved_gtids', $_sss_slave_timeout)`
88+
}
89+
if(!$wait_for_executed_gtid_set)
90+
{
91+
if ($rpl_debug)
92+
{
93+
--echo debug: WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$_saved_gtids', $_sss_slave_timeout)
94+
}
95+
--let $_sss_result= `SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$_saved_gtids', $_sss_slave_timeout)`
8096
}
81-
--let $_sss_result= `SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$_saved_gtids', $_sss_slave_timeout)`
8297
}
98+
8399
if (!$_sync_with_gtids)
84100
{
85101
if ($rpl_debug)
@@ -96,7 +112,7 @@ if ($_sss_result == '')
96112
}
97113
if ($_sss_result == -1)
98114
{
99-
--let $error_type= Timeout after $slave_timeout seconds.
115+
--let $error_type= Timeout after $_sss_slave_timeout seconds.
100116
}
101117
102118
if ($_sss_result < 0)

mysql-test/include/sync_slave_sql_with_master.inc

+12-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# [--let $use_gtids= 1]
1414
# [--let $slave_timeout= NUMBER]
1515
# [--let $rpl_debug= 1]
16+
# [--let $wait_for_executed_gtid_set= 1]
1617
# --source include/sync_slave_io_with_master.inc
1718
#
1819
# Must be called on the master. Will change connection to the slave.
@@ -32,7 +33,17 @@
3233
#
3334
# $rpl_debug
3435
# See include/rpl_init.inc
35-
36+
#
37+
# $ignore_gtids_on_sync
38+
# Forces the use of master file and position, even if $use_gtids is set.
39+
# This might be used if the slave will not have all the GTIDs of the
40+
# master but have to read and apply all master events to the end.
41+
#
42+
# $wait_for_executed_gtid_set
43+
# This option makes the test use WAIT_FOR_EXECUTED_GTID_SET instead of
44+
# WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS. This options also requires
45+
# $use_gtids and !$ignore_gtids_on_sync to be set.
46+
#
3647

3748
--let $include_filename= sync_slave_sql_with_master.inc
3849
--source include/begin_include_file.inc

mysql-test/include/wait_for_slave_param.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# [--let $slave_timeout= NUMBER]
1313
# [--let $slave_error_param= [Slave_SQL_Errno | Slave_IO_Errno]]
1414
# [--let $rpl_debug= 1]
15-
# --source include/slave_wait_param.inc
15+
# --source include/wait_for_slave_param.inc
1616
#
1717
# Parameters:
1818
#

mysql-test/r/lock_sync.result

+36
Original file line numberDiff line numberDiff line change
@@ -776,3 +776,39 @@ SET DEBUG_SYNC="RESET";
776776
disconnect con1;
777777
disconnect con2;
778778
DROP TABLES t1, t2;
779+
#
780+
#Bug#18110156: RECREATE+ANALYZE OPTIMIZE TABLE T AND ONLINE
781+
# ALTER TABLE T MAY DEADLOCK
782+
CREATE TABLE t1 (fld1 INT) ENGINE=InnoDB;
783+
connection con1;
784+
SET DEBUG_SYNC= 'before_lock_tables_takes_lock SIGNAL before_thr_lock WAIT_FOR do_thr_lock EXECUTE 3';
785+
SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL opti_recreate WAIT_FOR opti_analyze';
786+
OPTIMIZE TABLE t1;
787+
connection con2;
788+
# Skip thr_lock acquisition during the initial phase of OPTIMIZE TABLE
789+
SET DEBUG_SYNC= 'now WAIT_FOR before_thr_lock';
790+
SET DEBUG_SYNC= 'now SIGNAL do_thr_lock';
791+
# Skip thr_lock acquisition during the recreate phase of OPTIMIZE TABLE
792+
SET DEBUG_SYNC= 'now WAIT_FOR before_thr_lock';
793+
SET DEBUG_SYNC= 'now SIGNAL do_thr_lock';
794+
SET DEBUG_SYNC= 'now WAIT_FOR opti_recreate';
795+
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL lock_downgraded
796+
WAIT_FOR finish_alter';
797+
ALTER TABLE t1 ADD INDEX index1(fld1), ALGORITHM=INPLACE, LOCK=NONE;
798+
#Without the patch, the test case hangs.
799+
connection default;
800+
SET DEBUG_SYNC= 'now WAIT_FOR lock_downgraded';
801+
SET DEBUG_SYNC= 'now SIGNAL opti_analyze';
802+
SET DEBUG_SYNC= 'now WAIT_FOR before_thr_lock';
803+
SET DEBUG_SYNC= 'now SIGNAL finish_alter';
804+
SET DEBUG_SYNC= 'now SIGNAL do_thr_lock';
805+
#Reap: OPTIMIZE TABLE t1
806+
connection con1;
807+
Table Op Msg_type Msg_text
808+
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
809+
test.t1 optimize status OK
810+
#Reap: ALTER TABLE t1
811+
connection con2;
812+
#Clean up.
813+
DROP TABLE t1;
814+
SET DEBUG_SYNC= 'RESET';

mysql-test/r/log_errchk.result

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
call mtr.add_suppression("Could not use");
2+
# Case 1: Setting fife file to general_log_file and slow_query_log_file
3+
# system variable.
4+
SET GLOBAL general_log_file="MYSQLTEST_VARDIR/tmp/general_log.fifo";;
5+
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'MYSQLTEST_VARDIR/tmp/general_log.fifo'
6+
SET GLOBAL slow_query_log_file="MYSQLTEST_VARDIR/tmp/slow_log.fifo";;
7+
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'MYSQLTEST_VARDIR/tmp/slow_log.fifo'
8+
# Case 2: Starting server with fifo file as general log file
9+
# and slow query log file.
10+
Setting fifo file as general log file and slow query log failed.

0 commit comments

Comments
 (0)