Commit eddd2aed authored by marko's avatar marko

branches/zip: Minor cleanup.

row_remove_indexes_for_mysql(): Rename to row_merge_drop_indexes(),
move from row0mysql.c to row0merge.c and make the return type void.

row_merge_remove_index(): Rename to row_merge_drop_index() and make
the return type void.
parent 8a294fa3
...@@ -8313,7 +8313,7 @@ ha_innobase::add_index( ...@@ -8313,7 +8313,7 @@ ha_innobase::add_index(
prebuilt->trx->error_key_num = trx->error_key_num; prebuilt->trx->error_key_num = trx->error_key_num;
/* fall through */ /* fall through */
default: default:
row_remove_indexes_for_mysql( row_merge_drop_indexes(
trx, indexed_table, index, num_created); trx, indexed_table, index, num_created);
if (indexed_table != innodb_table) { if (indexed_table != innodb_table) {
row_merge_drop_table(trx, indexed_table); row_merge_drop_table(trx, indexed_table);
...@@ -8580,7 +8580,6 @@ ha_innobase::final_drop_index( ...@@ -8580,7 +8580,6 @@ ha_innobase::final_drop_index(
dict_index_t* index; /* Index to be dropped */ dict_index_t* index; /* Index to be dropped */
trx_t* trx; /* Transaction */ trx_t* trx; /* Transaction */
THD* thd; THD* thd;
ulint error = DB_SUCCESS;/* DB_SUCCESS or error code */
DBUG_ENTER("ha_innobase::final_drop_index"); DBUG_ENTER("ha_innobase::final_drop_index");
ut_ad(table); ut_ad(table);
...@@ -8599,15 +8598,14 @@ ha_innobase::final_drop_index( ...@@ -8599,15 +8598,14 @@ ha_innobase::final_drop_index(
index = dict_table_get_first_index_noninline(prebuilt->table); index = dict_table_get_first_index_noninline(prebuilt->table);
while (index && error == DB_SUCCESS) { while (index) {
dict_index_t* next_index; dict_index_t* next_index;
next_index = dict_table_get_next_index_noninline(index); next_index = dict_table_get_next_index_noninline(index);
if (index->to_be_dropped == TRUE) { if (index->to_be_dropped) {
error = row_merge_remove_index( row_merge_drop_index(index, prebuilt->table, trx);
index, prebuilt->table, trx);
} }
index = next_index; index = next_index;
...@@ -8638,9 +8636,7 @@ ha_innobase::final_drop_index( ...@@ -8638,9 +8636,7 @@ ha_innobase::final_drop_index(
trx_commit_for_mysql(trx); trx_commit_for_mysql(trx);
error = convert_error_code_to_mysql(error, thd); DBUG_RETURN(0);
DBUG_RETURN((int) error);
} }
/*********************************************************************** /***********************************************************************
......
...@@ -95,7 +95,27 @@ row_merge_sort_linked_list_in_disk( ...@@ -95,7 +95,27 @@ row_merge_sort_linked_list_in_disk(
dict_index_t* index, /* in: index to be created */ dict_index_t* index, /* in: index to be created */
os_file_t file, /* in: File handle */ os_file_t file, /* in: File handle */
int* error); /* out: 0 or error */ int* error); /* out: 0 or error */
/*************************************************************************
Drop an index from the InnoDB system tables. */
void
row_merge_drop_index(
/*=================*/
/* out: error code or DB_SUCCESS */
dict_index_t* index, /* in: index to be removed */
dict_table_t* table, /* in: table */
trx_t* trx); /* in: transaction handle */
/*************************************************************************
Drop those indexes which were created before an error occurred
when building an index. */
void
row_merge_drop_indexes(
/*===================*/
trx_t* trx, /* in: transaction */
dict_table_t* table, /* in: table containing the indexes */
dict_index_t** index, /* in: indexes to drop */
ulint num_created); /* in: number of elements in index[] */
/************************************************************************* /*************************************************************************
Initialize memory for a merge file structure */ Initialize memory for a merge file structure */
...@@ -103,16 +123,6 @@ void ...@@ -103,16 +123,6 @@ void
row_merge_file_create( row_merge_file_create(
/*==================*/ /*==================*/
merge_file_t* merge_file); /* out: merge file structure */ merge_file_t* merge_file); /* out: merge file structure */
/*************************************************************************
Remove a index from system tables */
ulint
row_merge_remove_index(
/*===================*/
/* out: error code or DB_SUCCESS */
dict_index_t* index, /* in: index to be removed */
dict_table_t* table, /* in: table */
trx_t* trx); /* in: transaction handle */
/************************************************************************* /*************************************************************************
Print definition of a table in the dictionary */ Print definition of a table in the dictionary */
......
...@@ -523,19 +523,6 @@ row_create_index_graph_for_mysql( ...@@ -523,19 +523,6 @@ row_create_index_graph_for_mysql(
trx_t* trx, /* in: trx */ trx_t* trx, /* in: trx */
dict_table_t* table, /* in: table */ dict_table_t* table, /* in: table */
dict_index_t* index); /* in: index */ dict_index_t* index); /* in: index */
/*************************************************************************
Remove those indexes which were created before a error happened in
the index build */
ulint
row_remove_indexes_for_mysql(
/*=========================*/
/* out: 0 or error code */
trx_t* trx, /* in: transaction */
dict_table_t* table, /* in: Table where index is created */
dict_index_t** index, /* in: Indexes to be created */
ulint num_created); /* in: Number of indexes created
before error and now must be removed */
/*************************************************************************** /***************************************************************************
Writes information to an undo log about dictionary operation, create_table. Writes information to an undo log about dictionary operation, create_table.
This information is used in a rollback of the transaction. */ This information is used in a rollback of the transaction. */
......
...@@ -1744,11 +1744,11 @@ row_merge_insert_index_tuples( ...@@ -1744,11 +1744,11 @@ row_merge_insert_index_tuples(
} }
/************************************************************************* /*************************************************************************
Remove a index from system tables */ Drop an index from the InnoDB system tables. */
ulint void
row_merge_remove_index( row_merge_drop_index(
/*===================*/ /*=================*/
/* out: error code or DB_SUCCESS */ /* out: error code or DB_SUCCESS */
dict_index_t* index, /* in: index to be removed */ dict_index_t* index, /* in: index to be removed */
dict_table_t* table, /* in: table */ dict_table_t* table, /* in: table */
...@@ -1804,8 +1804,25 @@ row_merge_remove_index( ...@@ -1804,8 +1804,25 @@ row_merge_remove_index(
} }
trx->op_info = ""; trx->op_info = "";
}
return(err); /*************************************************************************
Drop those indexes which were created before an error occurred
when building an index. */
void
row_merge_drop_indexes(
/*===================*/
trx_t* trx, /* in: transaction */
dict_table_t* table, /* in: table containing the indexes */
dict_index_t** index, /* in: indexes to drop */
ulint num_created) /* in: number of elements in index[] */
{
ulint key_num;
for (key_num = 0; key_num < num_created; key_num++) {
row_merge_drop_index(index[key_num], table, trx);
}
} }
/************************************************************************* /*************************************************************************
......
...@@ -4549,36 +4549,6 @@ row_build_index_for_mysql( ...@@ -4549,36 +4549,6 @@ row_build_index_for_mysql(
return(error); return(error);
} }
/*************************************************************************
Remove those indexes which were created before a error happened in
the index build */
ulint
row_remove_indexes_for_mysql(
/*=========================*/
/* out: 0 or error code */
trx_t* trx, /* in: transaction */
dict_table_t* table, /* in: Table where index is created */
dict_index_t** index, /* in: Indexes to be created */
ulint num_created) /* in: Number of indexes created
before error and now must be removed */
{
ulint key_num;
ulint error = DB_SUCCESS;
ut_ad(trx && table && index);
for (key_num = 0; key_num < num_created; key_num++) {
error = row_merge_remove_index(index[key_num], table, trx);
if (error != DB_SUCCESS) {
break;
}
}
return(error);
}
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
/************************************************************************* /*************************************************************************
......
...@@ -612,11 +612,8 @@ row_undo_dictionary( ...@@ -612,11 +612,8 @@ row_undo_dictionary(
switch (dict_undo->op_type) { switch (dict_undo->op_type) {
case TRX_UNDO_INDEX_CREATE_REC: case TRX_UNDO_INDEX_CREATE_REC:
row_merge_drop_index(dict_undo->data.index,
err = row_merge_remove_index( dict_undo->data.index->table, trx);
dict_undo->data.index, dict_undo->data.index->table,
trx);
break; break;
/* TODO: We are REDOing the DROP ? */ /* TODO: We are REDOing the DROP ? */
......
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