Commit graph

420 commits

Author SHA1 Message Date
marko
cb433098b4 branches/zip: trx_set_dict_operation(): Allow a transition from
TRX_DICT_OP_TABLE to TRX_DICT_OP_TABLE.
2007-10-22 08:10:13 +00:00
marko
0938db8f68 branches/zip: lock_sec_rec_read_check_and_lock(): Correct a typo in comment. 2007-10-22 07:49:54 +00:00
marko
3980b139e0 branches/zip: Introduce two new dictionary operation modes for transactions.
enum trx_dict_op: dictionary operation modes

trx_get_dict_operation(), trx_set_dict_operation(): Accessors for
trx->dict_operation.

lock_table_enqueue_waiting(), lock_rec_enqueue_waiting(): Do not complain
about lock waits if the dictionary mode is TRX_DICT_OP_INDEX_MAY_WAIT.

row_merge_lock_table(): Remove the work-around for avoiding the warning
in lock_table_enqueue_waiting().

trx_undo_mark_as_dict_operation(): Do not write trx->table_id to the
undo log unless the dict_operation is TRX_DICT_OP_TABLE.

ha_innobase::add_index(): Set the dict_operation mode initially to
TRX_DICT_OP_INDEX_MAY_WAIT, then lock the table exclusively, and set the
mode to TRX_DICT_OP_INDEX, and optionally to TRX_DICT_OP_TABLE when
creating a temporary table.
2007-10-19 10:52:25 +00:00
marko
65d4e6308e branches/zip: Remove const warnings reported by GCC 4.2.1.
page_cur_set_before_first(), page_cur_set_after_last(),
page_cur_position(): Add const qualifiers to buf_block_t and rec.
A better solution would be to define a const_page_cur_t and a
set of accessors, but it would lead to severe code duplication.

page_rec_get_n_recs_before(): Add const qualifiers.

page_dir_get_nth_slot(): Define as a const-preserving macro.

page_dir_slot_get_rec(), page_dir_slot_get_n_owned(),
page_dir_find_owner_slot(), page_check_dir(): Add const qualifiers.

page_rec_get_next_low(): Add const qualifiers.

page_rec_get_next_const(), page_rec_get_prev_const(): New functions,
based on the const-less page_rec_get_next() and page_rec_get_prev().

page_cur_get_page(), page_cur_get_block(), page_cur_get_page_zip(),
page_cur_get_rec(): Define as const-preserving macros.

page_cur_try_search_shortcut(), page_cur_search_with_match():
Add const qualifiers.

buf_page_get_mutex(): Add a const qualifier to buf_page_t*.

rec_get_next_ptr_const(): Const variant of rec_get_next_ptr().
2007-10-18 07:12:05 +00:00
vasil
e0352dd317 branches/zip:
Fix typo in comment.
2007-10-17 12:30:22 +00:00
marko
e7267909d7 branches/zip: Initialize dfield_t::ext as soon as possible. This should
fix the bugs introduced in r1591.

row_rec_to_index_entry_low(): Clear "n_ext".  Do not allow it to be NULL.
Add const qualifier to dict_index_t*.

row_rec_to_index_entry(): Add the parameters "offsets" and "n_ext".

btr_cur_optimistic_update(): Add an assertion that there are no externally
stored columns.  Remove the unreachable call to btr_cur_unmark_extern_fields()
and the preceding unnecessary call to rec_get_offsets().

btr_push_update_extern_fields(): Remove the parameters index, offsets.
Only report the additional externally stored columns of the update vector.

row_build(), trx_undo_rec_get_partial_row(): Flag externally stored columns
also with dfield_set_ext().

rec_copy_prefix_to_dtuple(): Assert that there are no externally stored
columns in the prefix.

row_build_row_ref(): Note and assert that the index is a secondary index,
and assert that there are no externally stored columns.

row_build_row_ref_fast(): Assert that there are no externally stored columns.

rec_offs_get_n_alloc(): Expose the function.

row_build_row_ref_in_tuple(): Assert that there are no externally stored
columns in a record of a secondary index.

row_build_row_ref_from_row(): Assert that there are no externally stored
columns.

row_upd_check_references_constraints(): Add the parameter offsets, to
avoid a redundant call to rec_get_offsets().

row_upd_del_mark_clust_rec(): Add the parameter offsets.  Remove
duplicated code.

row_ins_index_entry_set_vals(): Copy the external storage flag.

sel_pop_prefetched_row(): Assert that there are no externally stored
columns.

row_scan_and_check_index(): Copy offsets to a temporary heap across
the invocation of row_rec_to_index_entry().
2007-10-17 12:13:29 +00:00
marko
c6f5ea288a branches/zip: btr_push_update_extern_fields(): Add parameter "index"
and use it for flagging externally stored columns in the data tuple.
The data tuple contains the same columns as the clustered index record,
but in a different order.  This error was introduced in r1591.

TODO: the assertion ut_ad(!dfield_is_ext()) may fail in
btr_cur_pessimistic_update().
2007-10-16 07:25:58 +00:00
marko
2561797bb9 branches/zip: On compressed pages, always update the insert buffer bitmap.
Do not assume anything about the contents of the bitmap.

ibuf_update_free_bits_low(): Use this function only for uncompressed pages.
Remove the parameter zip_size.  This function avoids latching the bitmap page
and updating the bitmap when the bits do not change.

ibuf_update_free_bits_zip(): New function based on ibuf_update_free_bits_low(),
for use on compressed pages.  Remove the parameter max_insert_size that
was used for computing the before image of the free bits.  Always update the
bitmap.

ibuf_index_page_calc_free_zip(): New function, factored out from
ibuf_index_page_calc_free().

ibuf_update_free_bits_if_full(): Document that this function must only be
invoked on uncompressed pages.  Add a debug assertion about this.
2007-10-12 13:25:12 +00:00
vasil
5ccc74c515 branches/zip:
Add the proper macros for checking the correct latching order in trx
information_schema code.

Approved by:	Marko
2007-10-12 11:20:13 +00:00
marko
23b5958255 branches/zip: page_zip_max_ins_size(): Correct the comment of the return value. 2007-10-12 11:16:20 +00:00
marko
20951b8e4f branches/zip: ibuf_index_page_calc_free(): Add const qualifiers. 2007-10-12 10:45:41 +00:00
vasil
6da6eb23e3 branches/zip:
Fix off-by-one error in ut_raw_to_hex().
2007-10-12 10:20:01 +00:00
marko
dd9dc4e91f branches/zip: ut_raw_to_hex(): Fix a compiler warning that was introduced
in r1960.
2007-10-12 08:37:27 +00:00
vasil
9d1a3ad901 branches/zip:
Non-functional change: fix compiler warning:

buf0buf.ic:637: warning: assignment discards qualifiers from pointer target type
2007-10-11 11:54:51 +00:00
vasil
c9106d39e5 branches/zip:
Add ut_raw_to_hex() function to convert a raw binary strings to hex.
This is a monstrous, fine-tuned implementation.

Approved by:	Marko
2007-10-10 16:35:05 +00:00
vasil
bfc48819c5 branches/zip:
Add diagnostic function ha_storage_get_size() to retrieve the amount of
memory used by a ha_storage_t object.

Approved by:	Marko
2007-10-08 10:46:26 +00:00
marko
2b93ccc9c1 branches/zip: page_mem_alloc_free(): Fix the debug assertion that was
accidentally broken in r1939.  It failed when next_rec == NULL.
2007-10-05 11:33:19 +00:00
marko
f3d0ad8160 branches/zip: Use static linkage for row_ins(). 2007-10-05 06:23:37 +00:00
marko
3d647001fb branches/zip: Silence some more GCC 4.2.1 warnings. 2007-10-03 12:36:59 +00:00
marko
94755e4f27 branches/zip: page_rec_get_next_low(): Fix a bug that was made in r952. 2007-10-03 12:27:06 +00:00
marko
2ddbc912e7 branches/zip: Silence most GCC 4.2.1 warnings about const pointers.
For some reason, GCC 4.2.1 ignores casts (for removing constness)
in calls to inline functions.

page_align(), ut_align_down(): Make the parameter const void*, but still
return a non-const pointer.  This is ugly, but these functions cannot be
replaced with a const-preserving macro in a portable way, given that
the pointer argument is not always pointing to bytes.

buf_block_get_page_zip(): Implement as a const-preserving macro.

buf_frame_get_page_zip(), buf_block_align(): Add const qualifiers.

lock_rec_get_prev(): Silence GCC 4.2.1 warnings.

mlog_write_initial_log_record(), mlog_write_initial_log_record_fast(),
mtr_memo_contains(): Add const qualifier to the pointer.

page_header_get_ptr(): Rewrite as page_header_get_offs(), and
implement as a macro that calls this function.
2007-10-03 12:22:29 +00:00
marko
e9507ea69b branches/zip: Merge 1918:1937 from trunk. 2007-10-03 08:44:50 +00:00
marko
0c8ffae623 branches/zip: dict_index_copy_rec_order_prefix(): Add const qualifiers. 2007-10-01 08:00:24 +00:00
marko
6759a929ad branches/zip: Optimize buf_page_try_get_func().
buf_block_hash_get(): New function, similar to buf_page_hash_get().

buf_page_get_block(): Remove the const qualifiers.  This is a low-level
function, and the operations on block->mutex are non-const.

buf_page_try_get_func(): Implement with lower-level predicates, somewhat
similar to buf_page_get_known_nowait().

lock_rec_print(): Remove the unused variable zip_size and the
call to fil_space_get_zip_size().  Adapt to buf_page_try_get() returning
a const pointer.
2007-10-01 07:32:45 +00:00
marko
aafdd9ab80 branches/zip: Introduce the function buf_block_fix_dec(), similar to
buf_block_fix_inc(), and use it.
2007-10-01 07:25:02 +00:00
vasil
331af5c563 branches/zip:
Remove bogus comment from ha_storage_empty().
2007-09-28 14:07:02 +00:00
vasil
8dba58e45b branches/zip:
Add const qualifier to the value returned by ha_storage_put().
It must not be changed as this will invalidate the hash.
2007-09-28 13:40:12 +00:00
marko
ec6a38ad89 branches/zip: Add the function buf_page_get_block(), for converting
from buf_page_t* to buf_block_t*.

buf_page_can_relocate(): Replace the incorrect __attribute__((const))
with __attribute__((pure)).
2007-09-28 12:04:04 +00:00
marko
3877f6910f branches/zip: Define the macro rec_offs_init() and use it for initializing
offsets_[] arrays, as suggested by Vasil.

rec_offs_set_n_alloc(): Declare as a public function.  Assert that
n_alloc > REC_OFFS_HEADER_SIZE.

rec_offs_get_n_alloc(): Assert that n_alloc > REC_OFFS_HEADER_SIZE.
2007-09-28 07:05:57 +00:00
marko
9e86928b7e branches/zip: Define buf_block_get_frame() as a const-preserving macro. 2007-09-28 06:26:21 +00:00
marko
5f51afe264 branches/zip: Merge 1894:1918 from trunk. 2007-09-28 06:16:20 +00:00
vasil
098c5b4dbc branches/zip:
Fix a warning produced when UNIV_DEBUG is defined.
2007-09-27 15:15:51 +00:00
vasil
f38752862a branches/zip:
Move part of the code from lock_rec_print() in a separate function
buf_page_try_get() because the same functionality is needed in
INFORMATION SCHEMA code.

Approved by:	Heikki
2007-09-27 14:35:18 +00:00
vasil
89423c0455 branches/zip:
Add auxiliary function lock_rec_get_index() to retrieve the index on
which the lock is.

Approved by:	Heikki
2007-09-27 13:54:21 +00:00
vasil
54df816bb9 branches/zip:
Fix a bug where the condition (prtype & DATA_ROW_ID) is unexpectedly
always false becasue DATA_ROW_ID is 0.

Use a switch instead of if-else in order to avoid repeating
(prtype & DATA_SYS_PRTYPE_MASK).

Approved by:	Heikki
2007-09-27 13:52:47 +00:00
marko
14b2f454cf branches/zip: Correctly convert InnoDB records to MySQL table->record[0].
innobase_col_to_mysql(): New function, adapted from
row_sel_field_store_in_mysql_format().

innobase_rec_to_mysql(): Correct the function comment, which was still
saying "clustered index record", although we can convert any record.
Make use of innobase_col_to_mysql().  Always call field->reset(),
so that innobase_col_to_mysql() will not have to pad anything.
2007-09-27 11:03:36 +00:00
marko
55f4395272 branches/zip: row_mysql_store_blob_ref(): Change the type of the parameter
"data" from byte* to const void*.
2007-09-27 10:59:54 +00:00
marko
79ec158732 branches/zip: innobase_rec_to_mysql(): Allow "index" to be any index,
clustered or secondary.  Remove the rec_offs_validate() assertion, because
the function may be passed a mrec_t* that would fail the check.
2007-09-27 08:19:38 +00:00
marko
2646e38c58 branches/zip: Clean up some non-inlined functions.
dtuple_create_for_mysql(), dtuple_free_for_mysql(): Remove.

ha_innobase::records_in_range(): Use mem_heap_create(), mem_heap_free(),
and dtuple_create() instead of the removed functions above.  Since r1587,
InnoDB C++ functions can invoke inlined C functions.
2007-09-26 12:07:07 +00:00
marko
34ab0c0523 branches/zip: Implement the reporting of duplicate key values to MySQL.
innobase_rec_to_mysql(): New function, for converting an InnoDB clustered
index record to MySQL table->record[0].  TODO: convert integer fields.
Currently, integer fields are in big-endian byte order instead of
host byte order, and signed integer fields are offset by 0x80000000.

innobase_rec_reset(): New function, for resetting table->record[0].

row_merge_build_indexes(): Add the parameter TABLE* table (the MySQL table
handle) for reporting duplicate key values.

dtuple_from_fields(): New function, to convert an array of dfield_t* to
dtuple_t.

dtuple_get_n_ext(): New function, to compute the number of externally stored
fields.

row_merge_dup_t: Structure for counting and reporting duplicate records.

row_merge_dup_report(): Function for counting and reporting duplicate records.

row_merge_tuple_cmp(), row_merge_tuple_sort(): Replace the ulint* n_dup
parameter with row_merge_dup_t* dup.

row_merge_buf_sort(): Add the parameter row_merge_dup_t* dup, which is
NULL when sorting a non-unique index.

row_merge_buf_write(), row_merge_heap_create(), row_merge_read_rec(),
row_merge_cmp(), row_merge_read_clustered_index(), row_merge_blocks(),
row_merge(), row_merge_sort(): Add const qualifiers.

row_merge_read_clustered_index(): Use a common error handling branch err_exit.
Invoke row_merge_buf_sort() differently on unique indexes.

row_merge_blocks(): note TODO: We could invoke innobase_rec_to_mysql()
to report duplicate key values when creating a clustered index.
2007-09-26 11:56:26 +00:00
marko
f44bec1917 branches/zip: Minor cleanup.
dict_find_index_by_max_id(): Rename this static function to its
only caller, dict_table_get_index_by_max_id().

dict_table_get_index_by_max_id(): Copy the function comment from
dict_find_index_by_max_id().
2007-09-26 09:59:17 +00:00
marko
3ad7bd739d branches/zip: Add some const qualifiers to input parameters.
rec_get_converted_size_comp(), rec_convert_dtuple_to_rec_comp(),
rec_convert_dtuple_to_rec_new(), rec_convert_dtuple_to_rec(): Add a
const qualifier to dict_index_t*.

row_search_on_row_ref(): Add const qualifiers to the dict_table_t*
and dtuple_t* parameters.  Note that pcur is an "out" parameter
and mtr is "in/out".
2007-09-26 09:12:23 +00:00
marko
366087058f branches/zip: Minor cleanup.
row_build_row_ref_fast(): Note that "ref" is an in/out parameter.

row_build_row_ref_from_row(): Add const qualifiers to all "in" parameters.
2007-09-26 07:45:08 +00:00
marko
9b1d1fff14 branches/zip: Minor cleanup.
dtuple_create(): Simplify a pointer expression.  Flag the fields uninitialized
after initializing them in the debug version.

dtuple_t: Only declare magic_n if UNIV_DEBUG is defined.  The field is
not assigned to nor tested unless UNIV_DEBUG is defined.
2007-09-26 06:37:17 +00:00
marko
051545ad66 branches/zip: row_build_row_ref_in_tuple(): Add the parameter "offsets",
to avoid a rec_get_offsets() call.  Add some const qualifiers.

row_sel_get_clust_rec_for_mysql(): Note that "offsets" will also be
an input parameter.
2007-09-25 07:20:56 +00:00
marko
1595953ae9 branches/zip: Add some const qualifiers or in/out comments to the
dict_index_t* and dict_table_t* parameters of some functions.
2007-09-24 13:29:18 +00:00
vasil
92ff5c4790 branches/zip:
Add a type that stores chunks of data in its own storage and avoids
duplicates. Supported methods:

ha_storage_create()
Allocates new storage object.

ha_storage_put()
Copies a given data chunk into the storage and returns pointer to the
copy. If the data chunk is already present, a pointer to the existing
object is returned and the given data chunk is not copied.

ha_storage_empty()
Clears (empties) the storage from all data chunks that are stored in it.

ha_storage_free()
Destroys a storage object. Opposite to ha_storage_create().

Approved by:	Marko
2007-09-24 12:21:29 +00:00
marko
ba051c35e7 branches/zip: Add const qualifiers to the dict_index_t* parameters of
rec_get_n_fields(), rec_offs_validate(), and rec_offs_make_valid().
2007-09-24 11:58:07 +00:00
marko
4bf90e5355 branches/zip: Reduce internal memory fragmentation.
mem_alloc2(): New macro.  This is a variant of mem_alloc() that
returns the allocated size, which is equal to or greater than
the requested size.

mem_alloc_func(): Add the output parameter *size for the allocated size.
When it is set, adjust the parameter passed to mem_heap_alloc().

rec_copy_prefix_to_buf_old(), rec_copy_prefix_to_buf(): Use mem_alloc2()
instead of mem_alloc().
2007-09-21 12:45:46 +00:00
marko
53b14f2f5d branches/zip: When creating a memory heap, set the block size to what
was actually obtained from the buddy allocator.  This should avoid some
internal memory fragmentation in mem_heap_create() and mem_heap_alloc().

mem_area_alloc(): Change the in parameter size to an in/out parameter.
Adjust the size based on what was obtained from pool->free_list[].

mem_heap_create_block(): Adjust block->len to what was obtained from
mem_area_alloc().
2007-09-21 10:22:58 +00:00