Commit graph

688 commits

Author SHA1 Message Date
marko
a4bc32b857 branches/zip: Resolve an error number collision in db0err.h.
The code for DB_CANNOT_DROP_FOREIGN_INDEX should have been
renumbered in r1494 (Merge revisions 1402:1493 from trunk).
2007-08-08 13:13:01 +00:00
marko
16c72f9fb5 branches/zip: Add const qualifiers to some dict_table_t* accessor functions. 2007-08-08 09:01:46 +00:00
marko
e011cc2f57 branches/zip: merge_index_field_struct: Remove the unused field col_type. 2007-08-08 08:49:33 +00:00
marko
3e7e12c595 branches/zip: Fix memory management errors in row_merge_buf_t.
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.
2007-08-03 11:49:51 +00:00
marko
c157205e38 branches/zip: ha_innobase::add_index(): When creating a clustered index,
do not release and relock the data dictionary during initial preparations.
2007-08-03 11:42:37 +00:00
marko
a691de4bb2 branches/zip: row_undo_dictionary(): For TRX_UNDO_INDEX_CREATE_REC,
the index may be NULL when unfinished transactions are rolled back
after crash recovery.
2007-08-03 10:53:08 +00:00
marko
a5a74334aa branches/zip: trx_sys_init_at_db_start(): Initialize trx_dummy_sess
before calling trx_lists_init_at_db_start().  This was broken in r1594.
2007-08-03 10:17:50 +00:00
marko
1dbd4148e6 branches/zip: Fix errors made in r1672. 2007-08-03 07:35:05 +00:00
marko
a3566c2c2d branches/zip: Add const qualifiers to the functions that read MySQL data.
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.
2007-08-03 07:09:29 +00:00
marko
11665dc32a branches/zip: Ensure that the dictionary updates are atomic by keeping
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.
2007-08-02 10:55:25 +00:00
marko
fd6f7e4dea branches/zip: row_merge_create_temporary_table(): Correct a bogus ut_ad(). 2007-08-02 09:46:28 +00:00
marko
39c5ae17ce branches/zip: innodb-index.test: Replace numeric error codes with
symbolic ones.
2007-08-01 13:00:16 +00:00
marko
cd73e0c602 branches/zip: Declare schema_table_store_record(), because MySQL strangely
does not declare it unless MYSQL_SERVER is defined.
2007-08-01 11:49:19 +00:00
marko
d662c3c656 branches/zip: Merge 1575:1664 from trunk. 2007-08-01 11:18:43 +00:00
marko
9a09ec002f branches/zip: innodb.test: Use ER_DROP_INDEX_FK instead of a numeric
error code.  Apparently, the numeric error codes in MySQL 5.1 are changing.
2007-08-01 11:01:27 +00:00
marko
0106316096 branches/zip: Add explicit type casts to *.ic, because C++ does not allow
implicit type conversion from void*.  Inlining is enabled in ha_innodb.cc
since r1587.
2007-08-01 10:38:07 +00:00
marko
54113d6d9f branches/zip: HASH_SEARCH(): Add the parameter TYPE, for the type of DATA.
C++ requires explicit type casts when converting from void*, and *.ic files
are now inlined in ha_innodb.cc.

fil_space_get_by_id(), fil_space_get_by_name(): New inline functions, to
replace occurrences of the HASH_SEARCH() macro in fil0fil.c.  This should
improve readability.
2007-08-01 08:13:22 +00:00
marko
681d9e9f00 branches/zip: trx_weight_cmp(): Add const qualifiers. 2007-08-01 08:01:47 +00:00
marko
fbdd5b437c branches/zip: btr_cur_mark_dtuple_inherited_extern(): Initialize len.
This was broken in r1591.
2007-08-01 07:53:27 +00:00
marko
5817db3381 branches/zip: row_merge_read_clustered_index(): Remove a bogus warning
about "row" being possibly uninitialized.
2007-08-01 07:52:05 +00:00
marko
7827b838e6 branches/zip: lock_rec_print(), lock_table_print(), lock_rec_get_prev():
Add a const qualifier to lock_t*.
2007-08-01 07:49:43 +00:00
marko
f1b9240b67 branches/zip: Declare innobase_mysql_print_thd() in ha_prototypes.h. 2007-06-21 13:27:22 +00:00
marko
4f496e6410 branches/zip: row_prebuilt_free(), row_drop_tables_for_mysql_in_background():
Fix some printouts.
2007-06-21 13:25:03 +00:00
marko
7f46c9bb44 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
12caeb9870 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
9d1898a03a branches/zip: que_thr_dec_refer_count(): Cleanup. Remove unused variable sess. 2007-06-21 11:14:13 +00:00
marko
5afcf2e864 branches/zip: trx_commit_for_mysql(): Call trx_start_if_not_started() earlier.
Return DB_SUCCESS.  Do not release and reacquire kernel_mutex.
2007-06-21 10:42:20 +00:00
marko
5288876e23 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
d7dbb4608c branches/zip: btr_rec_copy_externally_stored_field(): Add const qualifier
to rec_t*.  Remove the ut_ad(rec_offs_validate()), because this function
will be called from row0merge.c on a record that lacks the
REC_N_NEW_EXTRA_BYTES.
2007-06-21 08:58:41 +00:00
marko
889449d203 branches/zip: Add .deps to svn:ignore. 2007-06-20 20:07:56 +00:00
marko
9b2a9caf47 branches/zip: Restore the transaction commit that was removed in r1583.
ha_innobase::add_index(): Do commit the transaction, because the error
handler (label err1) in mysql_alter_table() won't commit it as of now.
This was detected in a failure of type_bit_innodb.
2007-06-20 13:58:16 +00:00
marko
f29addba49 branches/zip: Enable calls to inlined InnoDB functions in ha_innodb.cc,
now that all of InnoDB code is built from a single Makefile and it should
not be possible to build the modules with mutually incompatible options.

#define INSIDE_HA_INNOBASE_CC: Remove.

srv_sizeof_trx_t_in_ha_innodb_cc: Remove.

dict_table_get_low_noninlined(): Remove.  This function was unused.

Remove all _noninline functions.  Remove the _noninline suffix from
all function calls in ha_innodb.cc.
2007-06-20 08:26:26 +00:00
marko
d62b28beeb 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
71e8cceeab 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
7235ea1060 branches/zip: ha_innobase::add_index(): Split some assertions.
Remove the variable parent_trx.

Call innobase_register_stmt() in order to work around a MySQL bug
in mysql_alter_table(), which, as of

ChangeSet@1.2482.61.2, 2007-06-07 16:37:15+02:00, joerg@trift2. +8 -0

commits the transaction before calling ha_innobase::add_index().
Without re-registering the statement, the ha_commit_stmt(thd)
in mysql_alter_table() would not invoke innobase_commit.
2007-06-18 11:46:42 +00:00
marko
513f7ceb3c branches/zip: ha_innobase::add_index(): Do not commit the transaction.
It should be committed by MySQL after all.  The error in mysql_alter_table()
will be worked around in r1584.
2007-06-18 11:01:30 +00:00
marko
a5ddf51aa2 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
62ad3dbd71 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
258fb5d4c1 branches/zip: Merge 1571:1575 from trunk. 2007-06-13 10:20:52 +00:00
marko
251a921e76 branches/zip: trx_commit_for_mysql(): Replace ut_a(err)
with ut_a(err == DB_SUCCESS).
2007-06-13 10:19:23 +00:00
marko
f839b3f390 branches/zip: Merge 1556:1571 from trunk. 2007-06-12 10:59:01 +00:00
marko
4ed9adb502 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
5ab4cfd4ad 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
1cfcd4f2cf branches/zip: Create special single-table tablespace file names for
temporary tablespaces in fast index creation.  The tablespaces must
reside in the same directory as the persistent tablespaces, so that
they can be renamed without copying.  Namespace collisions are avoided
by replacing the ".ibd" file name suffix with ".ib1" or ".ib2".

fil_make_ibd_name(): Treat names starting with TEMP_TABLE_PREFIX
specially.  Document the dependence on
innobase_create_temporary_tablename().
2007-06-11 08:26:33 +00:00
marko
0954bbedb8 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
ffe5998e4a 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
fd91f7bb76 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
2d90ae68e7 branches/zip: Merge 1553:1556 from trunk. 2007-06-08 07:05:17 +00:00
marko
d1bdef34ac branches/zip: innodb-index.test: Check the length of the long columns. 2007-06-07 19:57:34 +00:00
marko
07d004c46e branches/zip: Reduce memory allocation and pointer indirection
in fast index creation.

innobase_create_index_def(), innobase_copy_index_def(): Copy to pre-allocated
space.

innobase_create_key_def(): Change the return type from merge_index_def_t**
to merge_index_def_t*.
2007-06-07 18:29:57 +00:00