Commit graph

347 commits

Author SHA1 Message Date
inaam
98c1aefe7c branches/zip: The freed_page_clock for both buf_pool and block starts ticking
only after the buffer_cache has warmed up. During the initial warmup
phase these values are set to zero. We should recommend to move the
block to the start of the LRU in this case.

Also added some comments to buf0buf.c about the LRU logic.

reviewed by: Sunny
2007-08-27 19:41:56 +00:00
vasil
9584b46995 branches/zip: Add trx_get_id() and trx_get_que_state_str() functions to
retrieve trx_t's properties that will be exported in INFORMATION_SCHEMA tables.

Approved by:	Marko
2007-08-23 09:29:28 +00:00
vasil
617cbacd07 branches/zip: Use hash_table_clear() to initialize the array instead of
for()-loop.

Suggested by:	Sunny
Approved by:	Marko
2007-08-23 07:01:24 +00:00
vasil
756a8b29a9 branches/zip: Add a hash_table_clear() function to drop all elements that
have been added to it.

Approved by:	Marko
2007-08-22 09:43:45 +00:00
marko
e7d302e786 branches/zip: Remove trx->sync_cb. Call dict_rename_indexes() directly
from ha_innobase::add_index().

dict_rename_indexes(): Remove the redundant parameter commit_flag.
2007-08-21 12:36:13 +00:00
marko
7274fd95af branches/zip: Fix a memory leak in fast index creation.
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.
2007-08-21 12:10:14 +00:00
marko
dea769663d branches/zip: mem_heap_free_heap_top(): Declare the memory
freed with UNIV_MEM_FREE().  Before this change, the memory
freed by mem_heap_empty() was not completely flagged free
in UNIV_DEBUG_VALGRIND builds.  After this change, Valgrind
will hopefully catch all errors caught by UNIV_MEM_DEBUG.
2007-08-21 09:48:33 +00:00
marko
885212294d branches/zip: Preserve FOREIGN KEY constraints when creating a PRIMARY KEY.
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().
2007-08-20 11:40:00 +00:00
marko
c09dd214be branches/zip: Add const qualifiers to the upd_t* parameters of some functions. 2007-08-20 06:59:22 +00:00
marko
1e7b92f844 branches/zip: Use mem_heap_zalloc() when initializing
dict_table_t, dict_index_t, and dict_foreign_t.
2007-08-20 06:58:37 +00:00
marko
8634d343f7 branches/zip: Rename mem_heap_calloc() and mem_calloc() to
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.
2007-08-16 13:25:56 +00:00
marko
2c7f6f6a26 branches/zip: Remove redundant type casts. Change the parameter type
of ut_strcmp() from const void* to const char*.
2007-08-16 09:09:08 +00:00
marko
064e5aae3f branches/zip: dict0mem.h: Minor cleanup.
Remove the unused constant DICT_NOT_READY.
Make dict_index_t::type a bit-field, and move it next to other bit-fields.
Add a const qualifier to dict_index_t::name.
2007-08-16 08:48:29 +00:00
marko
91ee8176f6 branches/zip: Remove the error code DB_CANNOT_DROP_FOREIGN_INDEX.
It was only set by ha_innobase::prepare_drop_index(), which can return
the appropriate MySQL error code (HA_ERR_DROP_INDEX_FK) directly.

ha_innobase::add_index(): Correct the function comment.

ha_innobase::prepare_drop_index(): Correct the function comment.
Return MySQL error codes directly.

ha_innobase::final_drop_index(): Correct the function comment.
2007-08-15 15:49:58 +00:00
marko
6b7c6cb398 branches/zip: Minor cleanup.
trx_t: Change the type of error_info from void* to const dict_index_t*.

trx_get_error_info(): Add const qualifier to trx_t*.  Make this an
inline function.
2007-08-15 06:53:34 +00:00
marko
e0009cd4db branches/zip: Add some const qualifiers to dict_index_t* and dict_table_t*.
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.
2007-08-13 15:57:28 +00:00
marko
f68d3656dc branches/zip: Use mem_calloc and mem_heap_calloc when possible.
row_ext_create(): After a memset() inside UNIV_DEBUG, flag the memory
uninitialized with UNIV_MEM_ALLOC().
2007-08-13 14:07:59 +00:00
marko
d9db67696e branches/zip: row_rename_table_for_mysql(): Change the return type to ulint
and simplify error handling.
2007-08-13 12:46:13 +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
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
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
0a780db994 branches/zip: Merge 1575:1664 from trunk. 2007-08-01 11:18:43 +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
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
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
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
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
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
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
0e14cb5579 branches/zip: Document dict_rename_indexes() better. 2007-06-07 09:47:59 +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
ab2f114ad9 branches/zip: Merge 1533:1553 from trunk. 2007-06-06 11:07:37 +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
42e1de99df branches/zip: Revert r1523. Passing extra parameters to SORT_FUN and CMP_FUN
of UT_SORT_FUNCTION_BODY is best done by defining SORT_FUN and CMP_FUN as
macros when needed.  The solution of r1523 allows for only one extra parameter.
2007-05-28 07:42:28 +00:00
marko
1b83baaddf branches/zip: UT_SORT_FUNCTION_BODY(): Add the parameter CTX, which will be
needed in row0merge.c for merge sorting the small blocks in main memory.
Pass CTX also to SORT_FUN.  Adjust all users.
2007-05-24 13:14:57 +00:00
marko
d2d4b2f84d branches/zip: rec_get_offsets_reverse(): Fix the type of the parameter
node_ptr.
2007-05-22 11:55:07 +00:00