Commit graph

156 commits

Author SHA1 Message Date
marko
42dcad50b8 branches/zip: Remove all references to buf_block_align() except those
from the adaptive hash index [btr_search_guess_on_hash() and
btr_search_validate()].  Some references to buf_block_align() remain
in debug builds.

btr_store_big_rec_extern_fields(): Add the parameter rec_block.

page_rec_get_next_low(): Do not assume that the page has been
allocated from the buffer pool when printing the diagnostic information.

page_cur_insert_rec_low(): Replace the parameter page_zip_des_t* page_zip
with the parameter buf_block_t* block.
2006-10-24 14:06:31 +00:00
marko
9b0a89867e branches/zip: Remove all buf_block_align() calls from lock0lock.c.
Replace all page_t* parameters with buf_block_t*, and replace many
rec_t* parameters with heap_no.  This eliminates also many
rec_get_heap_no() calls, which became more expensive with the
introduction of ROW_FORMAT=COMPACT in MySQL/InnoDB 5.0.3.

page_rec_get_heap_no(), lock_get_min_heap_no(): New functions.
2006-10-24 06:45:52 +00:00
marko
7e8c129370 branches/zip: buf_page_get_release_on_io(), buf_page_get_gen():
Replace buf_frame_t* guess with buf_block_t* guess in order to avoid
a buf_block_align() call.

trx_undo_t: Replace page_t* guess_page with buf_block_t* guess_block.

btr_search_t: Replace page_t* root_guess with buf_block_t* root_guess.
2006-10-23 19:34:45 +00:00
marko
866f51741d branches/zip: Minor cleanup.
buf_calc_page_new_checksum(), buf_calc_page_old_checksum(),
buf_page_is_corrupted(), buf_page_print():
Add const qualifier to byte* parameter.

page_parse_create_zip(): Remove this declaration of non-existing function.

page_rec_check(), page_rec_print(), row_vers_impl_x_locked_off_kernel():
Add const qualifier to rec_t* parameter.

row_vers_old_has_index_entry(): Add const qualifier to dtuple_t* parameter.

row_sel_sec_rec_is_for_blob(): Add const qualifiers.

Replace some occurrences of mtr_memo_contains_page() with mtr_memo_contains().
2006-10-23 19:14:36 +00:00
marko
009533b471 branches/zip: Minor cleanup.
page_set_max_trx_id(): Replace page_t* parameter with buf_block_t*,
to avoid a buf_block_align() call.

Replace some occurrences of page_get_page_no() with buf_block_get_page_no().

page_cur_delete_rec(): Replace buf_block_align() with page_cur_get_block().
2006-10-23 18:26:10 +00:00
marko
5f877224a4 branches/zip: Add const qualifiers to some read-only byte* and rec_t*
parameters of some functions.
2006-10-20 13:50:40 +00:00
marko
8562e752bc branches/zip: Remove some more buf_block_align() calls.
btr_cur_t: Move page_block to page_cur_t::block.

page_cur_get_block(), page_cur_get_page_zip(): New functions.

page_cur_position(): Add parameter block.

Remove many page_zip parameters, now that there is page_cur_get_page_zip().
Replace some page, page_zip parameters with block.

Add some const qualifiers to function parameters and remove casts.

PAGE_HEAP_NO_INFIMUM, PAGE_HEAP_NO_SUPREMUM, PAGE_HEAP_NO_USER_LOW:
New constants.

Replace some cursor code in low-level diagnostic functions with
direct management of rec, because buf_block_t::buf_fix_count may be 0
when the functions are called, and debug assertions would fail.
2006-10-20 12:45:53 +00:00
marko
98a829723c branches/zip: Add const qualifiers to function parameters, mostly dtuple_t. 2006-10-20 08:30:07 +00:00
marko
91f8a3dde5 branches/zip: Remove many fil_space_get_zip_size() calls.
ibuf_page(), ibuf_page_low(), ibuf_free_excess_pages(), ibuf_insert(),
buf_read_page(), buf_read_ahead_linear(), buf_read_recv_pages():
Add parameter zip_size.
2006-10-19 11:07:50 +00:00
marko
a3860f7126 branches/zip: Remove some more buf_block_align() calls.
btr_search_build_page_hash_index(), fsp_parse_init_file_page(),
ibuf_parse_bitmap_init(): Replace page_t* with buf_block_t*.

buf_read_ibuf_merge_pages(): Add const qualifiers.  Retrieve zip_size.

ibuf_merge_or_delete_for_page(): Replace page_t* with buf_block_t*.
Add parameter zip_size.
2006-10-19 08:27:34 +00:00
marko
223cb22210 branches/zip: Remove some more casts.
dict_index_get_nth_col_pos(), dict_index_get_sys_col_pos(),
dict_index_get_n_fields(), fil_page_get_type():
Add const qualifier to parameter.

dict_index_get_nth_field(): Implement as a macro unless #ifdef UNIV_DEBUG.
2006-10-19 07:52:28 +00:00
marko
e8a779e73e branches/zip: Remove the casts introduced in r920 and r925. Replace the
accessors returning pointers with macros that preserve const qualifiers.
In UNIV_DEBUG builds, retain the accessors and cast away constness there.

dfield_get_type(), dfield_get_data(), dtuple_get_nth_field(),
dict_table_get_nth_col(), dict_table_get_sys_col(): Implement as macro
unless #ifdef UNIV_DEBUG.

rec_get_nth_field(): Replace with rec_get_nth_field_offs() that does not
do pointer arithmetics.  Implement rec_get_nth_field() as a macro.
2006-10-19 07:27:26 +00:00
marko
f52a757e24 branches/zip: ha_create(): Remove parameter in_btr_search, which was
passed as TRUE.

Enclose hash_table_t::adaptive and buf_block_t::n_pointers in
#ifdef UNIV_DEBUG.

btr_search_drop_page_hash_index(): Enclose the corruption check
(which depends on buf_block_t::n_pointers) in #ifdef UNIV_DEBUG.
2006-10-18 18:52:04 +00:00
marko
ab0456cb5e branches/zip: btr_cur_t: replace left_page with left_block, to avoid
calling buf_block_align() in btr_pcur_move_backward_from_page().
Also, enclose some assertions about page_is_comp() in #ifdef UNIV_BTR_DEBUG.
2006-10-18 17:43:04 +00:00
marko
c659b59a5d branches/zip: Eliminate many buf_block_align() calls.
Replace page_t* or page_zip_des_t* parameters in some functions with
buf_block_t*.

buf_frame_get_page_zip(): Disable unless #ifdef UNIV_DEBUG || UNIV_ZIP_DEBUG.

btr_cur_t: Add buf_block_t* page_block.

btr_pcur_get_block(), btr_cur_get_block(), btr_cur_get_page_zip():
New functions.

btr_cur_position(): Add the parameter block.
2006-10-18 11:39:31 +00:00
marko
6bf52fdaca branches/zip: Introduce const qualifiers to many read-only parameters
and modify some functions to return const pointers.  Add const qualifiers
to local variable declarations or casts to remove the const qualifier
in those places where write access is needed.
2006-10-17 12:24:13 +00:00
marko
a54a2bead6 branches/zip: Add const qualifiers to read-only rec_t* parameters
of rec accessor functions.
2006-10-16 11:42:46 +00:00
marko
b7867623ae branches/zip: buf_ptr_get_fsp_addr(): Change parameter ptr to const void*,
and remove the buf_block_align() call.
2006-10-13 13:03:06 +00:00
marko
70e765aeb3 branches/zip: Remove some more buf_block_align() calls.
Replace buf_frame_modify_clock_inc() with buf_block_modify_clock_inc().
Replace buf_frame_get_lock_hash_val() with buf_block_get_lock_hash_val().
Replace buf_frame_get_lock_mutex() with buf_block_get_lock_mutex().

page_create_zip(), page_create(), page_create_low(), btr_page_free(),
btr_page_free_low(): Replace page_t with buf_block_t.
2006-10-13 11:55:27 +00:00
marko
0fa8df757f branches/zip: Eliminate some more buf_block_align() calls.
ibuf_update_free_bits_low(), ibuf_update_free_bits_for_two_pages_low(),
ibuf_set_free_bits_low(): Replace page_t with buf_block_t.
2006-10-13 09:15:17 +00:00
marko
138ee61049 branches/zip: Remove more references to buf_block_align().
ibuf_reset_free_bits(): Remove, as there already is a similar function
ibuf_reset_free_bits_with_type().

ibuf_reset_free_bits_with_type(), ibuf_set_free_bits(),
ibuf_update_free_bits_if_full(), btr_leaf_page_release(),
buf_page_make_young(): Replace page_t with buf_block_t.

btr_compress(): Replace btr_page_get() with btr_block_get().
2006-10-13 07:45:52 +00:00
marko
6064200df2 branches/zip: Eliminate some more buf_block_align() calls.
mlog_write_initial_log_record_fast(): Remove the buf_block_align() call
unless #ifdef UNIV_DEBUG.

btr_cur_update_in_place(): Replace buf_frame_get_page_zip() with
buf_block_get_page_zip().

btr_page_create(), btr_page_empty(): Replace the parameter page with block.

btr_attach_half_pages(): Use btr_block_get() instead of btr_page_get().
Remove buf_block_align() calls.

btr_cur_latch_leaves(): Remove duplicated code.  Use btr_block_get()
instead of btr_page_get().  Remove buf_block_align() calls.
2006-10-12 18:39:43 +00:00
marko
a208526186 branches/zip: Replace buf_frame_alloc() and buf_frame_free()
with buf_block_alloc() and buf_block_free(), in order to
avoid buf_block_align() calls.
2006-10-12 12:38:29 +00:00
marko
c755e88727 branches/zip: Reduce the number of buf_block_align() calls.
btr_block_get(): New function to return buf_block_t.

btr_page_alloc(), buf_page_get_release_on_io(), buf_page_get_gen(),
buf_page_create(), fseg_create(), fseg_create_general(): Return buf_block_t.

buf_page_get_known_nowait(): Expect buf_block_t instead of buf_frame_t.

buf_frame_get_newest_modification(): Replace with
buf_block_get_newest_modification().

buf_page_dbg_add_level(): Replace with buf_block_dbg_add_level().

buf_block_get_zip_size(): New function.

buf_block_get_page_zip(): Reintroduce.

recv_recover_page(): Replace page, space, page_no with block.

ibuf_bitmap_page_init(): Replace page, zip_size with block.

ibuf_parse_bitmap_init(): Remove the parameter zip_size.

btr_search_drop_page_hash_index(): Replace page with block.
2006-10-12 11:05:22 +00:00
marko
d61d296ccd branches/zip: Replace buf_frame_get_page_no() and buf_frame_get_space_id()
with page_get_page_no() and page_get_space_id().  We want to avoid
buf_block_align() calls, and the page_no and space_id are now stamped
on the pages early on.
2006-10-12 07:02:36 +00:00
marko
606bd38428 branches/zip: Stamp (space_id, page_no) on buffer pool pages early on.
buf_flush_init_for_writing(): Remove parameters space, page_no.

fsp_init_file_page_low(): Wriet space_id and page_no to the page.

fil_create_new_single_table_tablespace(): Write space_id to the page.
2006-10-10 12:26:37 +00:00
marko
d699fde33a row_ext_create(): Allocate enough space for the structure.
This error was introduced in r867.
2006-10-10 10:21:04 +00:00
marko
5a10ee2721 branches/zip: Add function mtr_memo_contains_page() #ifdef UNIV_DEBUG.
Replace ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr), ...))
with ut_ad(mtr_memo_contains_page(mtr, ptr, ...)) in order to reduce the
number of buf_block_align() calls.
2006-10-09 19:36:58 +00:00
marko
3fffefd3d6 branches/zip: Replace buf_frame_align() with page_align(), page_offset(),
ut_align_down(), or ut_align_offset().
2006-10-09 16:22:47 +00:00
marko
11cd834bb1 branches/zip: buf_block_get_page_zip(): Replace with buf_frame_get_page_zip(). 2006-10-09 15:37:19 +00:00
marko
152fbb78a2 branches/zip: Remove compilation errors with -DUNIV_HOTBACKUP.
dict_load_foreigns(): Enclose in #ifndef UNIV_HOTBACKUP.

fil_extend_tablespaces_to_stored_len(): Pass zip_size to fil_read().

buf_page_init_for_backup_restore(): Add parameter zip_size.
Enclose the declaration in buf0buf.h in #ifdef UNIV_HOTBACKUP.

recv_apply_log_recs_for_backup(): Replace the local variable "page"
with the local variable "block".  Add local variable zip_size.
2006-10-06 11:23:19 +00:00
marko
346431193e branches/zip: Merge revisions 861:869 from trunk. 2006-09-29 12:12:47 +00:00
marko
285f1e1d0a branches/zip: Remove the unused function ut_clock(). 2006-09-29 10:43:42 +00:00
marko
77ebaf6f33 branches/zip: dtuple_convert_big_rec(): Do not store anything locally
of externally stored columns, and fix bugs introduced in r873.  (Bug #22496)

btr_page_get_sure_split_rec(), btr_page_insert_fits(),
rec_get_converted_size(), rec_convert_dtuple_to_rec(),
rec_convert_dtuple_to_rec_old(), rec_convert_dtuple_to_rec_new():
Add parameters ext and n_ext.  Flag external fields during the
conversion.

rec_set_field_extern_bits(), rec_set_field_extern_bits_new(),
rec_offs_set_nth_extern(), rec_set_nth_field_extern_bit_old():
Remove.  The bits are set by rec_convert_dtuple_to_rec().

page_cur_insert_rec_low(): Remove the parameters ext and n_ext.

btr_cur_add_ext(): New utility function for updating and sorting ext[].
Low-level functions now expect the array to be in ascending order
for performance reasons.  Used in btr_cur_optimistic_insert(),
btr_cur_pessimistic_insert(), and btr_cur_pessimistic_update().

btr_cur_optimistic_insert(): Remove some defensive code, because we cannot
compute the added parameters of rec_get_converted_size().

btr_push_update_extern_fields(): Sort the array.  Require the array to
be twice the maximum usage, so that ut_ulint_sort() can be used.

dtuple_convert_big_rec(): Allocate new space for the BLOB pointer,
to avoid overwriting prefix indexes to the same column.  Adapt
dtuple_convert_back_big_rec().

row_build_index_entry(): Fetch the columns also for prefix indexes of
the clustered index.

page_zip_apply_log(), page_zip_decompress_clust(): Allow externally
stored fields to lack a locally stored part.
2006-09-29 10:40:42 +00:00
marko
9d2146e431 branches/zip: Replace FIL_PAGE_ZBLOB_SPACE_ID and FIL_PAGE_ZBLOB_DATA
with FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID and FIL_PAGE_DATA.  The doublewrite
buffer needs to read the space_id in order to determine the type of the page.
Because FIL_PAGE_TYPE could contain garbage in MySQL/InnoDB 5.0 and earlier
versions, we cannot trust fil_page_get_type().  Instead, we have to always
store the space_id at the same location.  This modification wastes 12 bytes
per compressed BLOB page (1.2% on 1-kilobyte pages).
2006-09-27 10:51:05 +00:00
marko
2884c83de6 branches/zip: dtuple_convert_big_rec(): Reduce the locally stored part
of externally stored columns to REC_1BYTE_OFFS_LIMIT (128) bytes.
TODO: only store BTR_EXTERN_FIELD_REF_SIZE (20) bytes with the record,
and store the entire column externally.  (Bug #22496)

dict_col_t::min_prefix: Remove.
2006-09-26 19:50:21 +00:00
marko
83ef74df8b branches/zip: Allow the locally stored part of externally stored columns
in the clustered index to be smaller than the indexed prefix in secondary
indexes.

row_ext_lookup(): Return NULL if the column is not stored externally.

trx_undo_rec_get_partial_row(): row_build(): Add parameter row_ext_t** ext.

row_build_index_entry(): Add the parameter row_ext_t* ext.
Invoke row_ext_lookup() to fetch prefixes of externally stored columns.

upd_node_t, undo_node_t, purge_node_t: Add the field row_ext_t* ext.
2006-09-26 11:50:54 +00:00
marko
22c95e9a63 branches/zip: Add const qualifiers to the pointer parameters of
mach_read_...() functions.  Remove unnecessary casts.
2006-09-26 07:39:02 +00:00
marko
c60a8c2f55 branches/zip: Add row_ext_t for caching prefixes of externally stored columns.
This will be needed for fixing Bug #22496.

REC_MAX_INDEX_COL_LEN: New constant, copied from DICT_MAX_INDEX_COL_LEN.

row_ext_create(), row_ext_lookup(), row_ext_lookup_low(): New functions.
2006-09-26 07:28:23 +00:00
marko
6e269ddf34 branches/zip: Implement the ability to fetch a prefix of an externally
stored column.  This is the first part of fixing Bug #22496.

btr_copy_externally_stored_field_prefix(): New function.

btr_copy_externally_stored_field(): Split to
btr_copy_externally_stored_field_prefix_low().

row_sel_sec_rec_is_for_blob(): New function, used by
row_sel_sec_rec_is_for_clust_rec() in selects via
a secondary index.
2006-09-26 06:22:16 +00:00
marko
75e478a01b branches/zip: page_zip_empty_size(): New function to compute the
guaranteed free space available for inserting one record.

btr_page_get_sure_split_rec(), btr_cur_pessimistic_insert():
Use page_zip_empty_size().

btr_page_split_and_insert(): Relax a debug assertion that there should
be at least two user records on the page.  On compressed pages, we may
be able to write only one record.
2006-09-20 14:26:53 +00:00
marko
c12e237a09 branches/zip: Instrument the buffer pool allocator and deallocator
for more accurate Valgrind debugging.

univ.i: Introduce UNIV_DEBUG_VALGRIND, UNIV_MEM_VALID, and UNIV_MEM_INVALID.

buf_LRU_block_free_non_file_page(): Invalidate the buffer frame
with UNIV_MEM_INVALID().

buf_LRU_get_free_block(): Declare the buffer frame valid
with UNIV_MEM_VALID().

Other memory is allocated and deallocated via malloc() and free(),
which are already overridden by Valgrind.  Without the added
instrumentation, accesses to free pages in the buffer pool cannot
be caught.

The diagnostics could probably be improved further by declaring all
non-latched buffer frames invalid.
2006-09-20 12:42:08 +00:00
marko
9a16aac783 branches/zip: Merge revisions 804:838 from trunk. 2006-09-19 10:14:07 +00:00
marko
e4dc19ba38 branches/zip: Merge revisions 789:804 from trunk. 2006-09-12 07:29:57 +00:00
marko
78d1dd326c branches/zip: Merge revisions 767:789 from trunk. 2006-09-04 19:47:47 +00:00
marko
6429e2e682 branches/zip: dtuple_convert_big_rec(): Shorten the locally stored part
of externally stored columns to 108 bytes when possible.

This will unmask a bug in the handling of BLOBs on compressed tablespaces,
especially of small page sizes.  Apparently, the locally stored part must
be less than 235 bytes in size for the bug to occur.

dict_col_struct: Add field min_prefix.

dict_index_build_internal_non_clust(): Adjust min_prefix.
2006-08-31 11:00:02 +00:00
marko
6c932eefb7 branches/zip: Merge revisions 765:767 from trunk. 2006-08-29 12:17:50 +00:00
marko
64f3cee67f branches/zip: Merge revisions 720:765 from trunk and reindent the code
as per revisions r763:765.
2006-08-29 09:30:31 +00:00
marko
20de0a2ad7 branches/zip: Assert that only leaf pages of clustered indexes may contain
externally stored columns.  Make some use of the fact in compression and
decompression.

rec_init_offsets(): Add ut_ad(dict_index_is_clust(index)) before flagging
external columns.

page_zip_get_trailer_len(): Assert ut_ad(!page_zip->n_blobs) unless
dict_index_is_clust(index).

page_zip_get_n_prev_extern(): Add ut_ad(dict_index_is_clust(index)).

page_zip_compress(), page_zip_decompress_low(): Add dict_index_is_clust()
assertions.  Allow completely external storage of columns.  Simplify
the computation of "externs".

page_zip_write_rec(): Store leaf node records of non-clustered indexes
with one memcpy(), avoiding rec_offs_n_extern() and the for loop.

page_zip_write_blob_ptr(): Add ut_ad(dict_index_is_clust(index)).
Simplify the computation of "externs".

page_zip_clear_rec(): Only attempt to zero out BLOB pointers when
the record belongs to a leaf page of a clustered index.

page_zip_dir_delete(): Take a fast path when the record is
not on a leaf page of a clustered index.
Simplify the computation of "externs".

page_zip_copy(): Assert that n_blobs is zero on anything else than
leaf pages of clustered indexes.
2006-08-21 10:27:15 +00:00
marko
98b296946f branches/zip: page_zip_dir_insert(): Remove unused parameters index, offsets. 2006-08-21 09:27:44 +00:00