From d695cc864c54222d446ccd50662d8d3ea6cfee60 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Sep 2010 15:26:29 +0200 Subject: [PATCH 01/64] Raise version number after cloning 5.1.51 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 3ec62b836f1..c1672557bd1 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.1.51], [], [mysql]) +AC_INIT([MySQL Server], [5.1.52], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From b76277fce5a375b931ae2f967e26956539eb1ffc Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Thu, 23 Sep 2010 10:43:51 +0400 Subject: [PATCH 02/64] Bug#54494 crash with explain extended and prepared statements In case of outer join and emtpy WHERE conditon 'always true' condition is created for WHERE clasue. Later in mysql_select() original SELECT_LEX WHERE condition is overwritten with created cond. However SELECT_LEX condition is also used as inital condition in mysql_select()->JOIN::prepare(). On second execution of PS modified SELECT_LEX condition is taken and it leads to crash. The fix is to restore original SELECT_LEX condition (set to NULL if original cond is NULL) in reinit_stmt_before_use(). HAVING clause is fixed too for safety reason (no test case as I did not manage to think out appropriate example). mysql-test/r/ps.result: test case mysql-test/t/ps.test: test case sql/sql_prepare.cc: restore original SELECT_LEX condition (set to NULL if original cond is NULL) in reinit_stmt_before_use() --- mysql-test/r/ps.result | 20 ++++++++++++++++++++ mysql-test/t/ps.test | 11 +++++++++++ sql/sql_prepare.cc | 4 ++++ 3 files changed, 35 insertions(+) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index f21f1d83acd..c2bc80c4641 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -3001,4 +3001,24 @@ EXECUTE stmt; 1 DEALLOCATE PREPARE stmt; DROP TABLE t1; +# +# Bug#54494 crash with explain extended and prepared statements +# +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (1),(2); +PREPARE stmt FROM 'EXPLAIN EXTENDED SELECT 1 FROM t1 RIGHT JOIN t1 t2 ON 1'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 select 1 AS `1` from `test`.`t1` `t2` left join `test`.`t1` on(1) where 1 +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 select 1 AS `1` from `test`.`t1` `t2` left join `test`.`t1` on(1) where 1 +DEALLOCATE PREPARE stmt; +DROP TABLE t1; End of 5.1 tests. diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 4390b70e9e9..036c8404095 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3079,4 +3079,15 @@ EXECUTE stmt; DEALLOCATE PREPARE stmt; DROP TABLE t1; +--echo # +--echo # Bug#54494 crash with explain extended and prepared statements +--echo # +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (1),(2); +PREPARE stmt FROM 'EXPLAIN EXTENDED SELECT 1 FROM t1 RIGHT JOIN t1 t2 ON 1'; +EXECUTE stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + --echo End of 5.1 tests. diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index d6eb90a57be..5ba375f9710 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2362,11 +2362,15 @@ void reinit_stmt_before_use(THD *thd, LEX *lex) sl->where= sl->prep_where->copy_andor_structure(thd); sl->where->cleanup(); } + else + sl->where= NULL; if (sl->prep_having) { sl->having= sl->prep_having->copy_andor_structure(thd); sl->having->cleanup(); } + else + sl->having= NULL; DBUG_ASSERT(sl->join == 0); ORDER *order; /* Fix GROUP list */ From 21197c70b8e0f7ef1b7b2d74f693cfd366a05bfd Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 28 Sep 2010 11:16:30 +0200 Subject: [PATCH 03/64] Set version number for mysql-5.1.49sp1 release --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 74e575fad8c..84767b01264 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.1.49], [], [mysql]) +AC_INIT([MySQL Server], [5.1.49sp1], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From 2331ea8edbf2dcc9bb7166b19fb038dd37da85ad Mon Sep 17 00:00:00 2001 From: smenon Date: Tue, 28 Sep 2010 12:36:08 +0200 Subject: [PATCH 04/64] Backport into mysql-5.1.49sp1-release > ------------------------------------------------------------ > revno: 3452.1.12 > revision-id: davi.arnaut@oracle.com-20100730121710-sc068t4d2f1c2gi9 > parent: dao-gang.qu@sun.com-20100730035934-8in8err1b1rqu72y > committer: Davi Arnaut > branch nick: mysql-5.1-bugteam > timestamp: Fri 2010-07-30 09:17:10 -0300 > message: > Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run > > Fix a regression (due to a typo) which caused spurious incorrect > argument errors for long data stream parameters if all forms of > logging were disabled (binary, general and slow logs). --- mysql-test/r/mysql_client_test.result | 2 ++ mysql-test/t/mysql_client_test.test | 2 ++ sql/sql_prepare.cc | 4 +-- tests/mysql_client_test.c | 49 +++++++++++++++++++++------ 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/mysql-test/r/mysql_client_test.result b/mysql-test/r/mysql_client_test.result index 08d982c85e3..edda7980e97 100644 --- a/mysql-test/r/mysql_client_test.result +++ b/mysql-test/r/mysql_client_test.result @@ -1,3 +1,5 @@ SET @old_general_log= @@global.general_log; +SET @old_slow_query_log= @@global.slow_query_log; ok SET @@global.general_log= @old_general_log; +SET @@global.slow_query_log= @old_slow_query_log; diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test index 15c0cd4ac84..41670117c7c 100644 --- a/mysql-test/t/mysql_client_test.test +++ b/mysql-test/t/mysql_client_test.test @@ -2,6 +2,7 @@ -- source include/not_embedded.inc SET @old_general_log= @@global.general_log; +SET @old_slow_query_log= @@global.slow_query_log; # We run with different binaries for normal and --embedded-server # @@ -17,3 +18,4 @@ SET @old_general_log= @@global.general_log; echo ok; SET @@global.general_log= @old_general_log; +SET @@global.slow_query_log= @old_slow_query_log; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 041d9f7c30b..e80517d4bc4 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -790,7 +790,7 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array, type (the types are supplied at execute). Check that the supplied type of placeholder can accept a data stream. */ - else if (!is_param_long_data_type(param)) + else if (! is_param_long_data_type(param)) DBUG_RETURN(1); res= param->query_val_str(&str); if (param->convert_str_value(thd)) @@ -836,7 +836,7 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array, type (the types are supplied at execute). Check that the supplied type of placeholder can accept a data stream. */ - else if (is_param_long_data_type(param)) + else if (! is_param_long_data_type(param)) DBUG_RETURN(1); if (param->convert_str_value(stmt->thd)) DBUG_RETURN(1); /* out of memory */ diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 97d146ff9ef..a5f5812c2f0 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -13246,37 +13246,52 @@ static void test_bug15518() } -static void disable_general_log() +static void disable_query_logs() { int rc; rc= mysql_query(mysql, "set @@global.general_log=off"); myquery(rc); + rc= mysql_query(mysql, "set @@global.slow_query_log=off"); + myquery(rc); } -static void enable_general_log(int truncate) +static void enable_query_logs(int truncate) { int rc; rc= mysql_query(mysql, "set @save_global_general_log=@@global.general_log"); myquery(rc); + rc= mysql_query(mysql, "set @save_global_slow_query_log=@@global.slow_query_log"); + myquery(rc); + rc= mysql_query(mysql, "set @@global.general_log=on"); myquery(rc); + rc= mysql_query(mysql, "set @@global.slow_query_log=on"); + myquery(rc); + + if (truncate) { rc= mysql_query(mysql, "truncate mysql.general_log"); myquery(rc); + + rc= mysql_query(mysql, "truncate mysql.slow_log"); + myquery(rc); } } -static void restore_general_log() +static void restore_query_logs() { int rc; rc= mysql_query(mysql, "set @@global.general_log=@save_global_general_log"); myquery(rc); + + rc= mysql_query(mysql, "set @@global.slow_query_log=@save_global_slow_query_log"); + myquery(rc); } @@ -15447,7 +15462,7 @@ static void test_bug17667() return; } - enable_general_log(1); + enable_query_logs(1); for (statement_cursor= statements; statement_cursor->buffer != NULL; statement_cursor++) @@ -15527,7 +15542,7 @@ static void test_bug17667() statement_cursor->buffer); } - restore_general_log(); + restore_query_logs(); if (!opt_silent) printf("success. All queries found intact in the log.\n"); @@ -17390,7 +17405,7 @@ static void test_bug28386() } mysql_free_result(result); - enable_general_log(1); + enable_query_logs(1); stmt= mysql_simple_prepare(mysql, "SELECT ?"); check_stmt(stmt); @@ -17429,7 +17444,7 @@ static void test_bug28386() mysql_free_result(result); - restore_general_log(); + restore_query_logs(); DBUG_VOID_RETURN; } @@ -18215,7 +18230,7 @@ static void test_bug42373() Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run */ -static void test_bug54041() +static void test_bug54041_impl() { int rc; MYSQL_STMT *stmt; @@ -18230,7 +18245,7 @@ static void test_bug54041() rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)"); myquery(rc); - stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 (a) VALUES (?)"); + stmt= mysql_simple_prepare(mysql, "SELECT a FROM t1 WHERE a > ?"); check_stmt(stmt); verify_param_count(stmt, 1); @@ -18268,6 +18283,20 @@ static void test_bug54041() } +/** + Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run +*/ + +static void test_bug54041() +{ + enable_query_logs(0); + test_bug54041_impl(); + disable_query_logs(); + test_bug54041_impl(); + restore_query_logs(); +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -18348,7 +18377,7 @@ and you are welcome to modify and redistribute it under the GPL license\n"); static struct my_tests_st my_tests[]= { - { "disable_general_log", disable_general_log }, + { "disable_query_logs", disable_query_logs }, { "test_view_sp_list_fields", test_view_sp_list_fields }, { "client_query", client_query }, { "test_prepare_insert_update", test_prepare_insert_update}, From e73738f13f037fcc78ae4480007104bfdfc8778c Mon Sep 17 00:00:00 2001 From: smenon Date: Tue, 28 Sep 2010 12:39:22 +0200 Subject: [PATCH 05/64] Backport into mysql-5.1.49sp1-release > ------------------------------------------------------------ > revno: 3457.3.1 > revision-id: alexey.kopytov@sun.com-20100712145855-niybvwsthe480r69 > parent: mattias.jonsson@oracle.com-20100709130033-fgr7hggrrebf6qkc > committer: Alexey Kopytov > branch nick: 55061-5.1-bugteam > timestamp: Mon 2010-07-12 18:58:55 +0400 > message: > Bug#55061: Build failing on sol 8 x86 - assembler code vs > compiler problem > > GCC-style inline assembly is not supported by the Sun Studio > compilers prior to version 12. > > Added a check for the Sun Studio version to avoid using > _FPU_GETCW() / _FPU_SETCW() when inline assembly is > unsupported. This can lead to some differences in floating > point calculations on Solaris 8/x86 which, however, is not worth > bothering with Sun-style assembly .il templates. --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5514c356bd1..f9012b750f4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -190,7 +190,7 @@ typedef fp_except fp_except_t; # define fpu_control_t unsigned int # define _FPU_EXTENDED 0x300 # define _FPU_DOUBLE 0x200 -# if defined(__GNUC__) || defined(__SUNPRO_CC) +# if defined(__GNUC__) || (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590) # define _FPU_GETCW(cw) asm volatile ("fnstcw %0" : "=m" (*&cw)) # define _FPU_SETCW(cw) asm volatile ("fldcw %0" : : "m" (*&cw)) # else From 233e4d809aeccff150494b8632abedb77c213fbd Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 1 Oct 2010 14:08:38 +0400 Subject: [PATCH 06/64] Bug#54488 crash when using explain and prepared statements with subqueries The crash happens because original join table is replaced with temporary table at execution stage and later we attempt to use this temporary table in select_describe. It might happen that Item_subselect::update_used_tables() method which sets const_item flag is not called by some reasons (no where/having conditon in subquery for example). It prevents JOIN::join_tmp creation and breaks original join. The fix is to call ::update_used_tables() before ::const_item() check. mysql-test/r/ps.result: test case mysql-test/t/ps.test: test case sql/item_subselect.cc: call ::update_used_tables() before ::const_item() check. --- mysql-test/r/ps.result | 18 ++++++++++++++++++ mysql-test/t/ps.test | 11 +++++++++++ sql/item_subselect.cc | 26 +++++++++++++++----------- 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index c2bc80c4641..5cc10e49c51 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -3021,4 +3021,22 @@ Warnings: Note 1003 select 1 AS `1` from `test`.`t1` `t2` left join `test`.`t1` on(1) where 1 DEALLOCATE PREPARE stmt; DROP TABLE t1; +# +# Bug#54488 crash when using explain and prepared statements with subqueries +# +CREATE TABLE t1(f1 INT); +INSERT INTO t1 VALUES (1),(1); +PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 WHERE (SELECT (SELECT 1 FROM t1 GROUP BY f1))'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +DEALLOCATE PREPARE stmt; +DROP TABLE t1; End of 5.1 tests. diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 036c8404095..9b3f3e750e1 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3090,4 +3090,15 @@ EXECUTE stmt; DEALLOCATE PREPARE stmt; DROP TABLE t1; +--echo # +--echo # Bug#54488 crash when using explain and prepared statements with subqueries +--echo # +CREATE TABLE t1(f1 INT); +INSERT INTO t1 VALUES (1),(1); +PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 WHERE (SELECT (SELECT 1 FROM t1 GROUP BY f1))'; +EXECUTE stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + --echo End of 5.1 tests. diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index b93ea6f241b..2daeeb12b6d 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1914,18 +1914,22 @@ int subselect_single_select_engine::exec() } if (!select_lex->uncacheable && thd->lex->describe && !(join->select_options & SELECT_DESCRIBE) && - join->need_tmp && item->const_item()) + join->need_tmp) { - /* - Force join->join_tmp creation, because this subquery will be replaced - by a simple select from the materialization temp table by optimize() - called by EXPLAIN and we need to preserve the initial query structure - so we can display it. - */ - select_lex->uncacheable|= UNCACHEABLE_EXPLAIN; - select_lex->master_unit()->uncacheable|= UNCACHEABLE_EXPLAIN; - if (join->init_save_join_tab()) - DBUG_RETURN(1); /* purecov: inspected */ + item->update_used_tables(); + if (item->const_item()) + { + /* + Force join->join_tmp creation, because this subquery will be replaced + by a simple select from the materialization temp table by optimize() + called by EXPLAIN and we need to preserve the initial query structure + so we can display it. + */ + select_lex->uncacheable|= UNCACHEABLE_EXPLAIN; + select_lex->master_unit()->uncacheable|= UNCACHEABLE_EXPLAIN; + if (join->init_save_join_tab()) + DBUG_RETURN(1); /* purecov: inspected */ + } } if (item->engine_changed) { From bd09e49843b83bb96bd64b20ce049f940ca4cc68 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Mon, 4 Oct 2010 12:51:26 +0400 Subject: [PATCH 07/64] result fix --- mysql-test/r/ps.result | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 5cc10e49c51..84c64a3905a 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -3028,15 +3028,15 @@ CREATE TABLE t1(f1 INT); INSERT INTO t1 VALUES (1),(1); PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 WHERE (SELECT (SELECT 1 FROM t1 GROUP BY f1))'; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort DEALLOCATE PREPARE stmt; DROP TABLE t1; End of 5.1 tests. From cf2c8701b48417bde08dd6fdc58d9da735d53481 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Wed, 6 Oct 2010 03:41:26 -0700 Subject: [PATCH 08/64] Fix Bug #57255 Cascade Delete results in "Got error -1 from storage engine". rb://477 approved by Marko --- .../suite/innodb/r/innodb_bug57255.result | 10 ++++++ .../suite/innodb/t/innodb_bug57255.test | 36 +++++++++++++++++++ .../innodb_plugin/r/innodb_bug57255.result | 10 ++++++ .../innodb_plugin/t/innodb_bug57255.test | 36 +++++++++++++++++++ storage/innobase/row/row0mysql.c | 9 +++++ storage/innodb_plugin/ChangeLog | 4 +++ storage/innodb_plugin/row/row0mysql.c | 9 +++++ 7 files changed, 114 insertions(+) create mode 100644 mysql-test/suite/innodb/r/innodb_bug57255.result create mode 100644 mysql-test/suite/innodb/t/innodb_bug57255.test create mode 100644 mysql-test/suite/innodb_plugin/r/innodb_bug57255.result create mode 100644 mysql-test/suite/innodb_plugin/t/innodb_bug57255.test diff --git a/mysql-test/suite/innodb/r/innodb_bug57255.result b/mysql-test/suite/innodb/r/innodb_bug57255.result new file mode 100644 index 00000000000..d61a0d42ba3 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug57255.result @@ -0,0 +1,10 @@ +create table A(id int not null primary key) engine=innodb; +create table B(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references A(id) on delete cascade) engine=innodb; +create table C(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references B(id) on delete cascade) engine=innodb; +insert into A values(1), (2); +DELETE FROM A where id = 1; +DELETE FROM C where f1 = 2; +DELETE FROM A where id = 1; +DROP TABLE C; +DROP TABLE B; +DROP TABLE A; diff --git a/mysql-test/suite/innodb/t/innodb_bug57255.test b/mysql-test/suite/innodb/t/innodb_bug57255.test new file mode 100644 index 00000000000..2b37a0a6092 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug57255.test @@ -0,0 +1,36 @@ +# Test Bug #57255. Cascade deletes that affect different rows should not +# result in DB_FOREIGN_EXCEED_MAX_CASCADE error + +--source include/have_innodb.inc + +create table A(id int not null primary key) engine=innodb; + +create table B(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references A(id) on delete cascade) engine=innodb; + +create table C(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references B(id) on delete cascade) engine=innodb; + +insert into A values(1), (2); + +--disable_query_log +let $i=257; +while ($i) +{ +insert into B(f1) values(1); +dec $i; +} +let $i=486; +while ($i) +{ +insert into C(f1) values(2); +dec $i; +} +--enable_query_log + +# Following Deletes should not report error +DELETE FROM A where id = 1; +DELETE FROM C where f1 = 2; +DELETE FROM A where id = 1; + +DROP TABLE C; +DROP TABLE B; +DROP TABLE A; diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug57255.result b/mysql-test/suite/innodb_plugin/r/innodb_bug57255.result new file mode 100644 index 00000000000..d61a0d42ba3 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/r/innodb_bug57255.result @@ -0,0 +1,10 @@ +create table A(id int not null primary key) engine=innodb; +create table B(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references A(id) on delete cascade) engine=innodb; +create table C(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references B(id) on delete cascade) engine=innodb; +insert into A values(1), (2); +DELETE FROM A where id = 1; +DELETE FROM C where f1 = 2; +DELETE FROM A where id = 1; +DROP TABLE C; +DROP TABLE B; +DROP TABLE A; diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug57255.test b/mysql-test/suite/innodb_plugin/t/innodb_bug57255.test new file mode 100644 index 00000000000..96184c355b6 --- /dev/null +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug57255.test @@ -0,0 +1,36 @@ +# Test Bug #57255. Cascade deletes that affect different rows should not +# result in DB_FOREIGN_EXCEED_MAX_CASCADE error + +--source include/have_innodb_plugin.inc + +create table A(id int not null primary key) engine=innodb; + +create table B(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references A(id) on delete cascade) engine=innodb; + +create table C(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references B(id) on delete cascade) engine=innodb; + +insert into A values(1), (2); + +--disable_query_log +let $i=257; +while ($i) +{ +insert into B(f1) values(1); +dec $i; +} +let $i=486; +while ($i) +{ +insert into C(f1) values(2); +dec $i; +} +--enable_query_log + +# Following Deletes should not report error +DELETE FROM A where id = 1; +DELETE FROM C where f1 = 2; +DELETE FROM A where id = 1; + +DROP TABLE C; +DROP TABLE B; +DROP TABLE A; diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index a0f54f7288e..c5a3a2da9e2 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -1613,6 +1613,9 @@ row_update_cascade_for_mysql( trx = thr_get_trx(thr); + /* Increment fk_cascade_depth to record the recursive call depth on + a single update/delete that affects multiple tables chained + together with foreign key relations. */ thr->fk_cascade_depth++; if (thr->fk_cascade_depth > FK_MAX_CASCADE_DEL) { @@ -1624,6 +1627,12 @@ run_again: row_upd_step(thr); + /* The recursive call for cascading update/delete happens + in above row_upd_step(), reset the counter once we come + out of the recursive call, so it does not accumulate for + different row deletes */ + thr->fk_cascade_depth = 0; + err = trx->error_state; /* Note that the cascade node is a subnode of another InnoDB diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index e1ce8abb7e4..342e3e32bc1 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,7 @@ +2010-10-06 The InnoDB Team + * row/row0mysql.c, innodb_bug57255.result, innodb_bug57255.test + Fix Bug #Cascade Delete results in "Got error -1 from storage engine" + 2010-09-27 The InnoDB Team * row/row0sel.c, innodb_bug56716.result, innodb_bug56716.test: diff --git a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c index 78b3b2afdbf..9cabea507fb 100644 --- a/storage/innodb_plugin/row/row0mysql.c +++ b/storage/innodb_plugin/row/row0mysql.c @@ -1593,6 +1593,9 @@ row_update_cascade_for_mysql( trx = thr_get_trx(thr); + /* Increment fk_cascade_depth to record the recursive call depth on + a single update/delete that affects multiple tables chained + together with foreign key relations. */ thr->fk_cascade_depth++; if (thr->fk_cascade_depth > FK_MAX_CASCADE_DEL) { @@ -1604,6 +1607,12 @@ run_again: row_upd_step(thr); + /* The recursive call for cascading update/delete happens + in above row_upd_step(), reset the counter once we come + out of the recursive call, so it does not accumulate for + different row deletes */ + thr->fk_cascade_depth = 0; + err = trx->error_state; /* Note that the cascade node is a subnode of another InnoDB From 72f61e31d7aabf5f0612761530508b0cb49a95c8 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 6 Oct 2010 16:23:46 +0300 Subject: [PATCH 09/64] Fixed the .spec file to include the new wl1054 shared objects --- support-files/mysql.spec.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index b17948fb75c..15fe4a38a54 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -974,11 +974,17 @@ echo "=====" >> $STATUS_HISTORY %attr(755, root, root) %{_libdir}/mysql/plugin/mypluglib.so %attr(755, root, root) %{_libdir}/mysql/plugin/semisync_master.so %attr(755, root, root) %{_libdir}/mysql/plugin/semisync_slave.so +%attr(755, root, root) %{_libdir}/mysql/plugin/auth.so +%attr(755, root, root) %{_libdir}/mysql/plugin/auth_socket.so +%attr(755, root, root) %{_libdir}/mysql/plugin/auth_test_plugin.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/adt_null.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/libdaemon_example.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/mypluglib.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/semisync_master.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/semisync_slave.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth_socket.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth_test_plugin.so %if %{WITH_TCMALLOC} %attr(755, root, root) %{_libdir}/mysql/%{malloc_lib_target} @@ -1075,6 +1081,10 @@ echo "=====" >> $STATUS_HISTORY # merging BK trees) ############################################################################## %changelog +* Wed Oct 6 2010 Georgi Kodinov + +- Added example external authentication (WL#1054) plugin binaries + * Wed Aug 11 2010 Joerg Bruehe - With a recent spec file cleanup, names have changed: A "-community" part was dropped. From 35f5429eda94f2ce87e453653cd22298d5851cfa Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Wed, 6 Oct 2010 06:55:34 -0700 Subject: [PATCH 10/64] Manual port Bug #Bug #54582 "stack overflow when opening many tables linked with foreign keys at once" from mysql-5.1-security to mysql-5.5-security again. rb://391 approved by Heikki --- storage/innobase/dict/dict0load.c | 81 ++++++++++++++++++++++++--- storage/innobase/handler/ha_innodb.cc | 13 +++++ storage/innobase/include/db0err.h | 3 + storage/innobase/include/dict0load.h | 2 + storage/innobase/include/dict0mem.h | 21 +++++++ storage/innobase/include/que0que.h | 3 + storage/innobase/row/row0merge.c | 2 +- storage/innobase/row/row0mysql.c | 21 ++++++- storage/innobase/ut/ut0ut.c | 2 + 9 files changed, 138 insertions(+), 10 deletions(-) diff --git a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c index 6bd15f0556a..74f108fcf8e 100644 --- a/storage/innobase/dict/dict0load.c +++ b/storage/innobase/dict/dict0load.c @@ -1718,17 +1718,28 @@ err_exit: err = dict_load_indexes(table, heap); + /* Initialize table foreign_child value. Its value could be + changed when dict_load_foreigns() is called below */ + table->fk_max_recusive_level = 0; + /* If the force recovery flag is set, we open the table irrespective of the error condition, since the user may want to dump data from the clustered index. However we load the foreign key information only if all indexes were loaded. */ if (!cached) { } else if (err == DB_SUCCESS) { - err = dict_load_foreigns(table->name, TRUE); + err = dict_load_foreigns(table->name, TRUE, TRUE); + + if (err != DB_SUCCESS) { + dict_table_remove_from_cache(table); + table = NULL; + } } else if (!srv_force_recovery) { dict_table_remove_from_cache(table); table = NULL; } + + table->fk_max_recusive_level = 0; #if 0 if (err != DB_SUCCESS && table != NULL) { @@ -1952,8 +1963,12 @@ dict_load_foreign( /*==============*/ const char* id, /*!< in: foreign constraint id as a null-terminated string */ - ibool check_charsets) + ibool check_charsets, /*!< in: TRUE=check charset compatibility */ + ibool check_recursive) + /*!< in: Whether to record the foreign table + parent count to avoid unlimited recursive + load of chained foreign tables */ { dict_foreign_t* foreign; dict_table_t* sys_foreign; @@ -1967,6 +1982,8 @@ dict_load_foreign( ulint len; ulint n_fields_and_type; mtr_t mtr; + dict_table_t* for_table; + dict_table_t* ref_table; ut_ad(mutex_own(&(dict_sys->mutex))); @@ -2051,11 +2068,54 @@ dict_load_foreign( dict_load_foreign_cols(id, foreign); - /* If the foreign table is not yet in the dictionary cache, we - have to load it so that we are able to make type comparisons - in the next function call. */ + ref_table = dict_table_check_if_in_cache_low( + foreign->referenced_table_name); - dict_table_get_low(foreign->foreign_table_name); + /* We could possibly wind up in a deep recursive calls if + we call dict_table_get_low() again here if there + is a chain of tables concatenated together with + foreign constraints. In such case, each table is + both a parent and child of the other tables, and + act as a "link" in such table chains. + To avoid such scenario, we would need to check the + number of ancesters the current table has. If that + exceeds DICT_FK_MAX_CHAIN_LEN, we will stop loading + the child table. + Foreign constraints are loaded in a Breath First fashion, + that is, the index on FOR_NAME is scanned first, and then + index on REF_NAME. So foreign constrains in which + current table is a child (foreign table) are loaded first, + and then those constraints where current table is a + parent (referenced) table. + Thus we could check the parent (ref_table) table's + reference count (fk_max_recusive_level) to know how deep the + recursive call is. If the parent table (ref_table) is already + loaded, and its fk_max_recusive_level is larger than + DICT_FK_MAX_CHAIN_LEN, we will stop the recursive loading + by skipping loading the child table. It will not affect foreign + constraint check for DMLs since child table will be loaded + at that time for the constraint check. */ + if (!ref_table + || ref_table->fk_max_recusive_level < DICT_FK_MAX_RECURSIVE_LOAD) { + + /* If the foreign table is not yet in the dictionary cache, we + have to load it so that we are able to make type comparisons + in the next function call. */ + + for_table = dict_table_get_low(foreign->foreign_table_name); + + if (for_table && ref_table && check_recursive) { + /* This is to record the longest chain of ancesters + this table has, if the parent has more ancesters + than this table has, record it after add 1 (for this + parent */ + if (ref_table->fk_max_recusive_level + >= for_table->fk_max_recusive_level) { + for_table->fk_max_recusive_level = + ref_table->fk_max_recusive_level + 1; + } + } + } /* Note that there may already be a foreign constraint object in the dictionary cache for this constraint: then the following @@ -2080,6 +2140,8 @@ ulint dict_load_foreigns( /*===============*/ const char* table_name, /*!< in: table name */ + ibool check_recursive,/*!< in: Whether to check recursive + load of tables chained by FK */ ibool check_charsets) /*!< in: TRUE=check charset compatibility */ { @@ -2181,7 +2243,7 @@ loop: /* Load the foreign constraint definition to the dictionary cache */ - err = dict_load_foreign(id, check_charsets); + err = dict_load_foreign(id, check_charsets, check_recursive); if (err != DB_SUCCESS) { btr_pcur_close(&pcur); @@ -2209,6 +2271,11 @@ load_next_index: mtr_start(&mtr); + /* Switch to scan index on REF_NAME, fk_max_recusive_level + already been updated when scanning FOR_NAME index, no need to + update again */ + check_recursive = FALSE; + goto start_load; } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index eafc73b4f87..25148fce24d 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -901,6 +901,19 @@ convert_error_code_to_mysql( case DB_INTERRUPTED: my_error(ER_QUERY_INTERRUPTED, MYF(0)); /* fall through */ + + case DB_FOREIGN_EXCEED_MAX_CASCADE: + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + HA_ERR_ROW_IS_REFERENCED, + "InnoDB: Cannot delete/update " + "rows with cascading foreign key " + "constraints that exceed max " + "depth of %d. Please " + "drop extra constraints and try " + "again", DICT_FK_MAX_RECURSIVE_LOAD); + + /* fall through */ + case DB_ERROR: default: return(-1); /* unspecified error */ diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h index f84ce2d15aa..01bb1b80754 100644 --- a/storage/innobase/include/db0err.h +++ b/storage/innobase/include/db0err.h @@ -101,6 +101,9 @@ enum db_err { requested but this storage does not exist itself or the stats for a given table do not exist */ + DB_FOREIGN_EXCEED_MAX_CASCADE, /* Foreign key constraint related + cascading delete/update exceeds + maximum allowed depth */ /* The following are partial failure codes */ DB_FAIL = 1000, diff --git a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict0load.h index 05d3532d59a..f009f221f32 100644 --- a/storage/innobase/include/dict0load.h +++ b/storage/innobase/include/dict0load.h @@ -200,6 +200,8 @@ ulint dict_load_foreigns( /*===============*/ const char* table_name, /*!< in: table name */ + ibool check_recursive,/*!< in: Whether to check recursive + load of tables chained by FK */ ibool check_charsets);/*!< in: TRUE=check charsets compatibility */ /********************************************************************//** diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 75f9acd6b26..d448e57e395 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -116,6 +116,21 @@ ROW_FORMAT=REDUNDANT. */ in table->flags. */ /* @} */ +/** Tables could be chained together with Foreign key constraint. When +first load the parent table, we would load all of its descedents. +This could result in rescursive calls and out of stack error eventually. +DICT_FK_MAX_RECURSIVE_LOAD defines the maximum number of recursive loads, +when exceeded, the child table will not be loaded. It will be loaded when +the foreign constraint check needs to be run. */ +#define DICT_FK_MAX_RECURSIVE_LOAD 255 + +/** Similarly, when tables are chained together with foreign key constraints +with on cascading delete/update clause, delete from parent table could +result in recursive cascading calls. This defines the maximum number of +such cascading deletes/updates allowed. When exceeded, the delete from +parent table will fail, and user has to drop excessive foreign constraint +before proceeds. */ +#define FK_MAX_CASCADE_DEL 255 /**********************************************************************//** Creates a table memory object. @@ -469,6 +484,12 @@ struct dict_table_struct{ NOT allowed until this count gets to zero; MySQL does NOT itself check the number of open handles at drop */ + unsigned fk_max_recusive_level:8; + /*!< maximum recursive level we support when + loading tables chained together with FK + constraints. If exceeds this level, we will + stop loading child table into memory along with + its parent table */ ulint n_foreign_key_checks_running; /*!< count of how many foreign key check operations are currently being performed diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h index 09734bbb197..720da6dcb46 100644 --- a/storage/innobase/include/que0que.h +++ b/storage/innobase/include/que0que.h @@ -381,6 +381,9 @@ struct que_thr_struct{ thus far */ ulint lock_state; /*!< lock state of thread (table or row) */ + ulint fk_cascade_depth; /*!< maximum cascading call depth + supported for foreign key constraint + related delete/updates */ }; #define QUE_THR_MAGIC_N 8476583 diff --git a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c index 38ec4bff08f..1b96ff50e66 100644 --- a/storage/innobase/row/row0merge.c +++ b/storage/innobase/row/row0merge.c @@ -2418,7 +2418,7 @@ row_merge_rename_tables( goto err_exit; } - err = dict_load_foreigns(old_name, TRUE); + err = dict_load_foreigns(old_name, FALSE, TRUE); if (err != DB_SUCCESS) { err_exit: diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index c12970b40ed..e0f85b3ebb4 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -635,6 +635,13 @@ handle_new_error: "InnoDB: " REFMAN "forcing-recovery.html" " for help.\n", stderr); break; + case DB_FOREIGN_EXCEED_MAX_CASCADE: + fprintf(stderr, "InnoDB: Cannot delete/update rows with" + " cascading foreign key constraints that exceed max" + " depth of %lu\n" + "Please drop excessive foreign constraints" + " and try again\n", (ulong) DICT_FK_MAX_RECURSIVE_LOAD); + break; default: fprintf(stderr, "InnoDB: unknown error code %lu\n", (ulong) err); @@ -1440,11 +1447,15 @@ row_update_for_mysql( run_again: thr->run_node = node; thr->prev_node = node; + thr->fk_cascade_depth = 0; row_upd_step(thr); err = trx->error_state; + /* Reset fk_cascade_depth back to 0 */ + thr->fk_cascade_depth = 0; + if (err != DB_SUCCESS) { que_thr_stop_for_mysql(thr); @@ -1640,6 +1651,12 @@ row_update_cascade_for_mysql( trx_t* trx; trx = thr_get_trx(thr); + + thr->fk_cascade_depth++; + + if (thr->fk_cascade_depth > FK_MAX_CASCADE_DEL) { + return (DB_FOREIGN_EXCEED_MAX_CASCADE); + } run_again: thr->run_node = node; thr->prev_node = node; @@ -2120,7 +2137,7 @@ row_table_add_foreign_constraints( name, reject_fks); if (err == DB_SUCCESS) { /* Check that also referencing constraints are ok */ - err = dict_load_foreigns(name, TRUE); + err = dict_load_foreigns(name, FALSE, TRUE); } if (err != DB_SUCCESS) { @@ -3993,7 +4010,7 @@ end: an ALTER, not in a RENAME. */ err = dict_load_foreigns( - new_name, !old_is_tmp || trx->check_foreigns); + new_name, FALSE, !old_is_tmp || trx->check_foreigns); if (err != DB_SUCCESS) { ut_print_timestamp(stderr); diff --git a/storage/innobase/ut/ut0ut.c b/storage/innobase/ut/ut0ut.c index 39978304696..39c60d2bc2f 100644 --- a/storage/innobase/ut/ut0ut.c +++ b/storage/innobase/ut/ut0ut.c @@ -693,6 +693,8 @@ ut_strerr( return("Lock structs have exhausted the buffer pool"); case DB_FOREIGN_DUPLICATE_KEY: return("Foreign key activated with duplicate keys"); + case DB_FOREIGN_EXCEED_MAX_CASCADE: + return("Foreign key cascade delete/update exceeds max depth"); case DB_TOO_MANY_CONCURRENT_TRXS: return("Too many concurrent transactions"); case DB_UNSUPPORTED: From 8642812c98b37f91f1cbbc58e0964702d1d37e23 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Wed, 6 Oct 2010 19:20:18 +0200 Subject: [PATCH 11/64] Bug #52131: SET and ENUM stored endian-dependent in binary log Replication SET and ENUM fields from a big-endian to a little- endian machine (or the opposite) that are represented using more than 1 byte (SET fields with more than 8 members or ENUM fields with more than 256 constants) will fail to replicate correctly when using row-based replication. The reason is that there are no pack() or unpack() functions for Field_set or Field_enum, which make them rely on Field::pack and Field::unpack. These functions pack data as strings, but since Field_set and Field_enum use integral types for representation, the fields are stored incorrectly on big-endian machines. This patch adds Field_enum::pack and Field_enum::unpack functions that store the integral value correctly in the binary log even on big-endian machines. Since Field_set inherits from Field_enum, it will use the same functions for packing and unpacking the field. sql/field.cc: Removing some obsolete debug printouts and adding Field_enum::pack and Field_enum::unpack functions. sql/field.h: Adding helper functions for packing and unpacking 16- and 24-bit integral types. Field_short::pack and Field_short::unpack now use these functions. sql/rpl_record.cc: Removing some obsolete debug printouts and adding some more useful ones. --- sql/field.cc | 53 +++++++++++++++++++---- sql/field.h | 106 +++++++++++++++++++++++++++++++++------------- sql/rpl_record.cc | 10 +++-- 3 files changed, 127 insertions(+), 42 deletions(-) diff --git a/sql/field.cc b/sql/field.cc index 728cd7e4090..b83b2bfae5a 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -7725,12 +7725,6 @@ void Field_blob::sql_type(String &res) const uchar *Field_blob::pack(uchar *to, const uchar *from, uint max_length, bool low_byte_first) { - DBUG_ENTER("Field_blob::pack"); - DBUG_PRINT("enter", ("to: 0x%lx; from: 0x%lx;" - " max_length: %u; low_byte_first: %d", - (ulong) to, (ulong) from, - max_length, low_byte_first)); - DBUG_DUMP("record", from, table->s->reclength); uchar *save= ptr; ptr= (uchar*) from; uint32 length=get_length(); // Length of from string @@ -7751,8 +7745,7 @@ uchar *Field_blob::pack(uchar *to, const uchar *from, memcpy(to+packlength, from,length); } ptr=save; // Restore org row pointer - DBUG_DUMP("packed", to, packlength + length); - DBUG_RETURN(to+packlength+length); + return to+packlength+length; } @@ -8396,6 +8389,50 @@ uint Field_enum::is_equal(Create_field *new_field) } +uchar *Field_enum::pack(uchar *to, const uchar *from, + uint max_length, bool low_byte_first) +{ + DBUG_ENTER("Field_enum::pack"); + DBUG_PRINT("debug", ("packlength: %d", packlength)); + DBUG_DUMP("from", from, packlength); + + switch (packlength) + { + case 1: + *to = *from; + DBUG_RETURN(to + 1); + case 2: DBUG_RETURN(pack_int16(to, from, low_byte_first)); + case 3: DBUG_RETURN(pack_int24(to, from, low_byte_first)); + case 4: DBUG_RETURN(pack_int32(to, from, low_byte_first)); + case 8: DBUG_RETURN(pack_int64(to, from, low_byte_first)); + default: + DBUG_ASSERT(0); + } +} + +const uchar *Field_enum::unpack(uchar *to, const uchar *from, + uint param_data, bool low_byte_first) +{ + DBUG_ENTER("Field_enum::unpack"); + DBUG_PRINT("debug", ("packlength: %d", packlength)); + DBUG_DUMP("from", from, packlength); + + switch (packlength) + { + case 1: + *to = *from; + DBUG_RETURN(from + 1); + + case 2: DBUG_RETURN(unpack_int16(to, from, low_byte_first)); + case 3: DBUG_RETURN(unpack_int24(to, from, low_byte_first)); + case 4: DBUG_RETURN(unpack_int32(to, from, low_byte_first)); + case 8: DBUG_RETURN(unpack_int64(to, from, low_byte_first)); + default: + DBUG_ASSERT(0); + } +} + + /** @return returns 1 if the fields are equally defined diff --git a/sql/field.h b/sql/field.h index 7b250c34fe4..d854b78f9a3 100644 --- a/sql/field.h +++ b/sql/field.h @@ -554,6 +554,48 @@ private: { return 0; } protected: + static void handle_int16(uchar *to, const uchar *from, + bool low_byte_first_from, bool low_byte_first_to) + { + int16 val; +#ifdef WORDS_BIGENDIAN + if (low_byte_first_from) + val = sint2korr(from); + else +#endif + shortget(val, from); + +#ifdef WORDS_BIGENDIAN + if (low_byte_first_to) + int2store(to, val); + else +#endif + shortstore(to, val); + } + + static void handle_int24(uchar *to, const uchar *from, + bool low_byte_first_from, bool low_byte_first_to) + { + int32 val; +#ifdef WORDS_BIGENDIAN + if (low_byte_first_from) + val = sint3korr(from); + else +#endif + val= (from[0] << 16) + (from[1] << 8) + from[2]; + +#ifdef WORDS_BIGENDIAN + if (low_byte_first_to) + int2store(to, val); + else +#endif + { + to[0]= 0xFF & (val >> 16); + to[1]= 0xFF & (val >> 8); + to[2]= 0xFF & val; + } + } + /* Helper function to pack()/unpack() int32 values */ @@ -598,6 +640,32 @@ protected: longlongstore(to, val); } + uchar *pack_int16(uchar *to, const uchar *from, bool low_byte_first_to) + { + handle_int16(to, from, table->s->db_low_byte_first, low_byte_first_to); + return to + sizeof(int16); + } + + const uchar *unpack_int16(uchar* to, const uchar *from, + bool low_byte_first_from) + { + handle_int16(to, from, low_byte_first_from, table->s->db_low_byte_first); + return from + sizeof(int16); + } + + uchar *pack_int24(uchar *to, const uchar *from, bool low_byte_first_to) + { + handle_int24(to, from, table->s->db_low_byte_first, low_byte_first_to); + return to + 3; + } + + const uchar *unpack_int24(uchar* to, const uchar *from, + bool low_byte_first_from) + { + handle_int24(to, from, low_byte_first_from, table->s->db_low_byte_first); + return from + 3; + } + uchar *pack_int32(uchar *to, const uchar *from, bool low_byte_first_to) { handle_int32(to, from, table->s->db_low_byte_first, low_byte_first_to); @@ -918,41 +986,13 @@ public: virtual uchar *pack(uchar* to, const uchar *from, uint max_length, bool low_byte_first) { - int16 val; -#ifdef WORDS_BIGENDIAN - if (table->s->db_low_byte_first) - val = sint2korr(from); - else -#endif - shortget(val, from); - -#ifdef WORDS_BIGENDIAN - if (low_byte_first) - int2store(to, val); - else -#endif - shortstore(to, val); - return to + sizeof(val); + return pack_int16(to, from, low_byte_first); } virtual const uchar *unpack(uchar* to, const uchar *from, uint param_data, bool low_byte_first) { - int16 val; -#ifdef WORDS_BIGENDIAN - if (low_byte_first) - val = sint2korr(from); - else -#endif - shortget(val, from); - -#ifdef WORDS_BIGENDIAN - if (table->s->db_low_byte_first) - int2store(to, val); - else -#endif - shortstore(to, val); - return from + sizeof(val); + return unpack_int16(to, from, low_byte_first); } }; @@ -1895,6 +1935,12 @@ public: bool has_charset(void) const { return TRUE; } /* enum and set are sorted as integers */ CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; } + + virtual uchar *pack(uchar *to, const uchar *from, + uint max_length, bool low_byte_first); + virtual const uchar *unpack(uchar *to, const uchar *from, + uint param_data, bool low_byte_first); + private: int do_save_field_metadata(uchar *first_byte); uint is_equal(Create_field *new_field); diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index 8219f70727e..dd16318303d 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -78,8 +78,6 @@ pack_row(TABLE *table, MY_BITMAP const* cols, unsigned int null_mask= 1U; for ( ; (field= *p_field) ; p_field++) { - DBUG_PRINT("debug", ("null_mask=%d; null_ptr=%p; row_data=%p; null_byte_count=%d", - null_mask, null_ptr, row_data, null_byte_count)); if (bitmap_is_set(cols, p_field - table->field)) { my_ptrdiff_t offset; @@ -110,6 +108,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols, field->field_name, field->real_type(), (ulong) old_pack_ptr, (ulong) pack_ptr, (int) (pack_ptr - old_pack_ptr))); + DBUG_DUMP("packed_data", old_pack_ptr, pack_ptr - old_pack_ptr); } null_mask <<= 1; @@ -380,8 +379,11 @@ unpack_row(Relay_log_info const *rli, } DBUG_ASSERT(null_mask & 0xFF); // One of the 8 LSB should be set - if (!((null_bits & null_mask) && tabledef->maybe_null(i))) - pack_ptr+= tabledef->calc_field_size(i, (uchar *) pack_ptr); + if (!((null_bits & null_mask) && tabledef->maybe_null(i))) { + uint32 len= tabledef->calc_field_size(i, (uchar *) pack_ptr); + DBUG_DUMP("field_data", pack_ptr, len); + pack_ptr+= len; + } null_mask <<= 1; } } From 498ee6bd19eabc85dcbd9abebc9cf6aeb79d1985 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Oct 2010 22:13:47 +0200 Subject: [PATCH 12/64] Fix bug #57345 --- storage/innobase/row/row0sel.c | 14 +++++++++++++- storage/innodb_plugin/ChangeLog | 6 +++++- storage/innodb_plugin/row/row0sel.c | 14 +++++++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index a64dd3151ee..ecb2c492706 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -3259,6 +3259,7 @@ row_search_for_mysql( mem_heap_t* heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint* offsets = offsets_; + ibool table_lock_waited = FALSE; *offsets_ = (sizeof offsets_) / sizeof *offsets_; @@ -3622,13 +3623,15 @@ shortcut_fails_too_big_rec: trx_assign_read_view(trx); prebuilt->sql_stat_start = FALSE; } else { +wait_table_again: err = lock_table(0, index->table, prebuilt->select_lock_type == LOCK_S ? LOCK_IS : LOCK_IX, thr); if (err != DB_SUCCESS) { - goto lock_wait_or_error; + table_lock_waited = TRUE; + goto lock_table_wait; } prebuilt->sql_stat_start = FALSE; } @@ -4408,6 +4411,7 @@ lock_wait_or_error: btr_pcur_store_position(pcur, &mtr); +lock_table_wait: mtr_commit(&mtr); mtr_has_extra_clust_latch = FALSE; @@ -4425,6 +4429,14 @@ lock_wait_or_error: thr->lock_state = QUE_THR_LOCK_NOLOCK; mtr_start(&mtr); + /* Table lock waited, go try to obtain table lock + again */ + if (table_lock_waited) { + table_lock_waited = FALSE; + + goto wait_table_again; + } + sel_restore_position_for_mysql(&same_user_rec, BTR_SEARCH_LEAF, pcur, moves_up, &mtr); diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 342e3e32bc1..c185215e65f 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,8 @@ +2010-10-11 The InnoDB Team + * row/row0sel.c + Fix Bug #57345 btr_pcur_store_position abort for load with + concurrent lock/unlock tables + 2010-10-06 The InnoDB Team * row/row0mysql.c, innodb_bug57255.result, innodb_bug57255.test Fix Bug #Cascade Delete results in "Got error -1 from storage engine" @@ -40,7 +45,6 @@ * handler/ha_innodb.cc Fix Bug #55382 Assignment with SELECT expressions takes unexpected S locks in READ COMMITTED ->>>>>>> MERGE-SOURCE 2010-07-27 The InnoDB Team diff --git a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c index 8b17bdc6ad3..cc7a7a6fe9b 100644 --- a/storage/innodb_plugin/row/row0sel.c +++ b/storage/innodb_plugin/row/row0sel.c @@ -3356,6 +3356,7 @@ row_search_for_mysql( mem_heap_t* heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint* offsets = offsets_; + ibool table_lock_waited = FALSE; rec_offs_init(offsets_); @@ -3742,13 +3743,15 @@ release_search_latch_if_needed: trx_assign_read_view(trx); prebuilt->sql_stat_start = FALSE; } else { +wait_table_again: err = lock_table(0, index->table, prebuilt->select_lock_type == LOCK_S ? LOCK_IS : LOCK_IX, thr); if (err != DB_SUCCESS) { - goto lock_wait_or_error; + table_lock_waited = TRUE; + goto lock_table_wait; } prebuilt->sql_stat_start = FALSE; } @@ -4559,6 +4562,7 @@ lock_wait_or_error: btr_pcur_store_position(pcur, &mtr); +lock_table_wait: mtr_commit(&mtr); mtr_has_extra_clust_latch = FALSE; @@ -4576,6 +4580,14 @@ lock_wait_or_error: thr->lock_state = QUE_THR_LOCK_NOLOCK; mtr_start(&mtr); + /* Table lock waited, go try to obtain table lock + again */ + if (table_lock_waited) { + table_lock_waited = FALSE; + + goto wait_table_again; + } + sel_restore_position_for_mysql(&same_user_rec, BTR_SEARCH_LEAF, pcur, moves_up, &mtr); From 1450cddf92e3a847b528f8882ec1723c1a658122 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Wed, 13 Oct 2010 13:29:34 +0400 Subject: [PATCH 13/64] Reverting a patch for Bug#45445 (cannot execute procedures with thread_stack set to 128k). Some platforms don't work with 4 * STACK_MIN_SIZE. Thus, reverting back to 8 * STACK_MIN_SIZE and waiting for another fix. --- sql/sp_head.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 52f658cbe0e..1fd4e9302c4 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1233,8 +1233,11 @@ sp_head::execute(THD *thd) The same with db_load_routine() required circa 7k bytes and 14k bytes accordingly. Hence, here we book the stack with some reasonable margin. + + Reverting back to 8 * STACK_MIN_SIZE until further fix. + 8 * STACK_MIN_SIZE is required on some exotic platforms. */ - if (check_stack_overrun(thd, 4 * STACK_MIN_SIZE, (uchar*)&old_packet)) + if (check_stack_overrun(thd, 8 * STACK_MIN_SIZE, (uchar*)&old_packet)) DBUG_RETURN(TRUE); /* init per-instruction memroot */ From 8a30cc4a79908452c5dabe50f93900c2eb873f66 Mon Sep 17 00:00:00 2001 From: smenon Date: Wed, 13 Oct 2010 21:54:45 +0200 Subject: [PATCH 14/64] Raise version number after cloning 5.5.7-rc --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index c272efe9214..dca7e548e50 100644 --- a/configure.in +++ b/configure.in @@ -27,7 +27,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.5.7-rc], [], [mysql]) +AC_INIT([MySQL Server], [5.5.8-rc], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From 6c1d9fd9a90117a1f8e605ec881d890618b51ac9 Mon Sep 17 00:00:00 2001 From: Calvin Sun Date: Thu, 21 Oct 2010 12:29:00 -0500 Subject: [PATCH 15/64] Fix an error introduced in a follow-up fix of Bug#57232 by Sunny Bains revno: 3185 revid: sunny.bains@oracle.com-20101018060544-wo81q6kbl3la1uq0 --- storage/innobase/os/os0sync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/os/os0sync.c b/storage/innobase/os/os0sync.c index 5c400ae31c5..65fdd49f839 100644 --- a/storage/innobase/os/os0sync.c +++ b/storage/innobase/os/os0sync.c @@ -136,7 +136,7 @@ os_cond_wait_timed( #ifndef __WIN__ const struct timespec* abstime /*!< in: timeout */ #else - ulint time_in_ms /*!< in: timeout in + DWORD time_in_ms /*!< in: timeout in milliseconds*/ #endif /* !__WIN__ */ ) @@ -655,7 +655,7 @@ os_event_wait_time_low( ut_a(event); if (time_in_usec != OS_SYNC_INFINITE_TIME) { - time_in_ms = time_in_ms / 1000; + time_in_ms = time_in_usec / 1000; err = WaitForSingleObject(event->handle, time_in_ms); } else { err = WaitForSingleObject(event->handle, INFINITE); From 1291c004775458f2f35e24730c9694f99b5b54d7 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Thu, 21 Oct 2010 23:34:57 -0700 Subject: [PATCH 16/64] Fix Bug #56791 Remove ios_mutex from InnoDB code rb://495 approved by Inaam --- storage/innobase/handler/ha_innodb.cc | 1 - storage/innobase/include/sync0sync.h | 1 - storage/innobase/srv/srv0start.c | 18 ------------------ 3 files changed, 20 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 97ddbfc8199..74c83e8d44b 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -240,7 +240,6 @@ static PSI_mutex_info all_innodb_mutexes[] = { {&ibuf_mutex_key, "ibuf_mutex", 0}, {&ibuf_pessimistic_insert_mutex_key, "ibuf_pessimistic_insert_mutex", 0}, - {&ios_mutex_key, "ios_mutex", 0}, {&kernel_mutex_key, "kernel_mutex", 0}, {&log_sys_mutex_key, "log_sys_mutex", 0}, # ifdef UNIV_MEM_DEBUG diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h index 940e583350a..fb3a24c5ee5 100644 --- a/storage/innobase/include/sync0sync.h +++ b/storage/innobase/include/sync0sync.h @@ -85,7 +85,6 @@ extern mysql_pfs_key_t hash_table_mutex_key; extern mysql_pfs_key_t ibuf_bitmap_mutex_key; extern mysql_pfs_key_t ibuf_mutex_key; extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key; -extern mysql_pfs_key_t ios_mutex_key; extern mysql_pfs_key_t log_sys_mutex_key; extern mysql_pfs_key_t log_flush_order_mutex_key; extern mysql_pfs_key_t kernel_mutex_key; diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index 67586de736c..d7ea3d5d3da 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -120,11 +120,6 @@ UNIV_INTERN enum srv_shutdown_state srv_shutdown_state = SRV_SHUTDOWN_NONE; /** Files comprising the system tablespace */ static os_file_t files[1000]; -/** Mutex protecting the ios count */ -static mutex_t ios_mutex; -/** Count of I/O operations in io_handler_thread() */ -static ulint ios; - /** io_handler_thread parameters for thread identification */ static ulint n[SRV_MAX_N_IO_THREADS + 6]; /** io_handler_thread identifiers */ @@ -152,11 +147,6 @@ UNIV_INTERN mysql_pfs_key_t srv_master_thread_key; UNIV_INTERN mysql_pfs_key_t srv_purge_thread_key; #endif /* UNIV_PFS_THREAD */ -#ifdef UNIV_PFS_MUTEX -/* Key to register ios_mutex_key with performance schema */ -UNIV_INTERN mysql_pfs_key_t ios_mutex_key; -#endif /* UNIV_PFS_MUTEX */ - /*********************************************************************//** Convert a numeric string that optionally ends in G or M, to a number containing megabytes. @@ -491,10 +481,6 @@ io_handler_thread( while (srv_shutdown_state != SRV_SHUTDOWN_EXIT_THREADS) { fil_aio_wait(segment); - - mutex_enter(&ios_mutex); - ios++; - mutex_exit(&ios_mutex); } /* We count the number of threads in os_thread_exit(). A created @@ -998,10 +984,6 @@ skip_size_check: srv_data_file_is_raw_partition[i] != 0); } - ios = 0; - - mutex_create(ios_mutex_key, &ios_mutex, SYNC_NO_ORDER_CHECK); - return(DB_SUCCESS); } From 112684b0ba31dbdc3f3b914a7f738793d28431fd Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Sun, 24 Oct 2010 22:51:21 -0700 Subject: [PATCH 17/64] Fix bug #57700 Latching order violation in row_truncate_table_for_mysql(). Approved by Sunny Bains --- storage/innodb_plugin/ChangeLog | 6 ++++++ storage/innodb_plugin/row/row0mysql.c | 23 ++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index cccd5c0550a..9033e5557f3 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,9 @@ +2010-10-24 The InnoDB Team + + * row/row0mysql.c + Fix Bug #57700 Latching order violation in + row_truncate_table_for_mysql() + 2010-10-20 The InnoDB Team * dict/dict0load.c diff --git a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c index 107af481b79..827be32bdf7 100644 --- a/storage/innodb_plugin/row/row0mysql.c +++ b/storage/innodb_plugin/row/row0mysql.c @@ -2771,15 +2771,6 @@ row_truncate_table_for_mysql( trx->table_id = table->id; - /* Lock all index trees for this table, as we will - truncate the table/index and possibly change their metadata. - All DML/DDL are blocked by table level lock, with - a few exceptions such as queries into information schema - about the table, MySQL could try to access index stats - for this kind of query, we need to use index locks to - sync up */ - dict_table_x_lock_indexes(table); - if (table->space && !table->dir_path_of_temp_table) { /* Discard and create the single-table tablespace. */ ulint space = table->space; @@ -2792,6 +2783,11 @@ row_truncate_table_for_mysql( dict_hdr_get_new_id(NULL, NULL, &space); + /* Lock all index trees for this table. We must + do so after dict_hdr_get_new_id() to preserve + the latch order */ + dict_table_x_lock_indexes(table); + if (space == ULINT_UNDEFINED || fil_create_new_single_table_tablespace( space, table->name, FALSE, flags, @@ -2825,6 +2821,15 @@ row_truncate_table_for_mysql( FIL_IBD_FILE_INITIAL_SIZE, &mtr); mtr_commit(&mtr); } + } else { + /* Lock all index trees for this table, as we will + truncate the table/index and possibly change their metadata. + All DML/DDL are blocked by table level lock, with + a few exceptions such as queries into information schema + about the table, MySQL could try to access index stats + for this kind of query, we need to use index locks to + sync up */ + dict_table_x_lock_indexes(table); } /* scan SYS_INDEXES for all indexes of the table */ From ef7982fd17b046d19e783ff1bea03af1602c381a Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 25 Oct 2010 18:11:58 +0300 Subject: [PATCH 18/64] Bug #57689: mysql_change_user() breaks user connection on older clients COM_CHANGE_USER was always handled like an implicit request to change the client plugin, so that the client can re-use the same code path for both normal login and COM_CHANGE_USER. However this doesn't really work well with old clients because they don't understand the request to change a client plugin. Fixed by implementing a special state in the code (and old client issuing COM_CHANGE_USER). In this state the server parses the COM_CHANGE_USER package and pushes back the password hash, the user name and the database to the input stream in the same order that the native password server side plugin expects. As a result it replies with an OK/FAIL just like the old server does thus making the new server compatible with older clients. No test case added, since it would requre an old client binary. Tested using accounts with and without passwords. Tested with a correct and incorrect password. --- sql/sql_acl.cc | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 49224444f5c..c741a50a1db 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -8091,6 +8091,24 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio, DBUG_RETURN (1); } + /* + If we're dealing with an older client we can't just send a change plugin + packet to re-initiate the authentication handshake, because the client + won't understand it. The good thing is that we don't need to : the old client + expects us to just check the user credentials here, which we can do by just reading + the cached data that are placed there by parse_com_change_user_packet() + In this case we just do nothing and behave as if normal authentication + should continue. + */ + if (!(mpvio->client_capabilities & CLIENT_PLUGIN_AUTH)) + { + DBUG_PRINT("info", ("old client sent a COM_CHANGE_USER")); + DBUG_ASSERT(mpvio->cached_client_reply.pkt); + /* get the status back so the read can process the cached result */ + mpvio->status= MPVIO_EXT::RESTART; + DBUG_RETURN(0); + } + DBUG_PRINT("info", ("requesting client to use the %s plugin", client_auth_plugin)); DBUG_RETURN(net_write_command(net, switch_plugin_request_buf[0], @@ -8574,8 +8592,16 @@ static int server_mpvio_write_packet(MYSQL_PLUGIN_VIO *param, int res; DBUG_ENTER("server_mpvio_write_packet"); - /* reset cached_client_reply */ - mpvio->cached_client_reply.pkt= 0; + /* + Reset cached_client_reply if not an old client doing mysql_change_user, + as this is where the password from COM_CHANGE_USER is stored. + */ + if (!((!(mpvio->client_capabilities & CLIENT_PLUGIN_AUTH)) && + mpvio->status == MPVIO_EXT::RESTART && + mpvio->cached_client_reply.plugin == + ((st_mysql_auth *) (plugin_decl(mpvio->plugin)->info))->client_auth_plugin + )) + mpvio->cached_client_reply.pkt= 0; /* for the 1st packet we wrap plugin data into the handshake packet */ if (mpvio->packets_written == 0) res= send_server_handshake_packet(mpvio, (char*) packet, packet_len); @@ -8641,6 +8667,15 @@ static int server_mpvio_read_packet(MYSQL_PLUGIN_VIO *param, uchar **buf) mpvio->packets_read++; DBUG_RETURN ((int) mpvio->cached_client_reply.pkt_len); } + + /* older clients don't support change of client plugin request */ + if (!(mpvio->client_capabilities & CLIENT_PLUGIN_AUTH)) + { + mpvio->status= MPVIO_EXT::FAILURE; + pkt_len= packet_error; + goto err; + } + /* But if the client has used the wrong plugin, the cached data are useless. Furthermore, we have to send a "change plugin" request From 840c602e83840c76c092c6d843eb83e7ff4aebb5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 26 Oct 2010 14:18:31 -0500 Subject: [PATCH 19/64] Bug#57720 - Windows Vista and possibly Windows 7 can return ERROR_TIMEOUT instead of WAIT_TIMEOUT from calls to SleepConditionVariableCS() which is used in os0sync.c; os_cond_wait_timeout() where it is mapped to sleep_condition_variable(). Consider ERROR_TIMEOUT to be a timeout just like WAIT_TIMEOUT. In addition, test for EINTR as a possible return value from pthread_cond_timeout() in the posix section of os_cond_wait_timeout(), even though it is not supposed to be returned, but just to be safe. --- storage/innobase/os/os0sync.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/storage/innobase/os/os0sync.c b/storage/innobase/os/os0sync.c index 65fdd49f839..2f481b76bda 100644 --- a/storage/innobase/os/os0sync.c +++ b/storage/innobase/os/os0sync.c @@ -142,14 +142,24 @@ os_cond_wait_timed( ) { #ifdef __WIN__ - BOOL ret; + BOOL ret; + DWORD err; ut_a(sleep_condition_variable != NULL); ret = sleep_condition_variable(cond, mutex, time_in_ms); - if (!ret && GetLastError() == WAIT_TIMEOUT) { - return(TRUE); + if (!ret) { + err = GetLastError(); + /* From http://msdn.microsoft.com/en-us/library/ms686301%28VS.85%29.aspx, + "Condition variables are subject to spurious wakeups + (those not associated with an explicit wake) and stolen wakeups + (another thread manages to run before the woken thread)." + Check for both types of timeouts. + Conditions are checked by the caller.*/ + if ((err == WAIT_TIMEOUT) || (err == ERROR_TIMEOUT)) { + return(TRUE); + } } ut_a(ret); @@ -163,12 +173,15 @@ os_cond_wait_timed( switch (ret) { case 0: case ETIMEDOUT: - break; + /* We play it safe by checking for EINTR even though + according to the POSIX documentation it can't return EINTR. */ + case EINTR: + break; default: fprintf(stderr, " InnoDB: pthread_cond_timedwait() returned: " "%d: abstime={%lu,%lu}\n", - ret, abstime->tv_sec, abstime->tv_nsec); + ret, abstime->tv_sec, abstime->tv_nsec); ut_error; } @@ -663,7 +676,7 @@ os_event_wait_time_low( if (err == WAIT_OBJECT_0) { return(0); - } else if (err == WAIT_TIMEOUT) { + } else if ((err == WAIT_TIMEOUT) || (err == ERROR_TIMEOUT)) { return(OS_SYNC_TIME_EXCEEDED); } From 26738c280f77962771d68c5b43becdffa8831c51 Mon Sep 17 00:00:00 2001 From: Inaam Rana Date: Tue, 26 Oct 2010 16:54:18 -0400 Subject: [PATCH 20/64] Bug #57611 ibdata file and continuous growing undo logs rb://498 Fix handling of update_undo_logs at trx commit. Previously, when rseg->update_undo_list grows beyond 500 the update_undo_logs were marked with state TRX_UNDO_TO_FREE which should have been TRX_UNDO_TO_PURGE. Approved by: Sunny Bains --- storage/innobase/trx/trx0undo.c | 18 ++++-------------- storage/innodb_plugin/trx/trx0undo.c | 18 ++++-------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/storage/innobase/trx/trx0undo.c b/storage/innobase/trx/trx0undo.c index 4547ee9ea64..329565943c8 100644 --- a/storage/innobase/trx/trx0undo.c +++ b/storage/innobase/trx/trx0undo.c @@ -1752,21 +1752,11 @@ trx_undo_set_state_at_finish( if (undo->size == 1 && mach_read_from_2(page_hdr + TRX_UNDO_PAGE_FREE) - < TRX_UNDO_PAGE_REUSE_LIMIT) { + < TRX_UNDO_PAGE_REUSE_LIMIT + && UT_LIST_GET_LEN(rseg->update_undo_list) < 500 + && UT_LIST_GET_LEN(rseg->insert_undo_list) < 500) { - /* This is a heuristic to avoid the problem of all UNDO - slots ending up in one of the UNDO lists. Previously if - the server crashed with all the slots in one of the lists, - transactions that required the slots of a different type - would fail for lack of slots. */ - - if (UT_LIST_GET_LEN(rseg->update_undo_list) < 500 - && UT_LIST_GET_LEN(rseg->insert_undo_list) < 500) { - - state = TRX_UNDO_CACHED; - } else { - state = TRX_UNDO_TO_FREE; - } + state = TRX_UNDO_CACHED; } else if (undo->type == TRX_UNDO_INSERT) { diff --git a/storage/innodb_plugin/trx/trx0undo.c b/storage/innodb_plugin/trx/trx0undo.c index c8a4b15e48b..76e88948e41 100644 --- a/storage/innodb_plugin/trx/trx0undo.c +++ b/storage/innodb_plugin/trx/trx0undo.c @@ -1823,21 +1823,11 @@ trx_undo_set_state_at_finish( if (undo->size == 1 && mach_read_from_2(page_hdr + TRX_UNDO_PAGE_FREE) - < TRX_UNDO_PAGE_REUSE_LIMIT) { + < TRX_UNDO_PAGE_REUSE_LIMIT + && UT_LIST_GET_LEN(rseg->update_undo_list) < 500 + && UT_LIST_GET_LEN(rseg->insert_undo_list) < 500) { - /* This is a heuristic to avoid the problem of all UNDO - slots ending up in one of the UNDO lists. Previously if - the server crashed with all the slots in one of the lists, - transactions that required the slots of a different type - would fail for lack of slots. */ - - if (UT_LIST_GET_LEN(rseg->update_undo_list) < 500 - && UT_LIST_GET_LEN(rseg->insert_undo_list) < 500) { - - state = TRX_UNDO_CACHED; - } else { - state = TRX_UNDO_TO_FREE; - } + state = TRX_UNDO_CACHED; } else if (undo->type == TRX_UNDO_INSERT) { From 1c3dc21f2a15e94425ded3f176fd2df5cb3eb025 Mon Sep 17 00:00:00 2001 From: Inaam Rana Date: Tue, 26 Oct 2010 17:06:24 -0400 Subject: [PATCH 21/64] Bug #57611 ibdata file and continuous growing undo logs rb://498 Fix handling of update_undo_logs at trx commit. Previously, when rseg->update_undo_list grows beyond 500 the update_undo_logs were marked with state TRX_UNDO_TO_FREE which should have been TRX_UNDO_TO_PURGE. In 5.5 we don't need the heuristic as we support multiple rollback segments. Approved by: Sunny Bains --- storage/innobase/trx/trx0undo.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/storage/innobase/trx/trx0undo.c b/storage/innobase/trx/trx0undo.c index 9162c82e423..ef877f4844d 100644 --- a/storage/innobase/trx/trx0undo.c +++ b/storage/innobase/trx/trx0undo.c @@ -1830,19 +1830,7 @@ trx_undo_set_state_at_finish( && mach_read_from_2(page_hdr + TRX_UNDO_PAGE_FREE) < TRX_UNDO_PAGE_REUSE_LIMIT) { - /* This is a heuristic to avoid the problem of all UNDO - slots ending up in one of the UNDO lists. Previously if - the server crashed with all the slots in one of the lists, - transactions that required the slots of a different type - would fail for lack of slots. */ - - if (UT_LIST_GET_LEN(rseg->update_undo_list) < 500 - && UT_LIST_GET_LEN(rseg->insert_undo_list) < 500) { - - state = TRX_UNDO_CACHED; - } else { - state = TRX_UNDO_TO_FREE; - } + state = TRX_UNDO_CACHED; } else if (undo->type == TRX_UNDO_INSERT) { From 431e3ee7c6a7b72b4dd2ba63862e13cb221e2f41 Mon Sep 17 00:00:00 2001 From: Inaam Rana Date: Tue, 26 Oct 2010 21:45:58 -0400 Subject: [PATCH 22/64] Fix compiler warning introduced by previous commit. --- storage/innobase/include/trx0undo.h | 2 -- storage/innobase/trx/trx0trx.c | 5 ++--- storage/innobase/trx/trx0undo.c | 4 ---- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h index 54809f9c2d5..937e9d7ef79 100644 --- a/storage/innobase/include/trx0undo.h +++ b/storage/innobase/include/trx0undo.h @@ -262,8 +262,6 @@ UNIV_INTERN page_t* trx_undo_set_state_at_finish( /*=========================*/ - trx_rseg_t* rseg, /*!< in: rollback segment memory object */ - trx_t* trx, /*!< in: transaction */ trx_undo_t* undo, /*!< in: undo log memory copy */ mtr_t* mtr); /*!< in: mtr */ /******************************************************************//** diff --git a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c index 6bae0527b53..7f2ca1f1471 100644 --- a/storage/innobase/trx/trx0trx.c +++ b/storage/innobase/trx/trx0trx.c @@ -753,8 +753,7 @@ trx_commit_off_kernel( mutex_enter(&(rseg->mutex)); if (trx->insert_undo != NULL) { - trx_undo_set_state_at_finish( - rseg, trx, trx->insert_undo, &mtr); + trx_undo_set_state_at_finish(trx->insert_undo, &mtr); } undo = trx->update_undo; @@ -769,7 +768,7 @@ trx_commit_off_kernel( transaction commit for this transaction. */ update_hdr_page = trx_undo_set_state_at_finish( - rseg, trx, undo, &mtr); + undo, &mtr); /* We have to do the cleanup for the update log while holding the rseg mutex because update log headers diff --git a/storage/innobase/trx/trx0undo.c b/storage/innobase/trx/trx0undo.c index ef877f4844d..4021a2ed573 100644 --- a/storage/innobase/trx/trx0undo.c +++ b/storage/innobase/trx/trx0undo.c @@ -1798,8 +1798,6 @@ UNIV_INTERN page_t* trx_undo_set_state_at_finish( /*=========================*/ - trx_rseg_t* rseg, /*!< in: rollback segment memory object */ - trx_t* trx __attribute__((unused)), /*!< in: transaction */ trx_undo_t* undo, /*!< in: undo log memory copy */ mtr_t* mtr) /*!< in: mtr */ { @@ -1808,10 +1806,8 @@ trx_undo_set_state_at_finish( page_t* undo_page; ulint state; - ut_ad(trx); ut_ad(undo); ut_ad(mtr); - ut_ad(mutex_own(&rseg->mutex)); if (undo->id >= TRX_RSEG_N_SLOTS) { fprintf(stderr, "InnoDB: Error: undo->id is %lu\n", From 0fbc74a451b33b10b66c4f47000ac0f2733c69f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 27 Oct 2010 09:54:20 +0300 Subject: [PATCH 23/64] Bug #57730 Clean up references to InnoDB Plugin CMakeLists.txt: Remove the checks for mysql_storage_engine.cmake and MYSQL_VERSION_ID. ha_innodb.cc, ha_innodb.h: Remove the checks for MYSQL_VERSION_ID. --- storage/innobase/CMakeLists.txt | 32 +++++---------------------- storage/innobase/handler/ha_innodb.cc | 14 ------------ storage/innobase/handler/ha_innodb.h | 3 +-- 3 files changed, 6 insertions(+), 43 deletions(-) diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 6cfd3d754f6..fa45cc96687 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -13,7 +13,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# This is the CMakeLists for InnoDB Plugin +# This is the CMakeLists for InnoDB INCLUDE(CheckFunctionExists) INCLUDE(CheckCSourceCompiles) @@ -254,29 +254,7 @@ IF(WITH_INNODB) SET(WITH_INNOBASE_STORAGE_ENGINE TRUE) ENDIF() - -#The plugin's CMakeLists.txt still needs to work with previous versions of MySQL. -IF(EXISTS ${SOURCE_DIR}/storage/mysql_storage_engine.cmake) - # Old plugin support on Windows only, - # use tricks to force ha_innodb.dll name for DLL - INCLUDE(${SOURCE_DIR}/storage/mysql_storage_engine.cmake) - MYSQL_STORAGE_ENGINE(INNOBASE) - GET_TARGET_PROPERTY(LIB_LOCATION ha_innobase LOCATION) - IF(LIB_LOCATION) - SET_TARGET_PROPERTIES(ha_innobase PROPERTIES OUTPUT_NAME ha_innodb) - ENDIF() -ELSEIF (MYSQL_VERSION_ID LESS "50137") - # Windows only, no plugin support - IF (NOT SOURCE_SUBLIBS) - ADD_DEFINITIONS(-DMYSQL_SERVER) - ADD_LIBRARY(innobase STATIC ${INNOBASE_SOURCES}) - # Require mysqld_error.h, which is built as part of the GenError - ADD_DEPENDENCIES(innobase GenError) - ENDIF() -ELSE() - # New plugin support, cross-platform , base name for shared module is "ha_innodb" - MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE - DEFAULT - MODULE_OUTPUT_NAME ha_innodb - LINK_LIBRARIES ${ZLIB_LIBRARY}) -ENDIF() +MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE + DEFAULT + MODULE_OUTPUT_NAME ha_innodb + LINK_LIBRARIES ${ZLIB_LIBRARY}) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 74c83e8d44b..ce4cba3356f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -95,10 +95,6 @@ extern "C" { # define MYSQL_PLUGIN_IMPORT /* nothing */ # endif /* MYSQL_PLUGIN_IMPORT */ -#if MYSQL_VERSION_ID < 50124 -bool check_global_access(THD *thd, ulong want_access); -#endif /* MYSQL_VERSION_ID < 50124 */ - /** to protect innobase_open_files */ static mysql_mutex_t innobase_share_mutex; /** to force correct commit order in binlog */ @@ -1885,11 +1881,7 @@ innobase_convert_identifier( FALSE=id is an UTF-8 string */ { char nz[NAME_LEN + 1]; -#if MYSQL_VERSION_ID >= 50141 char nz2[NAME_LEN + 1 + EXPLAIN_FILENAME_MAX_EXTRA_LENGTH]; -#else /* MYSQL_VERSION_ID >= 50141 */ - char nz2[NAME_LEN + 1 + sizeof srv_mysql50_table_name_prefix]; -#endif /* MYSQL_VERSION_ID >= 50141 */ const char* s = id; int q; @@ -1907,13 +1899,9 @@ innobase_convert_identifier( nz[idlen] = 0; s = nz2; -#if MYSQL_VERSION_ID >= 50141 idlen = explain_filename((THD*) thd, nz, nz2, sizeof nz2, EXPLAIN_PARTITIONS_AS_COMMENT); goto no_quote; -#else /* MYSQL_VERSION_ID >= 50141 */ - idlen = filename_to_tablename(nz, nz2, sizeof nz2); -#endif /* MYSQL_VERSION_ID >= 50141 */ } /* See if the identifier needs to be quoted. */ @@ -1924,9 +1912,7 @@ innobase_convert_identifier( } if (q == EOF) { -#if MYSQL_VERSION_ID >= 50141 no_quote: -#endif /* MYSQL_VERSION_ID >= 50141 */ if (UNIV_UNLIKELY(idlen > buflen)) { idlen = buflen; } diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 9c78c60d71e..f05ea8801f0 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -276,14 +276,13 @@ int thd_binlog_format(const MYSQL_THD thd); */ void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all); -#if MYSQL_VERSION_ID > 50140 /** Check if binary logging is filtered for thread's current db. @param thd Thread handle @retval 1 the query is not filtered, 0 otherwise. */ bool thd_binlog_filter_ok(const MYSQL_THD thd); -#endif /* MYSQL_VERSION_ID > 50140 */ + /** Check if the query may generate row changes which may end up in the binary. From 26d81a2a9835bc16b59010ebd4017ac508215643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 27 Oct 2010 09:56:56 +0300 Subject: [PATCH 24/64] Bug #57707 InnoDB buf_page_t size has doubled on 32-bit systems buf_page_t: Remove the buf_pool pointer. Add buf_pool_index:6 next to buf_fix_count:19 (it was buf_fix_count:25). This will limit the number of concurrent transactions to somewhere around 524,288. buf_pool_index(buf_pool): A new function to determine the index of a buffer pool in buf_pool_ptr[]. buf_pool_ptr: Make this a dynamically allocated array instead of an array of pointers. Allocate the array in buf_pool_init() and free in buf_pool_free(). buf_pool_free_instance(): No longer free the buf_pool object, as it is allocated from a big array. buf_pool_from_bpage(), buf_pool_from_block(): Move the definitions to the beginning of the files, because some compilers have (had) problems with forward definitions of inline functions. Calculate the buffer pool from buf_pool_index. buf_pool_from_array(): Add debug assertions for input validation. --- storage/innobase/buf/buf0buf.c | 33 ++++++------- storage/innobase/include/buf0buf.h | 25 +++++++--- storage/innobase/include/buf0buf.ic | 77 ++++++++++++++++++----------- 3 files changed, 81 insertions(+), 54 deletions(-) diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c index abfde83a3bd..03133e81ceb 100644 --- a/storage/innobase/buf/buf0buf.c +++ b/storage/innobase/buf/buf0buf.c @@ -246,8 +246,8 @@ static const int WAIT_FOR_READ = 5000; /** Number of attemtps made to read in a page in the buffer pool */ static const ulint BUF_PAGE_READ_MAX_RETRIES = 100; -/** The buffer buf_pool of the database */ -UNIV_INTERN buf_pool_t* buf_pool_ptr[MAX_BUFFER_POOLS]; +/** The buffer pools of the database */ +UNIV_INTERN buf_pool_t* buf_pool_ptr; #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG static ulint buf_dbg_counter = 0; /*!< This is used to insert validation @@ -858,7 +858,7 @@ buf_block_init( block->frame = frame; - block->page.buf_pool = buf_pool; + block->page.buf_pool_index = buf_pool_index(buf_pool); block->page.state = BUF_BLOCK_NOT_USED; block->page.buf_fix_count = 0; block->page.io_fix = BUF_IO_NONE; @@ -1280,8 +1280,6 @@ buf_pool_free_instance( mem_free(buf_pool->chunks); hash_table_free(buf_pool->page_hash); hash_table_free(buf_pool->zip_hash); - mem_free(buf_pool); - buf_pool = NULL; } /********************************************************************//** @@ -1294,25 +1292,22 @@ buf_pool_init( ulint total_size, /*!< in: size of the total pool in bytes */ ulint n_instances) /*!< in: number of instances */ { - ulint i; + ulint i; + const ulint size = total_size / n_instances; + + ut_ad(n_instances < MAX_BUFFER_POOLS); + ut_ad(n_instances == srv_buf_pool_instances); /* We create an extra buffer pool instance, this instance is used for flushing the flush lists, to keep track of n_flush for all the buffer pools and also used as a waiting object during flushing. */ + buf_pool_ptr = mem_zalloc(n_instances * sizeof *buf_pool_ptr); + for (i = 0; i < n_instances; i++) { - buf_pool_t* ptr; - ulint size; - - ptr = mem_zalloc(sizeof(*ptr)); - - size = total_size / n_instances; - - buf_pool_ptr[i] = ptr; + buf_pool_t* ptr = &buf_pool_ptr[i]; if (buf_pool_init_instance(ptr, size, i) != DB_SUCCESS) { - mem_free(buf_pool_ptr[i]); - /* Free all the instances created so far. */ buf_pool_free(i); @@ -1341,8 +1336,10 @@ buf_pool_free( for (i = 0; i < n_instances; i++) { buf_pool_free_instance(buf_pool_from_array(i)); - buf_pool_ptr[i] = NULL; } + + mem_free(buf_pool_ptr); + buf_pool_ptr = NULL; } /********************************************************************//** @@ -3685,7 +3682,7 @@ err_exit: bpage = buf_buddy_alloc(buf_pool, sizeof *bpage, &lru); /* Initialize the buf_pool pointer. */ - bpage->buf_pool = buf_pool; + bpage->buf_pool_index = buf_pool_index(buf_pool); /* If buf_buddy_alloc() allocated storage from the LRU list, it released and reacquired buf_pool->mutex. Thus, we must diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index b0fff919918..a42eba57fd2 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -69,7 +69,7 @@ Created 11/5/1995 Heikki Tuuri #define BUF_POOL_WATCH_SIZE 1 /*!< Maximum number of concurrent buffer pool watches */ -extern buf_pool_t* buf_pool_ptr[MAX_BUFFER_POOLS]; /*!< The buffer pools +extern buf_pool_t* buf_pool_ptr; /*!< The buffer pools of the database */ #ifdef UNIV_DEBUG extern ibool buf_debug_prints;/*!< If this is set TRUE, the program @@ -1034,6 +1034,15 @@ buf_page_address_fold( ulint space, /*!< in: space id */ ulint offset) /*!< in: offset of the page within space */ __attribute__((const)); +/********************************************************************//** +Calculates the index of a buffer pool to the buf_pool[] array. +@return the position of the buffer pool in buf_pool[] */ +UNIV_INLINE +ulint +buf_pool_index( +/*===========*/ + const buf_pool_t* buf_pool) /*!< in: buffer pool */ + __attribute__((nonnull, const)); /******************************************************************//** Returns the buffer pool instance given a page instance @return buf_pool */ @@ -1065,8 +1074,9 @@ Returns the buffer pool instance given its array index UNIV_INLINE buf_pool_t* buf_pool_from_array( -/*====================*/ - ulint index); /*!< in: array index to get buffer pool instance from */ +/*================*/ + ulint index); /*!< in: array index to get + buffer pool instance from */ /******************************************************************//** Returns the control block of a file page, NULL if not found. @return block, NULL if not found */ @@ -1204,8 +1214,13 @@ struct buf_page_struct{ unsigned io_fix:2; /*!< type of pending I/O operation; also protected by buf_pool->mutex @see enum buf_io_fix */ - unsigned buf_fix_count:25;/*!< count of how manyfold this block + unsigned buf_fix_count:19;/*!< count of how manyfold this block is currently bufferfixed */ + unsigned buf_pool_index:6;/*!< index number of the buffer pool + that this block belongs to */ +# if MAX_BUFFER_POOLS > 64 +# error "MAX_BUFFER_POOLS > 64; redefine buf_pool_index:6" +# endif /* @} */ #endif /* !UNIV_HOTBACKUP */ page_zip_des_t zip; /*!< compressed page; zip.data @@ -1324,8 +1339,6 @@ struct buf_page_struct{ frees a page in buffer pool */ # endif /* UNIV_DEBUG_FILE_ACCESSES */ #endif /* !UNIV_HOTBACKUP */ - buf_pool_t* buf_pool; /*!< buffer pool instance this - page belongs to */ }; /** The buffer control block structure */ diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic index 713b7cb990d..e2e83de0a78 100644 --- a/storage/innobase/include/buf0buf.ic +++ b/storage/innobase/include/buf0buf.ic @@ -46,6 +46,48 @@ buf_pool_get_curr_size(void) return(srv_buf_pool_curr_size); } +/********************************************************************//** +Calculates the index of a buffer pool to the buf_pool[] array. +@return the position of the buffer pool in buf_pool[] */ +UNIV_INLINE +ulint +buf_pool_index( +/*===========*/ + const buf_pool_t* buf_pool) /*!< in: buffer pool */ +{ + ulint i = buf_pool - buf_pool_ptr; + ut_ad(i < MAX_BUFFER_POOLS); + ut_ad(i < srv_buf_pool_instances); + return(i); +} + +/******************************************************************//** +Returns the buffer pool instance given a page instance +@return buf_pool */ +UNIV_INLINE +buf_pool_t* +buf_pool_from_bpage( +/*================*/ + const buf_page_t* bpage) /*!< in: buffer pool page */ +{ + ulint i; + i = bpage->buf_pool_index; + ut_ad(i < srv_buf_pool_instances); + return(&buf_pool_ptr[i]); +} + +/******************************************************************//** +Returns the buffer pool instance given a block instance +@return buf_pool */ +UNIV_INLINE +buf_pool_t* +buf_pool_from_block( +/*================*/ + const buf_block_t* block) /*!< in: block */ +{ + return(buf_pool_from_bpage(&block->page)); +} + /*********************************************************************//** Gets the current size of buffer buf_pool in pages. @return size in pages*/ @@ -885,33 +927,6 @@ buf_block_buf_fix_dec( #endif } -/******************************************************************//** -Returns the buffer pool instance given a page instance -@return buf_pool */ -UNIV_INLINE -buf_pool_t* -buf_pool_from_bpage( -/*================*/ - const buf_page_t* bpage) /*!< in: buffer pool page */ -{ - /* Every page must be in some buffer pool. */ - ut_ad(bpage->buf_pool != NULL); - - return(bpage->buf_pool); -} - -/******************************************************************//** -Returns the buffer pool instance given a block instance -@return buf_pool */ -UNIV_INLINE -buf_pool_t* -buf_pool_from_block( -/*================*/ - const buf_block_t* block) /*!< in: block */ -{ - return(buf_pool_from_bpage(&block->page)); -} - /******************************************************************//** Returns the buffer pool instance given space and offset of page @return buffer pool */ @@ -929,7 +944,7 @@ buf_pool_get( ignored_offset = offset >> 6; /* 2log of BUF_READ_AHEAD_AREA (64)*/ fold = buf_page_address_fold(space, ignored_offset); index = fold % srv_buf_pool_instances; - return buf_pool_ptr[index]; + return(&buf_pool_ptr[index]); } /******************************************************************//** @@ -939,10 +954,12 @@ UNIV_INLINE buf_pool_t* buf_pool_from_array( /*================*/ - ulint index) /*!< in: array index to get + ulint index) /*!< in: array index to get buffer pool instance from */ { - return buf_pool_ptr[index]; + ut_ad(index < MAX_BUFFER_POOLS); + ut_ad(index < srv_buf_pool_instances); + return(&buf_pool_ptr[index]); } /******************************************************************//** From 712beace38e9a621eb015663d4db4ce0ec0c5fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 27 Oct 2010 21:50:45 +0300 Subject: [PATCH 25/64] Fix a bogus debug assertion in the fix of Bug #57707. buf_pool_init(): Replace ut_ad(n_instances < MAX_BUFFER_POOLS) with ut_ad(n_instances <= MAX_BUFFER_POOLS). (Spotted by Michael Izioumtchenko.) Add ut_ad(n_instances > 0). --- storage/innobase/buf/buf0buf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c index 03133e81ceb..b79b5634957 100644 --- a/storage/innobase/buf/buf0buf.c +++ b/storage/innobase/buf/buf0buf.c @@ -1295,7 +1295,8 @@ buf_pool_init( ulint i; const ulint size = total_size / n_instances; - ut_ad(n_instances < MAX_BUFFER_POOLS); + ut_ad(n_instances > 0); + ut_ad(n_instances <= MAX_BUFFER_POOLS); ut_ad(n_instances == srv_buf_pool_instances); /* We create an extra buffer pool instance, this instance is used From 3fb574bf03d5c4e118d29acbc192058243a21404 Mon Sep 17 00:00:00 2001 From: Calvin Sun Date: Wed, 27 Oct 2010 17:06:20 -0500 Subject: [PATCH 26/64] Fixed a C89 violation when atomic builtins are not defined, causing a compile error with MSVC. The problem was introduced in Revision: 3150 revid:marko.makela@oracle.com-20100809085837-s1nfx6gjf7l6ttab --- storage/innobase/ibuf/ibuf0ibuf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index 7ef577e5178..ab42f1ad4f3 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -1363,12 +1363,12 @@ ibuf_add_ops( const ulint* ops) /*!< in: operation counts */ { + ulint i; + #ifndef HAVE_ATOMIC_BUILTINS ut_ad(mutex_own(&ibuf_mutex)); #endif /* !HAVE_ATOMIC_BUILTINS */ - ulint i; - for (i = 0; i < IBUF_OP_COUNT; i++) { #ifdef HAVE_ATOMIC_BUILTINS os_atomic_increment_ulint(&arr[i], ops[i]); From ec51b47954455b4714efbbccdeb9f7e11c17a60a Mon Sep 17 00:00:00 2001 From: Calvin Sun Date: Thu, 28 Oct 2010 00:34:53 -0500 Subject: [PATCH 27/64] Bug#52062: Compiler warning in os0file.c on windows 64-bit On Windows, the parameter for number of bytes passed into WriteFile() and ReadFile() is DWORD. Casting is needed to silence the warning on 64-bit Windows. Also, adding several asserts to ensure the variable for number of bytes is no more than 32 bits, even on 64-bit Windows. rb://415 Approved by: Inaam --- storage/innobase/os/os0file.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index 3d1577fe3ca..93d2f72746d 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -2400,7 +2400,10 @@ os_file_read_func( ulint i; #endif /* !UNIV_HOTBACKUP */ + /* On 64-bit Windows, ulint is 64 bits. But offset and n should be + no more than 32 bits. */ ut_a((offset & 0xFFFFFFFFUL) == offset); + ut_a((n & 0xFFFFFFFFUL) == n); os_n_file_reads++; os_bytes_read_since_printout += n; @@ -2526,7 +2529,10 @@ os_file_read_no_error_handling_func( ulint i; #endif /* !UNIV_HOTBACKUP */ + /* On 64-bit Windows, ulint is 64 bits. But offset and n should be + no more than 32 bits. */ ut_a((offset & 0xFFFFFFFFUL) == offset); + ut_a((n & 0xFFFFFFFFUL) == n); os_n_file_reads++; os_bytes_read_since_printout += n; @@ -2658,7 +2664,10 @@ os_file_write_func( ulint i; #endif /* !UNIV_HOTBACKUP */ - ut_a((offset & 0xFFFFFFFF) == offset); + /* On 64-bit Windows, ulint is 64 bits. But offset and n should be + no more than 32 bits. */ + ut_a((offset & 0xFFFFFFFFUL) == offset); + ut_a((n & 0xFFFFFFFFUL) == n); os_n_file_writes++; @@ -3621,6 +3630,10 @@ os_aio_array_reserve_slot( ulint slots_per_seg; ulint local_seg; +#ifdef WIN_ASYNC_IO + ut_a((len & 0xFFFFFFFFUL) == len); +#endif + /* No need of a mutex. Only reading constant fields */ slots_per_seg = array->n_slots / array->n_segments; @@ -3996,6 +4009,9 @@ os_aio_func( ut_ad(n % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(os_aio_validate()); +#ifdef WIN_ASYNC_IO + ut_ad((n & 0xFFFFFFFFUL) == n); +#endif wake_later = mode & OS_AIO_SIMULATED_WAKE_LATER; mode = mode & (~OS_AIO_SIMULATED_WAKE_LATER); @@ -4271,16 +4287,18 @@ os_aio_windows_handle( __FILE__, __LINE__); #endif + ut_a((slot->len & 0xFFFFFFFFUL) == slot->len); + switch (slot->type) { case OS_FILE_WRITE: ret = WriteFile(slot->file, slot->buf, - slot->len, &len, + (DWORD) slot->len, &len, &(slot->control)); break; case OS_FILE_READ: ret = ReadFile(slot->file, slot->buf, - slot->len, &len, + (DWORD) slot->len, &len, &(slot->control)); break; From 1a9083b94ab0fef7dbf29fe6069f588f8a4acab5 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Thu, 28 Oct 2010 12:08:09 +0200 Subject: [PATCH 28/64] post merge fix --- sql/ha_partition.h | 12 ------------ sql/sql_partition_admin.cc | 2 ++ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 785d2388652..f1abc0cefe2 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -935,22 +935,16 @@ private: /* lock already taken */ if (auto_increment_safe_stmt_log_lock) return; -#ifdef WITH_PARTITION_STORAGE_ENGINE DBUG_ASSERT(table_share->ha_part_data && !auto_increment_lock); -#endif if(table_share->tmp_table == NO_TMP_TABLE) { auto_increment_lock= TRUE; -#ifdef WITH_PARTITION_STORAGE_ENGINE mysql_mutex_lock(&table_share->ha_part_data->LOCK_auto_inc); -#endif } } virtual void unlock_auto_increment() { -#ifdef WITH_PARTITION_STORAGE_ENGINE DBUG_ASSERT(table_share->ha_part_data); -#endif /* If auto_increment_safe_stmt_log_lock is true, we have to keep the lock. It will be set to false and thus unlocked at the end of the statement by @@ -958,25 +952,19 @@ private: */ if(auto_increment_lock && !auto_increment_safe_stmt_log_lock) { -#ifdef WITH_PARTITION_STORAGE_ENGINE mysql_mutex_unlock(&table_share->ha_part_data->LOCK_auto_inc); -#endif auto_increment_lock= FALSE; } } virtual void set_auto_increment_if_higher(Field *field) { -#ifdef WITH_PARTITION_STORAGE_ENGINE ulonglong nr= (((Field_num*) field)->unsigned_flag || field->val_int() > 0) ? field->val_int() : 0; -#endif lock_auto_increment(); -#ifdef WITH_PARTITION_STORAGE_ENGINE DBUG_ASSERT(table_share->ha_part_data->auto_inc_initialized == TRUE); /* must check when the mutex is taken */ if (nr >= table_share->ha_part_data->next_auto_inc_val) table_share->ha_part_data->next_auto_inc_val= nr + 1; -#endif unlock_auto_increment(); } diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc index 98750314a4a..8f6ab5803d7 100644 --- a/sql/sql_partition_admin.cc +++ b/sql/sql_partition_admin.cc @@ -18,7 +18,9 @@ #include "sql_lex.h" // Sql_statement #include "sql_admin.h" // Analyze/Check/.._table_statement #include "sql_partition_admin.h" // Alter_table_*_partition +#ifdef WITH_PARTITION_STORAGE_ENGINE #include "ha_partition.h" // ha_partition +#endif #include "sql_base.h" // open_and_lock_tables #ifndef WITH_PARTITION_STORAGE_ENGINE From e3decfa0aed2f2240eda7f0f92b14ff3a791b8d4 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Thu, 28 Oct 2010 20:12:23 +0300 Subject: [PATCH 29/64] Fix a compilation warning: /export/home/pb2/build/sb_0-2459340-1288264809.63/mysql-5.5.8-ga/storage/innobase/os/os0sync.c: In function 'os_cond_wait_timed': /export/home/pb2/build/sb_0-2459340-1288264809.63/mysql-5.5.8-ga/storage/innobase/os/os0sync.c:184: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'time_t' gmake[2]: *** [storage/innobase/CMakeFiles/innobase.dir/os/os0sync.c.o] Error 1 --- storage/innobase/os/os0sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/os/os0sync.c b/storage/innobase/os/os0sync.c index 2f481b76bda..24d36acecb2 100644 --- a/storage/innobase/os/os0sync.c +++ b/storage/innobase/os/os0sync.c @@ -181,7 +181,7 @@ os_cond_wait_timed( default: fprintf(stderr, " InnoDB: pthread_cond_timedwait() returned: " "%d: abstime={%lu,%lu}\n", - ret, abstime->tv_sec, abstime->tv_nsec); + ret, (ulong) abstime->tv_sec, (ulong) abstime->tv_nsec); ut_error; } From 6f03e15cf958da34b9517a1fc4ae6cf00c80b9de Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Thu, 28 Oct 2010 21:55:43 -0700 Subject: [PATCH 30/64] Merge fix for bug#57616 from mysql-5.5-security to mysql-5.5-innodb. --- storage/innobase/dict/dict0load.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c index 74f108fcf8e..9c6fa086d58 100644 --- a/storage/innobase/dict/dict0load.c +++ b/storage/innobase/dict/dict0load.c @@ -1733,13 +1733,13 @@ err_exit: if (err != DB_SUCCESS) { dict_table_remove_from_cache(table); table = NULL; + } else { + table->fk_max_recusive_level = 0; } } else if (!srv_force_recovery) { dict_table_remove_from_cache(table); table = NULL; } - - table->fk_max_recusive_level = 0; #if 0 if (err != DB_SUCCESS && table != NULL) { From c3f923857a1cfcec4f1d037b20427931f8fe9a51 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 27 Oct 2010 18:12:17 +0300 Subject: [PATCH 31/64] Bug #57774: Typos/ambiguities in the WL1054 comments Fixed few typos and added better wording as suggested. --- include/mysql/plugin_auth.h | 6 +++--- plugin/auth/dialog.c | 6 +++--- plugin/auth/test_plugin.c | 26 ++++++++------------------ 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/include/mysql/plugin_auth.h b/include/mysql/plugin_auth.h index 5622e9cdebe..420eb3bb80f 100644 --- a/include/mysql/plugin_auth.h +++ b/include/mysql/plugin_auth.h @@ -90,8 +90,8 @@ typedef struct st_mysql_server_auth_info int password_used; /** - Set to the name of the connected client if it can be resolved, or to - the address otherwise + Set to the name of the connected client host, if it can be resolved, + or to its IP address otherwise. */ const char *host_or_ip; @@ -107,7 +107,7 @@ typedef struct st_mysql_server_auth_info */ struct st_mysql_auth { - int interface_version; /**< version plugin uses */ + int interface_version; /** version plugin uses */ /** A plugin that a client must use for authentication with this server plugin. Can be NULL to mean "any plugin". diff --git a/plugin/auth/dialog.c b/plugin/auth/dialog.c index 54f88dd9b4e..41312f95674 100644 --- a/plugin/auth/dialog.c +++ b/plugin/auth/dialog.c @@ -52,7 +52,7 @@ /** first byte of the question string is the question "type". - It can be a "ordinary" or a "password" question. + It can be an "ordinary" or a "password" question. The last bit set marks a last question in the authentication exchange. */ #define ORDINARY_QUESTION "\2" @@ -176,7 +176,7 @@ mysql_declare_plugin_end; This plugin performs a dialog with the user, asking questions and reading answers. Depending on the client it may be desirable to do it using GUI, or console, with or without curses, or read answers - from a smardcard, for example. + from a smartcard, for example. To support all this variety, the dialog plugin has a callback function "authentication_dialog_ask". If the client has a function of this name @@ -256,7 +256,7 @@ static int perform_dialog(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) in mysql_change_user() the client sends the first packet, so the first vio->read_packet() does nothing (pkt == 0). - We send the "password", assuming the client knows what its doing. + We send the "password", assuming the client knows what it's doing. (in other words, the dialog plugin should be only set as a default authentication plugin on the client if the first question asks for a password - which will be sent in clear text, by the way) diff --git a/plugin/auth/test_plugin.c b/plugin/auth/test_plugin.c index caea7795833..161062d5b6c 100644 --- a/plugin/auth/test_plugin.c +++ b/plugin/auth/test_plugin.c @@ -17,22 +17,12 @@ /** @file - dialog client authentication plugin with examples + Test driver for the mysql-test/t/plugin_auth.test - dialog is a general purpose client authentication plugin, it simply - asks the user the question, as provided by the server and reports - the answer back to the server. No encryption is involved, - the answers are sent in clear text. - - Two examples are provided: two_questions server plugin, that asks - the password and an "Are you sure?" question with a reply "yes, of course". - It demonstrates the usage of "password" (input is hidden) and "ordinary" - (input can be echoed) questions, and how to mark the last question, - to avoid an extra roundtrip. - - And three_attempts plugin that gives the user three attempts to enter - a correct password. It shows the situation when a number of questions - is not known in advance. + This is a set of test plugins used to test the external authentication + implementation. + See the above test file for more details. + This test plugin is based on the dialog plugin example. */ #include @@ -55,7 +45,7 @@ /********************* SERVER SIDE ****************************************/ /** - dialog test plugin mimicing the ordinary auth mechanism. Used to test the auth plugin API + dialog test plugin mimicking the ordinary auth mechanism. Used to test the auth plugin API */ static int auth_test_plugin(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) { @@ -150,10 +140,10 @@ static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) in mysql_change_user() the client sends the first packet, so the first vio->read_packet() does nothing (pkt == 0). - We send the "password", assuming the client knows what its doing. + We send the "password", assuming the client knows what it's doing. (in other words, the dialog plugin should be only set as a default authentication plugin on the client if the first question - asks for a password - which will be sent in cleat text, by the way) + asks for a password - which will be sent in clear text, by the way) */ reply= mysql->passwd; } From 16feea410975e17c3cf24f8af92a3f32e8c24ba1 Mon Sep 17 00:00:00 2001 From: Calvin Sun Date: Wed, 27 Oct 2010 23:18:59 -0500 Subject: [PATCH 32/64] Bug#52062: Compiler warning in os0file.c on windows 64-bit On Windows, the parameter for number of bytes passed into WriteFile() and ReadFile() is DWORD. Casting is needed to silence the warning on 64-bit Windows. Also, adding several asserts to ensure the variable for number of bytes is no more than 32 bits, even on 64-bit Windows. This is for built-in InnoDB. rb://415 Approved by: Inaam --- storage/innobase/os/os0file.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index f269cd39673..566c50381e7 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -2207,7 +2207,10 @@ os_file_read( ibool retry; ulint i; + /* On 64-bit Windows, ulint is 64 bits. But offset and n should be + no more than 32 bits. */ ut_a((offset & 0xFFFFFFFFUL) == offset); + ut_a((n & 0xFFFFFFFFUL) == n); os_n_file_reads++; os_bytes_read_since_printout += n; @@ -2324,7 +2327,10 @@ os_file_read_no_error_handling( ibool retry; ulint i; + /* On 64-bit Windows, ulint is 64 bits. But offset and n should be + no more than 32 bits. */ ut_a((offset & 0xFFFFFFFFUL) == offset); + ut_a((n & 0xFFFFFFFFUL) == n); os_n_file_reads++; os_bytes_read_since_printout += n; @@ -2447,7 +2453,10 @@ os_file_write( ulint n_retries = 0; ulint err; - ut_a((offset & 0xFFFFFFFF) == offset); + /* On 64-bit Windows, ulint is 64 bits. But offset and n should be + no more than 32 bits. */ + ut_a((offset & 0xFFFFFFFFUL) == offset); + ut_a((n & 0xFFFFFFFFUL) == n); os_n_file_writes++; @@ -3245,14 +3254,16 @@ os_aio_array_reserve_slot( ulint len) /* in: length of the block to read or write */ { os_aio_slot_t* slot; + ulint i; #ifdef WIN_ASYNC_IO OVERLAPPED* control; + ut_a((len & 0xFFFFFFFFUL) == len); #elif defined(POSIX_ASYNC_IO) struct aiocb* control; #endif - ulint i; + loop: os_mutex_enter(array->mutex); @@ -3517,6 +3528,9 @@ os_aio( ut_ad(n % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(os_aio_validate()); +#ifdef WIN_ASYNC_IO + ut_ad((n & 0xFFFFFFFFUL) == n); +#endif wake_later = mode & OS_AIO_SIMULATED_WAKE_LATER; mode = mode & (~OS_AIO_SIMULATED_WAKE_LATER); @@ -3765,16 +3779,18 @@ os_aio_windows_handle( /* retry failed read/write operation synchronously. No need to hold array->mutex. */ + ut_a((slot->len & 0xFFFFFFFFUL) == slot->len); + switch (slot->type) { case OS_FILE_WRITE: ret = WriteFile(slot->file, slot->buf, - slot->len, &len, + (DWORD) slot->len, &len, &(slot->control)); break; case OS_FILE_READ: ret = ReadFile(slot->file, slot->buf, - slot->len, &len, + (DWORD) slot->len, &len, &(slot->control)); break; From 460ad14e04d022ab9ccd122af7bcbc4a0030f67a Mon Sep 17 00:00:00 2001 From: Calvin Sun Date: Thu, 28 Oct 2010 00:10:28 -0500 Subject: [PATCH 33/64] Bug#52062: Compiler warning in os0file.c on windows 64-bit On Windows, the parameter for number of bytes passed into WriteFile() and ReadFile() is DWORD. Casting is needed to silence the warning on 64-bit Windows. Also, adding several asserts to ensure the variable for number of bytes is no more than 32 bits, even on 64-bit Windows. This is for InnoDB Plugin. rb://415 Approved by: Inaam --- storage/innodb_plugin/os/os0file.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/storage/innodb_plugin/os/os0file.c b/storage/innodb_plugin/os/os0file.c index 14b2fce43c3..ff80f7ed1b4 100644 --- a/storage/innodb_plugin/os/os0file.c +++ b/storage/innodb_plugin/os/os0file.c @@ -2280,7 +2280,10 @@ os_file_read( ulint i; #endif /* !UNIV_HOTBACKUP */ + /* On 64-bit Windows, ulint is 64 bits. But offset and n should be + no more than 32 bits. */ ut_a((offset & 0xFFFFFFFFUL) == offset); + ut_a((n & 0xFFFFFFFFUL) == n); os_n_file_reads++; os_bytes_read_since_printout += n; @@ -2404,7 +2407,10 @@ os_file_read_no_error_handling( ulint i; #endif /* !UNIV_HOTBACKUP */ + /* On 64-bit Windows, ulint is 64 bits. But offset and n should be + no more than 32 bits. */ ut_a((offset & 0xFFFFFFFFUL) == offset); + ut_a((n & 0xFFFFFFFFUL) == n); os_n_file_reads++; os_bytes_read_since_printout += n; @@ -2534,7 +2540,10 @@ os_file_write( ulint i; #endif /* !UNIV_HOTBACKUP */ - ut_a((offset & 0xFFFFFFFF) == offset); + /* On 64-bit Windows, ulint is 64 bits. But offset and n should be + no more than 32 bits. */ + ut_a((offset & 0xFFFFFFFFUL) == offset); + ut_a((n & 0xFFFFFFFFUL) == n); os_n_file_writes++; @@ -3304,12 +3313,14 @@ os_aio_array_reserve_slot( ulint len) /*!< in: length of the block to read or write */ { os_aio_slot_t* slot; -#ifdef WIN_ASYNC_IO - OVERLAPPED* control; -#endif ulint i; ulint slots_per_seg; ulint local_seg; +#ifdef WIN_ASYNC_IO + OVERLAPPED* control; + + ut_a((len & 0xFFFFFFFFUL) == len); +#endif /* No need of a mutex. Only reading constant fields */ slots_per_seg = array->n_slots / array->n_segments; @@ -3589,6 +3600,9 @@ os_aio( ut_ad(n % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(os_aio_validate()); +#ifdef WIN_ASYNC_IO + ut_ad((n & 0xFFFFFFFFUL) == n); +#endif wake_later = mode & OS_AIO_SIMULATED_WAKE_LATER; mode = mode & (~OS_AIO_SIMULATED_WAKE_LATER); @@ -3829,16 +3843,18 @@ os_aio_windows_handle( /* retry failed read/write operation synchronously. No need to hold array->mutex. */ + ut_a((slot->len & 0xFFFFFFFFUL) == slot->len); + switch (slot->type) { case OS_FILE_WRITE: ret = WriteFile(slot->file, slot->buf, - slot->len, &len, + (DWORD) slot->len, &len, &(slot->control)); break; case OS_FILE_READ: ret = ReadFile(slot->file, slot->buf, - slot->len, &len, + (DWORD) slot->len, &len, &(slot->control)); break; From a5eba94a1d8967d5a8c7e8d3d398a2426453f508 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Fri, 29 Oct 2010 11:35:07 +0200 Subject: [PATCH 34/64] Bug #52131: SET and ENUM stored endian-dependent in binary log Post-Push fix, DBUG build broken on freebsd7 sql/field.cc:8456: warning: control reaches end of non-void function sql/field.cc: Return NULL to keep compiler happy. --- sql/field.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sql/field.cc b/sql/field.cc index ce1b1fc6eb0..a9b5fedda2d 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8408,6 +8408,8 @@ uchar *Field_enum::pack(uchar *to, const uchar *from, default: DBUG_ASSERT(0); } + MY_ASSERT_UNREACHABLE(); + DBUG_RETURN(NULL); } const uchar *Field_enum::unpack(uchar *to, const uchar *from, @@ -8430,6 +8432,8 @@ const uchar *Field_enum::unpack(uchar *to, const uchar *from, default: DBUG_ASSERT(0); } + MY_ASSERT_UNREACHABLE(); + DBUG_RETURN(NULL); } From c4a4119829756aef666f2244f2e71d09a3bfd885 Mon Sep 17 00:00:00 2001 From: Sven Sandberg Date: Fri, 29 Oct 2010 16:56:58 +0200 Subject: [PATCH 35/64] wL#5625: Deprecate mysqlbinlog options --base64-output=always and --base64-output Adds deprecation warning for the mysqlbinlog options --base64-output=always and --base64-output. A warning is printed when the flags are used, and also when running mysqlbinlog --help. client/mysqlbinlog.cc: Give a warning for --base64-output=always and --base64-output, and print warning in mysqlbinlog --help. mysql-test/r/mysqlbinlog.result: updated result file mysql-test/t/mysqlbinlog.test: Test that mysqlbinlog --base64-output=always gives a warning. --- client/mysqlbinlog.cc | 16 ++++++++++++---- mysql-test/r/mysqlbinlog.result | 4 ++++ mysql-test/t/mysqlbinlog.test | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 226776e4404..bf4920c6f77 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1010,10 +1010,11 @@ static struct my_option my_long_options[] = "row-based events; 'decode-rows' decodes row events into commented SQL " "statements if the --verbose option is also given; 'auto' prints base64 " "only when necessary (i.e., for row-based events and format description " - "events); 'always' prints base64 whenever possible. 'always' is for " - "debugging only and should not be used in a production system. If this " - "argument is not given, the default is 'auto'; if it is given with no " - "argument, 'always' is used.", + "events); 'always' prints base64 whenever possible. 'always' is " + "deprecated, will be removed in a future version, and should not be used " + "in a production system. --base64-output with no 'name' argument is " + "equivalent to --base64-output=always and is also deprecated. If no " + "--base64-output[=name] option is given at all, the default is 'auto'.", &opt_base64_output_mode_str, &opt_base64_output_mode_str, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, /* @@ -2024,6 +2025,13 @@ int main(int argc, char** argv) if (opt_base64_output_mode == BASE64_OUTPUT_UNSPEC) opt_base64_output_mode= BASE64_OUTPUT_AUTO; + if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS) + warning("The --base64-output=always flag and the --base64-output flag " + "(with '=MODE' omitted), are deprecated. " + "The output generated when these flags are used cannot be " + "parsed by mysql 5.6.0 and later. " + "The flags will be removed in a future version. " + "Please use --base64-output=auto instead."); my_set_max_open_files(open_files_limit); diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 51fad679909..ce83fe5b79b 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -879,3 +879,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; End of 5.0 tests End of 5.1 tests +# Expect deprecation warning. +WARNING: The --base64-output=always flag and the --base64-output flag (with '=MODE' omitted), are deprecated. The output generated when these flags are used cannot be parsed by mysql 5.6.0 and later. The flags will be removed in a future version. Please use --base64-output=auto instead. +# Expect deprecation warning again. +WARNING: The --base64-output=always flag and the --base64-output flag (with '=MODE' omitted), are deprecated. The output generated when these flags are used cannot be parsed by mysql 5.6.0 and later. The flags will be removed in a future version. Please use --base64-output=auto instead. diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 3a9dae35476..76f6c63fc1d 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -487,3 +487,18 @@ diff_files $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn $MYSQLTEST_VARDIR/tmp/mysqlbin # Cleanup for this part of test remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty; remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn; + +# +# WL#5625: Deprecate mysqlbinlog options --base64-output=always and --base64-output +# + +--echo # Expect deprecation warning. +--exec $MYSQL_BINLOG --base64-output=always std_data/master-bin.000001 > /dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn +--cat_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn + +--echo # Expect deprecation warning again. +--exec $MYSQL_BINLOG --base64-output std_data/master-bin.000001 > /dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn +--cat_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn + +# Clean up this part of the test. +--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn From 20d704978ddb14dee414f40f28bd58f82b21711c Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Sun, 31 Oct 2010 19:04:38 +0300 Subject: [PATCH 36/64] Bug #52160: crash and inconsistent results when grouping by a function and column The bugreport reveals two different bugs about grouping on a function: 1) grouping by the TIME_TO_SEC function result caused a server crash or wrong results and 2) grouping by the function returning a blob caused an unexpected "Duplicate entry" error and wrong result. Details for the 1st bug: TIME_TO_SEC() returns NULL if its argument is invalid (empty string for example). Thus its nullability depends not only on the nullability of its arguments but also on their values. Fixed by (overoptimistically) setting TIME_TO_SEC() to be nullable despite the nullability of its arguments. Details for the 2nd bug: The server is unable to create indices on blobs without explicit blob key part length. However, this fact was ignored for blob function result fields of GROUP BY intermediate tables. Fixed by disabling GROUP BY index creation for blob function result fields like regular blob fields. mysql-test/r/func_time.result: Test case for bug #52160. mysql-test/r/type_blob.result: Test case for bug #52160. mysql-test/t/func_time.test: Test case for bug #52160. mysql-test/t/type_blob.test: Test case for bug #52160. sql/item_timefunc.h: Bug #52160: crash and inconsistent results when grouping by a function and column TIME_TO_SEC() returns NULL if its argument is invalid (empty string for example). Thus its nullability depends not only Fixed by (overoptimistically) setting TIME_TO_SEC() to be nullable despite the nullability of its arguments. sql/sql_select.cc: Bug #52160: crash and inconsistent results when grouping by a function and column The server is unable to create indices on blobs without explicit blob key part length. However, this fact was ignored for blob function result fields of GROUP BY intermediate tables. Fixed by disabling GROUP BY index creation for blob function result fields like regular blob fields. --- mysql-test/r/func_time.result | 14 ++++++++++++++ mysql-test/r/type_blob.result | 11 +++++++++++ mysql-test/t/func_time.test | 10 ++++++++++ mysql-test/t/type_blob.test | 16 ++++++++++++++++ sql/item_timefunc.h | 1 + sql/sql_select.cc | 2 ++ 6 files changed, 54 insertions(+) diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 4ff4cfa586b..48e837f180f 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1343,4 +1343,18 @@ SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a); 1 1 DROP TABLE t1; +# +# Bug #52160: crash and inconsistent results when grouping +# by a function and column +# +CREATE TABLE t1(a CHAR(10) NOT NULL); +INSERT INTO t1 VALUES (''),(''); +SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a); +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect time value: '' +Warning 1292 Truncated incorrect time value: '' +Warning 1292 Truncated incorrect time value: '' +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index 08c30d884fd..e6fd49b4247 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -974,3 +974,14 @@ ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967 explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295) End of 5.0 tests +# Bug #52160: crash and inconsistent results when grouping +# by a function and column +CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1; +CREATE TABLE t1(a CHAR(1)); +INSERT INTO t1 VALUES ('0'), ('0'); +SELECT COUNT(*) FROM t1 GROUP BY f1(), a; +COUNT(*) +2 +DROP FUNCTION f1; +DROP TABLE t1; +End of 5.1 tests diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index e764906c374..8fce7072319 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -849,4 +849,14 @@ INSERT INTO t1 VALUES (0),(9.216e-096); SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a); DROP TABLE t1; +--echo # +--echo # Bug #52160: crash and inconsistent results when grouping +--echo # by a function and column +--echo # + +CREATE TABLE t1(a CHAR(10) NOT NULL); +INSERT INTO t1 VALUES (''),(''); +SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a); +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test index 460da1c1614..4e097edf73d 100644 --- a/mysql-test/t/type_blob.test +++ b/mysql-test/t/type_blob.test @@ -612,3 +612,19 @@ explain select convert(1, binary(4294967296)); explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); --echo End of 5.0 tests + +--echo # Bug #52160: crash and inconsistent results when grouping +--echo # by a function and column + +CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1; + +CREATE TABLE t1(a CHAR(1)); +INSERT INTO t1 VALUES ('0'), ('0'); + +SELECT COUNT(*) FROM t1 GROUP BY f1(), a; + +DROP FUNCTION f1; +DROP TABLE t1; + +--echo End of 5.1 tests + diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index ef86406e1be..47bb9509582 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -331,6 +331,7 @@ public: const char *func_name() const { return "time_to_sec"; } void fix_length_and_dec() { + maybe_null= TRUE; decimals=0; max_length=10*MY_CHARSET_BIN_MB_MAXLEN; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 08bd0c28738..77d4447fd0f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -15198,6 +15198,8 @@ calc_group_buffer(JOIN *join,ORDER *group) { key_length+= 8; } + else if (type == MYSQL_TYPE_BLOB) + key_length+= MAX_BLOB_WIDTH; // Can't be used as a key else { /* From cdd706981c1dcda58624f38b75ac1c34e7f38a8a Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 1 Nov 2010 15:00:40 +0800 Subject: [PATCH 37/64] Re-enabled rpl.rpl_innodb_bug30888. --- mysql-test/collections/default.experimental | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 29046e9b8bc..ce3f50f5f94 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -24,7 +24,6 @@ main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeou rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically rpl.rpl_innodb_bug28430* # Bug#46029 -rpl.rpl_innodb_bug30888* @solaris # Bug#47646 2009-09-25 alik rpl.rpl_innodb_bug30888 fails sporadically on Solaris rpl.rpl_killed_ddl @windows # Bug#47638 2010-01-20 alik The rpl_killed_ddl test fails on Windows sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun From 6b553e775cff0b25c5fea9c07389268215222396 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Mon, 1 Nov 2010 10:53:21 +0300 Subject: [PATCH 38/64] Fix version tag (remove -ga suffix). --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index d8a45214a5c..2d67f34b4bb 100644 --- a/configure.in +++ b/configure.in @@ -27,7 +27,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.5.8-ga], [], [mysql]) +AC_INIT([MySQL Server], [5.5.8], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From 52ebe700c48269f95b29f2a8aa6c6fb2e770538c Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Mon, 1 Nov 2010 12:36:43 +0300 Subject: [PATCH 39/64] Temporarily fix for configure.in -- CMakeFiles requires suffix in version tag. --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 2d67f34b4bb..9f986e068cb 100644 --- a/configure.in +++ b/configure.in @@ -27,7 +27,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.5.8], [], [mysql]) +AC_INIT([MySQL Server], [5.5.8-rc], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From c10eb6ec6170734d87ab7f60a1c506c544de88e7 Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Mon, 1 Nov 2010 14:12:59 +0100 Subject: [PATCH 40/64] Backport from mysql-trunk-bugfixing of: ------------------------------------------------------------ revno: 3309 committer: Tor Didriksen branch nick: trunk-bugfixing timestamp: Mon 2010-11-01 08:58:27 +0100 message: Bug#45288: pb2 returns a lot of compilation warnings DBG build broken on binary-werror-linux-x86_64-tar-gz storage/innobase/os/os0sync.c:659: warning: 'timed_out' may be used uninitialized in this function --- storage/innobase/os/os0sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/os/os0sync.c b/storage/innobase/os/os0sync.c index 24d36acecb2..b461f9b7c78 100644 --- a/storage/innobase/os/os0sync.c +++ b/storage/innobase/os/os0sync.c @@ -656,7 +656,7 @@ os_event_wait_time_low( os_event_reset(). */ { - ibool timed_out; + ibool timed_out = FALSE; ib_int64_t old_signal_count; #ifdef __WIN__ From 1a5a109524cbd3445544888170686b023c6331b8 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Tue, 2 Nov 2010 15:20:02 +0200 Subject: [PATCH 41/64] Bug #51208: Extra string allocation from thd->mem_root in sql_show.cc, find_files() Removed the extra allocation. --- sql/sql_show.cc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e074461b452..9b344204d64 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -534,12 +534,6 @@ find_files(THD *thd, List *files, const char *db, else if (wild_compare(uname, wild, 0)) continue; } - if (!(file_name= - thd->make_lex_string(file_name, uname, file_name_len, TRUE))) - { - my_dirend(dirp); - DBUG_RETURN(FIND_FILES_OOM); - } } else { From 00f1e71d9ab02ca4b7b47b194a122afd88bad7f3 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Tue, 2 Nov 2010 17:45:26 +0200 Subject: [PATCH 42/64] Bug #57916: Fix the naming of the proxy_priv table 1. Fixed the name of the table to proxies_priv 2. Fixed the column names to be of the form Capitalized_lowecarse instead of Capitalized_Capitalized 3. Added Timestamp and Grantor columns 4. Added tests to plugin_auth to check the table structure 5. Updated the existing tests --- mysql-test/r/1st.result | 2 +- mysql-test/r/connect.result | 6 +- mysql-test/r/information_schema.result | 2 +- mysql-test/r/log_tables_upgrade.result | 2 +- mysql-test/r/mysql_upgrade.result | 12 +-- mysql-test/r/mysql_upgrade_ssl.result | 2 +- mysql-test/r/mysqlcheck.result | 8 +- mysql-test/r/plugin_auth.result | 24 +++++- mysql-test/r/system_mysql_db.result | 2 +- .../suite/funcs_1/r/is_columns_mysql.result | 24 +++--- .../funcs_1/r/is_key_column_usage.result | 8 +- .../suite/funcs_1/r/is_statistics.result | 9 +- .../funcs_1/r/is_statistics_mysql.result | 9 +- .../funcs_1/r/is_table_constraints.result | 2 +- .../r/is_table_constraints_mysql.result | 2 +- .../suite/funcs_1/r/is_tables_mysql.result | 2 +- mysql-test/t/plugin_auth.test | 7 +- mysql-test/t/system_mysql_db_fix40123.test | 2 +- mysql-test/t/system_mysql_db_fix50030.test | 2 +- mysql-test/t/system_mysql_db_fix50117.test | 2 +- scripts/mysql_system_tables.sql | 6 +- scripts/mysql_system_tables_data.sql | 10 +-- scripts/mysql_system_tables_fix.sql | 2 +- sql/sql_acl.cc | 85 +++++++++++-------- 24 files changed, 137 insertions(+), 95 deletions(-) diff --git a/mysql-test/r/1st.result b/mysql-test/r/1st.result index e8562662bfd..792d9eaf2f1 100644 --- a/mysql-test/r/1st.result +++ b/mysql-test/r/1st.result @@ -21,7 +21,7 @@ ndb_binlog_index plugin proc procs_priv -proxy_priv +proxies_priv servers slow_log tables_priv diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index bbd0273c1c6..b21956252d2 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -15,7 +15,7 @@ ndb_binlog_index plugin proc procs_priv -proxy_priv +proxies_priv servers slow_log tables_priv @@ -49,7 +49,7 @@ ndb_binlog_index plugin proc procs_priv -proxy_priv +proxies_priv servers slow_log tables_priv @@ -91,7 +91,7 @@ ndb_binlog_index plugin proc procs_priv -proxy_priv +proxies_priv servers slow_log tables_priv diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index bab60774b32..1418af5b813 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -88,7 +88,7 @@ host plugin proc procs_priv -proxy_priv +proxies_priv servers slow_log tables_priv diff --git a/mysql-test/r/log_tables_upgrade.result b/mysql-test/r/log_tables_upgrade.result index 13b08c2e771..7d15005e143 100644 --- a/mysql-test/r/log_tables_upgrade.result +++ b/mysql-test/r/log_tables_upgrade.result @@ -27,7 +27,7 @@ mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK -mysql.proxy_priv OK +mysql.proxies_priv OK mysql.renamed_general_log OK mysql.servers OK mysql.slow_log OK diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index f705db3e509..e36b4781ddf 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -15,7 +15,7 @@ mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK -mysql.proxy_priv OK +mysql.proxies_priv OK mysql.servers OK mysql.slow_log OK mysql.tables_priv OK @@ -44,7 +44,7 @@ mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK -mysql.proxy_priv OK +mysql.proxies_priv OK mysql.servers OK mysql.slow_log OK mysql.tables_priv OK @@ -73,7 +73,7 @@ mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK -mysql.proxy_priv OK +mysql.proxies_priv OK mysql.servers OK mysql.slow_log OK mysql.tables_priv OK @@ -104,7 +104,7 @@ mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK -mysql.proxy_priv OK +mysql.proxies_priv OK mysql.servers OK mysql.slow_log OK mysql.tables_priv OK @@ -139,7 +139,7 @@ mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK -mysql.proxy_priv OK +mysql.proxies_priv OK mysql.servers OK mysql.slow_log OK mysql.tables_priv OK @@ -177,7 +177,7 @@ mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK -mysql.proxy_priv OK +mysql.proxies_priv OK mysql.servers OK mysql.slow_log OK mysql.tables_priv OK diff --git a/mysql-test/r/mysql_upgrade_ssl.result b/mysql-test/r/mysql_upgrade_ssl.result index 694eb1e7d88..4cc8b6ab44b 100644 --- a/mysql-test/r/mysql_upgrade_ssl.result +++ b/mysql-test/r/mysql_upgrade_ssl.result @@ -17,7 +17,7 @@ mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK -mysql.proxy_priv OK +mysql.proxies_priv OK mysql.servers OK mysql.slow_log OK mysql.tables_priv OK diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index 241c92f0aa6..ef46eba5ccb 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -18,7 +18,7 @@ mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK -mysql.proxy_priv OK +mysql.proxies_priv OK mysql.servers OK mysql.slow_log note : The storage engine for the table doesn't support analyze @@ -46,7 +46,7 @@ mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK -mysql.proxy_priv OK +mysql.proxies_priv OK mysql.servers OK mysql.slow_log note : The storage engine for the table doesn't support optimize @@ -72,7 +72,7 @@ mysql.ndb_binlog_index OK mysql.plugin OK mysql.proc OK mysql.procs_priv OK -mysql.proxy_priv OK +mysql.proxies_priv OK mysql.servers OK mysql.slow_log note : The storage engine for the table doesn't support analyze @@ -98,7 +98,7 @@ mysql.ndb_binlog_index Table is already up to date mysql.plugin Table is already up to date mysql.proc Table is already up to date mysql.procs_priv Table is already up to date -mysql.proxy_priv Table is already up to date +mysql.proxies_priv Table is already up to date mysql.servers Table is already up to date mysql.slow_log note : The storage engine for the table doesn't support optimize diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result index 54467b78f19..d56a4e5326a 100644 --- a/mysql-test/r/plugin_auth.result +++ b/mysql-test/r/plugin_auth.result @@ -11,6 +11,26 @@ test_plugin_server plug_dest ## test plugin auth ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES) GRANT PROXY ON plug_dest TO plug; +test proxies_priv columns +SELECT * FROM mysql.proxies_priv; +Host User Proxied_host Proxied_user With_grant Grantor Timestamp +localhost root 1 xx +unknown root 1 xx +% plug % plug_dest 0 root@localhost xx +test mysql.proxies_priv; +SHOW CREATE TABLE mysql.proxies_priv; +Table Create Table +proxies_priv CREATE TABLE `proxies_priv` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', + `Proxied_host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `Proxied_user` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', + `With_grant` tinyint(1) NOT NULL DEFAULT '0', + `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '', + `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`), + KEY `Grantor` (`Grantor`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User proxy privileges' select USER(),CURRENT_USER(); USER() CURRENT_USER() plug@localhost plug_dest@% @@ -146,8 +166,8 @@ Grants for test_drop@localhost GRANT USAGE ON *.* TO 'test_drop'@'localhost' GRANT PROXY ON 'future_user'@'%' TO 'test_drop'@'localhost' DROP USER test_drop@localhost; -SELECT * FROM mysql.proxy_priv WHERE Host = 'test_drop' AND User = 'localhost'; -Host User Proxied_Host Proxied_User With_Grant +SELECT * FROM mysql.proxies_priv WHERE Host = 'test_drop' AND User = 'localhost'; +Host User Proxied_host Proxied_user With_grant Grantor Timestamp DROP USER proxy_admin; DROP USER grant_plug,grant_plug_dest,grant_plug_dest2; ## END GRANT PROXY tests diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index e82cf229912..0028f2ce5c1 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -14,7 +14,7 @@ ndb_binlog_index plugin proc procs_priv -proxy_priv +proxies_priv servers slow_log tables_priv diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index 767f9e47f13..c61a09084a8 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -134,11 +134,13 @@ def mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL utf8 utf8_general_ def mysql procs_priv Routine_type 5 NULL NO enum 9 27 NULL NULL utf8 utf8_bin enum('FUNCTION','PROCEDURE') PRI select,insert,update,references def mysql procs_priv Timestamp 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references def mysql procs_priv User 3 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references -def mysql proxy_priv Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references -def mysql proxy_priv Proxied_Host 3 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references -def mysql proxy_priv Proxied_User 4 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references -def mysql proxy_priv User 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references -def mysql proxy_priv With_Grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL tinyint(1) select,insert,update,references +def mysql proxies_priv Grantor 6 NO char 77 231 NULL NULL utf8 utf8_bin char(77) MUL select,insert,update,references +def mysql proxies_priv Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references +def mysql proxies_priv Proxied_host 3 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references +def mysql proxies_priv Proxied_user 4 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references +def mysql proxies_priv Timestamp 7 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def mysql proxies_priv User 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references +def mysql proxies_priv With_grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL tinyint(1) select,insert,update,references def mysql servers Db 3 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references def mysql servers Host 2 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references def mysql servers Owner 9 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references @@ -425,11 +427,13 @@ NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp 3.0000 mysql procs_priv Grantor char 77 231 utf8 utf8_bin char(77) 3.0000 mysql procs_priv Proc_priv set 27 81 utf8 utf8_general_ci set('Execute','Alter Routine','Grant') NULL mysql procs_priv Timestamp timestamp NULL NULL NULL NULL timestamp -3.0000 mysql proxy_priv Host char 60 180 utf8 utf8_bin char(60) -3.0000 mysql proxy_priv User char 16 48 utf8 utf8_bin char(16) -3.0000 mysql proxy_priv Proxied_Host char 16 48 utf8 utf8_bin char(16) -3.0000 mysql proxy_priv Proxied_User char 60 180 utf8 utf8_bin char(60) -NULL mysql proxy_priv With_Grant tinyint NULL NULL NULL NULL tinyint(1) +3.0000 mysql proxies_priv Host char 60 180 utf8 utf8_bin char(60) +3.0000 mysql proxies_priv User char 16 48 utf8 utf8_bin char(16) +3.0000 mysql proxies_priv Proxied_host char 60 180 utf8 utf8_bin char(60) +3.0000 mysql proxies_priv Proxied_user char 16 48 utf8 utf8_bin char(16) +NULL mysql proxies_priv With_grant tinyint NULL NULL NULL NULL tinyint(1) +3.0000 mysql proxies_priv Grantor char 77 231 utf8 utf8_bin char(77) +NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp 3.0000 mysql servers Server_name char 64 192 utf8 utf8_general_ci char(64) 3.0000 mysql servers Host char 64 192 utf8 utf8_general_ci char(64) 3.0000 mysql servers Db char 64 192 utf8 utf8_general_ci char(64) diff --git a/mysql-test/suite/funcs_1/r/is_key_column_usage.result b/mysql-test/suite/funcs_1/r/is_key_column_usage.result index 2e50a0c36bf..afd1fe15fed 100644 --- a/mysql-test/suite/funcs_1/r/is_key_column_usage.result +++ b/mysql-test/suite/funcs_1/r/is_key_column_usage.result @@ -106,10 +106,10 @@ def mysql PRIMARY def mysql procs_priv Db def mysql PRIMARY def mysql procs_priv User def mysql PRIMARY def mysql procs_priv Routine_name def mysql PRIMARY def mysql procs_priv Routine_type -def mysql PRIMARY def mysql proxy_priv Host -def mysql PRIMARY def mysql proxy_priv User -def mysql PRIMARY def mysql proxy_priv Proxied_Host -def mysql PRIMARY def mysql proxy_priv Proxied_User +def mysql PRIMARY def mysql proxies_priv Host +def mysql PRIMARY def mysql proxies_priv User +def mysql PRIMARY def mysql proxies_priv Proxied_host +def mysql PRIMARY def mysql proxies_priv Proxied_user def mysql PRIMARY def mysql servers Server_name def mysql PRIMARY def mysql tables_priv Host def mysql PRIMARY def mysql tables_priv Db diff --git a/mysql-test/suite/funcs_1/r/is_statistics.result b/mysql-test/suite/funcs_1/r/is_statistics.result index 0c43883789b..de84590e2f7 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics.result +++ b/mysql-test/suite/funcs_1/r/is_statistics.result @@ -118,10 +118,11 @@ def mysql procs_priv mysql PRIMARY def mysql procs_priv mysql PRIMARY def mysql procs_priv mysql PRIMARY def mysql procs_priv mysql Grantor -def mysql proxy_priv mysql PRIMARY -def mysql proxy_priv mysql PRIMARY -def mysql proxy_priv mysql PRIMARY -def mysql proxy_priv mysql PRIMARY +def mysql proxies_priv mysql PRIMARY +def mysql proxies_priv mysql PRIMARY +def mysql proxies_priv mysql PRIMARY +def mysql proxies_priv mysql PRIMARY +def mysql proxies_priv mysql Grantor def mysql servers mysql PRIMARY def mysql tables_priv mysql PRIMARY def mysql tables_priv mysql PRIMARY diff --git a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result index 584bbeb7af5..4c7d58f96f1 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result @@ -40,10 +40,11 @@ def mysql procs_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE def mysql procs_priv 0 mysql PRIMARY 3 User A #CARD# NULL NULL BTREE def mysql procs_priv 0 mysql PRIMARY 4 Routine_name A #CARD# NULL NULL BTREE def mysql procs_priv 0 mysql PRIMARY 5 Routine_type A #CARD# NULL NULL BTREE -def mysql proxy_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE -def mysql proxy_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE -def mysql proxy_priv 0 mysql PRIMARY 3 Proxied_Host A #CARD# NULL NULL BTREE -def mysql proxy_priv 0 mysql PRIMARY 4 Proxied_User A #CARD# NULL NULL BTREE +def mysql proxies_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE +def mysql proxies_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +def mysql proxies_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE +def mysql proxies_priv 0 mysql PRIMARY 3 Proxied_host A #CARD# NULL NULL BTREE +def mysql proxies_priv 0 mysql PRIMARY 4 Proxied_user A #CARD# NULL NULL BTREE def mysql servers 0 mysql PRIMARY 1 Server_name A #CARD# NULL NULL BTREE def mysql tables_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints.result b/mysql-test/suite/funcs_1/r/is_table_constraints.result index d4d2c38c9ba..559a1f1f9f5 100644 --- a/mysql-test/suite/funcs_1/r/is_table_constraints.result +++ b/mysql-test/suite/funcs_1/r/is_table_constraints.result @@ -73,7 +73,7 @@ def mysql PRIMARY mysql ndb_binlog_index def mysql PRIMARY mysql plugin def mysql PRIMARY mysql proc def mysql PRIMARY mysql procs_priv -def mysql PRIMARY mysql proxy_priv +def mysql PRIMARY mysql proxies_priv def mysql PRIMARY mysql servers def mysql PRIMARY mysql tables_priv def mysql PRIMARY mysql time_zone diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result index 38e9c9034c9..bca333b6387 100644 --- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result @@ -23,7 +23,7 @@ def mysql PRIMARY mysql ndb_binlog_index PRIMARY KEY def mysql PRIMARY mysql plugin PRIMARY KEY def mysql PRIMARY mysql proc PRIMARY KEY def mysql PRIMARY mysql procs_priv PRIMARY KEY -def mysql PRIMARY mysql proxy_priv PRIMARY KEY +def mysql PRIMARY mysql proxies_priv PRIMARY KEY def mysql PRIMARY mysql servers PRIMARY KEY def mysql PRIMARY mysql tables_priv PRIMARY KEY def mysql PRIMARY mysql time_zone PRIMARY KEY diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql.result b/mysql-test/suite/funcs_1/r/is_tables_mysql.result index ae512327807..7db87c4215a 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_tables_mysql.result @@ -336,7 +336,7 @@ user_comment Procedure privileges Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql -TABLE_NAME proxy_priv +TABLE_NAME proxies_priv TABLE_TYPE BASE TABLE ENGINE MyISAM VERSION 10 diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test index 77dcd7add73..ebbaf389632 100644 --- a/mysql-test/t/plugin_auth.test +++ b/mysql-test/t/plugin_auth.test @@ -16,6 +16,11 @@ connect(plug_con,localhost,plug,plug_dest); --enable_query_log GRANT PROXY ON plug_dest TO plug; +--echo test proxies_priv columns +--replace_column 7 xx +SELECT * FROM mysql.proxies_priv; +--echo test mysql.proxies_priv; +SHOW CREATE TABLE mysql.proxies_priv; connect(plug_con,localhost,plug,plug_dest); @@ -226,7 +231,7 @@ CREATE USER test_drop@localhost; GRANT PROXY ON future_user TO test_drop@localhost; SHOW GRANTS FOR test_drop@localhost; DROP USER test_drop@localhost; -SELECT * FROM mysql.proxy_priv WHERE Host = 'test_drop' AND User = 'localhost'; +SELECT * FROM mysql.proxies_priv WHERE Host = 'test_drop' AND User = 'localhost'; DROP USER proxy_admin; diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test index d069271a02e..8c2060d76ba 100644 --- a/mysql-test/t/system_mysql_db_fix40123.test +++ b/mysql-test/t/system_mysql_db_fix40123.test @@ -72,7 +72,7 @@ CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL, -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxy_priv; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv; -- enable_query_log diff --git a/mysql-test/t/system_mysql_db_fix50030.test b/mysql-test/t/system_mysql_db_fix50030.test index 53166919f1c..7d55a091b6d 100644 --- a/mysql-test/t/system_mysql_db_fix50030.test +++ b/mysql-test/t/system_mysql_db_fix50030.test @@ -78,7 +78,7 @@ INSERT INTO servers VALUES ('test','localhost','test','root','', 0,'','mysql','r -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxy_priv; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv; -- enable_query_log diff --git a/mysql-test/t/system_mysql_db_fix50117.test b/mysql-test/t/system_mysql_db_fix50117.test index 872829ae79d..260400b9c8a 100644 --- a/mysql-test/t/system_mysql_db_fix50117.test +++ b/mysql-test/t/system_mysql_db_fix50117.test @@ -97,7 +97,7 @@ CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxy_priv; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv; -- enable_query_log diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index d5dd20542ff..02c5389f8d3 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -478,7 +478,7 @@ PREPARE stmt FROM @str; EXECUTE stmt; DROP PREPARE stmt; -CREATE TABLE IF NOT EXISTS proxy_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_Host char(16) binary DEFAULT '' NOT NULL, Proxied_User char(60) binary DEFAULT '' NOT NULL, With_Grant BOOL DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User,Proxied_Host,Proxied_User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges'; +CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(16) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges'; --- Remember for later if proxy_priv table already existed -set @had_proxy_priv_table= @@warning_count != 0; +-- Remember for later if proxies_priv table already existed +set @had_proxies_priv_table= @@warning_count != 0; diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql index 293baa46523..bc5ffae2063 100644 --- a/scripts/mysql_system_tables_data.sql +++ b/scripts/mysql_system_tables_data.sql @@ -30,8 +30,8 @@ INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOW INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0; DROP TABLE tmp_user; -CREATE TEMPORARY TABLE tmp_proxy_priv LIKE proxy_priv; -INSERT INTO tmp_proxy_priv VALUES ('localhost', 'root', '', '', TRUE); -REPLACE INTO tmp_proxy_priv SELECT @current_hostname, 'root', '', '', TRUE FROM DUAL WHERE LOWER (@current_hostname) != 'localhost'; -INSERT INTO proxy_priv SELECT * FROM tmp_proxy_priv WHERE @had_proxy_priv_table=0; -DROP TABLE tmp_proxy_priv; +CREATE TEMPORARY TABLE tmp_proxies_priv LIKE proxies_priv; +INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now()); +REPLACE INTO tmp_proxies_priv SELECT @current_hostname, 'root', '', '', TRUE, '', now() FROM DUAL WHERE LOWER (@current_hostname) != 'localhost'; +INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0; +DROP TABLE tmp_proxies_priv; diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index ceb910676ab..b51e4c6f549 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -643,7 +643,7 @@ drop procedure mysql.die; ALTER TABLE user ADD plugin char(60) DEFAULT '' NOT NULL, ADD authentication_string TEXT NOT NULL; ALTER TABLE user MODIFY plugin char(60) DEFAULT '' NOT NULL; -CREATE TABLE IF NOT EXISTS proxy_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_User char(60) binary DEFAULT '' NOT NULL, Proxied_Host char(16) binary DEFAULT '' NOT NULL, With_Grant BOOL DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User,Proxied_Host,Proxied_User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; +CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(16) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges'; # Activate the new, possible modified privilege tables # This should not be needed, but gives us some extra testing that the above diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index c741a50a1db..8ef17cec6a8 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -268,11 +268,13 @@ class ACL_PROXY_USER :public ACL_ACCESS bool with_grant; typedef enum { - MYSQL_PROXY_PRIV_HOST, - MYSQL_PROXY_PRIV_USER, - MYSQL_PROXY_PRIV_PROXIED_HOST, - MYSQL_PROXY_PRIV_PROXIED_USER, - MYSQL_PROXY_PRIV_WITH_GRANT } old_acl_proxy_users; + MYSQL_PROXIES_PRIV_HOST, + MYSQL_PROXIES_PRIV_USER, + MYSQL_PROXIES_PRIV_PROXIED_HOST, + MYSQL_PROXIES_PRIV_PROXIED_USER, + MYSQL_PROXIES_PRIV_WITH_GRANT, + MYSQL_PROXIES_PRIV_GRANTOR, + MYSQL_PROXIES_PRIV_TIMESTAMP } old_acl_proxy_users; public: ACL_PROXY_USER () {}; @@ -308,11 +310,11 @@ public: void init(TABLE *table, MEM_ROOT *mem) { - init (get_field(mem, table->field[MYSQL_PROXY_PRIV_HOST]), - get_field(mem, table->field[MYSQL_PROXY_PRIV_USER]), - get_field(mem, table->field[MYSQL_PROXY_PRIV_PROXIED_HOST]), - get_field(mem, table->field[MYSQL_PROXY_PRIV_PROXIED_USER]), - table->field[MYSQL_PROXY_PRIV_WITH_GRANT]->val_int() != 0); + init (get_field(mem, table->field[MYSQL_PROXIES_PRIV_HOST]), + get_field(mem, table->field[MYSQL_PROXIES_PRIV_USER]), + get_field(mem, table->field[MYSQL_PROXIES_PRIV_PROXIED_HOST]), + get_field(mem, table->field[MYSQL_PROXIES_PRIV_PROXIED_USER]), + table->field[MYSQL_PROXIES_PRIV_WITH_GRANT]->val_int() != 0); } bool get_with_grant() { return with_grant; } @@ -337,7 +339,7 @@ public: (hostname_requires_resolving(host.hostname) || hostname_requires_resolving(proxied_host.hostname))) { - sql_print_warning("'proxy_priv' entry '%s@%s %s@%s' " + sql_print_warning("'proxes_priv' entry '%s@%s %s@%s' " "ignored in --skip-name-resolve mode.", proxied_user ? proxied_user : "", proxied_host.hostname ? proxied_host.hostname : "", @@ -452,19 +454,19 @@ public: user->str ? user->str : "", proxied_host->str ? proxied_host->str : "", proxied_user->str ? proxied_user->str : "")); - if (table->field[MYSQL_PROXY_PRIV_HOST]->store(host->str, + if (table->field[MYSQL_PROXIES_PRIV_HOST]->store(host->str, host->length, system_charset_info)) DBUG_RETURN(TRUE); - if (table->field[MYSQL_PROXY_PRIV_USER]->store(user->str, + if (table->field[MYSQL_PROXIES_PRIV_USER]->store(user->str, user->length, system_charset_info)) DBUG_RETURN(TRUE); - if (table->field[MYSQL_PROXY_PRIV_PROXIED_HOST]->store(proxied_host->str, + if (table->field[MYSQL_PROXIES_PRIV_PROXIED_HOST]->store(proxied_host->str, proxied_host->length, system_charset_info)) DBUG_RETURN(TRUE); - if (table->field[MYSQL_PROXY_PRIV_PROXIED_USER]->store(proxied_user->str, + if (table->field[MYSQL_PROXIES_PRIV_PROXIED_USER]->store(proxied_user->str, proxied_user->length, system_charset_info)) DBUG_RETURN(TRUE); @@ -472,20 +474,25 @@ public: DBUG_RETURN(FALSE); } - static int store_data_record(TABLE *table, - const LEX_STRING *host, + static int store_data_record(TABLE *table, + const LEX_STRING *host, const LEX_STRING *user, - const LEX_STRING *proxied_host, + const LEX_STRING *proxied_host, const LEX_STRING *proxied_user, - bool with_grant) + bool with_grant, + const char *grantor) { - DBUG_ENTER ("ACL_PROXY_USER::store_pk"); - if (store_pk (table, host, user, proxied_host, proxied_user)) + DBUG_ENTER("ACL_PROXY_USER::store_pk"); + if (store_pk(table, host, user, proxied_host, proxied_user)) DBUG_RETURN(TRUE); - DBUG_PRINT ("info", ("with_grant=%s", with_grant ? "TRUE" : "FALSE")); - if (table->field[MYSQL_PROXY_PRIV_WITH_GRANT]->store(with_grant ? 1 : 0, + DBUG_PRINT("info", ("with_grant=%s", with_grant ? "TRUE" : "FALSE")); + if (table->field[MYSQL_PROXIES_PRIV_WITH_GRANT]->store(with_grant ? 1 : 0, TRUE)) DBUG_RETURN(TRUE); + if (table->field[MYSQL_PROXIES_PRIV_GRANTOR]->store(grantor, + strlen(grantor), + system_charset_info)) + DBUG_RETURN(TRUE); DBUG_RETURN(FALSE); } @@ -1113,8 +1120,8 @@ my_bool acl_reload(THD *thd) tables[2].init_one_table(C_STRING_WITH_LEN("mysql"), C_STRING_WITH_LEN("db"), "db", TL_READ); tables[3].init_one_table(C_STRING_WITH_LEN("mysql"), - C_STRING_WITH_LEN("proxy_priv"), - "proxy_priv", TL_READ); + C_STRING_WITH_LEN("proxies_priv"), + "proxies_priv", TL_READ); tables[0].next_local= tables[0].next_global= tables + 1; tables[1].next_local= tables[1].next_global= tables + 2; tables[2].next_local= tables[2].next_global= tables + 3; @@ -2608,7 +2615,7 @@ acl_insert_proxy_user(ACL_PROXY_USER *new_value) static int -replace_proxy_priv_table(THD *thd, TABLE *table, const LEX_USER *user, +replace_proxies_priv_table(THD *thd, TABLE *table, const LEX_USER *user, const LEX_USER *proxied_user, bool with_grant_arg, bool revoke_grant) { @@ -2616,8 +2623,9 @@ replace_proxy_priv_table(THD *thd, TABLE *table, const LEX_USER *user, int error; uchar user_key[MAX_KEY_LENGTH]; ACL_PROXY_USER new_grant; + char grantor[USER_HOST_BUFF_SIZE]; - DBUG_ENTER("replace_proxy_priv_table"); + DBUG_ENTER("replace_proxies_priv_table"); if (!initialized) { @@ -2639,6 +2647,8 @@ replace_proxy_priv_table(THD *thd, TABLE *table, const LEX_USER *user, key_copy(user_key, table->record[0], table->key_info, table->key_info->key_length); + get_grantor(thd, grantor); + table->file->ha_index_init(0, 1); if (table->file->index_read_map(table->record[0], user_key, HA_WHOLE_KEY, @@ -2655,7 +2665,8 @@ replace_proxy_priv_table(THD *thd, TABLE *table, const LEX_USER *user, ACL_PROXY_USER::store_data_record(table, &user->host, &user->user, &proxied_user->host, &proxied_user->user, - with_grant_arg); + with_grant_arg, + grantor); } else { @@ -2712,7 +2723,7 @@ table_error: table->file->print_error(error, MYF(0)); /* purecov: inspected */ abort: - DBUG_PRINT("info", ("aborting replace_proxy_priv_table")); + DBUG_PRINT("info", ("aborting replace_proxies_priv_table")); table->file->ha_index_end(); DBUG_RETURN(-1); } @@ -3962,14 +3973,14 @@ bool mysql_grant(THD *thd, const char *db, List &list, proxied_user= str_list++; } - /* open the mysql.user and mysql.db or mysql.proxy_priv tables */ + /* open the mysql.user and mysql.db or mysql.proxies_priv tables */ tables[0].init_one_table(C_STRING_WITH_LEN("mysql"), C_STRING_WITH_LEN("user"), "user", TL_WRITE); if (is_proxy) tables[1].init_one_table(C_STRING_WITH_LEN("mysql"), - C_STRING_WITH_LEN("proxy_priv"), - "proxy_priv", + C_STRING_WITH_LEN("proxies_priv"), + "proxies_priv", TL_WRITE); else tables[1].init_one_table(C_STRING_WITH_LEN("mysql"), @@ -4063,7 +4074,7 @@ bool mysql_grant(THD *thd, const char *db, List &list, } else if (is_proxy) { - if (replace_proxy_priv_table (thd, tables[1].table, Str, proxied_user, + if (replace_proxies_priv_table (thd, tables[1].table, Str, proxied_user, rights & GRANT_ACL ? TRUE : FALSE, revoke_grant)) result= -1; @@ -5690,8 +5701,8 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables) C_STRING_WITH_LEN("procs_priv"), "procs_priv", TL_WRITE); (tables+5)->init_one_table(C_STRING_WITH_LEN("mysql"), - C_STRING_WITH_LEN("proxy_priv"), - "proxy_priv", TL_WRITE); + C_STRING_WITH_LEN("proxies_priv"), + "proxies_priv", TL_WRITE); tables->next_local= tables->next_global= tables + 1; (tables+1)->next_local= (tables+1)->next_global= tables + 2; (tables+2)->next_local= (tables+2)->next_global= tables + 3; @@ -6283,7 +6294,7 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop, } } - /* Handle proxy_priv table. */ + /* Handle proxies_priv table. */ if ((found= handle_grant_table(tables, 5, drop, user_from, user_to)) < 0) { /* Handle of table failed, don't touch the in-memory array. */ @@ -6291,7 +6302,7 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop, } else { - /* Handle proxy_priv array. */ + /* Handle proxies_priv array. */ if ((handle_grant_struct(5, drop, user_from, user_to) && !result) || found) result= 1; /* At least one record/element found. */ From 6f01f9c5acde003554af93f8f33c85198ab0813d Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Tue, 2 Nov 2010 19:52:56 +0100 Subject: [PATCH 43/64] Fix cmake's version string handling (change proposed by Jonathan Perkin). Before this, a text suffix (like "-rc") after the numeric version was needed. --- cmake/mysql_version.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake index 6adca2ccc2f..886d7b9e8a9 100644 --- a/cmake/mysql_version.cmake +++ b/cmake/mysql_version.cmake @@ -42,6 +42,9 @@ MACRO(GET_MYSQL_VERSION) IF(NOT VERSION_STRING) FILE(STRINGS configure.in str REGEX "AC_INIT\\(") STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][a-zAZ0-9]+" VERSION_STRING "${str}") + IF(NOT VERSION_STRING) + STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}") + ENDIF() ENDIF() ENDIF() ENDIF() From 682f27266be2b1cfd1bd28597838ce0c6753512f Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Tue, 2 Nov 2010 19:54:58 +0100 Subject: [PATCH 44/64] Add the new "qa_auth_*" plugin files to the RPM spec file, otherwise RPM builds will fail due to "unpackaged file". --- support-files/mysql.spec.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 15fe4a38a54..53178bb4d96 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -977,6 +977,9 @@ echo "=====" >> $STATUS_HISTORY %attr(755, root, root) %{_libdir}/mysql/plugin/auth.so %attr(755, root, root) %{_libdir}/mysql/plugin/auth_socket.so %attr(755, root, root) %{_libdir}/mysql/plugin/auth_test_plugin.so +%attr(755, root, root) %{_libdir}/mysql/plugin/qa_auth_client.so +%attr(755, root, root) %{_libdir}/mysql/plugin/qa_auth_interface.so +%attr(755, root, root) %{_libdir}/mysql/plugin/qa_auth_server.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/adt_null.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/libdaemon_example.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/mypluglib.so @@ -985,6 +988,9 @@ echo "=====" >> $STATUS_HISTORY %attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth_socket.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth_test_plugin.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/qa_auth_client.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/qa_auth_interface.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/qa_auth_server.so %if %{WITH_TCMALLOC} %attr(755, root, root) %{_libdir}/mysql/%{malloc_lib_target} From 812827e669e187e16623a327c0a5adc7cabe647a Mon Sep 17 00:00:00 2001 From: smenon Date: Wed, 3 Nov 2010 09:59:11 +0100 Subject: [PATCH 45/64] Bug #57746: Win directory of source distribution - out-of-date files / support for new files --- win/README | 34 ++++++++++++++++++++++++++-------- win/build-nmake-x64.bat | 21 --------------------- win/build-nmake.bat | 21 --------------------- win/build-vs71.bat | 22 ---------------------- win/build-vs8.bat | 21 --------------------- win/build-vs8_x64.bat | 21 --------------------- win/build-vs9.bat | 18 ------------------ win/build-vs9_x64.bat | 18 ------------------ 8 files changed, 26 insertions(+), 150 deletions(-) delete mode 100644 win/build-nmake-x64.bat delete mode 100644 win/build-nmake.bat delete mode 100755 win/build-vs71.bat delete mode 100755 win/build-vs8.bat delete mode 100755 win/build-vs8_x64.bat delete mode 100644 win/build-vs9.bat delete mode 100644 win/build-vs9_x64.bat diff --git a/win/README b/win/README index 63923a6d7e2..9886fe3a44d 100644 --- a/win/README +++ b/win/README @@ -10,7 +10,7 @@ or ealier. The Windows build system uses a tool named CMake to generate build files for a variety of project systems. This tool is combined with a set of jscript -files to enable building of MySQL for Windows directly out of a bk clone. +files to enable building of MySQL for Windows directly out of a bzr clone. The steps required are below. Step 1: @@ -41,7 +41,7 @@ before you start the build) Step 4 ------ -Clone your bk tree to any location you like. +Clone your bzr tree to any location you like. Step 5 ------ @@ -76,17 +76,35 @@ win\configure WITH_INNOBASE_STORAGE_ENGINE WITH_PARTITION_STORAGE_ENGINE MYSQL_S Step 6 ------ -From the root of your installation directory/bk clone, execute one of -the batch files to generate the type of project files you desire. +From the root of your installation directory/bzr clone, you can +use cmake to compile the sources.Use cmake --help when necessary. +Before you run cmake with changed settings (compiler, system +libraries, options, ...), make sure you delete the CMakeCache.txt +generated by your previous run. -For Visual Studio 8 (or Visual C++ 2005 express edition), do win\build-vs8. -For Visual Studio 7.1, do win\build-vs71. +C:\>del CMakeCache.txt +C:\>cmake . -G "target name" -We will support building with nmake in the near future. +For Example: +To generate the Win64 project files using Visual Studio 9, you would run +cmake . -G "Visual Studio 9 2008 Win64" +Other target names supported using CMake 2.6 patch 4 are: + + Visual Studio 7 "Visual Studio 7 .NET 2003" + Visual Studio 8 "Visual Studio 8 2005" + Visual Studio 8 (64 bit) "Visual Studio 8 2005 Win64" + Visual Studio 9 "Visual Studio 9 2008" + Visual Studio 9 (64 bit) "Visual Studio 9 2008 Win64" + +For generating project files using Visual Studio 10, you need CMake 2.8 +or higher and corresponding target names are + Visual Studio 10 + Visual Studio 10 Win64 + Step 7 ------ -From the root of your bk clone, start your build. +From the root of your bzr clone, start your build. For Visual Studio, execute mysql.sln. This will start the IDE and you can click the build solution menu option. diff --git a/win/build-nmake-x64.bat b/win/build-nmake-x64.bat deleted file mode 100644 index f73574ac8de..00000000000 --- a/win/build-nmake-x64.bat +++ /dev/null @@ -1,21 +0,0 @@ -@echo off - -REM Copyright (C) 2006 MySQL AB -REM -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License -REM along with this program; if not, write to the Free Software -REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -if exist cmakecache.txt del cmakecache.txt -copy win\nmake_x64_cache.txt cmakecache.txt -cmake -G "NMake Makefiles" -copy cmakecache.txt win\nmake_x64_cache.txt diff --git a/win/build-nmake.bat b/win/build-nmake.bat deleted file mode 100644 index 89505c08313..00000000000 --- a/win/build-nmake.bat +++ /dev/null @@ -1,21 +0,0 @@ -@echo off - -REM Copyright (C) 2006 MySQL AB -REM -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License -REM along with this program; if not, write to the Free Software -REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -if exist cmakecache.txt del cmakecache.txt -copy win\nmake_cache.txt cmakecache.txt -cmake -G "NMake Makefiles" -copy cmakecache.txt win\nmake_cache.txt diff --git a/win/build-vs71.bat b/win/build-vs71.bat deleted file mode 100755 index 159b1ec97d1..00000000000 --- a/win/build-vs71.bat +++ /dev/null @@ -1,22 +0,0 @@ -@echo off - -REM Copyright (C) 2006 MySQL AB -REM -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License -REM along with this program; if not, write to the Free Software -REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -if exist cmakecache.txt del cmakecache.txt -copy win\vs71cache.txt cmakecache.txt -cmake -G "Visual Studio 7 .NET 2003" -copy cmakecache.txt win\vs71cache.txt - diff --git a/win/build-vs8.bat b/win/build-vs8.bat deleted file mode 100755 index ff0eeb0a8cb..00000000000 --- a/win/build-vs8.bat +++ /dev/null @@ -1,21 +0,0 @@ -@echo off - -REM Copyright (C) 2006 MySQL AB -REM -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License -REM along with this program; if not, write to the Free Software -REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -if exist cmakecache.txt del cmakecache.txt -copy win\vs8cache.txt cmakecache.txt -cmake -G "Visual Studio 8 2005" -copy cmakecache.txt win\vs8cache.txt diff --git a/win/build-vs8_x64.bat b/win/build-vs8_x64.bat deleted file mode 100755 index bc13e01d742..00000000000 --- a/win/build-vs8_x64.bat +++ /dev/null @@ -1,21 +0,0 @@ -@echo off - -REM Copyright (C) 2006 MySQL AB -REM -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License -REM along with this program; if not, write to the Free Software -REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -if exist cmakecache.txt del cmakecache.txt -copy win\vs8cache.txt cmakecache.txt -cmake -G "Visual Studio 8 2005 Win64" -copy cmakecache.txt win\vs8cache.txt diff --git a/win/build-vs9.bat b/win/build-vs9.bat deleted file mode 100644 index 09f1e343013..00000000000 --- a/win/build-vs9.bat +++ /dev/null @@ -1,18 +0,0 @@ -@echo off - -REM Copyright (C) 2006 MySQL AB -REM -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License -REM along with this program; if not, write to the Free Software -REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -cmake -G "Visual Studio 9 2008" - diff --git a/win/build-vs9_x64.bat b/win/build-vs9_x64.bat deleted file mode 100644 index 61c7253132d..00000000000 --- a/win/build-vs9_x64.bat +++ /dev/null @@ -1,18 +0,0 @@ -@echo off - -REM Copyright (C) 2006 MySQL AB -REM -REM This program is free software; you can redistribute it and/or modify -REM it under the terms of the GNU General Public License as published by -REM the Free Software Foundation; version 2 of the License. -REM -REM This program is distributed in the hope that it will be useful, -REM but WITHOUT ANY WARRANTY; without even the implied warranty of -REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM GNU General Public License for more details. -REM -REM You should have received a copy of the GNU General Public License -REM along with this program; if not, write to the Free Software -REM Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -cmake -G "Visual Studio 9 2008 Win64" - From 74328892e0f28c1b1a410df1889225639cb9152b Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 3 Nov 2010 13:47:22 +0200 Subject: [PATCH 46/64] Addendum to bug #57916 : fixed the test suite to be less environment dependent. --- mysql-test/r/plugin_auth.result | 6 +++--- mysql-test/t/plugin_auth.test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result index d56a4e5326a..7119ba11077 100644 --- a/mysql-test/r/plugin_auth.result +++ b/mysql-test/r/plugin_auth.result @@ -14,9 +14,9 @@ GRANT PROXY ON plug_dest TO plug; test proxies_priv columns SELECT * FROM mysql.proxies_priv; Host User Proxied_host Proxied_user With_grant Grantor Timestamp -localhost root 1 xx -unknown root 1 xx -% plug % plug_dest 0 root@localhost xx +xx root 1 xx +xx root 1 xx +xx plug % plug_dest 0 root@localhost xx test mysql.proxies_priv; SHOW CREATE TABLE mysql.proxies_priv; Table Create Table diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test index ebbaf389632..439cabaef18 100644 --- a/mysql-test/t/plugin_auth.test +++ b/mysql-test/t/plugin_auth.test @@ -17,7 +17,7 @@ connect(plug_con,localhost,plug,plug_dest); GRANT PROXY ON plug_dest TO plug; --echo test proxies_priv columns ---replace_column 7 xx +--replace_column 1 xx 7 xx SELECT * FROM mysql.proxies_priv; --echo test mysql.proxies_priv; SHOW CREATE TABLE mysql.proxies_priv; From e68f62e7519d540d19ec76d3c881444ebfb0b06a Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Wed, 3 Nov 2010 14:52:10 +0300 Subject: [PATCH 47/64] Fix version tag (remove -rc suffix). --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 9f986e068cb..2d67f34b4bb 100644 --- a/configure.in +++ b/configure.in @@ -27,7 +27,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.5.8-rc], [], [mysql]) +AC_INIT([MySQL Server], [5.5.8], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From 39bceaac0295e556a8db5d354315b39dfb0f3ef6 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 3 Nov 2010 15:31:42 +0200 Subject: [PATCH 48/64] added windows cmake binaries --- .bzrignore | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.bzrignore b/.bzrignore index e1e2083e2d2..3d27c001e2b 100644 --- a/.bzrignore +++ b/.bzrignore @@ -9,15 +9,19 @@ *.core *.d *.da +*.dll *.exe +*.exp *.gcda *.gcno *.gcov *.idb +*.ilk *.la *.lai *.lib *.lo +*.manifest *.map *.o *.obj @@ -87,6 +91,7 @@ BitKeeper/tmp/* BitKeeper/tmp/bkr3sAHD BitKeeper/tmp/gone CMakeFiles/* +CMakeFiles COPYING COPYING.LIB Docs/#manual.texi# @@ -146,6 +151,7 @@ Makefile Makefile.in Makefile.in' PENDING/* +scripts/scripts TAGS VC++Files/client/mysql_amd64.dsp ac_available_languages_fragment @@ -1968,6 +1974,7 @@ sql-bench/test-transactions sql-bench/test-wisconsin sql/*.cpp sql/*.ds? +sql/*.def sql/*.vcproj sql/.deps/client.Po sql/.deps/derror.Po @@ -2100,6 +2107,7 @@ sql/.libs/udf_example.lai sql/.libs/udf_example.so.0 sql/.libs/udf_example.so.0.0.0 sql/client.c +sql/cmake_dummy.cc sql/Doxyfile sql/f.c sql/gen_lex_hash @@ -3030,6 +3038,7 @@ vio/viotest.cpp win/configure.data win/vs71cache.txt win/vs8cache.txt +win/nmake_cache.txt ylwrap zlib/*.ds? zlib/*.vcproj From 4cfa91f42c4cde9c35979cd2b9837cb60213d876 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 3 Nov 2010 16:03:40 +0200 Subject: [PATCH 49/64] bumped up the version --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 7680a60226a..7c781c35cc2 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.1.53], [], [mysql]) +AC_INIT([MySQL Server], [5.1.54], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From 1602ffb8ab4e04d17db995a22bb6c33a5a638881 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Wed, 3 Nov 2010 14:51:52 +0000 Subject: [PATCH 50/64] BUG#57899: Certain reserved words should not be reserved In MySQL 5.5 the new reserved words include: SLOW as in FLUSH SLOW LOGS GENERAL as in FLUSH GENERAL LOGS IGNORE_SERVER_IDS as in CHANGE MASTER ... IGNORE_SERVER_IDS MASTER_HEARTBEAT_PERIOD as in CHANGE MASTER ... MASTER_HEARTBEAT_PERIOD These are not reserved words in standard SQL, or in Oracle 11g, and as such, may affect existing applications. We fix this by adding the new words to the list of keywords that are allowed for labels in SPs. mysql-test/t/keywords.test: Test case that checks that the target words can be used for naming fields in a table or as local routine variable names. --- mysql-test/r/keywords.result | 224 +++++++++++++++++++++++++++++++++++ mysql-test/t/keywords.test | 100 +++++++++++++++- sql/sql_yacc.yy | 4 + 3 files changed, 327 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result index 5f338ad6a62..977fe7791b9 100644 --- a/mysql-test/r/keywords.result +++ b/mysql-test/r/keywords.result @@ -45,3 +45,227 @@ p1 max=1 drop procedure p1; drop table t1; +CREATE TABLE slow (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT); +INSERT INTO slow(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8); +INSERT INTO slow(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); +INSERT INTO slow(slow, general) VALUES (1,2), (5,6); +INSERT INTO slow(slow) VALUES (1), (5); +SELECT slow, general, master_heartbeat_period, slow FROM slow ORDER BY slow; +slow general master_heartbeat_period slow +1 2 3 1 +1 2 3 1 +1 2 NULL 1 +1 NULL NULL 1 +5 6 7 5 +5 6 7 5 +5 6 NULL 5 +5 NULL NULL 5 +SELECT slow, general, master_heartbeat_period FROM slow ORDER BY slow; +slow general master_heartbeat_period +1 2 3 +1 2 3 +1 2 NULL +1 NULL NULL +5 6 7 +5 6 7 +5 6 NULL +5 NULL NULL +SELECT slow, master_heartbeat_period FROM slow ORDER BY slow; +slow master_heartbeat_period +1 3 +1 3 +1 NULL +1 NULL +5 7 +5 7 +5 NULL +5 NULL +SELECT slow FROM slow ORDER BY slow; +slow +1 +1 +1 +1 +5 +5 +5 +5 +DROP TABLE slow; +CREATE TABLE general (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT); +INSERT INTO general(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8); +INSERT INTO general(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); +INSERT INTO general(slow, general) VALUES (1,2), (5,6); +INSERT INTO general(slow) VALUES (1), (5); +SELECT slow, general, master_heartbeat_period, slow FROM general ORDER BY slow; +slow general master_heartbeat_period slow +1 2 3 1 +1 2 3 1 +1 2 NULL 1 +1 NULL NULL 1 +5 6 7 5 +5 6 7 5 +5 6 NULL 5 +5 NULL NULL 5 +SELECT slow, general, master_heartbeat_period FROM general ORDER BY slow; +slow general master_heartbeat_period +1 2 3 +1 2 3 +1 2 NULL +1 NULL NULL +5 6 7 +5 6 7 +5 6 NULL +5 NULL NULL +SELECT slow, master_heartbeat_period FROM general ORDER BY slow; +slow master_heartbeat_period +1 3 +1 3 +1 NULL +1 NULL +5 7 +5 7 +5 NULL +5 NULL +SELECT slow FROM general ORDER BY slow; +slow +1 +1 +1 +1 +5 +5 +5 +5 +DROP TABLE general; +CREATE TABLE master_heartbeat_period (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT); +INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8); +INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); +INSERT INTO master_heartbeat_period(slow, general) VALUES (1,2), (5,6); +INSERT INTO master_heartbeat_period(slow) VALUES (1), (5); +SELECT slow, general, master_heartbeat_period, slow FROM master_heartbeat_period ORDER BY slow; +slow general master_heartbeat_period slow +1 2 3 1 +1 2 3 1 +1 2 NULL 1 +1 NULL NULL 1 +5 6 7 5 +5 6 7 5 +5 6 NULL 5 +5 NULL NULL 5 +SELECT slow, general, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow; +slow general master_heartbeat_period +1 2 3 +1 2 3 +1 2 NULL +1 NULL NULL +5 6 7 +5 6 7 +5 6 NULL +5 NULL NULL +SELECT slow, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow; +slow master_heartbeat_period +1 3 +1 3 +1 NULL +1 NULL +5 7 +5 7 +5 NULL +5 NULL +SELECT slow FROM master_heartbeat_period ORDER BY slow; +slow +1 +1 +1 +1 +5 +5 +5 +5 +DROP TABLE master_heartbeat_period; +CREATE TABLE ignore_server_ids (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT); +INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8); +INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); +INSERT INTO ignore_server_ids(slow, general) VALUES (1,2), (5,6); +INSERT INTO ignore_server_ids(slow) VALUES (1), (5); +SELECT slow, general, master_heartbeat_period, slow FROM ignore_server_ids ORDER BY slow; +slow general master_heartbeat_period slow +1 2 3 1 +1 2 3 1 +1 2 NULL 1 +1 NULL NULL 1 +5 6 7 5 +5 6 7 5 +5 6 NULL 5 +5 NULL NULL 5 +SELECT slow, general, master_heartbeat_period FROM ignore_server_ids ORDER BY slow; +slow general master_heartbeat_period +1 2 3 +1 2 3 +1 2 NULL +1 NULL NULL +5 6 7 +5 6 7 +5 6 NULL +5 NULL NULL +SELECT slow, master_heartbeat_period FROM ignore_server_ids ORDER BY slow; +slow master_heartbeat_period +1 3 +1 3 +1 NULL +1 NULL +5 7 +5 7 +5 NULL +5 NULL +SELECT slow FROM ignore_server_ids ORDER BY slow; +slow +1 +1 +1 +1 +5 +5 +5 +5 +DROP TABLE ignore_server_ids; +CREATE TABLE t1 (slow INT, general INT, ignore_server_ids INT, master_heartbeat_period INT); +INSERT INTO t1 VALUES (1,2,3,4); +CREATE PROCEDURE p1() +BEGIN +DECLARE slow INT; +DECLARE general INT; +DECLARE ignore_server_ids INT; +DECLARE master_heartbeat_period INT; +SELECT max(t1.slow) INTO slow FROM t1; +SELECT max(t1.general) INTO general FROM t1; +SELECT max(t1.ignore_server_ids) INTO ignore_server_ids FROM t1; +SELECT max(t1.master_heartbeat_period) INTO master_heartbeat_period FROM t1; +SELECT slow, general, ignore_server_ids, master_heartbeat_period; +END| +CREATE PROCEDURE p2() +BEGIN +DECLARE n INT DEFAULT 2; +general: WHILE n > 0 DO +SET n = n -1; +END WHILE general; +SET n = 2; +slow: WHILE n > 0 DO +SET n = n -1; +END WHILE slow; +SET n = 2; +ignore_server_ids: WHILE n > 0 DO +SET n = n -1; +END WHILE ignore_server_ids; +SET n = 2; +master_heartbeat_period: WHILE n > 0 DO +SET n = n -1; +END WHILE master_heartbeat_period; +END| +CALL p1(); +slow general ignore_server_ids master_heartbeat_period +1 2 3 4 +call p2(); +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP TABLE t1; diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test index 3080c4847b4..2681f786f40 100644 --- a/mysql-test/t/keywords.test +++ b/mysql-test/t/keywords.test @@ -62,5 +62,103 @@ call p1(); drop procedure p1; drop table t1; - # End of 5.0 tests + +# +# BUG#57899: Certain reserved words should not be reserved +# + +# +# We are looking for SYNTAX ERRORS here, so no need to +# log the queries +# + +CREATE TABLE slow (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT); +INSERT INTO slow(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8); +INSERT INTO slow(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); +INSERT INTO slow(slow, general) VALUES (1,2), (5,6); +INSERT INTO slow(slow) VALUES (1), (5); +SELECT slow, general, master_heartbeat_period, slow FROM slow ORDER BY slow; +SELECT slow, general, master_heartbeat_period FROM slow ORDER BY slow; +SELECT slow, master_heartbeat_period FROM slow ORDER BY slow; +SELECT slow FROM slow ORDER BY slow; +DROP TABLE slow; +CREATE TABLE general (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT); +INSERT INTO general(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8); +INSERT INTO general(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); +INSERT INTO general(slow, general) VALUES (1,2), (5,6); +INSERT INTO general(slow) VALUES (1), (5); +SELECT slow, general, master_heartbeat_period, slow FROM general ORDER BY slow; +SELECT slow, general, master_heartbeat_period FROM general ORDER BY slow; +SELECT slow, master_heartbeat_period FROM general ORDER BY slow; +SELECT slow FROM general ORDER BY slow; +DROP TABLE general; +CREATE TABLE master_heartbeat_period (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT); +INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8); +INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); +INSERT INTO master_heartbeat_period(slow, general) VALUES (1,2), (5,6); +INSERT INTO master_heartbeat_period(slow) VALUES (1), (5); +SELECT slow, general, master_heartbeat_period, slow FROM master_heartbeat_period ORDER BY slow; +SELECT slow, general, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow; +SELECT slow, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow; +SELECT slow FROM master_heartbeat_period ORDER BY slow; +DROP TABLE master_heartbeat_period; +CREATE TABLE ignore_server_ids (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT); +INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8); +INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); +INSERT INTO ignore_server_ids(slow, general) VALUES (1,2), (5,6); +INSERT INTO ignore_server_ids(slow) VALUES (1), (5); +SELECT slow, general, master_heartbeat_period, slow FROM ignore_server_ids ORDER BY slow; +SELECT slow, general, master_heartbeat_period FROM ignore_server_ids ORDER BY slow; +SELECT slow, master_heartbeat_period FROM ignore_server_ids ORDER BY slow; +SELECT slow FROM ignore_server_ids ORDER BY slow; +DROP TABLE ignore_server_ids; + +CREATE TABLE t1 (slow INT, general INT, ignore_server_ids INT, master_heartbeat_period INT); +INSERT INTO t1 VALUES (1,2,3,4); +DELIMITER |; +CREATE PROCEDURE p1() +BEGIN + DECLARE slow INT; + DECLARE general INT; + DECLARE ignore_server_ids INT; + DECLARE master_heartbeat_period INT; + + SELECT max(t1.slow) INTO slow FROM t1; + SELECT max(t1.general) INTO general FROM t1; + SELECT max(t1.ignore_server_ids) INTO ignore_server_ids FROM t1; + SELECT max(t1.master_heartbeat_period) INTO master_heartbeat_period FROM t1; + + SELECT slow, general, ignore_server_ids, master_heartbeat_period; +END| + +CREATE PROCEDURE p2() +BEGIN + + DECLARE n INT DEFAULT 2; + general: WHILE n > 0 DO + SET n = n -1; + END WHILE general; + + SET n = 2; + slow: WHILE n > 0 DO + SET n = n -1; + END WHILE slow; + + SET n = 2; + ignore_server_ids: WHILE n > 0 DO + SET n = n -1; + END WHILE ignore_server_ids; + + SET n = 2; + master_heartbeat_period: WHILE n > 0 DO + SET n = n -1; + END WHILE master_heartbeat_period; + +END| +DELIMITER ;| +CALL p1(); +call p2(); +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP TABLE t1; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 396c426f29f..66d74a398fb 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -12497,6 +12497,7 @@ keyword_sp: | FILE_SYM {} | FIRST_SYM {} | FIXED_SYM {} + | GENERAL {} | GEOMETRY_SYM {} | GEOMETRYCOLLECTION {} | GET_FORMAT {} @@ -12506,6 +12507,7 @@ keyword_sp: | HOSTS_SYM {} | HOUR_SYM {} | IDENTIFIED_SYM {} + | IGNORE_SERVER_IDS_SYM {} | INVOKER_SYM {} | IMPORT {} | INDEXES {} @@ -12528,6 +12530,7 @@ keyword_sp: | LOGS_SYM {} | MAX_ROWS {} | MASTER_SYM {} + | MASTER_HEARTBEAT_PERIOD_SYM {} | MASTER_HOST_SYM {} | MASTER_PORT_SYM {} | MASTER_LOG_FILE_SYM {} @@ -12633,6 +12636,7 @@ keyword_sp: | SIMPLE_SYM {} | SHARE_SYM {} | SHUTDOWN {} + | SLOW {} | SNAPSHOT_SYM {} | SOUNDS_SYM {} | SOURCE_SYM {} From 6429e7d36b7c608392fb5e94f14b092addde3eda Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Thu, 4 Nov 2010 13:29:16 +0800 Subject: [PATCH 51/64] BUG#47027 delegates_init() failure is not user friendly (usability issue) Function delegetas_init() did not report proper error messages when there are failures, which made it hard to know where the problem occurred. Fixed the problem by adding specific error message for every possible place that can fail. And since these failures are supposed to never happen, ask the user to report a bug if they happened. --- sql/mysqld.cc | 8 ++++---- sql/rpl_handler.cc | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 99754e8b7f6..df4f0f95b8c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3778,12 +3778,12 @@ static int init_server_components() unireg_abort(1); } - /* initialize delegates for extension observers */ + /* + initialize delegates for extension observers, errors have already + been reported in the function + */ if (delegates_init()) - { - sql_print_error("Initialize extension delegates failed"); unireg_abort(1); - } /* need to configure logging before initializing storage engines */ if (opt_log_slave_updates && !opt_bin_log) diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc index 5f16544d855..4355942e47f 100644 --- a/sql/rpl_handler.cc +++ b/sql/rpl_handler.cc @@ -105,12 +105,20 @@ int delegates_init() transaction_delegate= new (place_trans_mem) Trans_delegate; if (!transaction_delegate->is_inited()) + { + sql_print_error("Initialization of transaction delegates failed. " + "Please report a bug."); return 1; + } binlog_storage_delegate= new (place_storage_mem) Binlog_storage_delegate; if (!binlog_storage_delegate->is_inited()) + { + sql_print_error("Initialization binlog storage delegates failed. " + "Please report a bug."); return 1; + } #ifdef HAVE_REPLICATION void *place_transmit_mem= transmit_mem.data; @@ -119,16 +127,29 @@ int delegates_init() binlog_transmit_delegate= new (place_transmit_mem) Binlog_transmit_delegate; if (!binlog_transmit_delegate->is_inited()) + { + sql_print_error("Initialization of binlog transmit delegates failed. " + "Please report a bug."); return 1; + } binlog_relay_io_delegate= new (place_relay_io_mem) Binlog_relay_IO_delegate; if (!binlog_relay_io_delegate->is_inited()) + { + sql_print_error("Initialization binlog relay IO delegates failed. " + "Please report a bug."); return 1; + } #endif if (pthread_key_create(&RPL_TRANS_BINLOG_INFO, NULL)) + { + sql_print_error("Error while creating pthread specific data key for replication. " + "Please report a bug."); return 1; + } + return 0; } From 64bee6fdc5a16bacc6e290e586038ac338b1ed69 Mon Sep 17 00:00:00 2001 From: Jorgen Loland Date: Thu, 4 Nov 2010 09:36:04 +0100 Subject: [PATCH 52/64] Bug#57882 - Item_func_conv_charset::val_str(String*): Assertion `fixed == 1' failed (also fixes duplicate bug 57515) agg_item_set_converter() (item.cc) handles conversion of character sets by creating a new Item. fix_fields() is then called on this newly created item. Prior to this patch, it was not checked whether fix_fields() was successful or not. Thus, agg_item_set_converter() would return success even when an error occured. This patch makes it return error (TRUE) if fix_fields() fails. mysql-test/r/errors.result: Add test for BUG#57882 mysql-test/t/errors.test: Add test for BUG#57882 sql/item.cc: Make agg_item_set_converter() return with error if fix_fields() on the newly created converted item fails. --- mysql-test/r/errors.result | 12 ++++++++++++ mysql-test/t/errors.test | 16 ++++++++++++++++ sql/item.cc | 11 ++++++----- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index 3d247a242a3..43cabd28498 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -134,3 +134,15 @@ INSERT INTO t1 VALUES ('abc\0\0'); INSERT INTO t1 VALUES ('abc\0\0'); ERROR 23000: Duplicate entry 'abc\x00\x00' for key 'PRIMARY' DROP TABLE t1; +# +# Bug#57882: Item_func_conv_charset::val_str(String*): +# Assertion `fixed == 1' failed +# +SELECT (CONVERT('0' USING latin1) IN (CHAR(COT('v') USING utf8),'')); +ERROR 22003: DOUBLE value is out of range in 'cot('v')' +SET NAMES utf8 COLLATE utf8_latvian_ci ; +SELECT UPDATEXML(-73 * -2465717823867977728,@@global.slave_net_timeout,null); +ERROR 22003: BIGINT value is out of range in '(-(73) * -(2465717823867977728))' +# +# End Bug#57882 +# diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test index f308c340645..8de5889f1c6 100644 --- a/mysql-test/t/errors.test +++ b/mysql-test/t/errors.test @@ -155,3 +155,19 @@ INSERT INTO t1 VALUES ('abc\0\0'); --error ER_DUP_ENTRY INSERT INTO t1 VALUES ('abc\0\0'); DROP TABLE t1; + +--echo # +--echo # Bug#57882: Item_func_conv_charset::val_str(String*): +--echo # Assertion `fixed == 1' failed +--echo # + +--error ER_DATA_OUT_OF_RANGE +SELECT (CONVERT('0' USING latin1) IN (CHAR(COT('v') USING utf8),'')); + +SET NAMES utf8 COLLATE utf8_latvian_ci ; +--error ER_DATA_OUT_OF_RANGE +SELECT UPDATEXML(-73 * -2465717823867977728,@@global.slave_net_timeout,null); + +--echo # +--echo # End Bug#57882 +--echo # diff --git a/sql/item.cc b/sql/item.cc index b166f3e645f..3594bf45798 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1853,11 +1853,12 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname, *arg= conv; else thd->change_item_tree(arg, conv); - /* - We do not check conv->fixed, because Item_func_conv_charset which can - be return by safe_charset_converter can't be fixed at creation - */ - conv->fix_fields(thd, arg); + + if (conv->fix_fields(thd, arg)) + { + res= TRUE; + break; // we cannot return here, we need to restore "arena". + } } if (arena) thd->restore_active_arena(arena, &backup); From f8d2154c30b37817299c37fed39ed7c86b92d052 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Thu, 4 Nov 2010 11:00:59 +0100 Subject: [PATCH 53/64] BUG#57108: mysqld crashes when I attempt to install plugin If a relative path is supplied to option --defaults-file or --defaults-extra-file, the server will crash when executing an INSTALL PLUGIN command. The reason is that the defaults file is initially read relative the current working directory when the server is started, but when INSTALL PLUGIN is executed, the server has changed working directory to the data directory. Since there is no check that the call to my_load_defaults() inside mysql_install_plugin(), the subsequence call to free_defaults() will crash the server. This patch fixes the problem by: - Prepending the current working directory to the file name when a relative path is given to the --defaults-file or --defaults- extra-file option the first time my_load_defaults() is called, which is just after the server has started in main(). - Adding a check of the return value of my_load_defaults() inside mysql_install_plugin() and aborting command (with an error) if an error is returned. - It also adds a check of the return value for load_defaults in lib_sql.cc for the embedded server since that was missing. To test that the relative files for the options --defaults-file and --defaults-extra-file is handled properly, mysql-test-run.pl is also changed to not add a --defaults-file option if one is provided in the tests *.opt file. --- include/my_sys.h | 2 +- libmysqld/lib_sql.cc | 3 +- mysql-test/mysql-test-run.pl | 11 ++- mysql-test/std_data/bug57108.cnf | 95 +++++++++++++++++++++ mysql-test/suite/bugs/r/bug57108.result | 5 ++ mysql-test/suite/bugs/t/bug57108-master.opt | 2 + mysql-test/suite/bugs/t/bug57108.test | 12 +++ mysys/default.c | 61 +++++++++++-- sql/sql_plugin.cc | 6 +- 9 files changed, 184 insertions(+), 13 deletions(-) create mode 100644 mysql-test/std_data/bug57108.cnf create mode 100644 mysql-test/suite/bugs/r/bug57108.result create mode 100644 mysql-test/suite/bugs/t/bug57108-master.opt create mode 100644 mysql-test/suite/bugs/t/bug57108.test diff --git a/include/my_sys.h b/include/my_sys.h index 23c9b2da55f..7b437e2a745 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -256,7 +256,7 @@ extern my_bool my_disable_locking, my_disable_async_io, extern char wild_many,wild_one,wild_prefix; extern const char *charsets_dir; /* from default.c */ -extern char *my_defaults_extra_file; +extern const char *my_defaults_extra_file; extern const char *my_defaults_group_suffix; extern const char *my_defaults_file; diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 1c9b773de15..b07ae1de96b 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -506,7 +506,8 @@ int init_embedded_server(int argc, char **argv, char **groups) orig_argc= *argcp; orig_argv= *argvp; - load_defaults("my", (const char **)groups, argcp, argvp); + if (load_defaults("my", (const char **)groups, argcp, argvp)) + return 1; defaults_argc= *argcp; defaults_argv= *argvp; remaining_argc= argc; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 88719ff5bb2..db9e6eda2bc 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4406,7 +4406,13 @@ sub mysqld_arguments ($$$) { my $mysqld= shift; my $extra_opts= shift; - mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + my @defaults = grep(/^--defaults-file=/, @$extra_opts); + if (@defaults > 0) { + mtr_add_arg($args, pop(@defaults)) + } + else { + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + } # When mysqld is run by a root user(euid is 0), it will fail # to start unless we specify what user to run as, see BUG#30630 @@ -4442,6 +4448,9 @@ sub mysqld_arguments ($$$) { my $found_skip_core= 0; foreach my $arg ( @$extra_opts ) { + # Skip --defaults-file option since it's handled above. + next if $arg =~ /^--defaults-file/; + # Allow --skip-core-file to be set in -[master|slave].opt file if ($arg eq "--skip-core-file") { diff --git a/mysql-test/std_data/bug57108.cnf b/mysql-test/std_data/bug57108.cnf new file mode 100644 index 00000000000..5fd8c485cf0 --- /dev/null +++ b/mysql-test/std_data/bug57108.cnf @@ -0,0 +1,95 @@ +[mysqld] +open-files-limit=1024 +character-set-server=latin1 +connect-timeout=4711 +log-bin-trust-function-creators=1 +key_buffer_size=1M +sort_buffer=256K +max_heap_table_size=1M +loose-innodb_data_file_path=ibdata1:10M:autoextend +loose-innodb_buffer_pool_size=8M +loose-innodb_write_io_threads=2 +loose-innodb_read_io_threads=2 +loose-innodb_log_buffer_size=1M +loose-innodb_log_file_size=5M +loose-innodb_additional_mem_pool_size=1M +loose-innodb_log_files_in_group=2 +slave-net-timeout=120 +log-bin=mysqld-bin +loose-enable-performance-schema +loose-performance-schema-max-mutex-instances=10000 +loose-performance-schema-max-rwlock-instances=10000 +loose-performance-schema-max-table-instances=500 +loose-performance-schema-max-table-handles=1000 +binlog-direct-non-transactional-updates + +[mysql] +default-character-set=latin1 + +[mysqlshow] +default-character-set=latin1 + +[mysqlimport] +default-character-set=latin1 + +[mysqlcheck] +default-character-set=latin1 + +[mysql_upgrade] +default-character-set=latin1 +tmpdir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp + +[mysqld.1] +#!run-master-sh +log-bin=master-bin +loose-enable-performance-schema +basedir=/home/bzr/bugs/b57108-5.5-bugteam +tmpdir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1 +character-sets-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/charsets +lc-messages-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/ +datadir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/data +pid-file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/run/mysqld.1.pid +#host=localhost +port=13000 +socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock +#log-error=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/log/mysqld.1.err +general_log=1 +general_log_file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/mysqld.log +slow_query_log=1 +slow_query_log_file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/mysqld-slow.log +#user=root +#password= +server-id=1 +secure-file-priv=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var +ssl-ca=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/cacert.pem +ssl-cert=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/server-cert.pem +ssl-key=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/server-key.pem + +[mysqlbinlog] +disable-force-if-open +character-sets-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/charsets + +[ENV] +MASTER_MYPORT=13000 +MASTER_MYSOCK=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock + +[client] +password= +user=root +port=13000 +host=localhost +socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock + +[mysqltest] +ssl-ca=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/cacert.pem +ssl-cert=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/client-cert.pem +ssl-key=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/client-key.pem +skip-ssl=1 + +[client.1] +password= +user=root +port=13000 +host=localhost +socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock + diff --git a/mysql-test/suite/bugs/r/bug57108.result b/mysql-test/suite/bugs/r/bug57108.result new file mode 100644 index 00000000000..ad60b07a1e3 --- /dev/null +++ b/mysql-test/suite/bugs/r/bug57108.result @@ -0,0 +1,5 @@ +INSTALL PLUGIN example SONAME 'ha_example.so'; +SELECT @@global.connect_timeout AS connect_timeout, @@global.local_infile AS local_infile; +connect_timeout 4711 +local_infile 1 +UNINSTALL PLUGIN example; diff --git a/mysql-test/suite/bugs/t/bug57108-master.opt b/mysql-test/suite/bugs/t/bug57108-master.opt new file mode 100644 index 00000000000..c2ab1c2ead6 --- /dev/null +++ b/mysql-test/suite/bugs/t/bug57108-master.opt @@ -0,0 +1,2 @@ +--defaults-file=std_data/bug57108.cnf +$EXAMPLE_PLUGIN_OPT diff --git a/mysql-test/suite/bugs/t/bug57108.test b/mysql-test/suite/bugs/t/bug57108.test new file mode 100644 index 00000000000..1006a7b30f1 --- /dev/null +++ b/mysql-test/suite/bugs/t/bug57108.test @@ -0,0 +1,12 @@ +--source include/not_windows_embedded.inc +--source include/have_example_plugin.inc + +# Test that we can install a plugin despite the fact that we have +# switched directory after starting the server and am using a relative +# --defaults-file. +--replace_regex /\.dll/.so/ +eval INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO; + +--query_vertical SELECT @@global.connect_timeout AS connect_timeout, @@global.local_infile AS local_infile + +UNINSTALL PLUGIN example; diff --git a/mysys/default.c b/mysys/default.c index 0e0883e1fcf..a57f1150816 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -66,7 +66,9 @@ const char *args_separator= "----args-separator----"; const char *my_defaults_file=0; const char *my_defaults_group_suffix=0; -char *my_defaults_extra_file=0; +const char *my_defaults_extra_file=0; + +static my_bool defaults_already_read= FALSE; /* Which directories are searched for options (and in which order) */ @@ -139,6 +141,36 @@ static const char **init_default_directories(MEM_ROOT *alloc); static char *remove_end_comment(char *ptr); +/* + Expand a file name so that the current working directory is added if + the name is relative. + + RETURNS + 0 All OK + 2 Out of memory or path to long + 3 Not able to get working directory + */ + +static int +fn_expand(const char *filename, const char **filename_var) +{ + char dir[FN_REFLEN], buf[FN_REFLEN]; + const int flags= MY_UNPACK_FILENAME | MY_SAFE_PATH | MY_RELATIVE_PATH; + const char *result_path= NULL; + DBUG_ENTER("fn_expand"); + DBUG_PRINT("enter", ("filename: %s, buf: 0x%lx", filename, (unsigned long) buf)); + if (my_getwd(dir, sizeof(dir), MYF(0))) + DBUG_RETURN(3); + DBUG_PRINT("debug", ("dir: %s", dir)); + if (fn_format(buf, filename, dir, NULL, flags) == NULL || + (result_path= my_strdup(buf, MYF(0))) == NULL) + DBUG_RETURN(2); + DBUG_PRINT("return", ("result: %s", result_path)); + DBUG_ASSERT(result_path != NULL); + *filename_var= result_path; + DBUG_RETURN(0); +} + /* Process config files in default directories. @@ -167,6 +199,7 @@ static char *remove_end_comment(char *ptr); 0 ok 1 given cinf_file doesn't exist 2 out of memory + 3 Can't get current working directory The global variable 'my_defaults_group_suffix' is updated with value for --defaults_group_suffix @@ -189,11 +222,21 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv, if (! my_defaults_group_suffix) my_defaults_group_suffix= getenv(STRINGIFY_ARG(DEFAULT_GROUP_SUFFIX_ENV)); - if (forced_extra_defaults) - my_defaults_extra_file= (char *) forced_extra_defaults; - - if (forced_default_file) - my_defaults_file= forced_default_file; + if (forced_extra_defaults && !defaults_already_read) + { + int error= fn_expand(forced_extra_defaults, &my_defaults_extra_file); + if (error) + DBUG_RETURN(error); + } + + if (forced_default_file && !defaults_already_read) + { + int error= fn_expand(forced_default_file, &my_defaults_file); + if (error) + DBUG_RETURN(error); + } + + defaults_already_read= TRUE; /* We can only handle 'defaults-group-suffix' if we are called from @@ -236,15 +279,15 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv, group->type_names[group->count]= 0; } - if (forced_default_file) + if (my_defaults_file) { if ((error= search_default_file_with_ext(func, func_ctx, "", "", - forced_default_file, 0)) < 0) + my_defaults_file, 0)) < 0) goto err; if (error > 0) { fprintf(stderr, "Could not open required defaults file: %s\n", - forced_default_file); + my_defaults_file); goto err; } } diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 451277712db..0fe89cd3748 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1738,7 +1738,11 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl mysql_mutex_lock(&LOCK_plugin); mysql_rwlock_wrlock(&LOCK_system_variables_hash); - my_load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv, NULL); + if (my_load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv, NULL)) + { + report_error(REPORT_TO_USER, ER_PLUGIN_IS_NOT_LOADED, name->str); + goto err; + } error= plugin_add(thd->mem_root, name, dl, &argc, argv, REPORT_TO_USER); if (argv) free_defaults(argv); From 0752b54a49fbb2c28a1a69e4de11ff68673d570c Mon Sep 17 00:00:00 2001 From: smenon Date: Thu, 4 Nov 2010 11:11:43 +0100 Subject: [PATCH 54/64] Bug #57746: Win directory of source distribution - out-of-date files / support for new files (win/README updated with some more changes) --- win/README | 62 ++++++++++++++++++++++++------------------------------ 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/win/README b/win/README index 9886fe3a44d..9c8ca9a87bc 100644 --- a/win/README +++ b/win/README @@ -11,6 +11,7 @@ or ealier. The Windows build system uses a tool named CMake to generate build files for a variety of project systems. This tool is combined with a set of jscript files to enable building of MySQL for Windows directly out of a bzr clone. +For relevant information, please refer to http://forge.mysql.com/wiki/CMake The steps required are below. Step 1: @@ -41,53 +42,42 @@ before you start the build) Step 4 ------ -Clone your bzr tree to any location you like. +One of the nice CMake features is "out-of-source" build support, which +means not building in the source directory, but in dedicated build +directory. This keeps the source directory clean and allows for more than +single build tree for the same source tree (e.g debug and release, 32 and +64 bit etc). We'll create subdirectory "bld" in the source directory for +this purpose. Clone your bzr tree to any location you like. Step 5 ------ -From the root of your installation directory, execute the command: +From the root of your installation directory use cmake . -L to see the +various configuration parameters. -win\configure - -The options right now are: - - WITH_INNOBASE_STORAGE_ENGINE Enable particular storage engines - WITH_PARTITION_STORAGE_ENGINE - WITH_ARCHIVE_STORAGE_ENGINE - WITH_BLACKHOLE_STORAGE_ENGINE - WITH_EXAMPLE_STORAGE_ENGINE - WITH_FEDERATED_STORAGE_ENGINE - __NT__ Enable named pipe support - WITHOUT_ATOMICS Do not use atomic instructions - MYSQL_SERVER_SUFFIX= Server suffix, default none - COMPILATION_COMMENT= Server comment, default "Source distribution" - MYSQL_TCP_PORT= Server port, default 3306 - CYBOZU Default character set is UTF8 - EMBED_MANIFESTS Embed custom manifests into final exes, otherwise VS - default will be used. (Note - This option should only be - used by MySQL AB.) - WITH_EMBEDDED_SERVER Configure solution to produce libmysqld.dll - and the static mysqlserver.lib - So the command line could look like: -win\configure WITH_INNOBASE_STORAGE_ENGINE WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro +cmake .. -G "target" -DWITH_INNOBASE_STORAGE_ENGINE=1 + +The recommended way of configuring would be to use -DBUILD_CONFIG=mysql_release +to build binaries exactly the same as the official MySQL releases. Step 6 ------ From the root of your installation directory/bzr clone, you can -use cmake to compile the sources.Use cmake --help when necessary. -Before you run cmake with changed settings (compiler, system -libraries, options, ...), make sure you delete the CMakeCache.txt -generated by your previous run. +use cmake to compile the sources. Use cmake --help when necessary. +Before you start building the sources, please remove the old build area +created from an earlier run and start afresh. + +C:\> del bld +C:\> md bld +C:\> cd bld +C:\> cmake .. -G "target name" -DBUILD_CONFIG=mysql_release -C:\>del CMakeCache.txt -C:\>cmake . -G "target name" For Example: To generate the Win64 project files using Visual Studio 9, you would run -cmake . -G "Visual Studio 9 2008 Win64" +cmake .. -G "Visual Studio 9 2008 Win64" Other target names supported using CMake 2.6 patch 4 are: @@ -99,8 +89,8 @@ Other target names supported using CMake 2.6 patch 4 are: For generating project files using Visual Studio 10, you need CMake 2.8 or higher and corresponding target names are - Visual Studio 10 - Visual Studio 10 Win64 + Visual Studio 10 "Visual Studio 10" + Visual Studio 10 (64 bit) "Visual Studio 10 Win64" Step 7 ------ @@ -109,6 +99,10 @@ From the root of your bzr clone, start your build. For Visual Studio, execute mysql.sln. This will start the IDE and you can click the build solution menu option. +Alternatively, you could start the build from command line as follows + +devenv mysql.sln /build relwithdebinfo + Current issues -------------- 1. After changing configuration (eg. adding or removing a storage engine), it From f0ce67873cd2eb2b6eb30ba1ecb0d3df5206d5a0 Mon Sep 17 00:00:00 2001 From: Jorgen Loland Date: Thu, 4 Nov 2010 13:36:36 +0100 Subject: [PATCH 55/64] Bug#57882 - Item_func_conv_charset::val_str(String*): Assertion `fixed == 1' failed Followup patch. Test case relied on system variable that is only available if replication is compiled in. Replaced with variable available in all builds. mysql-test/r/errors.result: Test case relied on system variable that is only available if replication is compiled in. Replaced with variable available in all builds. mysql-test/t/errors.test: Test case relied on system variable that is only available if replication is compiled in. Replaced with variable available in all builds. --- mysql-test/r/errors.result | 2 +- mysql-test/t/errors.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index 43cabd28498..e6a1b492b39 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -141,7 +141,7 @@ DROP TABLE t1; SELECT (CONVERT('0' USING latin1) IN (CHAR(COT('v') USING utf8),'')); ERROR 22003: DOUBLE value is out of range in 'cot('v')' SET NAMES utf8 COLLATE utf8_latvian_ci ; -SELECT UPDATEXML(-73 * -2465717823867977728,@@global.slave_net_timeout,null); +SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null); ERROR 22003: BIGINT value is out of range in '(-(73) * -(2465717823867977728))' # # End Bug#57882 diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test index 8de5889f1c6..82822c87e89 100644 --- a/mysql-test/t/errors.test +++ b/mysql-test/t/errors.test @@ -166,7 +166,7 @@ SELECT (CONVERT('0' USING latin1) IN (CHAR(COT('v') USING utf8),'')); SET NAMES utf8 COLLATE utf8_latvian_ci ; --error ER_DATA_OUT_OF_RANGE -SELECT UPDATEXML(-73 * -2465717823867977728,@@global.slave_net_timeout,null); +SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null); --echo # --echo # End Bug#57882 From aafb35d09975170b6162a9bcd3b2c35cdb78579d Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Fri, 5 Nov 2010 08:23:39 +0000 Subject: [PATCH 56/64] BUG#57899: Certain reserved words should not be reserved Small fix for the test case. The column named "slow" was used twice in the SELECTs. As a consequence, the column named "ignore_server_ids" was not used. To fix this we simply replace the second column selected named "slow" with a column named "ignore_server_ids". --- mysql-test/r/keywords.result | 80 ++++++++++++++++++------------------ mysql-test/t/keywords.test | 8 ++-- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result index 977fe7791b9..58cb7430563 100644 --- a/mysql-test/r/keywords.result +++ b/mysql-test/r/keywords.result @@ -50,16 +50,16 @@ INSERT INTO slow(slow, general, master_heartbeat_period, ignore_server_ids) VALU INSERT INTO slow(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); INSERT INTO slow(slow, general) VALUES (1,2), (5,6); INSERT INTO slow(slow) VALUES (1), (5); -SELECT slow, general, master_heartbeat_period, slow FROM slow ORDER BY slow; -slow general master_heartbeat_period slow -1 2 3 1 -1 2 3 1 -1 2 NULL 1 -1 NULL NULL 1 -5 6 7 5 -5 6 7 5 -5 6 NULL 5 -5 NULL NULL 5 +SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM slow ORDER BY slow; +slow general master_heartbeat_period ignore_server_ids +1 2 3 4 +1 2 3 NULL +1 2 NULL NULL +1 NULL NULL NULL +5 6 7 8 +5 6 7 NULL +5 6 NULL NULL +5 NULL NULL NULL SELECT slow, general, master_heartbeat_period FROM slow ORDER BY slow; slow general master_heartbeat_period 1 2 3 @@ -96,16 +96,16 @@ INSERT INTO general(slow, general, master_heartbeat_period, ignore_server_ids) V INSERT INTO general(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); INSERT INTO general(slow, general) VALUES (1,2), (5,6); INSERT INTO general(slow) VALUES (1), (5); -SELECT slow, general, master_heartbeat_period, slow FROM general ORDER BY slow; -slow general master_heartbeat_period slow -1 2 3 1 -1 2 3 1 -1 2 NULL 1 -1 NULL NULL 1 -5 6 7 5 -5 6 7 5 -5 6 NULL 5 -5 NULL NULL 5 +SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM general ORDER BY slow; +slow general master_heartbeat_period ignore_server_ids +1 2 3 4 +1 2 3 NULL +1 2 NULL NULL +1 NULL NULL NULL +5 6 7 8 +5 6 7 NULL +5 6 NULL NULL +5 NULL NULL NULL SELECT slow, general, master_heartbeat_period FROM general ORDER BY slow; slow general master_heartbeat_period 1 2 3 @@ -142,16 +142,16 @@ INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period, igno INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); INSERT INTO master_heartbeat_period(slow, general) VALUES (1,2), (5,6); INSERT INTO master_heartbeat_period(slow) VALUES (1), (5); -SELECT slow, general, master_heartbeat_period, slow FROM master_heartbeat_period ORDER BY slow; -slow general master_heartbeat_period slow -1 2 3 1 -1 2 3 1 -1 2 NULL 1 -1 NULL NULL 1 -5 6 7 5 -5 6 7 5 -5 6 NULL 5 -5 NULL NULL 5 +SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM master_heartbeat_period ORDER BY slow; +slow general master_heartbeat_period ignore_server_ids +1 2 3 4 +1 2 3 NULL +1 2 NULL NULL +1 NULL NULL NULL +5 6 7 8 +5 6 7 NULL +5 6 NULL NULL +5 NULL NULL NULL SELECT slow, general, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow; slow general master_heartbeat_period 1 2 3 @@ -188,16 +188,16 @@ INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period, ignore_ser INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); INSERT INTO ignore_server_ids(slow, general) VALUES (1,2), (5,6); INSERT INTO ignore_server_ids(slow) VALUES (1), (5); -SELECT slow, general, master_heartbeat_period, slow FROM ignore_server_ids ORDER BY slow; -slow general master_heartbeat_period slow -1 2 3 1 -1 2 3 1 -1 2 NULL 1 -1 NULL NULL 1 -5 6 7 5 -5 6 7 5 -5 6 NULL 5 -5 NULL NULL 5 +SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM ignore_server_ids ORDER BY slow; +slow general master_heartbeat_period ignore_server_ids +1 2 3 4 +1 2 3 NULL +1 2 NULL NULL +1 NULL NULL NULL +5 6 7 8 +5 6 7 NULL +5 6 NULL NULL +5 NULL NULL NULL SELECT slow, general, master_heartbeat_period FROM ignore_server_ids ORDER BY slow; slow general master_heartbeat_period 1 2 3 diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test index 2681f786f40..08016313ca7 100644 --- a/mysql-test/t/keywords.test +++ b/mysql-test/t/keywords.test @@ -78,7 +78,7 @@ INSERT INTO slow(slow, general, master_heartbeat_period, ignore_server_ids) VALU INSERT INTO slow(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); INSERT INTO slow(slow, general) VALUES (1,2), (5,6); INSERT INTO slow(slow) VALUES (1), (5); -SELECT slow, general, master_heartbeat_period, slow FROM slow ORDER BY slow; +SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM slow ORDER BY slow; SELECT slow, general, master_heartbeat_period FROM slow ORDER BY slow; SELECT slow, master_heartbeat_period FROM slow ORDER BY slow; SELECT slow FROM slow ORDER BY slow; @@ -88,7 +88,7 @@ INSERT INTO general(slow, general, master_heartbeat_period, ignore_server_ids) V INSERT INTO general(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); INSERT INTO general(slow, general) VALUES (1,2), (5,6); INSERT INTO general(slow) VALUES (1), (5); -SELECT slow, general, master_heartbeat_period, slow FROM general ORDER BY slow; +SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM general ORDER BY slow; SELECT slow, general, master_heartbeat_period FROM general ORDER BY slow; SELECT slow, master_heartbeat_period FROM general ORDER BY slow; SELECT slow FROM general ORDER BY slow; @@ -98,7 +98,7 @@ INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period, igno INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); INSERT INTO master_heartbeat_period(slow, general) VALUES (1,2), (5,6); INSERT INTO master_heartbeat_period(slow) VALUES (1), (5); -SELECT slow, general, master_heartbeat_period, slow FROM master_heartbeat_period ORDER BY slow; +SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM master_heartbeat_period ORDER BY slow; SELECT slow, general, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow; SELECT slow, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow; SELECT slow FROM master_heartbeat_period ORDER BY slow; @@ -108,7 +108,7 @@ INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period, ignore_ser INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7); INSERT INTO ignore_server_ids(slow, general) VALUES (1,2), (5,6); INSERT INTO ignore_server_ids(slow) VALUES (1), (5); -SELECT slow, general, master_heartbeat_period, slow FROM ignore_server_ids ORDER BY slow; +SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM ignore_server_ids ORDER BY slow; SELECT slow, general, master_heartbeat_period FROM ignore_server_ids ORDER BY slow; SELECT slow, master_heartbeat_period FROM ignore_server_ids ORDER BY slow; SELECT slow FROM ignore_server_ids ORDER BY slow; From 03b9e73878c8953d8228dfefb0a14d4c09756cf3 Mon Sep 17 00:00:00 2001 From: Guilhem Bichot Date: Fri, 5 Nov 2010 14:16:27 +0100 Subject: [PATCH 57/64] Fix for BUG#57316 "It is not clear how to disable autocommit" add boolean command-line option --autocommit. mysql-test/mysql-test-run.pl: do in --gdb like in --ddd: to let the developer debug the startup phase (like command-line options parsing), don't "run". It's the third time I do this change, it was previously lost by merges, port of 6.0 to next-mr... mysql-test/r/mysqld--help-notwin.result: new command-line option mysql-test/r/mysqld--help-win.result: a Linux user's best guess at what the Windows result should be mysql-test/suite/sys_vars/inc/autocommit_func2.inc: new test mysql-test/suite/sys_vars/t/autocommit_func2-master.opt: test new option mysql-test/suite/sys_vars/t/autocommit_func3-master.opt: test new option sql/mysqld.cc: new --autocommit sql/mysqld.h: new --autocommit sql/sql_partition.cc: What matters to this partitioning quote is to have the OPTION_QUOTE_SHOW_CREATE flag down, it's all that append_identifier() uses. So we make it explicit. --- mysql-test/mysql-test-run.pl | 3 +- mysql-test/r/mysqld--help-notwin.result | 1 + mysql-test/r/mysqld--help-win.result | 1 + .../suite/sys_vars/inc/autocommit_func2.inc | 29 ++++++++++++ .../suite/sys_vars/r/autocommit_func2.result | 46 +++++++++++++++++++ .../suite/sys_vars/r/autocommit_func3.result | 42 +++++++++++++++++ .../sys_vars/t/autocommit_func2-master.opt | 1 + .../suite/sys_vars/t/autocommit_func2.test | 1 + .../sys_vars/t/autocommit_func3-master.opt | 1 + .../suite/sys_vars/t/autocommit_func3.test | 1 + sql/mysqld.cc | 13 ++++++ sql/mysqld.h | 3 +- sql/sql_partition.cc | 5 +- 13 files changed, 141 insertions(+), 6 deletions(-) create mode 100644 mysql-test/suite/sys_vars/inc/autocommit_func2.inc create mode 100644 mysql-test/suite/sys_vars/r/autocommit_func2.result create mode 100644 mysql-test/suite/sys_vars/r/autocommit_func3.result create mode 100644 mysql-test/suite/sys_vars/t/autocommit_func2-master.opt create mode 100644 mysql-test/suite/sys_vars/t/autocommit_func2.test create mode 100644 mysql-test/suite/sys_vars/t/autocommit_func3-master.opt create mode 100644 mysql-test/suite/sys_vars/t/autocommit_func3.test diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 05d4dacaf71..6b8d73b3f69 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -5317,8 +5317,7 @@ sub gdb_arguments { "break mysql_parse\n" . "commands 1\n" . "disable 1\n" . - "end\n" . - "run"); + "end\n"); } if ( $opt_manual_gdb ) diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result index 63e17e1c188..fc269e1dd82 100644 --- a/mysql-test/r/mysqld--help-notwin.result +++ b/mysql-test/r/mysqld--help-notwin.result @@ -19,6 +19,7 @@ The following options may be given as the first argument: --auto-increment-offset[=#] Offset added to Auto-increment columns. Used when auto-increment-increment != 1 + --autocommit Set default value for autocommit (0 or 1) --automatic-sp-privileges Creating and dropping stored procedures alters ACLs (Defaults to on; use --skip-automatic-sp-privileges to disable.) diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result index c5996981e92..c5d7bb458c3 100644 --- a/mysql-test/r/mysqld--help-win.result +++ b/mysql-test/r/mysqld--help-win.result @@ -19,6 +19,7 @@ The following options may be given as the first argument: --auto-increment-offset[=#] Offset added to Auto-increment columns. Used when auto-increment-increment != 1 + --autocommit Set default value for autocommit (0 or 1) --automatic-sp-privileges Creating and dropping stored procedures alters ACLs (Defaults to on; use --skip-automatic-sp-privileges to disable.) diff --git a/mysql-test/suite/sys_vars/inc/autocommit_func2.inc b/mysql-test/suite/sys_vars/inc/autocommit_func2.inc new file mode 100644 index 00000000000..5fff72157b4 --- /dev/null +++ b/mysql-test/suite/sys_vars/inc/autocommit_func2.inc @@ -0,0 +1,29 @@ +--source include/have_innodb.inc + +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name varchar(30) +) ENGINE = INNODB; + +SELECT @@global.autocommit; +SELECT @@autocommit; +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); +SELECT * from t1; +ROLLBACK; +SELECT * from t1; + +set @@global.autocommit = 1-@@global.autocommit; +set @@autocommit = 1-@@autocommit; +SELECT @@global.autocommit; +SELECT @@autocommit; +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); +SELECT * from t1; +ROLLBACK; +SELECT * from t1; + +DROP TABLE t1; +set @@global.autocommit = 1-@@global.autocommit; diff --git a/mysql-test/suite/sys_vars/r/autocommit_func2.result b/mysql-test/suite/sys_vars/r/autocommit_func2.result new file mode 100644 index 00000000000..5fcb50526f2 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/autocommit_func2.result @@ -0,0 +1,46 @@ +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name varchar(30) +) ENGINE = INNODB; +SELECT @@global.autocommit; +@@global.autocommit +1 +SELECT @@autocommit; +@@autocommit +1 +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); +SELECT * from t1; +id name +1 Record_1 +2 Record_2 +ROLLBACK; +SELECT * from t1; +id name +1 Record_1 +2 Record_2 +set @@global.autocommit = 1-@@global.autocommit; +set @@autocommit = 1-@@autocommit; +SELECT @@global.autocommit; +@@global.autocommit +0 +SELECT @@autocommit; +@@autocommit +0 +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); +SELECT * from t1; +id name +1 Record_1 +2 Record_2 +3 Record_1 +4 Record_2 +ROLLBACK; +SELECT * from t1; +id name +1 Record_1 +2 Record_2 +DROP TABLE t1; +set @@global.autocommit = 1-@@global.autocommit; diff --git a/mysql-test/suite/sys_vars/r/autocommit_func3.result b/mysql-test/suite/sys_vars/r/autocommit_func3.result new file mode 100644 index 00000000000..6807c594cb1 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/autocommit_func3.result @@ -0,0 +1,42 @@ +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name varchar(30) +) ENGINE = INNODB; +SELECT @@global.autocommit; +@@global.autocommit +0 +SELECT @@autocommit; +@@autocommit +0 +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); +SELECT * from t1; +id name +1 Record_1 +2 Record_2 +ROLLBACK; +SELECT * from t1; +id name +set @@global.autocommit = 1-@@global.autocommit; +set @@autocommit = 1-@@autocommit; +SELECT @@global.autocommit; +@@global.autocommit +1 +SELECT @@autocommit; +@@autocommit +1 +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); +SELECT * from t1; +id name +3 Record_1 +4 Record_2 +ROLLBACK; +SELECT * from t1; +id name +3 Record_1 +4 Record_2 +DROP TABLE t1; +set @@global.autocommit = 1-@@global.autocommit; diff --git a/mysql-test/suite/sys_vars/t/autocommit_func2-master.opt b/mysql-test/suite/sys_vars/t/autocommit_func2-master.opt new file mode 100644 index 00000000000..85e5d17d5e8 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/autocommit_func2-master.opt @@ -0,0 +1 @@ +--autocommit=1 diff --git a/mysql-test/suite/sys_vars/t/autocommit_func2.test b/mysql-test/suite/sys_vars/t/autocommit_func2.test new file mode 100644 index 00000000000..9bb4c26d5d5 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/autocommit_func2.test @@ -0,0 +1 @@ +--source suite/sys_vars/inc/autocommit_func2.inc diff --git a/mysql-test/suite/sys_vars/t/autocommit_func3-master.opt b/mysql-test/suite/sys_vars/t/autocommit_func3-master.opt new file mode 100644 index 00000000000..e0fa81e6eeb --- /dev/null +++ b/mysql-test/suite/sys_vars/t/autocommit_func3-master.opt @@ -0,0 +1 @@ +--autocommit=0 diff --git a/mysql-test/suite/sys_vars/t/autocommit_func3.test b/mysql-test/suite/sys_vars/t/autocommit_func3.test new file mode 100644 index 00000000000..9bb4c26d5d5 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/autocommit_func3.test @@ -0,0 +1 @@ +--source suite/sys_vars/inc/autocommit_func2.inc diff --git a/sql/mysqld.cc b/sql/mysqld.cc index df4f0f95b8c..21754b23940 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5662,6 +5662,12 @@ struct my_option my_long_options[]= {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode " "will also set transaction isolation level 'serializable'.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + /* + Because Sys_var_bit does not support command-line options, we need to + explicitely add one for --autocommit + */ + {"autocommit", OPT_AUTOCOMMIT, "Set default value for autocommit (0 or 1)", + NULL, NULL, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, NULL}, {"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.", &my_bind_addr_str, &my_bind_addr_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -7114,6 +7120,13 @@ mysqld_get_one_option(int optid, if (argument == NULL) /* no argument */ log_error_file_ptr= const_cast(""); break; + case OPT_AUTOCOMMIT: + const ulonglong turn_bit_on= (argument && (atoi(argument) == 0)) ? + OPTION_NOT_AUTOCOMMIT : OPTION_AUTOCOMMIT; + global_system_variables.option_bits= + (global_system_variables.option_bits & + ~(OPTION_NOT_AUTOCOMMIT | OPTION_AUTOCOMMIT)) | turn_bit_on; + break; } return 0; } diff --git a/sql/mysqld.h b/sql/mysqld.h index 6e81c240f7d..dc9f94c0d03 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -391,7 +391,8 @@ enum options_mysqld OPT_UPDATE_LOG, OPT_WANT_CORE, OPT_ENGINE_CONDITION_PUSHDOWN, - OPT_LOG_ERROR + OPT_LOG_ERROR, + OPT_AUTOCOMMIT }; diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 455d95ada85..70b200bf3cd 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1997,7 +1997,7 @@ static int add_part_field_list(File fptr, List field_list) String field_string("", 0, system_charset_info); THD *thd= current_thd; ulonglong save_options= thd->variables.option_bits; - thd->variables.option_bits= 0; + thd->variables.option_bits&= ~OPTION_QUOTE_SHOW_CREATE; append_identifier(thd, &field_string, field_str, strlen(field_str)); thd->variables.option_bits= save_options; @@ -2016,8 +2016,7 @@ static int add_name_string(File fptr, const char *name) String name_string("", 0, system_charset_info); THD *thd= current_thd; ulonglong save_options= thd->variables.option_bits; - - thd->variables.option_bits= 0; + thd->variables.option_bits&= ~OPTION_QUOTE_SHOW_CREATE; append_identifier(thd, &name_string, name, strlen(name)); thd->variables.option_bits= save_options; From f6ae96d40dc3e24c7ea0d88fa8cbfc3554449d04 Mon Sep 17 00:00:00 2001 From: Guilhem Bichot Date: Fri, 5 Nov 2010 14:17:47 +0100 Subject: [PATCH 58/64] BUG#57933 "add -Wdeclaration-after-statement to gcc builds"; first part, for autotools build. config/ac-macros/maintainer.m4: Add the flag. With it, and as we use -Werror, we nicely get "error: ISO C90 forbids mixed declarations and code" if a declaration follows a statement in C code. Note that g++ refuses this flag. --- config/ac-macros/maintainer.m4 | 1 + 1 file changed, 1 insertion(+) diff --git a/config/ac-macros/maintainer.m4 b/config/ac-macros/maintainer.m4 index 5960853d7f1..b4d2f08e558 100644 --- a/config/ac-macros/maintainer.m4 +++ b/config/ac-macros/maintainer.m4 @@ -19,6 +19,7 @@ AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [ AS_IF([test "$GCC" = "yes"], [ C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror" CXX_WARNINGS="${C_WARNINGS} -Wno-unused-parameter" + C_WARNINGS="${C_WARNINGS} -Wdeclaration-after-statement" ]) # Test whether the warning options work. From 5b8dbe96a566f4c304f3ebee7c2c4fcdd5793116 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Sun, 7 Nov 2010 12:41:03 +0800 Subject: [PATCH 59/64] Remove rpl_killed_ddl.test from experimental after fixed BUG#47638 --- mysql-test/collections/default.experimental | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index ce3f50f5f94..2ddf87485ad 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -24,7 +24,6 @@ main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeou rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically rpl.rpl_innodb_bug28430* # Bug#46029 -rpl.rpl_killed_ddl @windows # Bug#47638 2010-01-20 alik The rpl_killed_ddl test fails on Windows sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun sys_vars.slow_query_log_func @solaris # Bug#54819 2010-06-26 alik sys_vars.slow_query_log_func fails sporadically on Solaris 10 From 8f237f5874a814daaa7431748849997d1a2aa8ea Mon Sep 17 00:00:00 2001 From: Dmitry Shulga Date: Sun, 7 Nov 2010 23:42:54 +0600 Subject: [PATCH 60/64] A fix and a test case for Bug#47924 -main.log_tables times out sporadically. The cause of the sporadic time out was a leaking protection against the global read lock, taken by the RENAME statement, and not released in case of an error occurred during RENAME. The leaking protection counter would lead to the value of protect_against_global_read never dropping to 0. Consequently FLUSH TABLES in all connections, including the one that leaked the protection, could not proceed. The fix is to ensure that all branchesin RENAME code properly release GRL protection. mysql-test/r/log_tables.result: Added results for test for bug#47924. mysql-test/t/log_tables.test: Added test for bug#47924. sql/sql_rename.cc: mysql_rename_tables() modified: replaced return from function to goto to clean up code block in case of error. --- mysql-test/r/log_tables.result | 10 ++++++++++ mysql-test/t/log_tables.test | 19 +++++++++++++++++++ sql/sql_rename.cc | 6 +++--- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result index f8321520880..fcde09db7c5 100644 --- a/mysql-test/r/log_tables.result +++ b/mysql-test/r/log_tables.result @@ -899,6 +899,16 @@ TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1 TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2 DROP TABLE t1; TRUNCATE TABLE mysql.slow_log; +use mysql; +drop table if exists renamed_general_log; +drop table if exists renamed_slow_log; +RENAME TABLE general_log TO renamed_general_log; +ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log' +RENAME TABLE slow_log TO renamed_slow_log; +ERROR HY000: Cannot rename 'slow_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'slow_log' +use test; +flush tables with read lock; +unlock tables; SET @@session.long_query_time= @old_long_query_time; SET @@global.log_output= @old_log_output; SET @@global.slow_query_log= @old_slow_query_log; diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test index 076f2e8bc3b..af6c34dec37 100644 --- a/mysql-test/t/log_tables.test +++ b/mysql-test/t/log_tables.test @@ -1027,6 +1027,25 @@ DROP TABLE t1; TRUNCATE TABLE mysql.slow_log; +# +# Bug #47924 main.log_tables times out sporadically +# + +use mysql; +# Should result in error +--disable_warnings +drop table if exists renamed_general_log; +drop table if exists renamed_slow_log; +--enable_warnings +--error ER_CANT_RENAME_LOG_TABLE +RENAME TABLE general_log TO renamed_general_log; +--error ER_CANT_RENAME_LOG_TABLE +RENAME TABLE slow_log TO renamed_slow_log; + +use test; +flush tables with read lock; +unlock tables; + SET @@session.long_query_time= @old_long_query_time; SET @@global.log_output= @old_log_output; diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index e85e730db5b..df7054c94d0 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -99,7 +99,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent) */ my_error(ER_CANT_RENAME_LOG_TABLE, MYF(0), ren_table->table_name, ren_table->table_name); - DBUG_RETURN(1); + goto err; } } else @@ -112,7 +112,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent) */ my_error(ER_CANT_RENAME_LOG_TABLE, MYF(0), ren_table->table_name, ren_table->table_name); - DBUG_RETURN(1); + goto err; } else { @@ -130,7 +130,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent) else my_error(ER_CANT_RENAME_LOG_TABLE, MYF(0), rename_log_table[1], rename_log_table[1]); - DBUG_RETURN(1); + goto err; } } From d7202ef7f8785d47788072d71f59270a862299b6 Mon Sep 17 00:00:00 2001 From: Anitha Gopi Date: Mon, 8 Nov 2010 14:57:05 +0530 Subject: [PATCH 61/64] Bug#58041 : Moved rpl_binlog_row to daily. Run just main suite for ps_row and embedded per push. Other suites run daily --- mysql-test/collections/mysql-5.1-bugteam.daily | 5 +++++ mysql-test/collections/mysql-5.1-bugteam.push | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 mysql-test/collections/mysql-5.1-bugteam.daily create mode 100644 mysql-test/collections/mysql-5.1-bugteam.push diff --git a/mysql-test/collections/mysql-5.1-bugteam.daily b/mysql-test/collections/mysql-5.1-bugteam.daily new file mode 100644 index 00000000000..0503bd49f73 --- /dev/null +++ b/mysql-test/collections/mysql-5.1-bugteam.daily @@ -0,0 +1,5 @@ +perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental +perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental diff --git a/mysql-test/collections/mysql-5.1-bugteam.push b/mysql-test/collections/mysql-5.1-bugteam.push new file mode 100644 index 00000000000..d01b98eb87f --- /dev/null +++ b/mysql-test/collections/mysql-5.1-bugteam.push @@ -0,0 +1,4 @@ +perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb +perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --suite=main --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb +perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --suite=main --embedded --experimental=collections/default.experimental --skip-ndb +perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb From 55086d79e1864f8a9f66af808d4566665d7bc846 Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Mon, 8 Nov 2010 10:48:31 +0100 Subject: [PATCH 62/64] Bug #45288 pb2 returns a lot of compilation warnings GCOV builds were broken after the patch for Bug#57933 which added add -Wdeclaration-after-statement to gcc builds. This patch fixes: stacktrace.c:328: warning: ISO C90 forbids mixed declarations and code No test case added. --- mysys/stacktrace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 7bac8017324..ebd84548a9b 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -318,6 +318,9 @@ end: /* Produce a core for the thread */ void my_write_core(int sig) { +#ifdef HAVE_gcov + extern void __gcov_flush(void); +#endif signal(sig, SIG_DFL); #ifdef HAVE_gcov /* @@ -325,7 +328,6 @@ void my_write_core(int sig) information from this process, causing gcov output to be incomplete. So we force the writing of coverage information here before terminating. */ - extern void __gcov_flush(void); __gcov_flush(); #endif pthread_kill(pthread_self(), sig); From 83e40f9634f860d8fbb1c4877b370003ca693618 Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Mon, 8 Nov 2010 12:51:48 +0100 Subject: [PATCH 63/64] Bug #45288 pb2 returns a lot of compilation warnings GCOV builds were broken after the patch for Bug#57933 which added add -Wdeclaration-after-statement to gcc builds. This patch fixes: stacktrace.c:328: warning: ISO C90 forbids mixed declarations and code No test case added. --- mysys/stacktrace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 7bac8017324..ebd84548a9b 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -318,6 +318,9 @@ end: /* Produce a core for the thread */ void my_write_core(int sig) { +#ifdef HAVE_gcov + extern void __gcov_flush(void); +#endif signal(sig, SIG_DFL); #ifdef HAVE_gcov /* @@ -325,7 +328,6 @@ void my_write_core(int sig) information from this process, causing gcov output to be incomplete. So we force the writing of coverage information here before terminating. */ - extern void __gcov_flush(void); __gcov_flush(); #endif pthread_kill(pthread_self(), sig); From 42e133e74e6f7e6adcf15afaa7bae1449c42ebbb Mon Sep 17 00:00:00 2001 From: Sven Sandberg Date: Mon, 8 Nov 2010 14:52:10 +0100 Subject: [PATCH 64/64] Fixed compilation error. storage/ndb/src/mgmsrv/InitConfigFileParser.cpp: Added 'const' to fix compilation error. --- storage/ndb/src/mgmsrv/InitConfigFileParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp index 560a9559999..7493e5e9c89 100644 --- a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp +++ b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp @@ -702,7 +702,7 @@ load_defaults(Vector& options, const char* groups[]) BaseString group_suffix; const char *save_file = my_defaults_file; - char *save_extra_file = my_defaults_extra_file; + const char *save_extra_file = my_defaults_extra_file; const char *save_group_suffix = my_defaults_group_suffix; if (my_defaults_file)