mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Put temporary files in binlog cache when using BEGIN/COMMIT
Let MySQL 4.0 read 4.1 .frm files without 4.1 specific extensions New variables @@rand_seed1 and @@rand_seed2 (used by replication) DROP TEMPORARY TABLE mysql-test/r/rpl_log.result: Update of results after last replication change mysql-test/r/variables.result: Test of new variables @@rand_seed1 and @@rand_seed2 mysql-test/t/variables.test: Test of new variables @@rand_seed1 and @@rand_seed2 sql/field.cc: Let MySQL 4.0 read 4.1 .frm files without 4.1 specific extensions sql/field.h: Let MySQL 4.0 read 4.1 .frm files without 4.1 specific extensions sql/item_func.cc: Put temporary files in binlog cache when using BEGIN/COMMIT sql/log.cc: Put temporary files in binlog cache when using BEGIN/COMMIT More debug information sql/log_event.cc: Put temporary files in binlog cache when using BEGIN/COMMIT sql/log_event.h: Put temporary files in binlog cache when using BEGIN/COMMIT sql/set_var.cc: Add system variables @@rand_seed1 and @@rand_seed2 sql/set_var.h: Add system variables @@rand_seed1 and @@rand_seed2 sql/slave.cc: Put temporary files in binlog cache when using BEGIN/COMMIT sql/sql_acl.cc: Put temporary files in binlog cache when using BEGIN/COMMIT sql/sql_base.cc: Store DROP of temporary tables in binlog cache sql/sql_class.h: Put temporary files in binlog cache when using BEGIN/COMMIT sql/sql_db.cc: Put temporary files in binlog cache when using BEGIN/COMMIT sql/sql_delete.cc: Put temporary files in binlog cache when using BEGIN/COMMIT sql/sql_insert.cc: Put temporary files in binlog cache when using BEGIN/COMMIT sql/sql_lex.h: DROP TEMPORARY TABLE sql/sql_load.cc: Put temporary files in binlog cache when using BEGIN/COMMIT sql/sql_parse.cc: Put temporary files in binlog cache when using BEGIN/COMMIT sql/sql_rename.cc: Put temporary files in binlog cache when using BEGIN/COMMIT sql/sql_repl.cc: Put temporary files in binlog cache when using BEGIN/COMMIT sql/sql_repl.h: Put temporary files in binlog cache when using BEGIN/COMMIT sql/sql_table.cc: Put temporary files in binlog cache when using BEGIN/COMMIT sql/sql_update.cc: Put temporary files in binlog cache when using BEGIN/COMMIT sql/sql_yacc.yy: DROP TEMPORARY sql/table.cc: Let MySQL 4.0 read 4.1 .frm files without 4.1 specific extensions sql/unireg.cc: Let MySQL 4.0 read 4.1 .frm files without 4.1 specific extensions
This commit is contained in:
@ -539,26 +539,20 @@ void close_temporary_tables(THD *thd)
|
||||
{
|
||||
TABLE *table,*next;
|
||||
char *query, *end;
|
||||
const uint init_query_buf_size = 11; // "drop table "
|
||||
uint query_buf_size;
|
||||
bool found_user_tables = 0;
|
||||
|
||||
if (!thd->temporary_tables)
|
||||
return;
|
||||
|
||||
LINT_INIT(end);
|
||||
query_buf_size = init_query_buf_size;
|
||||
query_buf_size= 50; // Enough for DROP ... TABLE
|
||||
|
||||
for (table=thd->temporary_tables ; table ; table=table->next)
|
||||
{
|
||||
query_buf_size += table->key_length;
|
||||
}
|
||||
|
||||
if (query_buf_size == init_query_buf_size)
|
||||
return; // no tables to close
|
||||
|
||||
if ((query = alloc_root(&thd->mem_root, query_buf_size)))
|
||||
{
|
||||
memcpy(query, "drop table ", init_query_buf_size);
|
||||
end = query + init_query_buf_size;
|
||||
}
|
||||
end=strmov(query, "DROP /*!40005 TEMPORARY */ TABLE ");
|
||||
|
||||
for (table=thd->temporary_tables ; table ; table=next)
|
||||
{
|
||||
@ -567,12 +561,14 @@ void close_temporary_tables(THD *thd)
|
||||
// skip temporary tables not created directly by the user
|
||||
if (table->real_name[0] != '#')
|
||||
{
|
||||
end = strxmov(end,table->table_cache_key,".",
|
||||
table->real_name,",", NullS);
|
||||
// here we assume table_cache_key always starts
|
||||
// with \0 terminated db name
|
||||
/*
|
||||
Here we assume table_cache_key always starts
|
||||
with \0 terminated db name
|
||||
*/
|
||||
found_user_tables = 1;
|
||||
}
|
||||
end = strxmov(end,table->table_cache_key,".",
|
||||
table->real_name,",", NullS);
|
||||
}
|
||||
next=table->next;
|
||||
close_temporary(table);
|
||||
@ -580,7 +576,7 @@ void close_temporary_tables(THD *thd)
|
||||
if (query && found_user_tables && mysql_bin_log.is_open())
|
||||
{
|
||||
/* The -1 is to remove last ',' */
|
||||
Query_log_event qinfo(thd, query, (ulong)(end-query)-1);
|
||||
Query_log_event qinfo(thd, query, (ulong)(end-query)-1, 0);
|
||||
qinfo.error_code=0;
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
|
Reference in New Issue
Block a user