diff options
author | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-05-24 15:35:43 +0500 |
---|---|---|
committer | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-05-24 15:35:43 +0500 |
commit | 3791e35f79e640f7bd2e20c895692ed1ec81e720 (patch) | |
tree | 551e35f02c91063f43be73cb14d9be4fc7977891 /mysql-test/r/rpl_user_variables.result | |
parent | d076bcbcc431061cbb668e81ab54281605ef9bbe (diff) | |
download | mariadb-git-3791e35f79e640f7bd2e20c895692ed1ec81e720.tar.gz |
Fix for
bug #26842: master binary log contains invalid queries - replication fails
bug #12826: Possible to get inconsistent slave using SQL syntax Prepared Statements
Problem:
binlogging PS' we may produce syntacticly incorrect queries in the binlog replacing
some parameters with variable names (instead of variable values).
E.g. in the reported case of "limit ?" clause: replacing "?" with "@var"
produces "limit @var" which is not a correct SQL syntax.
Also it may lead to different query execution on slave if we
set and use a variable in the same statement, e.g.
"insert into t1 values (@x:=@x+1, ?)"
Fix: make the stored statement string created upon its execution use variable values
(instead of names) to fill placeholders.
mysql-test/r/ctype_cp932_binlog.result:
Fix for
bug #26842: master binary log contains invalid queries - replication fails
bug #12826: Possible to get inconsistent slave using SQL syntax Prepared Statements
- result adjusted.
mysql-test/r/ctype_cp932_notembedded.result:
Fix for
bug #26842: master binary log contains invalid queries - replication fails
bug #12826: Possible to get inconsistent slave using SQL syntax Prepared Statements
- result adjusted.
mysql-test/r/rpl_user_variables.result:
Fix for
bug #26842: master binary log contains invalid queries - replication fails
bug #12826: Possible to get inconsistent slave using SQL syntax Prepared Statements
- test result.
mysql-test/t/ctype_cp932_binlog.test:
Fix for
bug #26842: master binary log contains invalid queries - replication fails
bug #12826: Possible to get inconsistent slave using SQL syntax Prepared Statements
- test adjusted.
mysql-test/t/rpl_user_variables.test:
Fix for
bug #26842: master binary log contains invalid queries - replication fails
bug #12826: Possible to get inconsistent slave using SQL syntax Prepared Statements
- test case.
sql/sql_prepare.cc:
Fix for
bug #26842: master binary log contains invalid queries - replication fails
bug #12826: Possible to get inconsistent slave using SQL syntax Prepared Statements
- set val to the variable's value (escaped if needed) then insert it into the query
string in the position of the placeholder. We don't need to call
get_var_with_binlog() here as there is no trace of the variable's name in the binlog.
Diffstat (limited to 'mysql-test/r/rpl_user_variables.result')
-rw-r--r-- | mysql-test/r/rpl_user_variables.result | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/mysql-test/r/rpl_user_variables.result b/mysql-test/r/rpl_user_variables.result index 05f2b68042e..26ac2b26aaa 100644 --- a/mysql-test/r/rpl_user_variables.result +++ b/mysql-test/r/rpl_user_variables.result @@ -253,10 +253,44 @@ SELECT * from t2; k 100 42 +drop table t1, t2; +reset master; +create table t1 (a int); +prepare s from "insert into t1 values (@a),(?)"; +set @a=98; +execute s using @a; +prepare s from "insert into t1 values (?)"; +set @a=99; +execute s using @a; +prepare s from "insert into t1 select 100 limit ?"; +set @a=100; +execute s using @a; +show binlog events from 98; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 98 Query 1 184 use `test`; create table t1 (a int) +slave-bin.000001 184 User var 2 226 @`a`=98 +slave-bin.000001 226 Query 1 320 use `test`; insert into t1 values (@a),(98) +slave-bin.000001 320 Query 1 409 use `test`; insert into t1 values (99) +slave-bin.000001 409 Query 1 507 use `test`; insert into t1 select 100 limit 100 +select * from t1; +a +98 +98 +99 +100 +drop table t1; +create table t1(a int, b int); +prepare s1 from 'insert into t1 values (@x:=@x+1, ?)'; +set @x=1; +execute s1 using @x; +select * from t1; +a b +2 1 +select * from t1; +a b +2 1 +drop table t1; End of 5.0 tests. -DROP TABLE t1; -DROP TABLE t2; -DROP TABLE IF EXISTS t1; DROP FUNCTION IF EXISTS f1; DROP FUNCTION IF EXISTS f2; CREATE TABLE t1 (i INT); |