Commit 36afa9a9 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Fixed problem with BDB tables and ALTER TABLE

parent ca08ed52
...@@ -46930,6 +46930,8 @@ not yet 100% confident in this code. ...@@ -46930,6 +46930,8 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.54 @appendixsubsec Changes in release 3.23.54
@itemize @itemize
@item @item
Fixed a problem with BDB and @code{ALTER TABLE}.
@item
Fixed reference to freed memory when doing complicated @code{GROUP BY Fixed reference to freed memory when doing complicated @code{GROUP BY
... ORDER BY} queries. Symptom was that @code{mysqld} died in function ... ORDER BY} queries. Symptom was that @code{mysqld} died in function
@code{send_fields}. @code{send_fields}.
-- source include/have_bdb.inc
# test for bug reported by Mark Steele # test for bug reported by Mark Steele
drop table if exists t1; drop table if exists t1;
......
...@@ -1530,6 +1530,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, ...@@ -1530,6 +1530,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
ha_open_options, ha_open_options,
tmp_table)) tmp_table))
{ {
my_free((char*) tmp_table,MYF(0));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
...@@ -1680,16 +1680,24 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1680,16 +1680,24 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
#ifdef HAVE_BERKELEY_DB #ifdef HAVE_BERKELEY_DB
if (old_db_type == DB_TYPE_BERKELEY_DB) if (old_db_type == DB_TYPE_BERKELEY_DB)
{ {
(void) berkeley_flush_logs();
/* /*
For the alter table to be properly flushed to the logs, we For the alter table to be properly flushed to the logs, we
have to open the new table. If not, we get a problem on server have to open the new table. If not, we get a problem on server
shutdown. shutdown.
*/ */
if (!open_tables(thd, table_list)) // Should always succeed char path[FN_REFLEN];
(void) sprintf(path,"%s/%s/%s",mysql_data_home,new_db,table_name);
fn_format(path,path,"","",4);
table=open_temporary_table(thd, path, new_db, tmp_name,0);
if (table)
{ {
close_thread_table(thd, &table_list->table); intern_close_table(table);
my_free((char*) table, MYF(0));
} }
else
sql_print_error("Warning: Could not open BDB table %s.%s after rename\n",
new_db,table_name);
(void) berkeley_flush_logs();
} }
#endif #endif
......
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