Drizzled Public API Documentation

row0merge.h File Reference
#include "univ.i"
#include "data0data.h"
#include "dict0types.h"
#include "trx0types.h"
#include "que0types.h"
#include "mtr0mtr.h"
#include "rem0types.h"
#include "rem0rec.h"
#include "read0types.h"
#include "btr0types.h"
#include "row0mysql.h"
#include "lock0types.h"

Go to the source code of this file.

Classes

struct  merge_index_field_struct
 
struct  merge_index_def_struct
 

Typedefs

typedef struct
merge_index_field_struct 
merge_index_field_t
 
typedef struct
merge_index_def_struct 
merge_index_def_t
 

Functions

UNIV_INTERN ulint row_merge_lock_table (trx_t *trx, dict_table_t *table, enum lock_mode mode)
 
UNIV_INTERN void row_merge_drop_index (dict_index_t *index, dict_table_t *table, trx_t *trx)
 
UNIV_INTERN void row_merge_drop_indexes (trx_t *trx, dict_table_t *table, dict_index_t **index, ulint num_created)
 
UNIV_INTERN void row_merge_drop_temp_indexes (void)
 
UNIV_INTERN ulint row_merge_rename_tables (dict_table_t *old_table, dict_table_t *new_table, const char *tmp_name, trx_t *trx)
 
UNIV_INTERN dict_table_trow_merge_create_temporary_table (const char *table_name, const merge_index_def_t *index_def, const dict_table_t *table, trx_t *trx)
 
UNIV_INTERN ulint row_merge_rename_indexes (trx_t *trx, dict_table_t *table)
 
UNIV_INTERN dict_index_trow_merge_create_index (trx_t *trx, dict_table_t *table, const merge_index_def_t *index_def)
 
UNIV_INTERN ibool row_merge_is_index_usable (const trx_t *trx, const dict_index_t *index)
 
UNIV_INTERN ulint row_merge_drop_table (trx_t *trx, dict_table_t *table)
 
UNIV_INTERN ulint row_merge_build_indexes (trx_t *trx, dict_table_t *old_table, dict_table_t *new_table, dict_index_t **indexes, ulint n_indexes, TABLE *table)
 

Detailed Description

Index build routines using a merge sort

Created 13/06/2005 Jan Lindstrom

Definition in file row0merge.h.

Typedef Documentation

Definition of an index being created

Definition at line 64 of file row0merge.h.

Index field definition

Definition at line 51 of file row0merge.h.

Function Documentation

UNIV_INTERN ulint row_merge_build_indexes ( trx_t trx,
dict_table_t old_table,
dict_table_t new_table,
dict_index_t **  indexes,
ulint  n_indexes,
TABLE *  table 
)

Build indexes on a table by reading a clustered index, creating a temporary file containing index entries, merge sorting these index entries and inserting sorted index entries to indexes.

Returns
DB_SUCCESS or error code in/out: MySQL table, for reporting erroneous key value if applicable

Build indexes on a table by reading a clustered index, creating a temporary file containing index entries, merge sorting these index entries and inserting sorted index entries to indexes.

Returns
DB_SUCCESS or error code
Parameters
trxin: transaction
old_tablein: table where rows are read from
new_tablein: table where indexes are created; identical to old_table unless creating a PRIMARY KEY
indexesin: indexes to be created
n_indexesin: size of indexes[]
tablein/out: MySQL table, for reporting erroneous key value if applicable

Definition at line 2632 of file row0merge.cc.

References dict_table_zip_size(), trx_struct::error_key_num, innobase_rec_reset(), mem_free, os_mem_alloc_large(), os_mem_free_large(), trx_start_if_not_started(), and ut_ad.

UNIV_INTERN dict_index_t* row_merge_create_index ( trx_t trx,
dict_table_t table,
const merge_index_def_t index_def 
)

Create the index and load in to the dictionary.

Returns
index, or NULL on error in: the index definition

Create the index and load in to the dictionary.

Returns
index, or NULL on error
Parameters
trxin/out: trx (sets error_state)
tablein: the index is on this table
index_defin: the index definition

Definition at line 2547 of file row0merge.cc.

References dict_mem_index_add_field(), dict_mem_index_create(), merge_index_field_struct::field_name, merge_index_def_struct::fields, trx_struct::id, merge_index_def_struct::ind_type, merge_index_def_struct::n_fields, merge_index_def_struct::name, dict_table_struct::name, merge_index_field_struct::prefix_len, dict_index_struct::trx_id, and ut_a.

UNIV_INTERN dict_table_t* row_merge_create_temporary_table ( const char *  table_name,
const merge_index_def_t index_def,
const dict_table_t table,
trx_t trx 
)

Create a temporary table for creating a primary key, using the definition of an existing table.

Returns
table, or NULL on error in/out: transaction (sets error_state)

Create a temporary table for creating a primary key, using the definition of an existing table.

Returns
table, or NULL on error
Parameters
table_namein: new table name
index_defin: the index definition of the primary key
tablein: old table definition
trxin/out: transaction (sets error_state)

Definition at line 2311 of file row0merge.cc.

References dict_mem_table_add_col(), dict_mem_table_create(), dict_sys, dict_table_get_col_name(), dict_table_get_n_user_cols(), trx_struct::error_state, dict_table_struct::flags, dict_col_struct::len, mem_heap_create, mem_heap_free, dict_col_struct::mtype, dict_sys_struct::mutex, row_create_table_for_mysql(), and ut_ad.

UNIV_INTERN void row_merge_drop_index ( dict_index_t index,
dict_table_t table,
trx_t trx 
)

Drop an index from the InnoDB system tables. The data dictionary must have been locked exclusively by the caller, because the transaction will not be committed. in: transaction handle

Drop an index from the InnoDB system tables. The data dictionary must have been locked exclusively by the caller, because the transaction will not be committed.

Parameters
indexin: index to be removed
tablein: table
trxin: transaction handle

Definition at line 2034 of file row0merge.cc.

References dict_index_remove_from_cache(), trx_struct::dict_operation_lock_mode, dict_table_replace_index_in_foreign_list(), dict_index_struct::id, trx_struct::op_info, pars_info_add_ull_literal(), pars_info_create(), que_eval_sql(), TEMP_INDEX_PREFIX_STR, trx_start_if_not_started(), ut_a, and ut_ad.

Referenced by row_merge_drop_indexes(), and row_merge_drop_temp_indexes().

UNIV_INTERN void row_merge_drop_indexes ( trx_t trx,
dict_table_t table,
dict_index_t **  index,
ulint  num_created 
)

Drop those indexes which were created before an error occurred when building an index. The data dictionary must have been locked exclusively by the caller, because the transaction will not be committed. in: number of elements in index[]

Drop those indexes which were created before an error occurred when building an index. The data dictionary must have been locked exclusively by the caller, because the transaction will not be committed.

Parameters
trxin: transaction
tablein: table containing the indexes
indexin: indexes to drop
num_createdin: number of elements in index[]

Definition at line 2092 of file row0merge.cc.

References row_merge_drop_index().

UNIV_INTERN ulint row_merge_drop_table ( trx_t trx,
dict_table_t table 
)

If there are views that refer to the old table name then we "attach" to the new instance of the table else we drop it immediately.

Returns
DB_SUCCESS or error code in: table instance to drop

Drop the old table.

Returns
DB_SUCCESS or error code
Parameters
trxin: transaction
tablein: table to drop

Definition at line 2614 of file row0merge.cc.

References dict_table_struct::n_mysql_handles_opened, dict_table_struct::name, row_drop_table_for_mysql(), and ut_a.

UNIV_INTERN ibool row_merge_is_index_usable ( const trx_t trx,
const dict_index_t index 
)

Check if a transaction can use an index.

Returns
TRUE if index can be used by the transaction else FALSE in: index to check

Check if a transaction can use an index.

Parameters
trxin: transaction
indexin: index to check

Definition at line 2600 of file row0merge.cc.

References trx_struct::read_view, read_view_sees_trx_id(), and dict_index_struct::trx_id.

Referenced by ha_innobase::change_active_index(), ha_innobase::check(), and ha_innobase::records_in_range().

UNIV_INTERN ulint row_merge_lock_table ( trx_t trx,
dict_table_t table,
enum lock_mode  mode 
)

Sets an exclusive lock on a table, for the duration of creating indexes.

Returns
error code or DB_SUCCESS in: LOCK_X or LOCK_S

Sets an exclusive lock on a table, for the duration of creating indexes.

Returns
error code or DB_SUCCESS
Parameters
trxin/out: transaction
tablein: table to lock
modein: LOCK_X or LOCK_S

Definition at line 1954 of file row0merge.cc.

References que_thr_struct::common, trx_struct::error_state, que_thr_struct::graph, lock_table(), mem_heap_create, trx_struct::op_info, os_thread_get_curr_id(), que_common_struct::parent, pars_complete_graph_for_exec(), que_thr_struct::prev_node, que_fork_get_first_thr(), que_fork_start_command(), que_graph_free(), que_node_get_parent(), que_thr_move_to_run_state_for_mysql(), que_thr_stop_for_mysql(), que_thr_stop_for_mysql_no_error(), row_mysql_handle_errors(), que_thr_struct::run_node, sel_node_create(), que_fork_struct::state, ut_a, and ut_ad.

UNIV_INTERN ulint row_merge_rename_indexes ( trx_t trx,
dict_table_t table 
)

Rename the temporary indexes in the dictionary to permanent ones. The data dictionary must have been locked exclusively by the caller, because the transaction will not be committed.

Returns
DB_SUCCESS if all OK in/out: table with new indexes

Rename the temporary indexes in the dictionary to permanent ones. The data dictionary must have been locked exclusively by the caller, because the transaction will not be committed.

Returns
DB_SUCCESS if all OK
Parameters
trxin/out: transaction
tablein/out: table with new indexes

Definition at line 2364 of file row0merge.cc.

References trx_struct::dict_operation_lock_mode, dict_table_struct::id, dict_index_struct::name, trx_struct::op_info, pars_info_add_ull_literal(), pars_info_create(), que_eval_sql(), TEMP_INDEX_PREFIX, TEMP_INDEX_PREFIX_STR, ut_a, and ut_ad.

UNIV_INTERN ulint row_merge_rename_tables ( dict_table_t old_table,
dict_table_t new_table,
const char *  tmp_name,
trx_t trx 
)

Rename the tables in the data dictionary. The data dictionary must have been locked exclusively by the caller, because the transaction will not be committed.

Returns
error code or DB_SUCCESS in: transaction handle

Rename the tables in the data dictionary. The data dictionary must have been locked exclusively by the caller, because the transaction will not be committed.

Returns
error code or DB_SUCCESS
Parameters
old_tablein/out: old table, renamed to tmp_name
new_tablein/out: new table, renamed to old_table->name
tmp_namein: new name for old_table
trxin: transaction handle

Definition at line 2415 of file row0merge.cc.

References dict_load_foreigns(), trx_struct::dict_operation_lock_mode, dict_sys, dict_table_rename_in_cache(), trx_struct::error_state, dict_sys_struct::mutex, dict_table_struct::name, trx_struct::op_info, os_thread_get_curr_id(), pars_info_add_str_literal(), pars_info_create(), que_eval_sql(), trx_general_rollback_for_mysql(), ut_a, ut_ad, ut_error, and ut_print_timestamp().