Commit graph

123 commits

Author SHA1 Message Date
marko
02e0334ed6 branches/zip: row_prebuilt_free(), row_drop_tables_for_mysql_in_background():
Fix some printouts.
2007-06-21 13:25:03 +00:00
marko
f2744d505b branches/zip: row_upd_sec_index_entry(): Pass foreign=TRUE to
row_ins_index_entry().  The added parameter (whether to check
foreign key constraints) was incorrectly passed as FALSE in r1591.
2007-06-21 12:22:04 +00:00
marko
e9351c6fbb branches/zip: Initialize trx_dummy_sess only once. Require trx->sess to
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.
2007-06-21 12:02:29 +00:00
marko
632ec54002 branches/zip: Make merge sort handle externally stored columns.
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().
2007-06-21 09:43:15 +00:00
marko
7e687905be branches/zip: Add some const qualifiers, mainly to upd_t*.
upd_get_n_fields(), upd_get_nth_field(): Add const qualifiers.
2007-06-19 12:44:45 +00:00
marko
f24fa9e6b0 branches/zip: Define mem_heap_calloc() and mem_calloc(). Use them
when allocating zero-filled memory.
2007-06-19 09:39:27 +00:00
marko
b864484fb2 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".
2007-06-13 13:40:29 +00:00
marko
d398e71764 branches/zip: Fix a few bugs in fast index creation. No more crashes
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.
2007-06-13 11:01:26 +00:00
marko
a8a3521b09 branches/zip: Merge 1556:1571 from trunk. 2007-06-12 10:59:01 +00:00
marko
ae0ae671da branches/zip: Correctly print the names of temporary tables and indexes
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().
2007-06-12 07:06:36 +00:00
marko
99efc2aeff branches/zip: Initialize some uninitialized variables in order to avoid
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.
2007-06-11 14:39:04 +00:00
marko
326353e12b branches/zip: Fix bugs in merge sort.
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.
2007-06-08 20:30:26 +00:00
marko
9187cd3d25 branches/zip: row_merge_build_indexes(): Allocate all buffers with a
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.
2007-06-08 09:49:50 +00:00
marko
1a8a63d0cd branches/zip: Reimplement merge sort in fast index creation.
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.
2007-06-08 07:37:07 +00:00
marko
b7d65c8c7f branches/zip: row_merge_read_clustered_index(): Correctly skip the page
infimum and supremum.  This was broken in r1515.
2007-06-07 08:14:42 +00:00
marko
02df7dd7d8 branches/zip: Clean up fast index creation API.
row_merge_create_temporary_table(), row_merge_create_index():
Return the dictionary object.  On error, set trx->error_state.
2007-06-06 20:25:35 +00:00
marko
b2c09f8a34 branches/zip: Minor cleanup.
row_merge_mark_prebuilt_obsolete(): Rename to row_prebuilt_table_obsolete()
and move from row0merge.c to row0mysql.c.  Remove the parameter trx.

row_merge_print_table(): Remove.
2007-06-04 07:51:10 +00:00
marko
eddd2aed6a 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.
2007-06-04 07:49:31 +00:00
marko
8a294fa351 branches/zip: Merge 1493:1533 from trunk.
Make use of UT_BITS_IN_BYTES().
2007-05-29 08:48:16 +00:00
marko
88eee48c1e branches/zip: Rename dtuple_datas_are_ordering_equal() to dtuple_coll_cmp(),
and change the return type from ibool to int (-1, 0, 1).  This comparison
function will be needed in fast index creation.
2007-05-22 09:34:25 +00:00
marko
ad0a869520 branches/zip: Correct the terminology: s/cluster index/clustered index/.
row_merge_read_clustered_index(): Simplify the loop that scans the
clustered index.
2007-05-22 06:48:53 +00:00
marko
b94379988f branches/zip: row_merge_block_merge(): Add an assertion against buffer
overflow.
2007-05-18 11:37:05 +00:00
marko
3f3a0c5334 branches/zip: Use ut_dulint_zero and ut_dulint_is_zero whenever possible. 2007-05-18 11:01:58 +00:00
marko
e70106837f branches/zip: Fix some minor things in row0uins.c after comparing to trunk.
Replace row0merge.h with row0mysql.h.

Remove redundant test trx->dict_operation_lock_mode == 0.
Fix typos in comments.

row_undo_ins(): Make the function more similar to the one in trunk.
2007-05-18 10:53:29 +00:00
marko
382cb9fdf1 branches/zip: Document and obey the rules for modifying the free bits in
the insert buffer bitmap.

ibuf_set_free_bits_func(): Never disable redo logging.

ibuf_update_free_bits_zip(): Remove.

btr_page_reorganize_low(), page_zip_reorganize(): Do not update the insert
buffer bitmap.  Instead, document that callers will have to take care of it,
and adapt the callers.

btr_compress(): On error, reset the insert buffer free bits.

btr_cur_insert_if_possible(): Do not modify the insert buffer bitmap.

btr_compress(), btr_cur_optimistic_insert(): On compressed pages,
reset the insert buffer bitmap.  Document why.

btr_cur_update_alloc_zip(): Document why it is necessary and sufficient
to reset the insert buffer free bits.

btr_cur_update_in_place(), btr_cur_optimistic_update(),
btr_cur_pessimistic_update(): Update the free bits in the same
mini-transaction.  Document that the mini-transaction must be
committed before latching any further pages.  Verify that this
is the case in all execution paths.

row_ins_sec_index_entry_by_modify(), row_ins_clust_index_entry_by_modify(),
row_undo_mod_clust_low(): Because these functions call
btr_cur_update_in_place(), btr_cur_optimistic_update(), or
btr_cur_pessimistic_update(), document that the mini-transaction must be
committed before latching any further pages.  Verify that this is the case
in all execution paths.
2007-05-16 09:23:53 +00:00
marko
88df83bb3b branches/zip: Merge revisions 1402:1493 from trunk.
Remove mysql.patch, because the configuration parameter interface has changed.
2007-05-14 09:07:15 +00:00
marko
eb80aa3b5a branches/zip: Correct the comment of row_merge_cmp(). 2007-05-03 07:42:54 +00:00
marko
dedf135216 branches/zip: row_merge_sort_linked_list(): Add a default: ut_error; branch
to the switch (row_merge_cmp(...)) to eliminate bogus warning about
uninitialized variable tmp.
2007-04-30 07:02:28 +00:00
marko
5ab279cb87 branches/zip: Apply a fix from Sunny. The function row_merge_block_merge()
was broken in one of the earlier cleanups.

row_merge_block_merge(): Remove the variable "selected".  Clear the record
count of new_block1 and new_block2.  Anticipate the right return values
from row_merge_cmp().
2007-04-30 06:25:47 +00:00
marko
6688b86338 branches/zip: Reintroduce the local variables "sorted" that were removed
in r1445.  They are needed after all, but apparently the tests do not
actually verify that the records are sorted.  (Also, a buffer overflow
will occur in index_merge_innodb.test if MERGE_BLOCK_SIZE is made smaller.)
2007-04-17 09:44:29 +00:00
marko
366f0aa2b5 branches/zip: Clean up fast index creation.
Correct the language of some comments.  Eliminate the local variables
"num_of_merges" (renamed to "sorted" in one function).
2007-04-17 08:53:47 +00:00
marko
a294481681 branches/zip: Make use of the function dict_index_is_unique(). 2007-04-16 09:21:39 +00:00
marko
39dc9f718a branches/zip: Clean up fast index creation.
dict_index_is_unique(): New function.

row_merge_rec_fits_to_block(), row_merge_store_rec_to_block():
Add const qualifiers to rec, offsets.

row_merge_select(): Rename to row_merge_cmp(), simplify the interface.

row_merge_sort_linked_list(): Change the return type to ibool.
Replace sec_offs1,sec_offs2 with offsets1,offsets2.  Replace offset_heap
with heap.  Define a func_exit label.

row_merge_block_merge(): Reduce the scope of rec_offsets.
2007-04-16 09:13:44 +00:00
marko
573a7a4729 branches/zip: Clean up fast index creation.
merge_rec_list_t: Define n_records only #ifdef UNIV_DEBUG.
2007-04-16 07:11:00 +00:00
marko
01a6c8c4cb branches/zip: Clean up fast index creation.
row_merge_dict_table_get_index(): Add function comment.
Use inlined versions of mem_alloc() and mem_free().
2007-04-16 07:10:00 +00:00
marko
f69417c2fe branches/zip: fast index creation: Check the status of os_file_read()
and os_file_write(), and return DB_CORRUPTION when they fail.  Minor cleanup.

row_mege_insert_index_tuples(): Use a shared heap for dtuple and rec.
Use fewer gotos.

row_merge_sort_linked_list_in_disk(): Free the merge blocks at error exit.
2007-04-13 12:11:43 +00:00
marko
588f498375 branches/zip: Clean up fast index creation.
row_merge_read(), row_merge_write(): Add UNIV_LIKELY hints.

row_merge_sort_linked_list_in_disk(): Reduce the scope of many variables.
Eliminate the variable "selected".
2007-04-12 12:58:09 +00:00
marko
7dd753edd8 branches/zip: Minor cleanup of merge_file_t and merge_block_header_t.
Replace byte offsets of type dulint with block offsets of type ulint.
Avoid references to MERGE_BLOCK_SIZE.

Improve the language of some comments.

row_merge_insert_index_tuples(), row_merge_sort_linked_list_in_disk():
Make the offset a ulint.

row_merge_read(), row_merge_write(): Helper functions.  Return the
status of os_file_read() and os_file_write().  TO DO: check the status
in the callers.
2007-04-12 10:32:16 +00:00
marko
5378db6e10 branches/zip: More cleanup of fast index creation.
innobase_create_temporary_tablename(): Add static qualifier.  Allocate
the memory from heap.  Return a fixed identifier.

ha_innobase::add_index(): Allocate all memory from a single heap.
Simplify error handling.  Use a fixed prefix for temporary table names,
because only one add_index() can be active for a given table.

mem_heap_empty_noninline(): New function, to be called from ha_innodb.cc.

row_build_index_for_mysql(): Remove the parameter new_primary.
2007-04-12 05:14:41 +00:00
marko
0e31dbaca0 branches/zip: Clean up fast index creation.
row_merge_remove_index(), row_merge_rename_index(): Remove risky sprintf()
calls.  Make use of named literals and que_eval_sql().
2007-04-11 12:42:54 +00:00
marko
e2a6db409f branches/zip: Some more cleanup of fast index creation.
Move more definitions from row0mysql.h to row0mysql.c.  Remove the
unused definition of merge_thread.

merge_index_def_t: Replace merge_index_field_t** with merge_index_field_t*.
Use mem_heap_strdup() when copying strings.

ha_innobase::add_index(): Avoid excessive use of current_thd.
2007-04-11 12:17:55 +00:00
marko
f2bcb9cab9 branches/zip: row_merge_sort_linked_list_in_disk(): Remove some unnecessary
assignments.  A memory leak remains at "goto error_handling": the memory
allocated with row_merge_block_create() in the beginning of this function
will not be freed.
2007-04-11 09:42:50 +00:00
marko
d33e525a08 branches/zip: Initial clean up of the merge sort subsystem.
Define the merge_rec_ structures in row0merge.c instead of
row0merge.h.  They are not used in the interface defined in row0merge.h.

row_merge_create_file_structure(): Rename to row_merge_file_create().
Input a pointer to a pre-allocated block of memory.

row_merge_read_clustered_index(): Replace merge_file_t** with merge_file_t*.

row_merge_sort_and_insert_thread(): Remove the declaration.
This function was never defined or called.

row_merge_is_index_usable(): Correct the formatting.

row_build_index_for_mysql(): Allocate an array of merge_file_t instead
of an array of pointers to merge_file_t.
2007-04-11 08:16:14 +00:00
marko
1ac0e7f098 branches/zip: Fix the merge of branches/fast-index-creation -r1413 in r1414.
innodb.test: The error code 1540 has been renumbered to 1542.
innodb.result: Adjust the expected value of Innodb_buffer_pool_pages_total.
Something may have changed in the BLOB handling in branches/zip.

ha_innodb.cc: Add ha_innobase:: prefix to some DBUG_ENTER macros.

row_merge_create_temporary_table(): Free the heap only after invoking
row_create_table_for_mysql().  The table->col_names points to the heap
until the system columns are added by row_create_table_for_mysql().

TODO: use the filename-safe encoding in temporary table names.  Test
extensively under Valgrind and fix all errors found.  Eliminate
merge_rec_t and rewrite row0merge.c to write the records directly to
the merge blocks.
2007-04-04 14:26:06 +00:00
marko
fc65b08f53 branches/zip: Merge branches/fast-index-creation -r1413.
Fix some bugs.  The tests innodb and innodb-index fail, but that might
be due to an old MySQL source tree being used.
2007-04-04 11:05:33 +00:00
marko
4d6805f2a8 branches/zip: Merge revisions 1322:1402 from trunk. 2007-04-02 05:39:41 +00:00
marko
d753d3e83c branches/zip: Make TRUNCATE TABLE recreate single-table tablespaces.
dict_truncate_index_tree(): Add the parameter space for specifying the
new tablespace identifier of a single-table tablespace that has been
recreated.  When SYS_INDEXES.PAGE_NO == FIL_NULL, do not abort but
create the index tree.

fil_discard_tablespace(): Pass the return code from fil_delete_tablespace().

row_truncate_table_for_mysql(): Attempt to discard and recreate
single-table tablespaces.  Reassign the tablespace identifier both in
the data dictionary (SYS_TABLES and SYS_INDEXES) and in the data
dictionary cache.
2007-03-29 08:51:13 +00:00
marko
a369b00981 branches/zip: btr_cur_pessimistic_update(): Add parameter heap.
Previously, when big_rec was returned, the fields would point to
freed memory.  The memory heap was allocated locally, and the data tuple
was allocated from the heap, and the big_rec would point to some fields
in the data tuple.

row_ins_clust_index_entry_by_modify(): Add parameter heap,
for the same reason.
2007-03-28 19:35:52 +00:00
marko
5fc003b65d branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. 2007-01-18 18:29:12 +00:00
marko
8f65d7a661 branches/zip: Merge revisions 1165:1206 from trunk. 2007-01-18 12:58:39 +00:00