Commit graph

644 commits

Author SHA1 Message Date
marko
4d793ff876 branches/zip: Add changes that accidentally omitted from r1698:
innodb-index.test, innodb-index.result: Add a test for creating
a PRIMARY KEY on a column that contains a NULL value.
2007-08-10 15:53:19 +00:00
marko
e2052eba27 branches/zip: When creating a PRIMARY KEY, flag all its columns NOT NULL.
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.
2007-08-10 15:52:09 +00:00
marko
f304ce109c branches/zip: Minor cleanup.
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).
2007-08-10 15:22:47 +00:00
marko
992f5be17f branches/zip: ha_innobase::add_index(): Convert the error code before
goto err_exit.  The error handling should be rewritten.  Many of the
error messages contain parameters, but this code is only returning
the error number to MySQL.
2007-08-08 14:23:14 +00:00
marko
77e01ec982 branches/zip: innobase_check_index_keys(): return 0 instead of DB_SUCCESS,
as documented.  Do not translate the error code.

This function is still broken; we should probably use my_error() for
reporting errors.
2007-08-08 13:57:04 +00:00
marko
b532e5059c branches/zip: convert_error_code_to_mysql(): replace if-else with switch-case 2007-08-08 13:43:44 +00:00
marko
33bf9d5024 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
5de9dc5627 branches/zip: Add const qualifiers to some dict_table_t* accessor functions. 2007-08-08 09:01:46 +00:00
marko
92f615ae30 branches/zip: merge_index_field_struct: Remove the unused field col_type. 2007-08-08 08:49:33 +00:00
marko
f2538af41a 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
b67e98ad20 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
79eb6e9e09 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
da0bcd6429 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
dcd1b3cbef branches/zip: Fix errors made in r1672. 2007-08-03 07:35:05 +00:00
marko
c99c5c240a 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
60c44c3a5f 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
3fa7bde536 branches/zip: row_merge_create_temporary_table(): Correct a bogus ut_ad(). 2007-08-02 09:46:28 +00:00
marko
9ae3820ffa branches/zip: innodb-index.test: Replace numeric error codes with
symbolic ones.
2007-08-01 13:00:16 +00:00
marko
b2ae834f95 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
0a780db994 branches/zip: Merge 1575:1664 from trunk. 2007-08-01 11:18:43 +00:00
marko
d3255c0b3f 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
1b49ba2908 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
08c1fc7aa7 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
26d6ea5627 branches/zip: trx_weight_cmp(): Add const qualifiers. 2007-08-01 08:01:47 +00:00
marko
e507ea0dd4 branches/zip: btr_cur_mark_dtuple_inherited_extern(): Initialize len.
This was broken in r1591.
2007-08-01 07:53:27 +00:00
marko
cd98f71ba5 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
952b4b8de2 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
8519302258 branches/zip: Declare innobase_mysql_print_thd() in ha_prototypes.h. 2007-06-21 13:27:22 +00:00
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
fa5b997a18 branches/zip: que_thr_dec_refer_count(): Cleanup. Remove unused variable sess. 2007-06-21 11:14:13 +00:00
marko
ac7cba9796 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
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
96f554c52a 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
d522bc9bf9 branches/zip: Add .deps to svn:ignore. 2007-06-20 20:07:56 +00:00
marko
1531d7329f 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
8b40a79c64 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
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
b3b01c1cee 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
73feaa11bd 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
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
e621c1e2e7 branches/zip: Merge 1571:1575 from trunk. 2007-06-13 10:20:52 +00:00
marko
df6107de8e 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
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
dcad18b1e8 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