summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Alff <marc.alff@sun.com>2010-02-05 09:56:55 -0700
committerMarc Alff <marc.alff@sun.com>2010-02-05 09:56:55 -0700
commit3630d78e6c5a0d83e0eaff554df833f4e392449f (patch)
tree4186fe2f1d42765fe6e7730a35ec37c9c1ece786
parent2d75b6c0af81820d5479d24cefd6779f5c084f3b (diff)
parenta4fc3c7bd77a9bbb57f9d591768f96c5d269626b (diff)
downloadmariadb-git-3630d78e6c5a0d83e0eaff554df833f4e392449f.tar.gz
Merge mysql-next-mr-marc --> mysql-next-mr-bugfixing
-rw-r--r--include/mysql/psi/psi.h7
-rw-r--r--include/mysql/psi/psi_abi_v1.h.pp2
-rw-r--r--mysql-test/collections/default.experimental3
-rw-r--r--mysql-test/r/constraints.result18
-rw-r--r--mysql-test/r/foreign_key.result42
-rw-r--r--mysql-test/suite/perfschema/r/aggregate.result13
-rw-r--r--mysql-test/suite/perfschema/r/dml_mutex_instances.result2
-rw-r--r--mysql-test/suite/perfschema/r/dml_rwlock_instances.result2
-rw-r--r--mysql-test/suite/perfschema/r/dml_setup_instruments.result3
-rw-r--r--mysql-test/suite/perfschema/t/aggregate.test16
-rw-r--r--mysql-test/suite/perfschema/t/dml_mutex_instances.test2
-rw-r--r--mysql-test/suite/perfschema/t/dml_rwlock_instances.test2
-rw-r--r--mysql-test/suite/perfschema/t/dml_setup_instruments.test3
-rw-r--r--mysql-test/t/constraints.test44
-rw-r--r--mysql-test/t/foreign_key.test72
-rw-r--r--mysys/my_init.c35
-rw-r--r--sql/mysqld.cc21
-rw-r--r--sql/sql_lex.h4
-rw-r--r--sql/sql_yacc.yy103
-rw-r--r--storage/perfschema/pfs.cc8
-rw-r--r--storage/perfschema/pfs_engine_table.cc4
21 files changed, 318 insertions, 88 deletions
diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h
index a9277cd18bd..51446fa83a5 100644
--- a/include/mysql/psi/psi.h
+++ b/include/mysql/psi/psi.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* Copyright (C) 2008-2010 Sun Microsystems, Inc
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,6 +614,9 @@ typedef void (*set_thread_v1_t)(struct PSI_thread *thread);
/** Delete the current thread instrumentation. */
typedef void (*delete_current_thread_v1_t)(void);
+/** Delete a thread instrumentation. */
+typedef void (*delete_thread_v1_t)(struct PSI_thread *thread);
+
/**
Get a mutex instrumentation locker.
@param mutex the instrumented mutex to lock
@@ -890,6 +893,8 @@ struct PSI_v1
set_thread_v1_t set_thread;
/** @sa delete_current_thread_v1_t. */
delete_current_thread_v1_t delete_current_thread;
+ /** @sa delete_thread_v1_t. */
+ delete_thread_v1_t delete_thread;
/** @sa get_thread_mutex_locker_v1_t. */
get_thread_mutex_locker_v1_t get_thread_mutex_locker;
/** @sa get_thread_rwlock_locker_v1_t. */
diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp
index aedf28ba694..6ecd0f3098d 100644
--- a/include/mysql/psi/psi_abi_v1.h.pp
+++ b/include/mysql/psi/psi_abi_v1.h.pp
@@ -127,6 +127,7 @@ typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread,
typedef struct PSI_thread* (*get_thread_v1_t)(void);
typedef void (*set_thread_v1_t)(struct PSI_thread *thread);
typedef void (*delete_current_thread_v1_t)(void);
+typedef void (*delete_thread_v1_t)(struct PSI_thread *thread);
typedef struct PSI_mutex_locker* (*get_thread_mutex_locker_v1_t)
(struct PSI_mutex *mutex, enum PSI_mutex_operation op);
typedef struct PSI_rwlock_locker* (*get_thread_rwlock_locker_v1_t)
@@ -204,6 +205,7 @@ struct PSI_v1
get_thread_v1_t get_thread;
set_thread_v1_t set_thread;
delete_current_thread_v1_t delete_current_thread;
+ delete_thread_v1_t delete_thread;
get_thread_mutex_locker_v1_t get_thread_mutex_locker;
get_thread_rwlock_locker_v1_t get_thread_rwlock_locker;
get_thread_cond_locker_v1_t get_thread_cond_locker;
diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental
index 71ae2bf2148..735cb6c5010 100644
--- a/mysql-test/collections/default.experimental
+++ b/mysql-test/collections/default.experimental
@@ -16,9 +16,6 @@ main.plugin # Bug#47146 Linking problem with exampl
main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.sp @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
-perfschema.tampered_perfschema_table1 @windows # Bug#50478 2010-01-20 alik perfschema.tampered_perfschema_table1 fails sporadically on Windows and Solaris
-perfschema.tampered_perfschema_table1 @solaris # Bug#50478 2010-01-20 alik perfschema.tampered_perfschema_table1 fails sporadically on Windows and Solaris
-
rpl.rpl_heartbeat_basic # BUG#43828 2009-10-22 luis fails sporadically
rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically
rpl.rpl_innodb_bug28430* # Bug#46029
diff --git a/mysql-test/r/constraints.result b/mysql-test/r/constraints.result
index 116efe429d5..46a718e4c42 100644
--- a/mysql-test/r/constraints.result
+++ b/mysql-test/r/constraints.result
@@ -3,7 +3,7 @@ create table t1 (a int check (a>0));
insert into t1 values (1);
insert into t1 values (0);
drop table t1;
-create table t1 (a int ,b int, check a>b);
+create table t1 (a int, b int, check (a>b));
insert into t1 values (1,0);
insert into t1 values (0,1);
drop table t1;
@@ -27,3 +27,19 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `key_2` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+drop table if exists t_illegal;
+create table t_illegal (a int, b int, check a>b);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a>b)' at line 1
+create table t_illegal (a int, b int, constraint abc check a>b);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a>b)' at line 1
+create table t_illegal (a int, b int, constraint abc);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
+drop table if exists t_11714;
+create table t_11714(a int, b int);
+alter table t_11714 add constraint cons1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+drop table t_11714;
+CREATE TABLE t_illegal (col_1 INT CHECK something (whatever));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'something (whatever))' at line 1
+CREATE TABLE t_illegal (col_1 INT CHECK something);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'something)' at line 1
diff --git a/mysql-test/r/foreign_key.result b/mysql-test/r/foreign_key.result
index ece53db2e9a..a6577dd376b 100644
--- a/mysql-test/r/foreign_key.result
+++ b/mysql-test/r/foreign_key.result
@@ -13,3 +13,45 @@ foreign key (a,b) references t3 (c,d) on update set null);
create index a on t1 (a);
create unique index b on t1 (a,b);
drop table t1;
+drop table if exists t_34455;
+create table t_34455 (
+a int not null,
+foreign key (a) references t3 (a) match full match partial);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match partial)' at line 3
+create table t_34455 (
+a int not null,
+foreign key (a) references t3 (a) on delete set default match full);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match full)' at line 3
+create table t_34455 (
+a int not null,
+foreign key (a) references t3 (a) on update set default match full);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match full)' at line 3
+create table t_34455 (
+a int not null,
+foreign key (a) references t3 (a)
+on delete set default on delete set default);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delete set default)' at line 4
+create table t_34455 (
+a int not null,
+foreign key (a) references t3 (a)
+on update set default on update set default);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'update set default)' at line 4
+create table t_34455 (a int not null);
+alter table t_34455
+add foreign key (a) references t3 (a) match full match partial);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match partial)' at line 2
+alter table t_34455
+add foreign key (a) references t3 (a) on delete set default match full);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match full)' at line 2
+alter table t_34455
+add foreign key (a) references t3 (a) on update set default match full);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match full)' at line 2
+alter table t_34455
+add foreign key (a) references t3 (a)
+on delete set default on delete set default);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delete set default)' at line 3
+alter table t_34455
+add foreign key (a) references t3 (a)
+on update set default on update set default);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'update set default)' at line 3
+drop table t_34455;
diff --git a/mysql-test/suite/perfschema/r/aggregate.result b/mysql-test/suite/perfschema/r/aggregate.result
index 598f9297cc5..197378ca38f 100644
--- a/mysql-test/suite/perfschema/r/aggregate.result
+++ b/mysql-test/suite/perfschema/r/aggregate.result
@@ -16,6 +16,7 @@ b CHAR(100) DEFAULT 'initial value')
ENGINE=MyISAM;
insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8);
update performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO';
+update performance_schema.SETUP_CONSUMERS set enabled = 'NO';
set @dump_all=FALSE;
"Verifying file aggregate consistency"
SELECT EVENT_NAME, e.COUNT_READ, SUM(i.COUNT_READ)
@@ -51,14 +52,14 @@ SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT)
FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
-HAVING (e.SUM_TIMER_WAIT <> SUM(i.SUM_TIMER_WAIT))
+HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT))
OR @dump_all;
EVENT_NAME SUM_TIMER_WAIT SUM(i.SUM_TIMER_WAIT)
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT)
FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
-HAVING (e.MIN_TIMER_WAIT <> MIN(i.MIN_TIMER_WAIT))
+HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT))
AND (MIN(i.MIN_TIMER_WAIT) != 0)
OR @dump_all;
EVENT_NAME MIN_TIMER_WAIT MIN(i.MIN_TIMER_WAIT)
@@ -66,7 +67,7 @@ SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT)
FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
-HAVING (e.MAX_TIMER_WAIT <> MAX(i.MAX_TIMER_WAIT))
+HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT))
OR @dump_all;
EVENT_NAME MAX_TIMER_WAIT MAX(i.MAX_TIMER_WAIT)
"Verifying waits aggregate consistency (thread)"
@@ -75,7 +76,7 @@ FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
-HAVING (e.SUM_TIMER_WAIT <> SUM(t.SUM_TIMER_WAIT))
+HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIMER_WAIT))
OR @dump_all;
EVENT_NAME SUM_TIMER_WAIT SUM(t.SUM_TIMER_WAIT)
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT)
@@ -83,7 +84,7 @@ FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
-HAVING (e.MIN_TIMER_WAIT <> MIN(t.MIN_TIMER_WAIT))
+HAVING (e.MIN_TIMER_WAIT > MIN(t.MIN_TIMER_WAIT))
AND (MIN(t.MIN_TIMER_WAIT) != 0)
OR @dump_all;
EVENT_NAME MIN_TIMER_WAIT MIN(t.MIN_TIMER_WAIT)
@@ -92,7 +93,7 @@ FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
-HAVING (e.MAX_TIMER_WAIT <> MAX(t.MAX_TIMER_WAIT))
+HAVING (e.MAX_TIMER_WAIT < MAX(t.MAX_TIMER_WAIT))
OR @dump_all;
EVENT_NAME MAX_TIMER_WAIT MAX(t.MAX_TIMER_WAIT)
update performance_schema.SETUP_CONSUMERS set enabled = 'YES';
diff --git a/mysql-test/suite/perfschema/r/dml_mutex_instances.result b/mysql-test/suite/perfschema/r/dml_mutex_instances.result
index 655ca811c06..862123b3450 100644
--- a/mysql-test/suite/perfschema/r/dml_mutex_instances.result
+++ b/mysql-test/suite/perfschema/r/dml_mutex_instances.result
@@ -1,6 +1,6 @@
select * from performance_schema.MUTEX_INSTANCES limit 1;
NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID
-# # NULL
+# # #
select * from performance_schema.MUTEX_INSTANCES
where name='FOO';
NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID
diff --git a/mysql-test/suite/perfschema/r/dml_rwlock_instances.result b/mysql-test/suite/perfschema/r/dml_rwlock_instances.result
index 62b5fbeaa8a..686007e58e9 100644
--- a/mysql-test/suite/perfschema/r/dml_rwlock_instances.result
+++ b/mysql-test/suite/perfschema/r/dml_rwlock_instances.result
@@ -1,6 +1,6 @@
select * from performance_schema.RWLOCK_INSTANCES limit 1;
NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT
-# # NULL 0
+# # # #
select * from performance_schema.RWLOCK_INSTANCES
where name='FOO';
NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT
diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
index 6d6651a5e1f..be7d8825364 100644
--- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
@@ -16,7 +16,8 @@ wait/synch/mutex/sql/LOCK_delayed_create YES YES
wait/synch/mutex/sql/LOCK_delayed_insert YES YES
select * from performance_schema.SETUP_INSTRUMENTS
where name like 'Wait/Synch/Rwlock/sql/%'
- order by name limit 10;
+ and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
+order by name limit 10;
NAME ENABLED TIMED
wait/synch/rwlock/sql/LOCK_dboptions YES YES
wait/synch/rwlock/sql/LOCK_grant YES YES
diff --git a/mysql-test/suite/perfschema/t/aggregate.test b/mysql-test/suite/perfschema/t/aggregate.test
index 7c01bdd0a4b..0fa4651ecda 100644
--- a/mysql-test/suite/perfschema/t/aggregate.test
+++ b/mysql-test/suite/perfschema/t/aggregate.test
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (C) 2009-2010 Sun Microsystems, Inc
#
# 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
@@ -50,6 +50,8 @@ insert into t1 (id) values (1), (2), (3), (4), (5), (6), (7), (8);
# Stop recording data, so the select below don't add noise.
update performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO';
+# Disable all consumers, for long standing waits
+update performance_schema.SETUP_CONSUMERS set enabled = 'NO';
# Helper to debug
set @dump_all=FALSE;
@@ -132,14 +134,14 @@ SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT)
FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
-HAVING (e.SUM_TIMER_WAIT <> SUM(i.SUM_TIMER_WAIT))
+HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT))
OR @dump_all;
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT)
FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
-HAVING (e.MIN_TIMER_WAIT <> MIN(i.MIN_TIMER_WAIT))
+HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT))
AND (MIN(i.MIN_TIMER_WAIT) != 0)
OR @dump_all;
@@ -147,7 +149,7 @@ SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT)
FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
GROUP BY EVENT_NAME
-HAVING (e.MAX_TIMER_WAIT <> MAX(i.MAX_TIMER_WAIT))
+HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT))
OR @dump_all;
--echo "Verifying waits aggregate consistency (thread)"
@@ -157,7 +159,7 @@ FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
-HAVING (e.SUM_TIMER_WAIT <> SUM(t.SUM_TIMER_WAIT))
+HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIMER_WAIT))
OR @dump_all;
SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT)
@@ -165,7 +167,7 @@ FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
-HAVING (e.MIN_TIMER_WAIT <> MIN(t.MIN_TIMER_WAIT))
+HAVING (e.MIN_TIMER_WAIT > MIN(t.MIN_TIMER_WAIT))
AND (MIN(t.MIN_TIMER_WAIT) != 0)
OR @dump_all;
@@ -174,7 +176,7 @@ FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
USING (EVENT_NAME)
GROUP BY EVENT_NAME
-HAVING (e.MAX_TIMER_WAIT <> MAX(t.MAX_TIMER_WAIT))
+HAVING (e.MAX_TIMER_WAIT < MAX(t.MAX_TIMER_WAIT))
OR @dump_all;
diff --git a/mysql-test/suite/perfschema/t/dml_mutex_instances.test b/mysql-test/suite/perfschema/t/dml_mutex_instances.test
index e3062c7b34c..0971c664eb8 100644
--- a/mysql-test/suite/perfschema/t/dml_mutex_instances.test
+++ b/mysql-test/suite/perfschema/t/dml_mutex_instances.test
@@ -18,7 +18,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---replace_column 1 # 2 #
+--replace_column 1 # 2 # 3 #
select * from performance_schema.MUTEX_INSTANCES limit 1;
select * from performance_schema.MUTEX_INSTANCES
diff --git a/mysql-test/suite/perfschema/t/dml_rwlock_instances.test b/mysql-test/suite/perfschema/t/dml_rwlock_instances.test
index 251168237eb..33a42450681 100644
--- a/mysql-test/suite/perfschema/t/dml_rwlock_instances.test
+++ b/mysql-test/suite/perfschema/t/dml_rwlock_instances.test
@@ -18,7 +18,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
---replace_column 1 # 2 #
+--replace_column 1 # 2 # 3 # 4 #
select * from performance_schema.RWLOCK_INSTANCES limit 1;
select * from performance_schema.RWLOCK_INSTANCES
diff --git a/mysql-test/suite/perfschema/t/dml_setup_instruments.test b/mysql-test/suite/perfschema/t/dml_setup_instruments.test
index f737160cebd..b82cde15fb5 100644
--- a/mysql-test/suite/perfschema/t/dml_setup_instruments.test
+++ b/mysql-test/suite/perfschema/t/dml_setup_instruments.test
@@ -36,8 +36,11 @@ select * from performance_schema.SETUP_INSTRUMENTS
and name not in ('wait/synch/mutex/sql/DEBUG_SYNC::mutex')
order by name limit 10;
+# CRYPTO_dynlock_value::lock is dependent on the build (SSL)
+
select * from performance_schema.SETUP_INSTRUMENTS
where name like 'Wait/Synch/Rwlock/sql/%'
+ and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
order by name limit 10;
# COND_handler_count is dependent on the build (Windows only)
diff --git a/mysql-test/t/constraints.test b/mysql-test/t/constraints.test
index ed268ab5846..70a95e5f16e 100644
--- a/mysql-test/t/constraints.test
+++ b/mysql-test/t/constraints.test
@@ -10,7 +10,7 @@ create table t1 (a int check (a>0));
insert into t1 values (1);
insert into t1 values (0);
drop table t1;
-create table t1 (a int ,b int, check a>b);
+create table t1 (a int, b int, check (a>b));
insert into t1 values (1,0);
insert into t1 values (0,1);
drop table t1;
@@ -29,3 +29,45 @@ show create table t1;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug#35578 (Parser allows useless/illegal CREATE TABLE syntax)
+#
+
+--disable_warnings
+drop table if exists t_illegal;
+--enable_warnings
+
+--error ER_PARSE_ERROR
+create table t_illegal (a int, b int, check a>b);
+
+--error ER_PARSE_ERROR
+create table t_illegal (a int, b int, constraint abc check a>b);
+
+--error ER_PARSE_ERROR
+create table t_illegal (a int, b int, constraint abc);
+
+#
+# Bug#11714 (Non-sensical ALTER TABLE ADD CONSTRAINT allowed)
+#
+
+--disable_warnings
+drop table if exists t_11714;
+--enable_warnings
+
+create table t_11714(a int, b int);
+
+--error ER_PARSE_ERROR
+alter table t_11714 add constraint cons1;
+
+drop table t_11714;
+
+#
+# Bug#38696 (CREATE TABLE ... CHECK ... allows illegal syntax)
+
+--error ER_PARSE_ERROR
+CREATE TABLE t_illegal (col_1 INT CHECK something (whatever));
+
+--error ER_PARSE_ERROR
+CREATE TABLE t_illegal (col_1 INT CHECK something);
+
diff --git a/mysql-test/t/foreign_key.test b/mysql-test/t/foreign_key.test
index 0a3708e6dc8..2a6ab01f511 100644
--- a/mysql-test/t/foreign_key.test
+++ b/mysql-test/t/foreign_key.test
@@ -23,3 +23,75 @@ create unique index b on t1 (a,b);
drop table t1;
# End of 4.1 tests
+
+#
+# Bug#34455 (Ambiguous foreign keys syntax is accepted)
+#
+
+--disable_warnings
+drop table if exists t_34455;
+--enable_warnings
+
+# 2 match clauses, illegal
+--error ER_PARSE_ERROR
+create table t_34455 (
+ a int not null,
+ foreign key (a) references t3 (a) match full match partial);
+
+# match after on delete, illegal
+--error ER_PARSE_ERROR
+create table t_34455 (
+ a int not null,
+ foreign key (a) references t3 (a) on delete set default match full);
+
+# match after on update, illegal
+--error ER_PARSE_ERROR
+create table t_34455 (
+ a int not null,
+ foreign key (a) references t3 (a) on update set default match full);
+
+# 2 on delete clauses, illegal
+--error ER_PARSE_ERROR
+create table t_34455 (
+ a int not null,
+ foreign key (a) references t3 (a)
+ on delete set default on delete set default);
+
+# 2 on update clauses, illegal
+--error ER_PARSE_ERROR
+create table t_34455 (
+ a int not null,
+ foreign key (a) references t3 (a)
+ on update set default on update set default);
+
+create table t_34455 (a int not null);
+
+# 2 match clauses, illegal
+--error ER_PARSE_ERROR
+alter table t_34455
+ add foreign key (a) references t3 (a) match full match partial);
+
+# match after on delete, illegal
+--error ER_PARSE_ERROR
+alter table t_34455
+ add foreign key (a) references t3 (a) on delete set default match full);
+
+# match after on update, illegal
+--error ER_PARSE_ERROR
+alter table t_34455
+ add foreign key (a) references t3 (a) on update set default match full);
+
+# 2 on delete clauses, illegal
+--error ER_PARSE_ERROR
+alter table t_34455
+ add foreign key (a) references t3 (a)
+ on delete set default on delete set default);
+
+# 2 on update clauses, illegal
+--error ER_PARSE_ERROR
+alter table t_34455
+ add foreign key (a) references t3 (a)
+ on update set default on update set default);
+
+drop table t_34455;
+
diff --git a/mysys/my_init.c b/mysys/my_init.c
index 31adc5ed99e..a3e53fdaae1 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -74,6 +74,8 @@ static MYSQL_FILE instrumented_stdin;
*/
my_bool my_basic_init(void)
{
+ char * str;
+
if (my_basic_init_done)
return 0;
my_basic_init_done= 1;
@@ -82,6 +84,19 @@ my_bool my_basic_init(void)
my_umask= 0660; /* Default umask for new files */
my_umask_dir= 0700; /* Default umask for new directories */
+#ifndef VMS
+ /* Default creation of new files */
+ if ((str= getenv("UMASK")) != 0)
+ my_umask= (int) (atoi_octal(str) | 0600);
+ /* Default creation of new dir's */
+ if ((str= getenv("UMASK_DIR")) != 0)
+ my_umask_dir= (int) (atoi_octal(str) | 0700);
+#endif
+
+ /* $HOME is needed early to parse configuration files located in ~/ */
+ if ((home_dir= getenv("HOME")) != 0)
+ home_dir= intern_filename(home_dir_buff, home_dir);
+
init_glob_errs();
instrumented_stdin.m_file= stdin;
@@ -124,7 +139,6 @@ my_bool my_basic_init(void)
my_bool my_init(void)
{
- char * str;
if (my_init_done)
return 0;
my_init_done= 1;
@@ -142,24 +156,11 @@ my_bool my_init(void)
{
DBUG_ENTER("my_init");
DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown"));
- if (!home_dir)
- { /* Don't initialize twice */
- my_win_init();
- if ((home_dir=getenv("HOME")) != 0)
- home_dir=intern_filename(home_dir_buff,home_dir);
-#ifndef VMS
- /* Default creation of new files */
- if ((str=getenv("UMASK")) != 0)
- my_umask=(int) (atoi_octal(str) | 0600);
- /* Default creation of new dir's */
- if ((str=getenv("UMASK_DIR")) != 0)
- my_umask_dir=(int) (atoi_octal(str) | 0700);
-#endif
+ my_win_init();
#ifdef VMS
- init_ctype(); /* Stupid linker don't link _ctype.c */
+ init_ctype(); /* Stupid linker don't link _ctype.c */
#endif
- DBUG_PRINT("exit",("home: '%s'",home_dir));
- }
+ DBUG_PRINT("exit", ("home: '%s'", home_dir));
#ifdef __WIN__
win32_init_tcp_ip();
#endif
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 733c54fc2de..983f1750a38 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -317,6 +317,10 @@ static PSI_thread_key key_thread_handle_con_sockets;
#ifdef __WIN__
static PSI_thread_key key_thread_handle_shutdown;
#endif /* __WIN__ */
+
+#if defined (HAVE_OPENSSL) && !defined(HAVE_YASSL)
+static PSI_rwlock_key key_rwlock_openssl;
+#endif
#endif /* HAVE_PSI_INTERFACE */
/* the default log output is log tables */
@@ -1561,7 +1565,7 @@ static void clean_up_mutexes()
mysql_mutex_destroy(&LOCK_des_key_file);
#ifndef HAVE_YASSL
for (int i= 0; i < CRYPTO_num_locks(); ++i)
- rwlock_destroy(&openssl_stdlocks[i].lock);
+ mysql_rwlock_destroy(&openssl_stdlocks[i].lock);
OPENSSL_free(openssl_stdlocks);
#endif
#endif
@@ -3753,7 +3757,7 @@ static int init_thread_environment()
openssl_stdlocks= (openssl_lock_t*) OPENSSL_malloc(CRYPTO_num_locks() *
sizeof(openssl_lock_t));
for (int i= 0; i < CRYPTO_num_locks(); ++i)
- my_rwlock_init(&openssl_stdlocks[i].lock, NULL);
+ mysql_rwlock_init(key_rwlock_openssl, &openssl_stdlocks[i].lock);
CRYPTO_set_dynlock_create_callback(openssl_dynlock_create);
CRYPTO_set_dynlock_destroy_callback(openssl_dynlock_destroy);
CRYPTO_set_dynlock_lock_callback(openssl_lock);
@@ -3807,7 +3811,7 @@ static unsigned long openssl_id_function()
static openssl_lock_t *openssl_dynlock_create(const char *file, int line)
{
openssl_lock_t *lock= new openssl_lock_t;
- my_rwlock_init(&lock->lock, NULL);
+ mysql_rwlock_init(key_rwlock_openssl, &lock->lock);
return lock;
}
@@ -3815,7 +3819,7 @@ static openssl_lock_t *openssl_dynlock_create(const char *file, int line)
static void openssl_dynlock_destroy(openssl_lock_t *lock, const char *file,
int line)
{
- rwlock_destroy(&lock->lock);
+ mysql_rwlock_destroy(&lock->lock);
delete lock;
}
@@ -3841,16 +3845,16 @@ static void openssl_lock(int mode, openssl_lock_t *lock, const char *file,
switch (mode) {
case CRYPTO_LOCK|CRYPTO_READ:
what = "read lock";
- err = rw_rdlock(&lock->lock);
+ err= mysql_rwlock_rdlock(&lock->lock);
break;
case CRYPTO_LOCK|CRYPTO_WRITE:
what = "write lock";
- err = rw_wrlock(&lock->lock);
+ err= mysql_rwlock_wrlock(&lock->lock);
break;
case CRYPTO_UNLOCK|CRYPTO_READ:
case CRYPTO_UNLOCK|CRYPTO_WRITE:
what = "unlock";
- err = rw_unlock(&lock->lock);
+ err= mysql_rwlock_unlock(&lock->lock);
break;
default:
/* Unknown locking mode. */
@@ -7983,6 +7987,9 @@ PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger,
static PSI_rwlock_info all_server_rwlocks[]=
{
+#if defined (HAVE_OPENSSL) && !defined(HAVE_YASSL)
+ { &key_rwlock_openssl, "CRYPTO_dynlock_value::lock", 0},
+#endif
{ &key_rwlock_LOCK_grant, "LOCK_grant", PSI_FLAG_GLOBAL},
{ &key_rwlock_LOCK_logger, "LOGGER::LOCK_logger", 0},
{ &key_rwlock_LOCK_sys_init_connect, "LOCK_sys_init_connect", PSI_FLAG_GLOBAL},
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 923e924dfbc..80cb1e0f210 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -1905,7 +1905,9 @@ struct LEX: public Query_tables_list
uint profile_options;
uint uint_geom_type;
uint grant, grant_tot_col, which_columns;
- uint fk_delete_opt, fk_update_opt, fk_match_option;
+ enum Foreign_key::fk_match_opt fk_match_option;
+ enum Foreign_key::fk_option fk_update_opt;
+ enum Foreign_key::fk_option fk_delete_opt;
uint slave_thd_opt, start_transaction_opt;
int nest_level;
/*
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 5ee6f292204..0b0ca2e6215 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -756,6 +756,7 @@ static bool add_create_index (LEX *lex, Key::Keytype type,
struct p_elem_val *p_elem_value;
enum index_hint_type index_hint;
enum enum_filetype filetype;
+ enum Foreign_key::fk_option m_fk_option;
Diag_condition_item_name diag_condition_item_name;
}
@@ -765,10 +766,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%pure_parser /* We have threads */
/*
- Currently there are 172 shift/reduce conflicts.
+ Currently there are 169 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 172
+%expect 169
/*
Comments for TOKENS.
@@ -1422,7 +1423,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
type type_with_opt_collate int_type real_type order_dir lock_option
udf_type if_exists opt_local opt_table_options table_options
table_option opt_if_not_exists opt_no_write_to_binlog
- delete_option opt_temporary all_or_any opt_distinct
+ opt_temporary all_or_any opt_distinct
opt_ignore_leaves fulltext_options spatial_type union_option
start_transaction_opts opt_chain opt_release
union_opt select_derived_init option_type2
@@ -1430,6 +1431,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
opt_ev_status opt_ev_on_completion ev_on_completion opt_ev_comment
ev_alter_on_schedule_completion opt_ev_rename_to opt_ev_sql_stmt
+%type <m_fk_option>
+ delete_option
+
%type <ulong_num>
ulong_num real_ulong_num merge_insert_types
@@ -1544,7 +1548,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
opt_precision opt_ignore opt_column opt_restrict
grant revoke set lock unlock string_list field_options field_option
field_opt_list opt_binary ascii unicode table_lock_list table_lock
- ref_list opt_on_delete opt_on_delete_list opt_on_delete_item use
+ ref_list opt_match_clause opt_on_update_delete use
opt_delete_options opt_delete_option varchar nchar nvarchar
opt_outer table_list table_name table_alias_ref_list table_alias_ref
opt_option opt_place
@@ -5282,10 +5286,6 @@ key_def:
/* Only used for ALTER TABLE. Ignored otherwise. */
lex->alter_info.flags|= ALTER_FOREIGN_KEY;
}
- | constraint opt_check_constraint
- {
- Lex->col_list.empty(); /* Alloced by sql_alloc */
- }
| opt_constraint check_constraint
{
Lex->col_list.empty(); /* Alloced by sql_alloc */
@@ -5298,7 +5298,7 @@ opt_check_constraint:
;
check_constraint:
- CHECK_SYM expr
+ CHECK_SYM '(' expr ')'
;
opt_constraint:
@@ -5837,21 +5837,20 @@ opt_primary:
;
references:
- REFERENCES table_ident
- {
- LEX *lex=Lex;
- lex->fk_delete_opt= lex->fk_update_opt= lex->fk_match_option= 0;
- lex->ref_list.empty();
- }
+ REFERENCES
+ table_ident
opt_ref_list
+ opt_match_clause
+ opt_on_update_delete
{
$$=$2;
}
;
opt_ref_list:
- /* empty */ opt_on_delete {}
- | '(' ref_list ')' opt_on_delete {}
+ /* empty */
+ { Lex->ref_list.empty(); }
+ | '(' ref_list ')'
;
ref_list:
@@ -5867,34 +5866,64 @@ ref_list:
Key_part_spec *key= new Key_part_spec($1, 0);
if (key == NULL)
MYSQL_YYABORT;
- Lex->ref_list.push_back(key);
+ LEX *lex= Lex;
+ lex->ref_list.empty();
+ lex->ref_list.push_back(key);
}
;
-opt_on_delete:
- /* empty */ {}
- | opt_on_delete_list {}
- ;
-
-opt_on_delete_list:
- opt_on_delete_list opt_on_delete_item {}
- | opt_on_delete_item {}
+opt_match_clause:
+ /* empty */
+ { Lex->fk_match_option= Foreign_key::FK_MATCH_UNDEF; }
+ | MATCH FULL
+ { Lex->fk_match_option= Foreign_key::FK_MATCH_FULL; }
+ | MATCH PARTIAL
+ { Lex->fk_match_option= Foreign_key::FK_MATCH_PARTIAL; }
+ | MATCH SIMPLE_SYM
+ { Lex->fk_match_option= Foreign_key::FK_MATCH_SIMPLE; }
;
-opt_on_delete_item:
- ON DELETE_SYM delete_option { Lex->fk_delete_opt= $3; }
- | ON UPDATE_SYM delete_option { Lex->fk_update_opt= $3; }
- | MATCH FULL { Lex->fk_match_option= Foreign_key::FK_MATCH_FULL; }
- | MATCH PARTIAL { Lex->fk_match_option= Foreign_key::FK_MATCH_PARTIAL; }
- | MATCH SIMPLE_SYM { Lex->fk_match_option= Foreign_key::FK_MATCH_SIMPLE; }
+opt_on_update_delete:
+ /* empty */
+ {
+ LEX *lex= Lex;
+ lex->fk_update_opt= Foreign_key::FK_OPTION_UNDEF;
+ lex->fk_delete_opt= Foreign_key::FK_OPTION_UNDEF;
+ }
+ | ON UPDATE_SYM delete_option
+ {
+ LEX *lex= Lex;
+ lex->fk_update_opt= $3;
+ lex->fk_delete_opt= Foreign_key::FK_OPTION_UNDEF;
+ }
+ | ON DELETE_SYM delete_option
+ {
+ LEX *lex= Lex;
+ lex->fk_update_opt= Foreign_key::FK_OPTION_UNDEF;
+ lex->fk_delete_opt= $3;
+ }
+ | ON UPDATE_SYM delete_option
+ ON DELETE_SYM delete_option
+ {
+ LEX *lex= Lex;
+ lex->fk_update_opt= $3;
+ lex->fk_delete_opt= $6;
+ }
+ | ON DELETE_SYM delete_option
+ ON UPDATE_SYM delete_option
+ {
+ LEX *lex= Lex;
+ lex->fk_update_opt= $6;
+ lex->fk_delete_opt= $3;
+ }
;
delete_option:
- RESTRICT { $$= (int) Foreign_key::FK_OPTION_RESTRICT; }
- | CASCADE { $$= (int) Foreign_key::FK_OPTION_CASCADE; }
- | SET NULL_SYM { $$= (int) Foreign_key::FK_OPTION_SET_NULL; }
- | NO_SYM ACTION { $$= (int) Foreign_key::FK_OPTION_NO_ACTION; }
- | SET DEFAULT { $$= (int) Foreign_key::FK_OPTION_DEFAULT; }
+ RESTRICT { $$= Foreign_key::FK_OPTION_RESTRICT; }
+ | CASCADE { $$= Foreign_key::FK_OPTION_CASCADE; }
+ | SET NULL_SYM { $$= Foreign_key::FK_OPTION_SET_NULL; }
+ | NO_SYM ACTION { $$= Foreign_key::FK_OPTION_NO_ACTION; }
+ | SET DEFAULT { $$= Foreign_key::FK_OPTION_DEFAULT; }
;
normal_key_type:
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index 01b4b3711c1..380801c8677 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -1081,6 +1081,13 @@ static void delete_current_thread_v1(void)
}
}
+static void delete_thread_v1(PSI_thread *thread)
+{
+ PFS_thread *pfs= reinterpret_cast<PFS_thread*> (thread);
+ if (pfs != NULL)
+ destroy_thread(pfs);
+}
+
static PSI_mutex_locker*
get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op)
{
@@ -2007,6 +2014,7 @@ PSI_v1 PFS_v1=
get_thread_v1,
set_thread_v1,
delete_current_thread_v1,
+ delete_thread_v1,
get_thread_mutex_locker_v1,
get_thread_rwlock_locker_v1,
get_thread_cond_locker_v1,
diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc
index 4190094b52b..8fe51e8c410 100644
--- a/storage/perfschema/pfs_engine_table.cc
+++ b/storage/perfschema/pfs_engine_table.cc
@@ -219,7 +219,7 @@ int PFS_engine_table::read_row(TABLE *table,
if (! m_share_ptr->m_checked)
{
my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0),
- PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name);
+ PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name.str);
return HA_ERR_TABLE_NEEDS_UPGRADE;
}
@@ -256,7 +256,7 @@ int PFS_engine_table::update_row(TABLE *table,
if (! m_share_ptr->m_checked)
{
my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0),
- PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name);
+ PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name.str);
return HA_ERR_TABLE_NEEDS_UPGRADE;
}