#At file:///home/kgeorge/mysql/work/merge-5.1-bugteam/ based on revid:mattias.jonsson@stripped
3486 Georgi Kodinov 2010-08-20 [merge]
merge
modified:
configure.in
mysql-test/r/func_gconcat.result
mysql-test/r/func_misc.result
mysql-test/suite/innodb/r/innodb_mysql.result
mysql-test/suite/innodb/t/innodb_mysql.test
mysql-test/suite/rpl/r/rpl_drop.result
mysql-test/suite/rpl/t/rpl_drop.test
mysql-test/t/func_gconcat.test
mysql-test/t/func_misc.test
sql/item_func.cc
sql/item_sum.cc
sql/log.cc
sql/log.h
sql/sql_insert.cc
sql/sql_table.cc
sql/table.h
=== modified file 'configure.in'
--- a/configure.in 2010-07-26 05:06:18 +0000
+++ b/configure.in 2010-08-19 15:18:58 +0000
@@ -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.50], [], [mysql])
+AC_INIT([MySQL Server], [5.1.51], [], [mysql])
AC_CONFIG_SRCDIR([sql/mysqld.cc])
AC_CANONICAL_SYSTEM
=== modified file 'mysql-test/r/func_gconcat.result'
--- a/mysql-test/r/func_gconcat.result 2010-03-31 13:00:56 +0000
+++ b/mysql-test/r/func_gconcat.result 2010-07-23 11:52:54 +0000
@@ -995,6 +995,7 @@ SELECT 1 FROM
1
1
DROP TABLE t1;
+End of 5.0 tests
#
# Bug #52397: another crash with explain extended and group_concat
#
@@ -1010,4 +1011,22 @@ id select_type table type possible_keys
Warnings:
Note 1003 select 1 AS `1` from (select group_concat(`test`.`t1`.`a` order by `test`.`t1`.`a` ASC separator ',') AS `GROUP_CONCAT(t1.a ORDER BY t1.a ASC)` from `test`.`t1` `t2` join `test`.`t1` group by `test`.`t1`.`a`) `d`
DROP TABLE t1;
-End of 5.0 tests
+#
+# Bug #54476: crash when group_concat and 'with rollup' in prepared statements
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
+EXECUTE stmt;
+GROUP_CONCAT(t1.a ORDER BY t1.a)
+1,1
+2,2
+1,1,2,2
+EXECUTE stmt;
+GROUP_CONCAT(t1.a ORDER BY t1.a)
+1,1
+2,2
+1,1,2,2
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+End of 5.1 tests
=== modified file 'mysql-test/r/func_misc.result'
--- a/mysql-test/r/func_misc.result 2009-06-11 16:21:32 +0000
+++ b/mysql-test/r/func_misc.result 2010-08-01 18:12:36 +0000
@@ -336,4 +336,19 @@ End of 5.0 tests
select connection_id() > 0;
connection_id() > 0
1
+#
+# Bug #54461: crash with longblob and union or update with subquery
+#
+CREATE TABLE t1 (a INT, b LONGBLOB);
+INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
+SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+LEAST(a, (SELECT b FROM t1 LIMIT 1))
+1
+2
+SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+GREATEST(a, (SELECT b FROM t1 LIMIT 1))
+2
+3
+1
+DROP TABLE t1;
End of tests
=== modified file 'mysql-test/suite/innodb/r/innodb_mysql.result'
--- a/mysql-test/suite/innodb/r/innodb_mysql.result 2010-08-13 08:07:39 +0000
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result 2010-08-20 09:09:17 +0000
@@ -2500,6 +2500,14 @@ id select_type table type possible_keys
1 SIMPLE t1 range f2,f4 f4 1 NULL 11 Using where
DROP TABLE t1;
#
+# Bug#54117 crash in thr_multi_unlock, temporary table
+#
+CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB;
+LOCK TABLES t1 READ;
+ALTER TABLE t1 COMMENT 'test';
+UNLOCK TABLES;
+DROP TABLE t1;
+#
# Bug#55580: segfault in read_view_sees_trx_id
#
CREATE TABLE t1 (a INT) ENGINE=Innodb;
=== modified file 'mysql-test/suite/innodb/t/innodb_mysql.test'
--- a/mysql-test/suite/innodb/t/innodb_mysql.test 2010-08-13 08:07:39 +0000
+++ b/mysql-test/suite/innodb/t/innodb_mysql.test 2010-08-20 09:09:17 +0000
@@ -733,6 +733,20 @@ ORDER BY f1 DESC LIMIT 5;
DROP TABLE t1;
+
+--echo #
+--echo # Bug#54117 crash in thr_multi_unlock, temporary table
+--echo #
+
+CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB;
+
+LOCK TABLES t1 READ;
+ALTER TABLE t1 COMMENT 'test';
+UNLOCK TABLES;
+
+DROP TABLE t1;
+
+
--echo #
--echo # Bug#55580: segfault in read_view_sees_trx_id
--echo #
=== modified file 'mysql-test/suite/rpl/r/rpl_drop.result'
--- a/mysql-test/suite/rpl/r/rpl_drop.result 2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/r/rpl_drop.result 2010-08-02 19:48:56 +0000
@@ -8,3 +8,27 @@ drop table if exists t1, t2;
create table t1 (a int);
drop table t1, t2;
ERROR 42S02: Unknown table 't2'
+include/stop_slave.inc
+SET @old_binlog_format= @@global.binlog_format;
+SET GLOBAL binlog_format = ROW;
+include/start_slave.inc
+SET @old_binlog_format= @@global.binlog_format;
+SET binlog_format = ROW;
+CREATE TABLE t2(a INT) ENGINE=MYISAM;
+CREATE TABLE t3(a INT) ENGINE=INNODB;
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+insert into t2 values(1);
+insert into t3 values(1);
+return 1;
+END|
+CREATE TABLE t1(UNIQUE(a)) ENGINE=MYISAM SELECT 1 AS a UNION ALL SELECT f1();
+ERROR 23000: Duplicate entry '1' for key 'a'
+CREATE TABLE t1(UNIQUE(a)) ENGINE=INNODB SELECT 1 AS a UNION ALL SELECT f1();
+ERROR 23000: Duplicate entry '1' for key 'a'
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+DROP FUNCTION f1;
+DROP TABLE t2, t3;
+SET @@global.binlog_format= @old_binlog_format;
+SET @@global.binlog_format= @old_binlog_format;
=== modified file 'mysql-test/suite/rpl/t/rpl_drop.test'
--- a/mysql-test/suite/rpl/t/rpl_drop.test 2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/t/rpl_drop.test 2010-08-02 19:48:56 +0000
@@ -1,6 +1,7 @@
# Testcase for BUG#4552 (DROP on two tables, one of which does not
# exist, must be binlogged with a non-zero error code)
source include/master-slave.inc;
+source include/have_innodb.inc;
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
@@ -10,7 +11,57 @@ drop table t1, t2;
save_master_pos;
connection slave;
sync_with_master;
-
# End of 4.1 tests
+# BUG#55625 RBR breaks on failing 'CREATE TABLE'
+# A CREATE...SELECT that fails is written to the binary log if a non-transactional
+# statement is updated. If the logging format is ROW, the CREATE statement and the
+# changes are written to the binary log as distinct events and by consequence the
+# created table is not rolled back in the slave.
+# To fix the problem, we do not write a CREATE...SELECT that fails to the binary
+# log. Howerver, the changes to non-transactional tables are not replicated and
+# thus the slave goes out of sync. This should be fixed after BUG#47899.
+#
+# In the test case, we verify if the binary log contains no information for a
+# CREATE...SELECT that fails.
+connection slave;
+
+--source include/stop_slave.inc
+SET @old_binlog_format= @@global.binlog_format;
+SET GLOBAL binlog_format = ROW;
+--source include/start_slave.inc
+
+connection master;
+SET @old_binlog_format= @@global.binlog_format;
+SET binlog_format = ROW;
+
+CREATE TABLE t2(a INT) ENGINE=MYISAM;
+CREATE TABLE t3(a INT) ENGINE=INNODB;
+
+delimiter |;
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+ insert into t2 values(1);
+ insert into t3 values(1);
+ return 1;
+END|
+delimiter ;|
+
+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1);
+
+--error 1062
+CREATE TABLE t1(UNIQUE(a)) ENGINE=MYISAM SELECT 1 AS a UNION ALL SELECT f1();
+--error 1062
+CREATE TABLE t1(UNIQUE(a)) ENGINE=INNODB SELECT 1 AS a UNION ALL SELECT f1();
+
+--source include/show_binlog_events.inc
+
+DROP FUNCTION f1;
+DROP TABLE t2, t3;
+SET @@global.binlog_format= @old_binlog_format;
+
+--sync_slave_with_master
+SET @@global.binlog_format= @old_binlog_format;
+# End of 5.1 tests
=== modified file 'mysql-test/t/func_gconcat.test'
--- a/mysql-test/t/func_gconcat.test 2010-03-31 13:00:56 +0000
+++ b/mysql-test/t/func_gconcat.test 2010-07-23 11:52:54 +0000
@@ -708,6 +708,7 @@ SELECT 1 FROM
DROP TABLE t1;
+--echo End of 5.0 tests
--echo #
--echo # Bug #52397: another crash with explain extended and group_concat
@@ -719,5 +720,18 @@ EXPLAIN EXTENDED SELECT 1 FROM
t1 t2, t1 GROUP BY t1.a) AS d;
DROP TABLE t1;
+--echo #
+--echo # Bug #54476: crash when group_concat and 'with rollup' in prepared statements
+--echo #
---echo End of 5.0 tests
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+
+PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
+--echo End of 5.1 tests
=== modified file 'mysql-test/t/func_misc.test'
--- a/mysql-test/t/func_misc.test 2009-06-11 16:21:32 +0000
+++ b/mysql-test/t/func_misc.test 2010-08-01 18:12:36 +0000
@@ -467,4 +467,16 @@ select NAME_CONST('_id',1234) as id;
select connection_id() > 0;
+--echo #
+--echo # Bug #54461: crash with longblob and union or update with subquery
+--echo #
+
+CREATE TABLE t1 (a INT, b LONGBLOB);
+INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
+
+SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+
+DROP TABLE t1;
+
--echo End of tests
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2010-07-14 11:54:51 +0000
+++ b/sql/item_func.cc 2010-08-01 18:12:36 +0000
@@ -2243,6 +2243,8 @@ void Item_func_min_max::fix_length_and_d
max_length= my_decimal_precision_to_length_no_truncation(max_int_part +
decimals, decimals,
unsigned_flag);
+ else if (cmp_type == REAL_RESULT)
+ max_length= float_length(decimals);
cached_field_type= agg_field_type(args, arg_count);
}
=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc 2010-08-13 08:07:39 +0000
+++ b/sql/item_sum.cc 2010-08-20 09:09:17 +0000
@@ -3035,7 +3035,6 @@ Item_func_group_concat::Item_func_group_
tree(item->tree),
unique_filter(item->unique_filter),
table(item->table),
- order(item->order),
context(item->context),
arg_count_order(item->arg_count_order),
arg_count_field(item->arg_count_field),
@@ -3048,6 +3047,24 @@ Item_func_group_concat::Item_func_group_
{
quick_group= item->quick_group;
result.set_charset(collation.collation);
+
+ /*
+ Since the ORDER structures pointed to by the elements of the 'order' array
+ may be modified in find_order_in_list() called from
+ Item_func_group_concat::setup(), create a copy of those structures so that
+ such modifications done in this object would not have any effect on the
+ object being copied.
+ */
+ ORDER *tmp;
+ if (!(order= (ORDER **) thd->alloc(sizeof(ORDER *) * arg_count_order +
+ sizeof(ORDER) * arg_count_order)))
+ return;
+ tmp= (ORDER *)(order + arg_count_order);
+ for (uint i= 0; i < arg_count_order; i++, tmp++)
+ {
+ memcpy(tmp, item->order[i], sizeof(ORDER));
+ order[i]= tmp;
+ }
}
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2010-07-20 18:07:36 +0000
+++ b/sql/log.cc 2010-08-02 19:48:56 +0000
@@ -1628,6 +1628,19 @@ static int binlog_rollback(handlerton *h
DBUG_RETURN(error);
}
+/**
+ Cleanup the cache.
+
+ @param thd The client thread that wants to clean up the cache.
+*/
+void MYSQL_BIN_LOG::reset_gathered_updates(THD *thd)
+{
+ binlog_trx_data *const trx_data=
+ (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
+
+ trx_data->reset();
+}
+
void MYSQL_BIN_LOG::set_write_error(THD *thd)
{
DBUG_ENTER("MYSQL_BIN_LOG::set_write_error");
=== modified file 'sql/log.h'
--- a/sql/log.h 2010-05-19 17:01:12 +0000
+++ b/sql/log.h 2010-08-02 19:48:56 +0000
@@ -356,10 +356,11 @@ public:
/* Use this to start writing a new log file */
void new_file();
+ void reset_gathered_updates(THD *thd);
bool write(Log_event* event_info); // binary log write
bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);
- bool write_incident(THD *thd, bool lock);
+ bool write_incident(THD *thd, bool lock);
int write_cache(IO_CACHE *cache, bool lock_log, bool flush_and_sync);
void set_write_error(THD *thd);
bool check_write_error(THD *thd);
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2010-08-18 04:56:06 +0000
+++ b/sql/sql_insert.cc 2010-08-20 09:09:17 +0000
@@ -3972,6 +3972,17 @@ void select_create::abort()
if (table)
{
+ if (thd->lex->sql_command == SQLCOM_CREATE_TABLE &&
+ thd->current_stmt_binlog_row_based &&
+ !(thd->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
+ mysql_bin_log.is_open())
+ {
+ /*
+ This should be removed after BUG#47899.
+ */
+ mysql_bin_log.reset_gathered_updates(thd);
+ }
+
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
if (!create_info->table_existed)
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2010-07-20 18:07:36 +0000
+++ b/sql/sql_table.cc 2010-07-21 15:54:11 +0000
@@ -7393,6 +7393,11 @@ view_err:
mysql_unlock_tables(thd, thd->lock);
thd->lock=0;
}
+ /*
+ If LOCK TABLES list is not empty and contains this table,
+ unlock the table and remove the table from this list.
+ */
+ mysql_lock_remove(thd, thd->locked_tables, table, FALSE);
/* Remove link to old table and rename the new one */
close_temporary_table(thd, table, 1, 1);
/* Should pass the 'new_name' as we store table name in the cache */
=== modified file 'sql/table.h'
--- a/sql/table.h 2010-07-29 03:00:57 +0000
+++ b/sql/table.h 2010-08-02 07:50:15 +0000
@@ -55,7 +55,6 @@ typedef struct st_order {
struct st_order *next;
Item **item; /* Point at item in select fields */
Item *item_ptr; /* Storage for initial item */
- Item **item_copy; /* For SPs; the original item ptr */
int counter; /* position in SELECT list, correct
only if counter_used is true*/
bool asc; /* true if ascending */
Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100820090917-68g3wjllf2e32vix.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3486) | Georgi Kodinov | 20 Aug |