Commit 39450498 authored by Marko Mäkelä's avatar Marko Mäkelä

Remove space_name_list_t

fil_get_space_names(): Remove.

fts_drop_orphaned_tables(): Iterate fil_system->space_list directly.
parent 094b0f86
......@@ -6160,51 +6160,6 @@ fil_delete_file(
}
}
/**
Iterate over all the spaces in the space list and fetch the
tablespace names. It will return a copy of the name that must be
freed by the caller using: delete[].
@return DB_SUCCESS if all OK. */
dberr_t
fil_get_space_names(
/*================*/
space_name_list_t& space_name_list)
/*!< in/out: List to append to */
{
fil_space_t* space;
dberr_t err = DB_SUCCESS;
mutex_enter(&fil_system->mutex);
for (space = UT_LIST_GET_FIRST(fil_system->space_list);
space != NULL;
space = UT_LIST_GET_NEXT(space_list, space)) {
if (space->purpose == FIL_TYPE_TABLESPACE) {
ulint len;
char* name;
len = ::strlen(space->name);
name = UT_NEW_ARRAY_NOKEY(char, len + 1);
if (name == 0) {
/* Caller to free elements allocated so far. */
err = DB_OUT_OF_MEMORY;
break;
}
memcpy(name, space->name, len);
name[len] = 0;
space_name_list.push_back(name);
}
}
mutex_exit(&fil_system->mutex);
return(err);
}
/** Generate redo log for swapping two .ibd files
@param[in] old_table old table
@param[in] new_table new table
......
......@@ -6991,15 +6991,6 @@ fts_drop_orphaned_tables(void)
que_t* graph;
ib_vector_t* tables;
ib_alloc_t* heap_alloc;
space_name_list_t space_name_list;
dberr_t error = DB_SUCCESS;
/* Note: We have to free the memory after we are done with the list. */
error = fil_get_space_names(space_name_list);
if (error == DB_OUT_OF_MEMORY) {
ib::fatal() << "Out of memory";
}
heap = mem_heap_create(1024);
heap_alloc = ib_heap_allocator_create(heap);
......@@ -7012,35 +7003,32 @@ fts_drop_orphaned_tables(void)
users can't map them back to table names and this will create
unnecessary clutter. */
for (space_name_list_t::iterator it = space_name_list.begin();
it != space_name_list.end();
++it) {
fts_aux_table_t* fts_aux_table;
fts_aux_table = static_cast<fts_aux_table_t*>(
ib_vector_push(tables, NULL));
memset(fts_aux_table, 0x0, sizeof(*fts_aux_table));
mutex_enter(&fil_system->mutex);
if (!fts_is_aux_table_name(fts_aux_table, *it, strlen(*it))) {
ib_vector_pop(tables);
} else {
ulint len = strlen(*it);
for (fil_space_t* space = UT_LIST_GET_FIRST(fil_system->space_list);
space != NULL;
space = UT_LIST_GET_NEXT(space_list, space)) {
fts_aux_table->id = fil_space_get_id_by_name(*it);
if (space->purpose != FIL_TYPE_TABLESPACE) {
continue;
}
/* We got this list from fil0fil.cc. The tablespace
with this name must exist. */
ut_a(fts_aux_table->id != ULINT_UNDEFINED);
fts_aux_table_t fts_aux_table;
memset(&fts_aux_table, 0x0, sizeof fts_aux_table);
fts_aux_table->name = static_cast<char*>(
mem_heap_dup(heap, *it, len + 1));
size_t len = strlen(space->name);
fts_aux_table->name[len] = 0;
if (!fts_is_aux_table_name(&fts_aux_table, space->name, len)) {
continue;
}
fts_aux_table.id = space->id;
fts_aux_table.name = mem_heap_strdupl(heap, space->name, len);
ib_vector_push(tables, &fts_aux_table);
}
mutex_exit(&fil_system->mutex);
trx = trx_allocate_for_background();
trx->op_info = "dropping orphaned FTS tables";
row_mysql_lock_data_dictionary(trx);
......@@ -7068,7 +7056,7 @@ fts_drop_orphaned_tables(void)
"CLOSE c;");
for (;;) {
error = fts_eval_sql(trx, graph);
dberr_t error = fts_eval_sql(trx, graph);
if (error == DB_SUCCESS) {
fts_check_and_drop_orphaned_tables(trx, tables);
......@@ -7101,14 +7089,6 @@ fts_drop_orphaned_tables(void)
if (heap != NULL) {
mem_heap_free(heap);
}
/** Free the memory allocated to store the .ibd names. */
for (space_name_list_t::iterator it = space_name_list.begin();
it != space_name_list.end();
++it) {
UT_DELETE_ARRAY(*it);
}
}
/**********************************************************************//**
......
......@@ -35,16 +35,11 @@ Created 10/25/1995 Heikki Tuuri
#include "page0size.h"
#include "ibuf0types.h"
#include <list>
#include <vector>
// Forward declaration
struct trx_t;
class page_id_t;
class truncate_t;
typedef std::list<char*, ut_allocator<char*> > space_name_list_t;
/** Structure containing encryption specification */
struct fil_space_crypt_t;
......@@ -1492,18 +1487,6 @@ ulint
fil_space_get_id_by_name(
const char* tablespace);
/**
Iterate over all the spaces in the space list and fetch the
tablespace names. It will return a copy of the name that must be
freed by the caller using: delete[].
@return DB_SUCCESS if all OK. */
dberr_t
fil_get_space_names(
/*================*/
space_name_list_t& space_name_list)
/*!< in/out: Vector for collecting the names. */
MY_ATTRIBUTE((warn_unused_result));
/** Generate redo log for swapping two .ibd files
@param[in] old_table old table
@param[in] new_table new table
......
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