Merge mysql.com:/home/mysql_src/mysql-5.0
into mysql.com:/home/mysql_src/mysql-5.1-new; will fix manually sp_head.cc and mysqld.cc later soon.
This commit is contained in:
commit
473cfdfcb2
@ -250,5 +250,36 @@ show binlog events from 102;
|
||||
do release_lock("lock1");
|
||||
drop table t0,t2;
|
||||
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
# Test for BUG#16559 (ROLLBACK should always have a zero error code in
|
||||
# binlog). Has to be here and not earlier, as the SELECTs influence
|
||||
# XIDs differently between normal and ps-protocol (and SHOW BINLOG
|
||||
# EVENTS above read XIDs).
|
||||
|
||||
connect (con4,localhost,root,,);
|
||||
connection con3;
|
||||
reset master;
|
||||
create table t1 (a int) engine=innodb;
|
||||
create table t2 (a int) engine=myisam;
|
||||
select get_lock("a",10);
|
||||
begin;
|
||||
insert into t1 values(8);
|
||||
insert into t2 select * from t1;
|
||||
disconnect con3;
|
||||
|
||||
connection con4;
|
||||
select get_lock("a",10); # wait for rollback to finish
|
||||
|
||||
# we check that the error code of the "ROLLBACK" event is 0 and not
|
||||
# ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
|
||||
# and does not make slave to stop)
|
||||
--exec $MYSQL_BINLOG --start-position=547 $MYSQL_TEST_DIR/var/log/master-bin.000001 > var/tmp/mix_innodb_myisam_binlog.output
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQL_TEST_DIR/var/tmp/mix_innodb_myisam_binlog.output"))
|
||||
is not null;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
eval select
|
||||
@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%",
|
||||
@a not like "%#%error_code=%error_code=%";
|
||||
|
@ -256,3 +256,26 @@ master-bin.000001 1654 Query 1 # use `test`; create table t2 (n int) engine=inno
|
||||
master-bin.000001 1754 Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
|
||||
do release_lock("lock1");
|
||||
drop table t0,t2;
|
||||
reset master;
|
||||
create table t1 (a int) engine=innodb;
|
||||
create table t2 (a int) engine=myisam;
|
||||
select get_lock("a",10);
|
||||
get_lock("a",10)
|
||||
1
|
||||
begin;
|
||||
insert into t1 values(8);
|
||||
insert into t2 select * from t1;
|
||||
select get_lock("a",10);
|
||||
get_lock("a",10)
|
||||
1
|
||||
select
|
||||
(@a:=load_file("MYSQL_TEST_DIR/var/tmp/mix_innodb_myisam_binlog.output"))
|
||||
is not null;
|
||||
(@a:=load_file("MYSQL_TEST_DIR/var/tmp/mix_innodb_myisam_binlog.output"))
|
||||
is not null
|
||||
1
|
||||
select
|
||||
@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%",
|
||||
@a not like "%#%error_code=%error_code=%";
|
||||
@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
|
||||
1 1
|
||||
|
@ -233,20 +233,25 @@ end @ # #
|
||||
delete from t2;
|
||||
alter table t2 add unique (a);
|
||||
drop function fn1;
|
||||
create function fn1()
|
||||
create function fn1(x int)
|
||||
returns int
|
||||
begin
|
||||
insert into t2 values(20),(20);
|
||||
insert into t2 values(x),(x);
|
||||
return 10;
|
||||
end|
|
||||
select fn1();
|
||||
do fn1(100);
|
||||
Warnings:
|
||||
Error 1062 Duplicate entry '100' for key 1
|
||||
select fn1(20);
|
||||
ERROR 23000: Duplicate entry '20' for key 1
|
||||
select * from t2;
|
||||
a
|
||||
20
|
||||
100
|
||||
select * from t2;
|
||||
a
|
||||
20
|
||||
100
|
||||
create trigger trg before insert on t1 for each row set new.a= 10;
|
||||
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||
delete from t1;
|
||||
@ -324,7 +329,7 @@ insert into t1 values (x);
|
||||
return x+2;
|
||||
end
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; DO `fn1`(20)
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20)
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21))
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1()
|
||||
@ -351,13 +356,14 @@ end
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a)
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1()
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1(x int)
|
||||
returns int
|
||||
begin
|
||||
insert into t2 values(20),(20);
|
||||
insert into t2 values(x),(x);
|
||||
return 10;
|
||||
end
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; DO `fn1`()
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(100)
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20)
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
|
||||
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1)
|
||||
@ -415,4 +421,3 @@ col
|
||||
test
|
||||
DROP PROCEDURE p1;
|
||||
drop table t1;
|
||||
reset master;
|
||||
|
@ -460,4 +460,20 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER="root"@"localhost" SQL SECURITY DEFINER VI
|
||||
create view v2 as select a from t2 where a in (select a from v1);
|
||||
drop view v2, v1;
|
||||
drop table t1, t2;
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
ANSI_QUOTES
|
||||
set sql_mode=2097152;
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
STRICT_TRANS_TABLES
|
||||
set sql_mode=16384+(65536*4);
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI
|
||||
set sql_mode=2147483648;
|
||||
ERROR 42000: Variable 'sql_mode' can't be set to the value of '2147483648'
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
||||
|
@ -1 +1 @@
|
||||
--log_bin_trust_routine_creators=0 --slave-skip-errors=1062
|
||||
--log_bin_trust_routine_creators=0
|
||||
|
@ -296,21 +296,19 @@ alter table t2 add unique (a);
|
||||
drop function fn1;
|
||||
|
||||
delimiter |;
|
||||
create function fn1()
|
||||
create function fn1(x int)
|
||||
returns int
|
||||
begin
|
||||
insert into t2 values(20),(20);
|
||||
insert into t2 values(x),(x);
|
||||
return 10;
|
||||
end|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
# Because of BUG#14769 the following statement requires that we start
|
||||
# slave with --slave-skip-errors=1062. When that bug is fixed, that
|
||||
# option can be removed.
|
||||
do fn1(100);
|
||||
|
||||
--error 1062
|
||||
select fn1();
|
||||
select fn1(20);
|
||||
|
||||
select * from t2;
|
||||
sync_slave_with_master;
|
||||
|
@ -255,4 +255,13 @@ create view v2 as select a from t2 where a in (select a from v1);
|
||||
drop view v2, v1;
|
||||
drop table t1, t2;
|
||||
|
||||
select @@sql_mode;
|
||||
set sql_mode=2097152;
|
||||
select @@sql_mode;
|
||||
set sql_mode=16384+(65536*4);
|
||||
select @@sql_mode;
|
||||
--error 1231
|
||||
set sql_mode=2147483648; # that mode does not exist
|
||||
select @@sql_mode;
|
||||
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
||||
|
@ -1099,6 +1099,7 @@ static int binlog_commit(THD *thd, bool all)
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE);
|
||||
qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
|
||||
DBUG_RETURN(binlog_end_trans(thd, trx_data, &qev));
|
||||
}
|
||||
|
||||
@ -1125,6 +1126,7 @@ static int binlog_rollback(THD *thd, bool all)
|
||||
if (unlikely(thd->options & OPTION_STATUS_NO_TRANS_UPDATE))
|
||||
{
|
||||
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE);
|
||||
qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
|
||||
error= binlog_end_trans(thd, trx_data, &qev);
|
||||
}
|
||||
else
|
||||
@ -3019,7 +3021,9 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event)
|
||||
Imagine this is rollback due to net timeout, after all statements of
|
||||
the transaction succeeded. Then we want a zero-error code in BEGIN.
|
||||
In other words, if there was a really serious error code it's already
|
||||
in the statement's events.
|
||||
in the statement's events, there is no need to put it also in this
|
||||
internally generated event, and as this event is generated late it
|
||||
would lead to false alarms.
|
||||
This is safer than thd->clear_error() against kills at shutdown.
|
||||
*/
|
||||
qinfo.error_code= 0;
|
||||
|
@ -1621,7 +1621,12 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
|
||||
else
|
||||
{
|
||||
ulonglong tmp= var->value->val_int();
|
||||
if (tmp >= enum_names->count)
|
||||
/*
|
||||
For when the enum is made to contain 64 elements, as 1ULL<<64 is
|
||||
undefined, we guard with a "count<64" test.
|
||||
*/
|
||||
if (unlikely((tmp >= ((ULL(1)) << enum_names->count)) &&
|
||||
(enum_names->count < 64)))
|
||||
{
|
||||
llstr(tmp, buff);
|
||||
goto err;
|
||||
|
Loading…
x
Reference in New Issue
Block a user