From 7bc7fb576f80fd80f5d922d4c7d06f24fee508b8 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 21 Jan 2010 08:47:05 -0700 Subject: [PATCH 01/12] Merge mysql-next-mr (revno 2966) --> mysql-next-mr-marc From 62fcfbd6c32b684edcd8eb0c91dfc4f71502a3d2 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 21 Jan 2010 11:06:03 -0700 Subject: [PATCH 02/12] Bug#50513 Build failure with ifdef HAVE_OPENSSL + ifndef HAVE_YASSL When compiling wiht ./configure --with-ssl=/usr, which used OPEN_SSL but not YASSL, the code in sql/mysqld.cc failed to build because of an incomplete performance schema instrumentation. This fix implements properly the instrumentation for the rwlock used in openssl_lock_t. Verified that the code builds, and the ssl + performance schema tests do pass. --- .../perfschema/r/dml_setup_instruments.result | 4 +++- .../perfschema/t/dml_setup_instruments.test | 3 +++ sql/mysqld.cc | 21 ++++++++++++------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result index 3a457578b3d..d680f8960d5 100644 --- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result +++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result @@ -16,8 +16,10 @@ wait/synch/mutex/sql/LOCK_delayed_insert YES YES wait/synch/mutex/sql/LOCK_delayed_status 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/mutex/sql/CRYPTO_dynlock_value::lock') +order by name limit 10; NAME ENABLED TIMED +wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock YES YES wait/synch/rwlock/sql/LOCK_dboptions YES YES wait/synch/rwlock/sql/LOCK_grant YES YES wait/synch/rwlock/sql/LOCK_system_variables_hash YES YES diff --git a/mysql-test/suite/perfschema/t/dml_setup_instruments.test b/mysql-test/suite/perfschema/t/dml_setup_instruments.test index f737160cebd..c6631e42612 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/mutex/sql/CRYPTO_dynlock_value::lock') order by name limit 10; # COND_handler_count is dependent on the build (Windows only) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6a9fd8ee37b..ba61eaa62df 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -316,6 +316,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 */ @@ -1538,7 +1542,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 @@ -3737,7 +3741,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); @@ -3791,7 +3795,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; } @@ -3799,7 +3803,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; } @@ -3825,16 +3829,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. */ @@ -7975,6 +7979,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}, From 7610c9eba503575c4be9493e3ea1a30fff9b99b0 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 21 Jan 2010 17:57:57 -0700 Subject: [PATCH 03/12] Fixed merge problem (naming of CRYPTO_dynlock_value::lock in the tests) --- mysql-test/suite/perfschema/r/dml_setup_instruments.result | 3 +-- mysql-test/suite/perfschema/t/dml_setup_instruments.test | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result index d680f8960d5..53d15e0a510 100644 --- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result +++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result @@ -16,10 +16,9 @@ wait/synch/mutex/sql/LOCK_delayed_insert YES YES wait/synch/mutex/sql/LOCK_delayed_status YES YES select * from performance_schema.SETUP_INSTRUMENTS where name like 'Wait/Synch/Rwlock/sql/%' - and name not in ('wait/synch/mutex/sql/CRYPTO_dynlock_value::lock') + and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock') order by name limit 10; NAME ENABLED TIMED -wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock YES YES wait/synch/rwlock/sql/LOCK_dboptions YES YES wait/synch/rwlock/sql/LOCK_grant YES YES wait/synch/rwlock/sql/LOCK_system_variables_hash YES YES diff --git a/mysql-test/suite/perfschema/t/dml_setup_instruments.test b/mysql-test/suite/perfschema/t/dml_setup_instruments.test index c6631e42612..b82cde15fb5 100644 --- a/mysql-test/suite/perfschema/t/dml_setup_instruments.test +++ b/mysql-test/suite/perfschema/t/dml_setup_instruments.test @@ -40,7 +40,7 @@ select * from performance_schema.SETUP_INSTRUMENTS select * from performance_schema.SETUP_INSTRUMENTS where name like 'Wait/Synch/Rwlock/sql/%' - and name not in ('wait/synch/mutex/sql/CRYPTO_dynlock_value::lock') + 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) From f62eb05d0879ff32d5595e4825fc348e823e2107 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 22 Jan 2010 17:15:16 -0700 Subject: [PATCH 04/12] Bug#50478 perfschema.tampered_perfschema_table1 fails sporadically on Windows and Solaris Reviewed every call to my_error() using the va_args parameters, to make sure the arguments type are ok. Fixed the broken calls to my_error() to pass a strings as 'char *', not LEX_STRING. --- storage/perfschema/pfs_engine_table.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } From 63ea7489a022437695b76e08eccc453b4a76f038 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 22 Jan 2010 18:06:13 -0700 Subject: [PATCH 05/12] Removing perfschema.tampered_perfschema_table1 from the experimental tests --- mysql-test/collections/default.experimental | 3 --- 1 file changed, 3 deletions(-) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 34cf1f964b8..d3a0daf78f8 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_get_master_version_and_clock* # Bug#49191 2009-12-01 Daogang rpl_get_master_version_and_clock failed on PB2: COM_REGISTER_SLAVE failed rpl.rpl_heartbeat_basic # BUG#43828 2009-10-22 luis fails sporadically rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically From 372611d7b5aab43a8e5304cbfe365ce8de72705f Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 22 Jan 2010 19:00:19 -0700 Subject: [PATCH 06/12] Bug#11714 Non-sensical ALTER TABLE ADD CONSTRAINT allowed Bug#35578 Parser allows useless/illegal CREATE TABLE syntax Bug#38696 CREATE TABLE ... CHECK ... allows illegal syntax Backport from 6.0 to mysql-next-mr. --- mysql-test/r/constraints.result | 18 +++++++++++++- mysql-test/t/constraints.test | 44 ++++++++++++++++++++++++++++++++- sql/sql_yacc.yy | 10 +++----- 3 files changed, 63 insertions(+), 9 deletions(-) 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/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/sql/sql_yacc.yy b/sql/sql_yacc.yy index ab128a9b701..aebf80e340f 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -765,10 +765,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. @@ -5282,10 +5282,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 +5294,7 @@ opt_check_constraint: ; check_constraint: - CHECK_SYM expr + CHECK_SYM '(' expr ')' ; opt_constraint: From 0d6a21807435991d2177d515ac92fecc72e86e97 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 25 Jan 2010 04:55:31 -0700 Subject: [PATCH 07/12] Bug#34455 Ambiguous foreign keys syntax is accepted Backport from 6.0 to 5.5 --- mysql-test/r/foreign_key.result | 42 +++++++++++++++ mysql-test/t/foreign_key.test | 72 +++++++++++++++++++++++++ sql/sql_lex.h | 4 +- sql/sql_yacc.yy | 93 ++++++++++++++++++++++----------- 4 files changed, 180 insertions(+), 31 deletions(-) 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/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/sql/sql_lex.h b/sql/sql_lex.h index 800a16cf2b6..7eb72bc5358 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1903,7 +1903,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 aebf80e340f..5e900b69aa3 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; } @@ -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 + delete_option + %type 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 @@ -5833,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: @@ -5863,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_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_list: - opt_on_delete_list opt_on_delete_item {} - | opt_on_delete_item {} - ; - -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: From f2338872bbf8f1c21fafc373a7276322311b894e Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 25 Jan 2010 20:12:20 -0700 Subject: [PATCH 08/12] Bug#50596 Spurious test failures in perfschema.dml_mutex_instances Fixed the dml_mutex_instances and dml_rwlock_instances to be more reliable. In particular, the tests may not assume a mutex or rwlock is never locked. --- mysql-test/suite/perfschema/r/dml_mutex_instances.result | 2 +- mysql-test/suite/perfschema/r/dml_rwlock_instances.result | 2 +- mysql-test/suite/perfschema/t/dml_mutex_instances.test | 2 +- mysql-test/suite/perfschema/t/dml_rwlock_instances.test | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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/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 From 3694c5a928c0dc6f30b90523722cca8dd6ab3ed6 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 25 Jan 2010 20:50:31 -0700 Subject: [PATCH 09/12] Bug#50337 --defaults-file=~/something doesn't work anymore Before this fix, opening a configuration file located under "~" failed. To evaluate the "~" path, home_dir needs to be initialized. The 'home_dir' variable was initialized too late in my_init(). This fix: - moved the home_dir initialization from my_init() to my_basic_init(), using getenv("HOME")) - moved the initialization of my_umask / my_umask_dir also to my_basic_init(), to have all the my_umask / my_umask_dir init code in the same place. The second part is not strictly required, but makes the code more maintainable. Tested the fix manually. No MTR tests added, because MTR should not access or modify the $HOME directory of the user running tests. --- mysys/my_init.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) 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 From e17faeeaaaff9fb1c75c15b54b2d6e85180c9a7e Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 25 Jan 2010 21:53:04 -0700 Subject: [PATCH 10/12] Bug#50436 perfschema.aggregate fails on HPUX in 6.0 Relaxed the test conditions to account for objects destroyed, as was intended in the comments in mysql-test/suite/perfschema/t/aggregate.test --- mysql-test/suite/perfschema/r/aggregate.result | 12 ++++++------ mysql-test/suite/perfschema/t/aggregate.test | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/mysql-test/suite/perfschema/r/aggregate.result b/mysql-test/suite/perfschema/r/aggregate.result index 598f9297cc5..3e38aebacfc 100644 --- a/mysql-test/suite/perfschema/r/aggregate.result +++ b/mysql-test/suite/perfschema/r/aggregate.result @@ -51,14 +51,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 +66,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 +75,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 +83,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 +92,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/t/aggregate.test b/mysql-test/suite/perfschema/t/aggregate.test index 7c01bdd0a4b..75bd5ad822e 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 @@ -132,14 +132,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 +147,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 +157,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 +165,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 +174,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; From a1917ee6873839e124b2e22603368db9ef30808f Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Tue, 26 Jan 2010 16:42:54 -0700 Subject: [PATCH 11/12] Bug#44210 Performance schema: pool-of-threads threads instrumentation is missing WL#5136 Pool of threads Added an explicit delete_thread() API in the instrumentation, to be used by the pool of threads implementations. --- include/mysql/psi/psi.h | 7 ++++++- include/mysql/psi/psi_abi_v1.h.pp | 2 ++ storage/perfschema/pfs.cc | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) 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/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 (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, From af37c866decb8c33908de52a6cc4f1c3c60b6e4a Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Wed, 27 Jan 2010 08:26:05 -0700 Subject: [PATCH 12/12] Misc cleanup --- mysql-test/suite/perfschema/r/aggregate.result | 1 + mysql-test/suite/perfschema/t/aggregate.test | 2 ++ 2 files changed, 3 insertions(+) diff --git a/mysql-test/suite/perfschema/r/aggregate.result b/mysql-test/suite/perfschema/r/aggregate.result index 3e38aebacfc..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) diff --git a/mysql-test/suite/perfschema/t/aggregate.test b/mysql-test/suite/perfschema/t/aggregate.test index 75bd5ad822e..0fa4651ecda 100644 --- a/mysql-test/suite/perfschema/t/aggregate.test +++ b/mysql-test/suite/perfschema/t/aggregate.test @@ -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;