MDEV-510 assert triggered by ./mtr --ps-protocol rpl_mdev382
The DELETE for emplicitly emptied MEMORY tables should be written directly to binlog.
This commit is contained in:
parent
caedd1992c
commit
a0efc4bd77
@ -321,9 +321,7 @@ a`
|
||||
# The DELETE statement should be correctly quoted
|
||||
show binlog events in 'master-bin.000002' from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000002 # Query # # BEGIN
|
||||
master-bin.000002 # Query # # use `test`; DELETE FROM `db1``; select 'oops!'`.`t``1`
|
||||
master-bin.000002 # Query # # COMMIT
|
||||
master-bin.000002 # Query # # DELETE FROM `db1``; select 'oops!'`.`t``1`
|
||||
include/start_slave.inc
|
||||
# The table should be empty on the slave also.
|
||||
SELECT * FROM `db1``; select 'oops!'`.`t``1`;
|
||||
|
@ -3893,34 +3893,22 @@ static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry)
|
||||
{
|
||||
char query_buf[2*FN_REFLEN + 21];
|
||||
String query(query_buf, sizeof(query_buf), system_charset_info);
|
||||
|
||||
query.length(0);
|
||||
if (query.ptr())
|
||||
{
|
||||
/* this DELETE FROM is needed even with row-based binlogging */
|
||||
query.append("DELETE FROM ");
|
||||
append_identifier(thd, &query, share->db.str, share->db.length);
|
||||
query.append(".");
|
||||
append_identifier(thd, &query, share->table_name.str,
|
||||
query.append("DELETE FROM ");
|
||||
append_identifier(thd, &query, share->db.str, share->db.length);
|
||||
query.append(".");
|
||||
append_identifier(thd, &query, share->table_name.str,
|
||||
share->table_name.length);
|
||||
int errcode= query_error_code(thd, TRUE);
|
||||
if (thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
query.ptr(), query.length(),
|
||||
FALSE, FALSE, FALSE, errcode))
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
As replication is maybe going to be corrupted, we need to warn the
|
||||
DBA on top of warning the client (which will automatically be done
|
||||
because of MYF(MY_WME) in my_malloc() above).
|
||||
*/
|
||||
sql_print_error("When opening HEAP table, could not allocate memory "
|
||||
"to write 'DELETE FROM %`s.%`s' to the binary log",
|
||||
share->db.str, share->table_name.str);
|
||||
delete entry->triggers;
|
||||
|
||||
/*
|
||||
we bypass thd->binlog_query() here,
|
||||
as it does a lot of extra work, that is simply wrong in this case
|
||||
*/
|
||||
Query_log_event qinfo(thd, query.ptr(), query.length(),
|
||||
FALSE, TRUE, TRUE, 0);
|
||||
if (mysql_bin_log.write(&qinfo))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user