1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Merge 5.5 -> mwl248

This commit is contained in:
Igor Babaev
2012-09-08 22:36:55 -07:00
79 changed files with 1264 additions and 405 deletions

View File

@@ -3903,34 +3903,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;