From f87acb594a15b415b58a3053e76bfd1b27a6d594 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 15:27:03 +0500 Subject: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out Problem: using "mysqlbinlog | mysql" for recoveries the connection_id() result may differ from what was used when issuing the statement. Fix: if there is a connection_id() in a statement, write to binlog SET pseudo_thread_id= XXX; before it and use the value later on. mysql-test/r/mysqlbinlog.result: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - test result. mysql-test/t/mysqlbinlog.test: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - test case. sql/item_create.cc: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - set thread_specific_used flag for the connection_id() function. sql/item_func.cc: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - always return thd->variables.pseudo_thread_id as a connection_id() result, as it contains a proper value for both master and slave. sql/log_event.cc: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - set LOG_EVENT_THREAD_SPECIFIC_F event flag if thread_specific_used is set. sql/sql_class.cc: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - thd->thread_specific_used introduced, which is set if thread specific value(s) used in a statement. sql/sql_class.h: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - thd->thread_specific_used introduced, which is set if thread specific value(s) used in a statement. --- mysql-test/r/mysqlbinlog.result | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mysql-test/r/mysqlbinlog.result') diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 1ba198dfd75..d16a4c39a11 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -318,4 +318,11 @@ INSERT INTO t1 VALUES ('0123456789'); flush logs; DROP TABLE t1; # Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED +flush logs; +create table t1(a int); +insert into t1 values(connection_id()); +flush logs; +drop table t1; +1 +drop table t1; End of 5.0 tests -- cgit v1.2.1