Commit b864484f authored by marko's avatar marko

branches/zip: Remove reads of freed memory in fast index creation.

Because row_drop_table_for_mysql_no_commit() checks with dict_load_table()
if the table was successfully dropped, we cannot pass table->name to it.

row_merge_drop_table(): Pass a copy of table->name to
row_drop_table_for_mysql().

row_prebuilt_free(): Do not dereference prebuilt->table->name after a
successful invocation of row_add_table_to_background_drop_list().  The
table object may be freed at any time.  Remove the debug message
"Dropping table".
parent d398e717
...@@ -1620,8 +1620,14 @@ row_merge_drop_table( ...@@ -1620,8 +1620,14 @@ row_merge_drop_table(
/* Drop the table immediately iff it is not references by MySQL */ /* Drop the table immediately iff it is not references by MySQL */
if (table->n_mysql_handles_opened == 0) { if (table->n_mysql_handles_opened == 0) {
/* Copy table->name, because table will have been
freed when row_drop_table_for_mysql_no_commit()
checks with dict_load_table() that the table was
indeed dropped. */
char* table_name = mem_strdup(table->name);
/* Set the commit flag to FALSE. */ /* Set the commit flag to FALSE. */
err = row_drop_table_for_mysql(table->name, trx, FALSE); err = row_drop_table_for_mysql(table_name, trx, FALSE);
mem_free(table_name);
} }
if (dict_locked) { if (dict_locked) {
......
...@@ -749,26 +749,15 @@ row_prebuilt_free( ...@@ -749,26 +749,15 @@ row_prebuilt_free(
references to it now.*/ references to it now.*/
if (prebuilt->table->to_be_dropped if (prebuilt->table->to_be_dropped
&& prebuilt->table->n_mysql_handles_opened == 0) { && prebuilt->table->n_mysql_handles_opened == 0) {
ibool added; ut_a(*prebuilt->table->name == TEMP_TABLE_PREFIX);
added = row_add_table_to_background_drop_list(prebuilt->table);
ut_print_timestamp(stderr);
if (added) { if (!row_add_table_to_background_drop_list(prebuilt->table)) {
fputs(" InnoDB: Dropping table ", stderr);
ut_print_name(stderr, NULL, TRUE,
prebuilt->table->name);
putc('\n', stderr);
} else {
fputs(" InnoDB: Error: failed trying to add ", fputs(" InnoDB: Error: failed trying to add ",
stderr); stderr);
ut_print_name(stderr, NULL, TRUE, ut_print_name(stderr, NULL, TRUE,
prebuilt->table->name); prebuilt->table->name);
fputs(" to the background drop list.\n", stderr); fputs(" to the background drop list.\n", stderr);
} }
ut_a(*prebuilt->table->name == TEMP_TABLE_PREFIX);
} }
UT_LIST_REMOVE(prebuilts, prebuilt->table->prebuilts, prebuilt); UT_LIST_REMOVE(prebuilts, prebuilt->table->prebuilts, prebuilt);
......
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