diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-09-06 10:08:09 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-09-06 10:08:09 +0200 |
commit | a0efc4bd7779e3fe9ef664a2254e8f9c5868afeb (patch) | |
tree | 33fa76f41bc473e7faf0079c741b8a416f2a2437 /sql/sql_base.cc | |
parent | caedd1992c0926f41e3fb5f8b6f430d9a2a827a9 (diff) | |
download | mariadb-git-a0efc4bd7779e3fe9ef664a2254e8f9c5868afeb.tar.gz |
MDEV-510 assert triggered by ./mtr --ps-protocol rpl_mdev382
The DELETE for emplicitly emptied MEMORY tables should be written directly to binlog.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 52569f193aa..a1e00b74a47 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -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; |