From: Christopher Powers Date: February 13 2012 7:31pm Subject: bzr push into mysql-trunk-wl5767 branch (chris.powers:3435 to 3436) WL#5767 List-Archive: http://lists.mysql.com/commits/142865 Message-Id: <201202131927.q1DJRiCF025842@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3436 Christopher Powers 2012-02-13 [merge] WL#5767 PERFORMANCE_SCHEMA, statement digest Merged with mysql-trunk modified: client/mysqldump.c mysql-test/r/create-big.result mysql-test/r/group_by.result mysql-test/r/lock.result mysql-test/r/multi_update.result mysql-test/r/query_cache.result mysql-test/r/sp-code.result mysql-test/r/type_blob.result mysql-test/suite/funcs_1/r/myisam_views-big.result mysql-test/suite/opt_trace/r/general2_no_prot.result mysql-test/suite/opt_trace/r/general2_ps_prot.result mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result mysql-test/suite/rpl/r/rpl_known_bugs_detection.result mysql-test/t/create-big.test mysql-test/t/group_by.test mysql-test/t/lock.test mysql-test/t/multi_update.test mysql-test/t/query_cache.test mysql-test/t/type_blob.test sql/lex.h sql/sql_base.cc sql/sql_yacc.yy storage/innobase/handler/ha_innodb.cc storage/innobase/trx/trx0trx.cc tests/mysql_client_test.c 3435 Christopher Powers 2012-02-13 WL#5767 PERFORMANCE_SCHEMA, statement digest Modified digest tests to accommodate prepared statements. Ordered results by digest text. modified: mysql-test/suite/perfschema/r/statement_digest.result mysql-test/suite/perfschema/r/statement_digest_consumers.result mysql-test/suite/perfschema/r/statement_digest_consumers2.result mysql-test/suite/perfschema/r/statement_digest_long_query.result mysql-test/suite/perfschema/t/statement_digest.test mysql-test/suite/perfschema/t/statement_digest_consumers.test mysql-test/suite/perfschema/t/statement_digest_consumers2.test mysql-test/suite/perfschema/t/statement_digest_long_query.test === modified file 'client/mysqldump.c' --- a/client/mysqldump.c 2012-01-17 03:54:44 +0000 +++ b/client/mysqldump.c 2012-02-13 15:23:37 +0000 @@ -2501,7 +2501,7 @@ static uint get_table_structure(char *ta verbose_msg("-- Retrieving table structure for table %s...\n", table); len= my_snprintf(query_buff, sizeof(query_buff), - "SET OPTION SQL_QUOTE_SHOW_CREATE=%d", + "SET SQL_QUOTE_SHOW_CREATE=%d", (opt_quoted || opt_keywords)); if (!create_options) strmov(query_buff+len, @@ -5172,7 +5172,7 @@ static my_bool get_view_structure(char * verbose_msg("-- Retrieving view structure for table %s...\n", table); #ifdef NOT_REALLY_USED_YET - sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d", + sprintf(insert_pat,"SET SQL_QUOTE_SHOW_CREATE=%d", (opt_quoted || opt_keywords)); #endif === modified file 'mysql-test/r/create-big.result' --- a/mysql-test/r/create-big.result 2011-11-22 10:57:11 +0000 +++ b/mysql-test/r/create-big.result 2012-02-13 10:45:46 +0000 @@ -53,8 +53,8 @@ set debug_sync='create_table_select_befo create table t1 select 1 as i;; set debug_sync='now WAIT_FOR parked'; alter table t3 rename to t1; -ERROR 42S01: Table 't1' already exists set debug_sync='now SIGNAL go'; +ERROR 42S01: Table 't1' already exists show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -65,8 +65,8 @@ set debug_sync='create_table_select_befo create table t1 select 1 as i;; set debug_sync='now WAIT_FOR parked'; alter table t3 rename to t1, add k int; -ERROR 42S01: Table 't1' already exists set debug_sync='now SIGNAL go'; +ERROR 42S01: Table 't1' already exists show create table t1; Table Create Table t1 CREATE TABLE `t1` ( === modified file 'mysql-test/r/group_by.result' --- a/mysql-test/r/group_by.result 2012-02-06 12:47:30 +0000 +++ b/mysql-test/r/group_by.result 2012-02-13 15:23:37 +0000 @@ -512,7 +512,7 @@ a count(*) NULL 9 3 b 1 -set option big_tables=1; +set big_tables=1; select a,count(*) from t1 group by a; a count(*) NULL 9 === modified file 'mysql-test/r/lock.result' --- a/mysql-test/r/lock.result 2011-01-26 22:06:30 +0000 +++ b/mysql-test/r/lock.result 2012-02-13 09:45:43 +0000 @@ -457,5 +457,18 @@ UNLOCK TABLES; UNLOCK TABLES; DROP TABLE t1, t2; # +# Bug#13586314 - RUNTIME - HIBISCUS: ISSUE DEPRECATION +# WARNING FOR LOW_PRIORITY MODIFIER +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT); +# Below statement should return a deprecation warning +LOCK TABLES t1 LOW_PRIORITY WRITE; +Warnings: +Warning 1287 'LOW_PRIORITY WRITE' is deprecated and will be removed in a future release. Please use WRITE instead +UNLOCK TABLES; +DROP TABLE t1; +# End of Bug#13586314 +# # End of 6.0 tests. # === modified file 'mysql-test/r/multi_update.result' --- a/mysql-test/r/multi_update.result 2011-12-13 14:10:33 +0000 +++ b/mysql-test/r/multi_update.result 2012-02-13 10:12:55 +0000 @@ -1,3 +1,4 @@ +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); drop table if exists t1,t2,t3; drop database if exists mysqltest; drop view if exists v1; @@ -605,7 +606,8 @@ a b show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; UPDATE t2,t1 SET t2.a=t1.a+2 +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT delete from t1; delete from t2; @@ -617,7 +619,8 @@ ERROR 23000: Duplicate entry '4' for key show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT drop table t1, t2; set @@session.binlog_format= @sav_binlog_format; === modified file 'mysql-test/r/query_cache.result' --- a/mysql-test/r/query_cache.result 2011-11-10 06:37:03 +0000 +++ b/mysql-test/r/query_cache.result 2012-02-13 15:23:37 +0000 @@ -650,14 +650,14 @@ select * from t1; a 1 2 -SET OPTION SQL_SELECT_LIMIT=1; +SET SQL_SELECT_LIMIT=1; select * from t1; a 1 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 -SET OPTION SQL_SELECT_LIMIT=DEFAULT; +SET SQL_SELECT_LIMIT=DEFAULT; drop table t1; flush query cache; reset query cache; === modified file 'mysql-test/r/sp-code.result' --- a/mysql-test/r/sp-code.result 2011-09-20 12:13:07 +0000 +++ b/mysql-test/r/sp-code.result 2012-02-13 15:23:37 +0000 @@ -847,7 +847,7 @@ drop procedure if exists p_20906_b; create procedure p_20906_a() SET @a=@a+1, @b=@b+1; show procedure code p_20906_a; Pos Instruction -0 stmt 31 "SET @a=@a+1" +0 stmt 31 "SET @a=@a+1" 1 stmt 31 "SET @b=@b+1" set @a=1; set @b=1; @@ -858,7 +858,7 @@ select @a, @b; create procedure p_20906_b() SET @a=@a+1, @b=@b+1, @c=@c+1; show procedure code p_20906_b; Pos Instruction -0 stmt 31 "SET @a=@a+1" +0 stmt 31 "SET @a=@a+1" 1 stmt 31 "SET @b=@b+1" 2 stmt 31 "SET @c=@c+1" set @a=1; === modified file 'mysql-test/r/type_blob.result' --- a/mysql-test/r/type_blob.result 2011-07-19 15:11:15 +0000 +++ b/mysql-test/r/type_blob.result 2012-02-13 15:23:37 +0000 @@ -232,7 +232,7 @@ HELLO HELLO MY a hello -set option big_tables=1; +set big_tables=1; select distinct t from t1; t NULL @@ -313,7 +313,7 @@ HELLO HELLO MY a hello -set option big_tables=0; +set big_tables=0; select distinct * from t1; t c b d NULL NULL NULL NULL === modified file 'mysql-test/suite/funcs_1/r/myisam_views-big.result' Files a/mysql-test/suite/funcs_1/r/myisam_views-big.result 2010-12-31 13:04:32 +0000 and b/mysql-test/suite/funcs_1/r/myisam_views-big.result 2012-02-13 11:59:41 +0000 differ === modified file 'mysql-test/suite/opt_trace/r/general2_no_prot.result' --- a/mysql-test/suite/opt_trace/r/general2_no_prot.result 2012-02-08 15:25:17 +0000 +++ b/mysql-test/suite/opt_trace/r/general2_no_prot.result 2012-02-13 15:23:37 +0000 @@ -1669,7 +1669,7 @@ insert into t1 values(3) { "steps": [ ] /* steps */ } 0 0 -SET @a=(select count(a) from t1 where a>0) { +SET @a=(select count(a) from t1 where a>0) { "steps": [ { "join_preparation": { @@ -1927,7 +1927,7 @@ jump_if_not 11(15) (case_expr@0 = 2) { "steps": [ ] /* steps */ } 0 0 -SET @b=2 { +SET @b=2 { "steps": [ ] /* steps */ } 0 0 === modified file 'mysql-test/suite/opt_trace/r/general2_ps_prot.result' --- a/mysql-test/suite/opt_trace/r/general2_ps_prot.result 2012-02-08 15:25:17 +0000 +++ b/mysql-test/suite/opt_trace/r/general2_ps_prot.result 2012-02-13 15:23:37 +0000 @@ -1685,7 +1685,7 @@ insert into t1 values(3) { "steps": [ ] /* steps */ } 0 0 -SET @a=(select count(a) from t1 where a>0) { +SET @a=(select count(a) from t1 where a>0) { "steps": [ { "join_preparation": { @@ -1943,7 +1943,7 @@ jump_if_not 11(15) (case_expr@0 = 2) { "steps": [ ] /* steps */ } 0 0 -SET @b=2 { +SET @b=2 { "steps": [ ] /* steps */ } 0 0 === modified file 'mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result' --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result 2011-11-19 08:08:03 +0000 +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result 2012-02-13 08:50:03 +0000 @@ -864,7 +864,8 @@ master-bin.000001 # Table_map # # table_ master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t2 SELECT * FROM t1 +master-bin.000001 # Table_map # # table_id: # (test_rpl.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test_rpl`; INSERT INTO t2 VALUES (1, 't1, text 1') ON DUPLICATE KEY UPDATE b = 't2, text 1' === modified file 'mysql-test/suite/rpl/r/rpl_known_bugs_detection.result' --- a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result 2011-12-26 17:21:34 +0000 +++ b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result 2012-02-13 08:50:03 +0000 @@ -49,6 +49,7 @@ ON DUPLICATE KEY UPDATE t1.field_3 = t2.field_c; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave. INSERT INTO t2 (field_a, field_b, field_c) VALUES (6, 'f', '6f'); INSERT INTO t1 (field_1, field_2, field_3) SELECT t2.field_a, t2.field_b, t2.field_c @@ -57,6 +58,7 @@ ON DUPLICATE KEY UPDATE t1.field_3 = t2.field_c; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave. SELECT * FROM t1; id field_1 field_2 field_3 1 1 a 1a === modified file 'mysql-test/t/create-big.test' --- a/mysql-test/t/create-big.test 2011-11-22 10:57:11 +0000 +++ b/mysql-test/t/create-big.test 2012-02-13 10:45:46 +0000 @@ -132,11 +132,20 @@ set debug_sync='create_table_select_befo --send create table t1 select 1 as i; connection addconroot1; set debug_sync='now WAIT_FOR parked'; ---error ER_TABLE_EXISTS_ERROR -alter table t3 rename to t1; +--send alter table t3 rename to t1 +connection addconroot2; +# Wait until the above ALTER TABLE RENAME is blocked due to CREATE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "alter table t3 rename to t1"; +--source include/wait_condition.inc set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--error ER_TABLE_EXISTS_ERROR +--reap connection default; show create table t1; drop table t1; @@ -146,11 +155,21 @@ set debug_sync='create_table_select_befo --send create table t1 select 1 as i; connection addconroot1; set debug_sync='now WAIT_FOR parked'; ---error ER_TABLE_EXISTS_ERROR -alter table t3 rename to t1, add k int; +--send alter table t3 rename to t1, add k int +connection addconroot2; +# Wait until the above ALTER TABLE RENAME is blocked due to CREATE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "alter table t3 rename to t1, add k int"; +--source include/wait_condition.inc set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--error ER_TABLE_EXISTS_ERROR +--reap +connection default; show create table t1; drop table t1,t3; === modified file 'mysql-test/t/group_by.test' --- a/mysql-test/t/group_by.test 2012-01-30 13:57:08 +0000 +++ b/mysql-test/t/group_by.test 2012-02-13 15:23:37 +0000 @@ -390,7 +390,7 @@ drop table t1,t2,t3; create table t1 (a blob null); insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(""),(""),(""),("b"); select a,count(*) from t1 group by a; -set option big_tables=1; +set big_tables=1; select a,count(*) from t1 group by a; drop table t1; === modified file 'mysql-test/t/lock.test' --- a/mysql-test/t/lock.test 2011-10-19 10:15:25 +0000 +++ b/mysql-test/t/lock.test 2012-02-13 09:45:43 +0000 @@ -550,6 +550,23 @@ UNLOCK TABLES; DROP TABLE t1, t2; disconnect con2; +--echo # +--echo # Bug#13586314 - RUNTIME - HIBISCUS: ISSUE DEPRECATION +--echo # WARNING FOR LOW_PRIORITY MODIFIER +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT); +--echo # Below statement should return a deprecation warning +LOCK TABLES t1 LOW_PRIORITY WRITE; +UNLOCK TABLES; +DROP TABLE t1; + +--echo # End of Bug#13586314 + --echo # --echo # End of 6.0 tests. === modified file 'mysql-test/t/multi_update.test' --- a/mysql-test/t/multi_update.test 2012-02-09 20:26:08 +0000 +++ b/mysql-test/t/multi_update.test 2012-02-13 10:12:55 +0000 @@ -6,6 +6,8 @@ source include/not_embedded.inc; source include/have_log_bin.inc; +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); + --disable_warnings drop table if exists t1,t2,t3; drop database if exists mysqltest; @@ -138,6 +140,7 @@ INSERT INTO t2(ParId) VALUES(1), (2), (3 select * from t2; +--disable_warnings ONCE UPDATE t2, t1 SET t2.tst = t1.tst, t2.tst1 = t1.tst1 WHERE t2.ParId = t1.Id; select * from t2; @@ -295,6 +298,7 @@ drop table t1,t2; create table t1 (a int not null auto_increment primary key, b int not null); insert into t1 (b) values (1),(2),(3),(4); +--disable_warnings ONCE update t1, t1 as t2 set t1.b=t2.b+1 where t1.a=t2.a; select * from t1; drop table t1; === modified file 'mysql-test/t/query_cache.test' --- a/mysql-test/t/query_cache.test 2011-11-10 06:37:03 +0000 +++ b/mysql-test/t/query_cache.test 2012-02-13 15:23:37 +0000 @@ -438,10 +438,10 @@ create table t1 (a int); insert into t1 values (1),(2); show status like "Qcache_queries_in_cache"; select * from t1; -SET OPTION SQL_SELECT_LIMIT=1; +SET SQL_SELECT_LIMIT=1; select * from t1; show status like "Qcache_queries_in_cache"; -SET OPTION SQL_SELECT_LIMIT=DEFAULT; +SET SQL_SELECT_LIMIT=DEFAULT; drop table t1; # === modified file 'mysql-test/t/type_blob.test' --- a/mysql-test/t/type_blob.test 2010-11-01 09:52:05 +0000 +++ b/mysql-test/t/type_blob.test 2012-02-13 15:23:37 +0000 @@ -112,7 +112,7 @@ select distinct t from t1 order by t; select distinct b from t1 order by b; select t from t1 group by t; select b from t1 group by b; -set option big_tables=1; +set big_tables=1; select distinct t from t1; select distinct b from t1; select distinct t from t1 order by t; @@ -123,7 +123,7 @@ select distinct c from t1 order by c; select distinct d from t1 order by d; select c from t1 group by c; select d from t1 group by d; -set option big_tables=0; +set big_tables=0; select distinct * from t1; select t,count(*) from t1 group by t; select b,count(*) from t1 group by b; === modified file 'sql/lex.h' --- a/sql/lex.h 2011-11-04 16:07:37 +0000 +++ b/sql/lex.h 2012-02-13 15:23:37 +0000 @@ -396,7 +396,6 @@ static SYMBOL symbols[] = { { "OLD_PASSWORD", SYM(OLD_PASSWORD)}, { "ON", SYM(ON)}, { "ONE", SYM(ONE_SYM)}, - { "ONE_SHOT", SYM(ONE_SHOT_SYM)}, { "OPEN", SYM(OPEN_SYM)}, { "OPTIMIZE", SYM(OPTIMIZE)}, { "OPTIONS", SYM(OPTIONS_SYM)}, === modified file 'sql/sql_base.cc' --- a/sql/sql_base.cc 2012-02-09 20:26:08 +0000 +++ b/sql/sql_base.cc 2012-02-13 08:50:03 +0000 @@ -5854,20 +5854,20 @@ bool lock_tables(THD *thd, TABLE_LIST *t *(ptr++)= table->table; } + /* + DML statements that modify a table with an auto_increment column based on + rows selected from a table are unsafe as the order in which the rows are + fetched fron the select tables cannot be determined and may differ on + master and slave. + */ + if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables && + has_write_table_with_auto_increment_and_select(tables)) + thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_WRITE_AUTOINC_SELECT); + /* We have to emulate LOCK TABLES if we are statement needs prelocking. */ if (thd->lex->requires_prelocking()) { - /* - DML statements that modify a table with an auto_increment column based on - rows selected from a table are unsafe as the order in which the rows are - fetched fron the select tables cannot be determined and may differ on - master and slave. - */ - if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables && - has_write_table_with_auto_increment_and_select(tables)) - thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_WRITE_AUTOINC_SELECT); - /* A query that modifies autoinc column in sub-statement can make the master and slave inconsistent. @@ -9362,7 +9362,7 @@ has_write_table_with_auto_increment(TABL } /* - checks if the tables have select tables in the table list and write tables + checks if we have select tables in the table list and write tables with auto-increment column. SYNOPSIS === modified file 'sql/sql_yacc.yy' --- a/sql/sql_yacc.yy 2012-02-03 18:09:00 +0000 +++ b/sql/sql_yacc.yy 2012-02-13 15:23:37 +0000 @@ -1227,7 +1227,6 @@ bool my_yyoverflow(short **a, YYSTYPE ** %token OFFSET_SYM %token OLD_PASSWORD %token ON /* SQL-2003-R */ -%token ONE_SHOT_SYM %token ONE_SYM %token OPEN_SYM /* SQL-2003-R */ %token OPTIMIZE @@ -1526,7 +1525,7 @@ bool my_yyoverflow(short **a, YYSTYPE ** opt_temporary all_or_any opt_distinct opt_ignore_leaves fulltext_options spatial_type union_option start_transaction_opts - union_opt select_derived_init option_type2 + union_opt select_derived_init opt_natural_language_mode opt_query_expansion 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 @@ -1661,7 +1660,7 @@ bool my_yyoverflow(short **a, YYSTYPE ** 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 + opt_place opt_attribute opt_attribute_list attribute column_list column_list_id opt_column_list grant_privileges grant_ident grant_list grant_option object_privilege object_privilege_list user_list rename_list @@ -13320,7 +13319,7 @@ keyword_sp: /* Option functions */ set: - SET opt_option + SET { LEX *lex=Lex; lex->sql_command= SQLCOM_SET_OPTION; @@ -13334,11 +13333,6 @@ set: {} ; -opt_option: - /* empty */ {} - | OPTION {} - ; - option_value_list: option_type_value | option_value_list ',' option_type_value @@ -13372,7 +13366,15 @@ option_type_value: lex->var_list.empty(); lex->one_shot_set= 0; lex->autocommit= 0; - lex->sphead->m_tmp_query= lip->get_tok_start(); + /* + Extract the query statement from the tokenizer. The + start is either lip->ptr, if there was no lookahead, + lip->tok_start otherwise. + */ + if (yychar == YYEMPTY) + lex->sphead->m_tmp_query= lip->get_ptr(); + else + lex->sphead->m_tmp_query= lip->get_tok_start(); } } ext_option_value @@ -13427,16 +13429,12 @@ option_type_value: ; option_type: - option_type2 {} + /* empty */ { $$= OPT_DEFAULT; } | GLOBAL_SYM { $$=OPT_GLOBAL; } | LOCAL_SYM { $$=OPT_SESSION; } | SESSION_SYM { $$=OPT_SESSION; } ; -option_type2: - /* empty */ { $$= OPT_DEFAULT; } - ; - opt_var_type: /* empty */ { $$=OPT_SESSION; } | GLOBAL_SYM { $$=OPT_GLOBAL; } @@ -13453,7 +13451,7 @@ opt_var_ident_type: ext_option_value: sys_option_value - | option_type2 option_value + | option_value ; sys_option_value: @@ -13815,7 +13813,11 @@ table_lock: lock_option: READ_SYM { $$= TL_READ_NO_INSERT; } | WRITE_SYM { $$= TL_WRITE_DEFAULT; } - | LOW_PRIORITY WRITE_SYM { $$= TL_WRITE_LOW_PRIORITY; } + | LOW_PRIORITY WRITE_SYM + { + $$= TL_WRITE_LOW_PRIORITY; + WARN_DEPRECATED(YYTHD, "LOW_PRIORITY WRITE", "WRITE"); + } | READ_SYM LOCAL_SYM { $$= TL_READ; } ; === modified file 'storage/innobase/handler/ha_innodb.cc' --- a/storage/innobase/handler/ha_innodb.cc 2012-02-08 13:10:23 +0000 +++ b/storage/innobase/handler/ha_innodb.cc 2012-02-13 08:22:20 +0000 @@ -9202,8 +9202,15 @@ ha_innobase::delete_table( ut_a(name_len < 1000); - /* Drop the table in InnoDB */ + /* Either the transaction is already flagged as a locking transaction + or it hasn't been started yet. */ + + ut_a(!trx_is_started(trx) || trx->will_lock > 0); + + /* We are doing a DDL operation. */ + ++trx->will_lock; + /* Drop the table in InnoDB */ error = row_drop_table_for_mysql(norm_name, trx, thd_sql_command(thd) == SQLCOM_DROP_DB); @@ -9313,6 +9320,14 @@ innobase_drop_database( #endif trx = innobase_trx_allocate(thd); + /* Either the transaction is already flagged as a locking transaction + or it hasn't been started yet. */ + + ut_a(!trx_is_started(trx) || trx->will_lock > 0); + + /* We are doing a DDL operation. */ + ++trx->will_lock; + row_drop_database_for_mysql(namebuf, trx); my_free(namebuf); @@ -9362,6 +9377,11 @@ innobase_rename_table( row_mysql_lock_data_dictionary(trx); } + /* Transaction must be flagged as a locking transaction or it hasn't + been started yet. */ + + ut_a(trx->will_lock > 0); + error = row_rename_table_for_mysql( norm_from, norm_to, trx, lock_and_commit); @@ -9474,6 +9494,14 @@ ha_innobase::rename_table( trx = innobase_trx_allocate(thd); + /* Either the transaction is already flagged as a locking transaction + or it hasn't been started yet. */ + + ut_a(!trx_is_started(trx) || trx->will_lock > 0); + + /* We are doing a DDL operation. */ + ++trx->will_lock; + error = innobase_rename_table(trx, from, to, TRUE); DEBUG_SYNC(thd, "after_innobase_rename_table"); === modified file 'storage/innobase/trx/trx0trx.cc' --- a/storage/innobase/trx/trx0trx.cc 2012-02-13 06:15:14 +0000 +++ b/storage/innobase/trx/trx0trx.cc 2012-02-13 08:22:20 +0000 @@ -1022,6 +1022,13 @@ trx_commit( ut_ad(!trx->in_ro_trx_list); ut_ad(!trx->in_rw_trx_list); + /* Note: We are asserting without holding the lock mutex. But + that is OK because this transaction is not waiting and cannot + be rolled back and no new locks can (or should not) be added + becuase it is flagged as a non-locking read-only transaction. */ + + ut_a(UT_LIST_GET_LEN(trx->lock.trx_locks) == 0); + /* This state change is not protected by any mutex, therefore there is an inherent race here around state transition during printouts. We ignore this race for the sake of efficiency. === modified file 'tests/mysql_client_test.c' --- a/tests/mysql_client_test.c 2011-11-21 11:58:25 +0000 +++ b/tests/mysql_client_test.c 2012-02-13 15:23:37 +0000 @@ -8193,7 +8193,7 @@ static void test_field_misc() /* - Test SET OPTION feature with prepare stmts + Test SET feature with prepare stmts bug #85 (reported by mark@stripped) */ @@ -8208,7 +8208,7 @@ static void test_set_option() mysql_autocommit(mysql, TRUE); /* LIMIT the rows count to 2 */ - rc= mysql_query(mysql, "SET OPTION SQL_SELECT_LIMIT= 2"); + rc= mysql_query(mysql, "SET SQL_SELECT_LIMIT= 2"); myquery(rc); rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_limit"); @@ -8249,7 +8249,7 @@ static void test_set_option() /* RESET the LIMIT the rows count to 0 */ if (!opt_silent) fprintf(stdout, "\n with SQL_SELECT_LIMIT=DEFAULT (prepare)"); - rc= mysql_query(mysql, "SET OPTION SQL_SELECT_LIMIT=DEFAULT"); + rc= mysql_query(mysql, "SET SQL_SELECT_LIMIT=DEFAULT"); myquery(rc); stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_limit"); No bundle (reason: useless for push emails).