row_add_table_to_background_drop_list(): Replace the dict_table_t*
parameter with const char* (the table name).
row_check_table_for_mysql(): Replace prebuilt->table with table.
trx_t: Remove dict_undo_list and dict_redo_list.
innobase_create_temporary_tablename(): Replace TEMP_TABLE_PREFIX with
a table name suffix "#1" or "#2". In this way, the user can restore
precious data, should anything go wrong. It is possible to reach an
inconsistent state, because the creation, deletion and renaming of
single-table tablespaces are not transactional.
ut_print_namel(), fil_make_ibd_name(), innobase_rename_table(): Remove
the special treatment of TEMP_TABLE_PREFIX.
Introduce TEMP_INDEX_PREFIX == 0xff for temporary indexes. This byte
cannot occur in index names since MySQL 4.1. However, it might have
been possible to use this byte in MySQL 4.0.
recv_recovery_from_checkpoint_finish(): Call the new function
row_merge_drop_temp_indexes(), to drop all indexes whose name starts
with the byte 0xff.
row_merge_rename_indexes(): Renamed from row_merge_rename_index().
Remove the parameter "index".
row_drop_table_for_mysql(): Unconditionally call trx_commit_for_mysql().
row_drop_table_for_mysql_no_commit(): Correct the function commit,
based on the corrected comment of row_drop_table_for_mysql(). Rely on
table->to_be_dropped instead of TEMP_TABLE_PREFIX.
ha_innobase::add_index(): Simplify the control flow.
row_drop_table_for_mysql() call with a call to
row_drop_table_for_mysql_no_commit(). The last parameter of
the function is ibool drop_db, not ibool do_commit. Also,
since r1790 of trunk it is not necessary to copy table->name.
#ifdef ROW_MERGE_IS_INDEX_USABLE, to avoid growing the memory
footprint until MySQL implements and calls the virtual method
handler::is_index_available() or something equivalent.
in fast index creation. The prefix was previously TEMP_TABLE_PREFIX == '/',
which may occur in index names.
ut_print_namel(): Do not assume that all '/' are separators between
database and table names.
created in fast index creation.
dict_load_indexes(): Always complain if the first index is not clustered.
lock_table_enqueue_waiting(): Always complain about lock waits in
a dictionary operation.
row_merge_rename_tables(): Add an assertion that dict_sys->mutex is
being held.
row_undo_mod_del_unmark_sec_and_undo_update(): Make the test about
temporary indexes more readable.
row_create_table_for_mysql(): Do not retry creating a temporary table
in fast index creation. Orphaned temporary tables will have to be dropped
in crash recovery.
row_upd_index_is_referenced(), row_upd_check_references_constraints(),
row_purge_parse_undo_rec(): Remove duplicated code that calls
row_mysql_unfreeze_data_dictionary().
row_undo_ins_remove_clust_rec():
Assert that the data dictionary is X-latched. Do not attempt to re-latch
the data dictionary, because doing so introduces race conditions. This
re-latching was probably made unnecessary already in r1676, which keeps
the data dictionary X-latched in ha_innobase::add_index() for the complete
duration of the data dictionary operations.
row_undo_ins_parse_undo_rec(): Do not attempt to acquire the data dictionary
latch. The data dictionary should be already X-latched when a transaction
that modifies system tables is rolled back. This also holds in the rollback
during crash recovery: trx_rollback_active() will X-latch the data dictionary
when needed.
ha_innobase::add_index(): Add assertions about !trx->sync_cb and
!trx->dict_redo_list. Remove a bogus comment. Replace
row_lock_table_for_merge() with row_merge_lock_table().
row_merge_lock_table(): Renamed from row_lock_table_for_merge()
and moved from row0mysql.c to row0merge.c. Always lock the table in
the mode LOCK_X. Call que_graph_free() in order not to leak memory.
innodb-index.test: Add some test cases for FOREIGN KEY constraints.
row_merge_rename_tables(): New function,
adapted from row_rename_table_for_mysql().
ha_innobase::add_index(): Use row_merge_rename_tables().
mem_heap_zalloc() and mem_zalloc(), because calloc() in the C runtime
library takes two size parameters, not one.
mem_heap_zalloc(): Add debug assertions. Document that the return value
is never NULL.
row_merge_buf_add(): Add a prefetch instruction to row->fields.
Eliminate a variable from the copying loop, and move the termination
condition to the end of the loop.
row_merge_build_indexes(): Remove the second call to
trx_start_if_not_started().
(merging branches/fast-index-creation):
row_truncate_table_for_mysql(), row_drop_table_for_mysql_no_commit():
Let ut_print_name() output to ef instead of stderr.
innobase_create_key_def(), row_table_got_default_clust_index(),
row_get_mysql_key_number_for_index(): Add a const qualifier.
dict_table_get_first_index(), dict_table_get_next_index(): Define
as a const-preserving macro. Preserve the old function for UNIV_DEBUG,
but add a const qualifier to the parameter and cast away the constness.
row_merge_create_temporary_table(): Add the parameter index_defs.
DB_PRIMARY_KEY_IS_NULL: New error code, mapped to ER_PRIMARY_CANT_HAVE_NULL.
row_merge_read_clustered_index(): Replace the parameter "table" with the
two parameters "old_table" and "new_table". Detect NULL values of columns
that are supposed to be NOT NULL.
row_merge_col_prtype(): New auxiliary function, used by
row_merge_create_temporary_table() to flag NOT NULL any columns
contained in an added PRIMARY KEY.
innobase_copy_index_field_def(): Remove parameter heap. The field->name
will not be deallocated before the copied index has been added to the
data dictionary cache.
innobase_copy_index_def(): Add const qualifier to dict_index_t*.
Add an assertion !dict_index_is_clust(index).
ha_innobase::add_index(): Add the missing user_thd parameter to the
convert_error_code_to_mysql() call that was forgotten from r1686.
merge_index_field_struct: Add const qualifier to field_name.
merge_index_def_struct: Add const qualifier to name.
row_merge_build_indexes(): Improve the function comment.
row_merge_drop_table(): Remove bogus assertion ut_a(table->to_be_dropped).
row_merge_buf_create_low(): Swap the parameters max_tuples and buf_size,
because the callers had them swapped. Add debug assertions about
these parameters.
row_merge_buf_empty(): Return the emptied buffer. In some cases, the
buffer may be relocated.
row_mysql_read_true_varchar(), row_mysql_read_blob_ref(),
row_mysql_store_col_in_innobase_format(),
row_sel_convert_mysql_key_to_innobase(): Add const qualifiers.
row_sel_convert_mysql_key_to_innobase(): Document that the first parameter
is in/out.
the data dictionary locked across the operations.
dict_table_decrement_handle_count(), row_prebuilt_free(): Add the flag
dict_locked, to prevent the acquisition of dict_sys->mutex.
innobase_rename_table(): Rename commit_flag to lock_and_commit,
and do not acquire dict_sys->mutex or flush the log unless the flag is set.
Remove bogus comment about utility threads, because the threads will
be waken up by the upper-level function ha_innobase::rename_table().
ha_innobase::add_index(): After creating a primary key, hold dict_sys->mutex
across all dictionary operations.
be set always.
trx_rollback_active(): Split from trx_rollback_or_clean_all_without_sess().
row_undo_dictionary(): Do not return a value. Assert that all operations
succeed.
row_merge_drop_index(): Remove bogus comment about void return value.
trx_dummy_sess: Move the declaration from trx0roll.h to trx0trx.h,
because the variable is defined in trx0trx.c.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.
dfield_t: Add an "external storage" flag, dfield->ext.
dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.
dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.
data_write_sql_null(): Use memset().
big_rec_field_t: Replace byte* data with const void* data.
ut_ulint_sort(): Remove.
upd_field_t: Remove extern_storage.
upd_node_t: Replace ext_vec, n_ext_vec with n_ext.
row_merge_copy_blobs(): New function.
row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.
btr_page_insert_fits(): Add const qualifiers.
btr_cur_add_ext(), upd_ext_vec_contains(): Remove.
dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
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".
occur in mysql-test-run, but mysql-test-run reports some warnings for
some tests and incorrect results for innodb-index.test.
innobase_start_trx_and_assign_read_view(): Use thd instead of current_thd.
ha_innobase::add_index(): Use ha_thd() instead of current_thd.
Commit the transaction at the end.
row_merge_rename_index(): Really change the name of the index. This was
broken in r1430.
during fast index creation.
TEMP_TABLE_PREFIX: Move the definition from dict0dict.h to ut0ut.h.
ut_print_namel(): Check if the name starts with TEMP_TABLE_PREFIX.
innobase_rename_table(): Print all names with ut_print_name().
row_prebuilt_free(): Replace assert() with ut_a().
comparing uninitialized values.
dict_mem_table_create(): Initialize table->version_number.
ins_node_create(): Initialize node->table_version_number.
row_create_prebuilt(): Initialize all fields. Initialize most fields
by memset(), so that any fields that are added will be initialized
automatically.
row_merge_buf_add(): Correctly calculate buf->total_size.
row_merge_buf_write(): Add an assertion about buf->total_size.
row_merge_heap_create(), row_merge_read_rec(), row_merge_insert_index_tuples():
offsets needs to be 1 + REC_OFFS_HEADER_SIZE + n_fields. Previously, we
allocated one element too little.
row_merge_blocks(): Use goto instead of break in the AT_END argument
of ROW_MERGE_WRITE_GET_NEXT.
single os_mem_alloc_large() call. The function mem_alloc() that was
used previously allocates unaligned memory.
row_merge_blocks(): Replace block1, block2, block3 with a single array.
Replace buf1, buf2, buf3 with buf[3]. Replace b1..b3 with b0..b2.
Replace mrec1,2 with mrec0,1. Replace offsets1,2 with offsets0,1.
row_merge(), row_merge_sort(): Replace block1, block2, block3 with a
single array.
The creation of the primary key does not work. We will have to flag
externally stored columns and copy the externally stored part from
the old table.
row_build_index_for_mysql(): Rename to row_merge_build_indexes().
Move from row0mysql.c to row0merge.c.
Remove private declarations from row0merge.h. Make many functions static
in row0merge.c.
cmp_rec_rec_simple(): A new comparison function.
dict_index_get_min_size(): New function.
OS_FILE_FROM_FD(fd): A macro for converting from int to os_file_t.
rec_convert_dtuple_to_rec_comp(): Make the interface lower-level.
rec_get_converted_size_comp(): Return also extra_size.
UT_SORT_FUNCTION_BODY(): Remove reference to an obsolete test program.
row_rec_to_index_entry_low(): New function.
row0merge.c: Implement merge sort based on file streams instead of
fixed-size blocks. Sort the small blocks as arrays of dfield_t*,
because it is faster than invoking rec_get_offsets() for every
comparison.