Commit 5756c30c authored by pekka@mysql.com's avatar pekka@mysql.com

Merge pnousiainen@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  mysql.com:/space/pekka/ndb/version/my51
parents 69d7e4f0 af149459
......@@ -539,7 +539,7 @@ error:
pthread_mutex_lock(&counter_mutex);
counter--;
pthread_mutex_unlock(&counter_mutex);
return error;
return 0;
}
......
......@@ -250,5 +250,23 @@ 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
......@@ -281,3 +281,27 @@ master-bin.000001 1092 Write_rows 1 #
master-bin.000001 1126 Query 1 # use `test`; create table t2 (n int) engine=innodb
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
drop table t1, t2;
......@@ -256,3 +256,27 @@ 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
drop table t1, t2;
......@@ -64,3 +64,7 @@ mysqld1 online
mysqld2 offline
SHOW INSTANCE STATUS;
ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
START INSTANCE mysqld1,mysqld2,mysqld3;
ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
STOP INSTANCE mysqld1,mysqld2,mysqld3;
ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use
......@@ -32,7 +32,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`blob_column` longblob,
`vchar_column` varchar(100) default NULL,
PRIMARY KEY (`a`)
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP PROCEDURE test.p1;
DROP FUNCTION test.fn1;
......
......@@ -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;
......@@ -3,3 +3,21 @@
-- source include/have_binlog_format_row.inc
-- source extra/binlog_tests/mix_innodb_myisam_binlog.test
# This piece below cannot be put into
# extra/binlog_tests/mix_innodb_myisam_binlog.test
# because the argument of --start-position differs between statement-
# and row-based (and "eval --exec" doesn't work).
# 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=516 $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=%";
drop table t1, t2;
......@@ -3,3 +3,21 @@
-- source include/have_binlog_format_statement.inc
-- source extra/binlog_tests/mix_innodb_myisam_binlog.test
# This piece below cannot be put into
# extra/binlog_tests/mix_innodb_myisam_binlog.test
# because the argument of --start-position differs between statement-
# and row-based (and "eval --exec" doesn't work).
# 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=551 $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=%";
drop table t1, t2;
......@@ -149,3 +149,18 @@ SHOW INSTANCES;
###########################################################################
--error 1149
SHOW INSTANCE STATUS;
#
# Tests for bug fixes
#
#
# Bug #12813 Instance Manager: START/STOP INSTANCE commands accept
# a list as argument.
#
--error 1149
START INSTANCE mysqld1,mysqld2,mysqld3;
--error 1149
STOP INSTANCE mysqld1,mysqld2,mysqld3;
--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;
......@@ -143,7 +143,7 @@ Command *parse_command(Instance_map *map, const char *text)
instance_name_len= word_len;
text+= word_len;
/* it should be the end of command */
get_word(&text, &word_len);
get_word(&text, &word_len, NONSPACE);
if (word_len)
goto syntax_error;
......@@ -156,7 +156,7 @@ Command *parse_command(Instance_map *map, const char *text)
if (shift_token(&text, &word_len) != TOK_INSTANCES)
goto syntax_error;
get_word(&text, &word_len);
get_word(&text, &word_len, NONSPACE);
if (word_len)
goto syntax_error;
......@@ -197,7 +197,7 @@ Command *parse_command(Instance_map *map, const char *text)
}
/* should be empty */
get_word(&text, &word_len);
get_word(&text, &word_len, NONSPACE);
if (word_len)
goto syntax_error;
......@@ -213,7 +213,7 @@ Command *parse_command(Instance_map *map, const char *text)
case TOK_SHOW:
switch (shift_token(&text, &word_len)) {
case TOK_INSTANCES:
get_word(&text, &word_len);
get_word(&text, &word_len, NONSPACE);
if (word_len)
goto syntax_error;
command= new Show_instances(map);
......@@ -226,7 +226,7 @@ Command *parse_command(Instance_map *map, const char *text)
goto syntax_error;
text+= instance_name_len;
/* check that this is the end of the command */
get_word(&text, &word_len);
get_word(&text, &word_len, NONSPACE);
if (word_len)
goto syntax_error;
if (tok2 == TOK_STATUS)
......@@ -250,7 +250,7 @@ Command *parse_command(Instance_map *map, const char *text)
case TOK_LOG:
switch (Token tok3= shift_token(&text, &word_len)) {
case TOK_FILES:
get_word(&text, &word_len);
get_word(&text, &word_len, NONSPACE);
/* check that this is the end of the command */
if (word_len)
goto syntax_error;
......@@ -290,10 +290,14 @@ Command *parse_command(Instance_map *map, const char *text)
get_word(&text, &word_len);
if (!word_len)
goto syntax_error;
text+= word_len;
command= new Show_instance_log(map, instance_name,
instance_name_len, log_type,
log_size, text);
get_word(&text, &word_len, NONSPACE);
/* check that this is the end of the command */
if (word_len)
goto syntax_error;
break;
case '\0':
command= new Show_instance_log(map, instance_name,
......
......@@ -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;
......
......@@ -5228,8 +5228,8 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
*/
{"log-bin-trust-function-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS,
"If equal to 0 (the default), then when --log-bin is used, creation of "
"a function (a trigger) is allowed only to users having the SUPER privilege "
"and only if this function (trigger) may not break binary logging."
"a stored function (or trigger) is allowed only to users having the SUPER privilege "
"and only if this stored function (trigger) may not break binary logging."
#ifdef HAVE_ROW_BASED_REPLICATION
" If using --binlog-format=row, the security issues do not exist and the "
"binary logging cannot break so this option is automatically set to 1."
......
......@@ -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;
......
......@@ -749,12 +749,6 @@ int cmp_splocal_locations(Item_splocal * const *a, Item_splocal * const *b)
written into binary log. Instead we catch function calls the statement
makes and write it into binary log separately (see #3).
We actually can easily write SELECT statements into the binary log in the
right order (we don't have issues with const tables being unlocked early
because SELECTs that use FUNCTIONs unlock all tables at once) We don't do
it because replication slave thread currently can't execute SELECT
statements. Fixing this is on the TODO.
2. PROCEDURE calls
CALL statements are not written into binary log. Instead
......@@ -775,7 +769,7 @@ int cmp_splocal_locations(Item_splocal * const *a, Item_splocal * const *b)
function execution (grep for start_union_events and stop_union_events)
If the answers are No and Yes, we write the function call into the binary
log as "DO spfunc(<param1value>, <param2value>, ...)"
log as "SELECT spfunc(<param1value>, <param2value>, ...)"
4. Miscellaneous issues.
......@@ -1327,7 +1321,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
char buf[256];
String bufstr(buf, sizeof(buf), &my_charset_bin);
bufstr.length(0);
bufstr.append(STRING_WITH_LEN("DO "));
bufstr.append(STRING_WITH_LEN("SELECT "));
append_identifier(thd, &bufstr, m_name.str, m_name.length);
bufstr.append('(');
for (uint i=0; i < argcount; i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment