Commit 23438dac authored by Andrei Elkin's avatar Andrei Elkin

merging 5.1->rep+2->rep+3

parents 184d7b02 80cb8106
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
# column and index but without primary key. # column and index but without primary key.
############################################################## ##############################################################
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
--echo # --echo #
--echo # Setup --echo # Setup
--echo # --echo #
...@@ -187,7 +189,9 @@ drop trigger t1_bi; ...@@ -187,7 +189,9 @@ drop trigger t1_bi;
# Check that nested call doesn't affect outer context. # Check that nested call doesn't affect outer context.
select last_insert_id(); select last_insert_id();
--disable_warnings
select bug15728_insert(); select bug15728_insert();
--enable_warnings
select last_insert_id(); select last_insert_id();
insert into t1 (last_id) values (bug15728()); insert into t1 (last_id) values (bug15728());
# This should be exactly one greater than in the previous call. # This should be exactly one greater than in the previous call.
...@@ -440,7 +444,9 @@ delimiter ;| ...@@ -440,7 +444,9 @@ delimiter ;|
INSERT INTO t1 VALUES (NULL, -1); INSERT INTO t1 VALUES (NULL, -1);
CALL p1(); CALL p1();
--disable_warnings
SELECT f1(); SELECT f1();
--enable_warnings
INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()), INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()),
(NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2()); (NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2());
INSERT INTO t1 VALUES (NULL, f2()); INSERT INTO t1 VALUES (NULL, f2());
...@@ -509,7 +515,9 @@ insert into t2 (id) values(1),(2),(3); ...@@ -509,7 +515,9 @@ insert into t2 (id) values(1),(2),(3);
delete from t2; delete from t2;
set sql_log_bin=1; set sql_log_bin=1;
#inside SELECT, then inside INSERT #inside SELECT, then inside INSERT
--disable_warnings
select insid(); select insid();
--enable_warnings
set sql_log_bin=0; set sql_log_bin=0;
insert into t2 (id) values(5),(6),(7); insert into t2 (id) values(5),(6),(7);
delete from t2 where id>=5; delete from t2 where id>=5;
......
...@@ -25,11 +25,11 @@ use b42829; ...@@ -25,11 +25,11 @@ use b42829;
### binlog-do-db is not filtering used database ### binlog-do-db is not filtering used database
BEGIN; BEGIN;
INSERT INTO t2 VALUES (1,2), (1,3), (1,4); INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT' ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
UPDATE b42829_filtered.t1 ft1, b42829.t1 nft1 SET ft1.x=1, nft1.x=2; UPDATE b42829_filtered.t1 ft1, b42829.t1 nft1 SET ft1.x=1, nft1.x=2;
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT' ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
INSERT INTO t1 SELECT * FROM t2; INSERT INTO t1 SELECT * FROM t2;
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT' ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
COMMIT; COMMIT;
### assertion: filtered events did not make into the binlog ### assertion: filtered events did not make into the binlog
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
......
...@@ -516,10 +516,10 @@ end| ...@@ -516,10 +516,10 @@ end|
reset master; reset master;
insert into t2 values (bug27417(1)); insert into t2 values (bug27417(1));
Warnings: Warnings:
Note 1592 Statement may not be safe to log in statement format. Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
insert into t2 select bug27417(2); insert into t2 select bug27417(2);
Warnings: Warnings:
Note 1592 Statement may not be safe to log in statement format. Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
reset master; reset master;
insert into t2 values (bug27417(2)); insert into t2 values (bug27417(2));
ERROR 23000: Duplicate entry '2' for key 'PRIMARY' ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
...@@ -539,7 +539,7 @@ count(*) ...@@ -539,7 +539,7 @@ count(*)
2 2
delete from t2 where a=bug27417(3); delete from t2 where a=bug27417(3);
Warnings: Warnings:
Note 1592 Statement may not be safe to log in statement format. Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
select count(*) from t2 /* nothing got deleted */; select count(*) from t2 /* nothing got deleted */;
count(*) count(*)
2 2
...@@ -555,7 +555,7 @@ count(*) ...@@ -555,7 +555,7 @@ count(*)
5 5
delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
Warnings: Warnings:
Note 1592 Statement may not be safe to log in statement format. Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
affected rows: 0 affected rows: 0
select count(*) from t1 /* must be 7 */; select count(*) from t1 /* must be 7 */;
count(*) count(*)
...@@ -780,10 +780,10 @@ end| ...@@ -780,10 +780,10 @@ end|
reset master; reset master;
insert into t2 values (bug27417(1)); insert into t2 values (bug27417(1));
Warnings: Warnings:
Note 1592 Statement may not be safe to log in statement format. Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
insert into t2 select bug27417(2); insert into t2 select bug27417(2);
Warnings: Warnings:
Note 1592 Statement may not be safe to log in statement format. Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
reset master; reset master;
insert into t2 values (bug27417(2)); insert into t2 values (bug27417(2));
ERROR 23000: Duplicate entry '2' for key 'PRIMARY' ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
...@@ -802,7 +802,7 @@ count(*) ...@@ -802,7 +802,7 @@ count(*)
2 2
delete from t2 where a=bug27417(3); delete from t2 where a=bug27417(3);
Warnings: Warnings:
Note 1592 Statement may not be safe to log in statement format. Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
select count(*) from t2 /* nothing got deleted */; select count(*) from t2 /* nothing got deleted */;
count(*) count(*)
2 2
...@@ -817,7 +817,7 @@ count(*) ...@@ -817,7 +817,7 @@ count(*)
5 5
delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
Warnings: Warnings:
Note 1592 Statement may not be safe to log in statement format. Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
affected rows: 0 affected rows: 0
select count(*) from t1 /* must be 7 */; select count(*) from t1 /* must be 7 */;
count(*) count(*)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -74,11 +74,11 @@ INSERT INTO t1 SELECT * FROM t2; ...@@ -74,11 +74,11 @@ INSERT INTO t1 SELECT * FROM t2;
-- echo ### assertion: the statements *will* raise log error because -- echo ### assertion: the statements *will* raise log error because
-- echo ### binlog-do-db is not filtering used database -- echo ### binlog-do-db is not filtering used database
BEGIN; BEGIN;
-- error ER_BINLOG_LOGGING_IMPOSSIBLE -- error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
INSERT INTO t2 VALUES (1,2), (1,3), (1,4); INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
-- error ER_BINLOG_LOGGING_IMPOSSIBLE -- error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
-- eval UPDATE $filtered.t1 ft1, $not_filtered.t1 nft1 SET ft1.x=1, nft1.x=2 -- eval UPDATE $filtered.t1 ft1, $not_filtered.t1 nft1 SET ft1.x=1, nft1.x=2
-- error ER_BINLOG_LOGGING_IMPOSSIBLE -- error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
INSERT INTO t1 SELECT * FROM t2; INSERT INTO t1 SELECT * FROM t2;
COMMIT; COMMIT;
......
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
# #
# Setup # Setup
# #
...@@ -531,3 +532,4 @@ id last_id ...@@ -531,3 +532,4 @@ id last_id
drop table t1, t2; drop table t1, t2;
drop procedure foo; drop procedure foo;
SET @@global.concurrent_insert= @old_concurrent_insert; SET @@global.concurrent_insert= @old_concurrent_insert;
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
...@@ -606,9 +606,6 @@ end ...@@ -606,9 +606,6 @@ end
master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`() master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`()
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
Warnings:
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 6.0. Please use '@@log_bin_trust_function_creators' instead
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
drop database mysqltest; drop database mysqltest;
......
...@@ -43,8 +43,7 @@ RETURN i; ...@@ -43,8 +43,7 @@ RETURN i;
END// END//
CALL p1(); CALL p1();
Warnings: Warnings:
Note 1592 Statement may not be safe to log in statement format. Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Statement may not be safe to log in statement format.
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # BEGIN
...@@ -130,8 +129,7 @@ id ...@@ -130,8 +129,7 @@ id
DROP TRIGGER tr1; DROP TRIGGER tr1;
CALL p2(); CALL p2();
Warnings: Warnings:
Note 1592 Statement may not be safe to log in statement format. Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Statement may not be safe to log in statement format.
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # BEGIN
...@@ -211,3 +209,4 @@ DROP PROCEDURE IF EXISTS p1; ...@@ -211,3 +209,4 @@ DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2; DROP PROCEDURE IF EXISTS p2;
DROP FUNCTION IF EXISTS f1; DROP FUNCTION IF EXISTS f1;
DROP TRIGGER IF EXISTS tr1; DROP TRIGGER IF EXISTS tr1;
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
...@@ -4,6 +4,7 @@ reset master; ...@@ -4,6 +4,7 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
==== Initialization ==== ==== Initialization ====
[on master] [on master]
SET @m_pseudo_thread_id= @@global.pseudo_thread_id; SET @m_pseudo_thread_id= @@global.pseudo_thread_id;
......
...@@ -9,3 +9,4 @@ ...@@ -9,3 +9,4 @@
-- source include/have_innodb.inc -- source include/have_innodb.inc
let $engine_type=myisam; let $engine_type=myisam;
-- source extra/rpl_tests/rpl_insert_id.test -- source extra/rpl_tests/rpl_insert_id.test
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
...@@ -108,3 +108,5 @@ DROP FUNCTION IF EXISTS f1; ...@@ -108,3 +108,5 @@ DROP FUNCTION IF EXISTS f1;
DROP TRIGGER IF EXISTS tr1; DROP TRIGGER IF EXISTS tr1;
enable_warnings; enable_warnings;
sync_slave_with_master; sync_slave_with_master;
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
source include/master-slave.inc; source include/master-slave.inc;
source include/have_binlog_format_mixed_or_statement.inc; source include/have_binlog_format_mixed_or_statement.inc;
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
--echo ==== Initialization ==== --echo ==== Initialization ====
...@@ -377,8 +378,9 @@ BEGIN ...@@ -377,8 +378,9 @@ BEGIN
END| END|
DELIMITER ;| DELIMITER ;|
--disable_warnings
SELECT func(); SELECT func();
--enable_warnings
--echo ==== Insert variables from a trigger ==== --echo ==== Insert variables from a trigger ====
......
...@@ -1488,199 +1488,6 @@ network_err: ...@@ -1488,199 +1488,6 @@ network_err:
DBUG_RETURN(2); DBUG_RETURN(2);
} }
/*
Used by fetch_master_table (used by LOAD TABLE tblname FROM MASTER and LOAD
DATA FROM MASTER). Drops the table (if 'overwrite' is true) and recreates it
from the dump. Honours replication inclusion/exclusion rules.
db must be non-zero (guarded by assertion).
RETURN VALUES
0 success
1 error
*/
static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
const char* table_name, bool overwrite)
{
ulong packet_len;
char *query, *save_db;
uint32 save_db_length;
Vio* save_vio;
HA_CHECK_OPT check_opt;
TABLE_LIST tables;
int error= 1;
handler *file;
ulonglong save_options;
NET *net= &mysql->net;
const char *found_semicolon= NULL;
DBUG_ENTER("create_table_from_dump");
packet_len= my_net_read(net); // read create table statement
if (packet_len == packet_error)
{
my_message(ER_MASTER_NET_READ, ER(ER_MASTER_NET_READ), MYF(0));
DBUG_RETURN(1);
}
if (net->read_pos[0] == 255) // error from master
{
char *err_msg;
err_msg= (char*) net->read_pos + ((mysql->server_capabilities &
CLIENT_PROTOCOL_41) ?
3+SQLSTATE_LENGTH+1 : 3);
my_error(ER_MASTER, MYF(0), err_msg);
DBUG_RETURN(1);
}
thd->command = COM_TABLE_DUMP;
if (!(query = thd->strmake((char*) net->read_pos, packet_len)))
{
sql_print_error("create_table_from_dump: out of memory");
my_message(ER_GET_ERRNO, "Out of memory", MYF(0));
DBUG_RETURN(1);
}
thd->set_query(query, packet_len);
thd->is_slave_error = 0;
bzero((char*) &tables,sizeof(tables));
tables.db = (char*)db;
tables.alias= tables.table_name= (char*)table_name;
/* Drop the table if 'overwrite' is true */
if (overwrite)
{
if (mysql_rm_table(thd,&tables,1,0)) /* drop if exists */
{
sql_print_error("create_table_from_dump: failed to drop the table");
goto err;
}
else
{
/* Clear the OK result of mysql_rm_table(). */
thd->main_da.reset_diagnostics_area();
}
}
/* Create the table. We do not want to log the "create table" statement */
save_options = thd->options;
thd->options &= ~ (OPTION_BIN_LOG);
thd_proc_info(thd, "Creating table from master dump");
// save old db in case we are creating in a different database
save_db = thd->db;
save_db_length= thd->db_length;
thd->db = (char*)db;
DBUG_ASSERT(thd->db != 0);
thd->db_length= strlen(thd->db);
/* run create table */
mysql_parse(thd, thd->query(), packet_len, &found_semicolon);
thd->db = save_db; // leave things the way the were before
thd->db_length= save_db_length;
thd->options = save_options;
if (thd->is_slave_error)
goto err; // mysql_parse took care of the error send
thd_proc_info(thd, "Opening master dump table");
thd->main_da.reset_diagnostics_area(); /* cleanup from CREATE_TABLE */
/*
Note: If this function starts to fail for MERGE tables,
change the next two lines to these:
tables.table= NULL; // was set by mysql_rm_table()
if (!open_n_lock_single_table(thd, &tables, TL_WRITE))
*/
tables.lock_type = TL_WRITE;
if (!open_ltable(thd, &tables, TL_WRITE, 0))
{
sql_print_error("create_table_from_dump: could not open created table");
goto err;
}
file = tables.table->file;
thd_proc_info(thd, "Reading master dump table data");
/* Copy the data file */
if (file->net_read_dump(net))
{
my_message(ER_MASTER_NET_READ, ER(ER_MASTER_NET_READ), MYF(0));
sql_print_error("create_table_from_dump: failed in\
handler::net_read_dump()");
goto err;
}
check_opt.init();
check_opt.flags|= T_VERY_SILENT | T_CALC_CHECKSUM | T_QUICK;
thd_proc_info(thd, "Rebuilding the index on master dump table");
/*
We do not want repair() to spam us with messages
just send them to the error log, and report the failure in case of
problems.
*/
save_vio = thd->net.vio;
thd->net.vio = 0;
/* Rebuild the index file from the copied data file (with REPAIR) */
error=file->ha_repair(thd,&check_opt) != 0;
thd->net.vio = save_vio;
if (error)
my_error(ER_INDEX_REBUILD, MYF(0), tables.table->s->table_name.str);
err:
close_thread_tables(thd);
DBUG_RETURN(error);
}
int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
Master_info *mi, MYSQL *mysql, bool overwrite)
{
int error= 1;
const char *errmsg=0;
bool called_connected= (mysql != NULL);
DBUG_ENTER("fetch_master_table");
DBUG_PRINT("enter", ("db_name: '%s' table_name: '%s'",
db_name,table_name));
if (!called_connected)
{
if (!(mysql = mysql_init(NULL)))
{
DBUG_RETURN(1);
}
if (connect_to_master(thd, mysql, mi))
{
my_error(ER_CONNECT_TO_MASTER, MYF(0), mysql_error(mysql));
/*
We need to clear the active VIO since, theoretically, somebody
might issue an awake() on this thread. If we are then in the
middle of closing and destroying the VIO inside the
mysql_close(), we will have a problem.
*/
#ifdef SIGNAL_WITH_VIO_CLOSE
thd->clear_active_vio();
#endif
mysql_close(mysql);
DBUG_RETURN(1);
}
if (thd->killed)
goto err;
}
if (request_table_dump(mysql, db_name, table_name))
{
error= ER_UNKNOWN_ERROR;
errmsg= "Failed on table dump request";
goto err;
}
if (create_table_from_dump(thd, mysql, db_name,
table_name, overwrite))
goto err; // create_table_from_dump have sent the error already
error = 0;
err:
if (!called_connected)
mysql_close(mysql);
if (errmsg && thd->vio_ok())
my_message(error, errmsg, MYF(0));
DBUG_RETURN(test(error)); // Return 1 on error
}
static bool wait_for_relay_log_space(Relay_log_info* rli) static bool wait_for_relay_log_space(Relay_log_info* rli)
{ {
bool slave_killed=0; bool slave_killed=0;
......
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