Commit graph

109 commits

Author SHA1 Message Date
marko
5669dc3d2a 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
736a8ffb01 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
334b002c5c 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
469a27ac2a 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
d374183221 branches/zip: buf_block_get_page_zip(): Replace with buf_frame_get_page_zip(). 2006-10-09 15:37:19 +00:00
marko
66ae0ded70 branches/zip: Fix all bugs detected by mysql-test-run. The exactly same set
of tests are failing with trunk -r869, with this revision using uncompressed
storage, and with this revision hard-wired to use 1-kilobyte compressed pages
and innodb_file_per_table.

btr_push_update_extern_fields(): Do not call ut_ulint_sort() if n_pushed == 0.

btr_copy_externally_stored_field_prefix_low(): Replace ut_max() with ut_min().
2006-10-02 08:42:42 +00:00
marko
174bd7b7ca 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
60504d8efa btr_page_get_sure_split_rec(): Revert the change from r875:
"On compressed pages, return NULL if incl_data > free_space."

btr_page_split_and_insert(): Remove the limit check of n_iterations
on compressed pages.  After enough many invocations of
btr_page_get_sure_split_rec(), the record will finally fit.
2006-09-28 11:02:04 +00:00
marko
44e33c235f branches/zip: btr_page_get_sure_split_rec(): Rewrite the
for (;;) { ... if (condition) { ... return }} loop as
do { ... } while (!condition); ... return.

On compressed pages, return NULL if incl_data > free_space.
2006-09-28 10:40:07 +00:00
marko
71e8ea627c 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
7edc6be45b 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
c66a0754b9 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
8e59e994ac branches/zip: Minor cleanup in update related code.
btr_push_update_extern_fields(): Instead of iterating all upd_get_n_fields(),
stop at the first match.

row_search_index_entry(): Simplify the return statements.

row_upd_sec_step(): Eliminate the local variable "err".

row_upd_clust_step(): Add a UNIV_UNLIKELY hint.
2006-09-25 12:17:33 +00:00
marko
5a21753bcb 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
68a65c142c branches/zip: Merge revisions 804:838 from trunk. 2006-09-19 10:14:07 +00:00
marko
090a1db9ad branches/zip: btr_store_big_rec_extern_fields(): When adjusting the
"next BLOB page" pointer, write it also to the compressed page,
which is the one that will be flushed to disk.
2006-09-06 14:17:20 +00:00
marko
50e286c04d branches/zip: btr_copy_externally_stored_field(): Add diagnostics for
unexpected end of compressed BLOB.
2006-09-06 09:51:00 +00:00
marko
0c26b8f1a4 branches/zip: btr_copy_externally_stored_field(): Correct the
reporting and handling of inflate() errors.
2006-09-05 19:41:05 +00:00
marko
23128a45c1 branches/zip: Split lines before operators, not after them. 2006-09-05 19:37:43 +00:00
marko
78357aa7c3 branches/zip: btr_cur_optimistic_insert(): When returning DB_FAIL,
always convert back big_rec_vec.
2006-09-05 12:49:35 +00:00
marko
da79b9060c branches/zip: btr_cur_optimistic_insert(): Add a closing parenthesis that
was accidentally omitted in r766.
2006-09-04 19:06:58 +00:00
marko
ff61ba46d9 branches/zip: Avoid overwriting an existing big_rec when calling
dtuple_convert_big_rec().  This should never happen, though.
2006-08-31 10:53:00 +00:00
marko
38e09b2fea 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
4858179f05 branches/zip: btr_cur_pessimistic_insert(): Prior to splitting, ensure that
the record will fit on an empty compressed page.

buf_block_alloc(), buf_block_free(), buf_frame_alloc(), buf_frame_free():
Make inlined.
2006-08-17 11:57:51 +00:00
marko
800047591a branches/zip: btr_page_get_sure_split_rec(): Align the variable declarations
according to InnoDB formatting rules.
2006-08-17 08:28:05 +00:00
marko
4fb0e5e762 branches/zip: Account for the compressed page size when checking if a
record will fit or need external storage.

btr_page_get_sure_split_rec(): Estimate the free space of an empty
compressed page.

page_zip_rec_needs_ext(): New function, to replace existing tests whether
external storage is needed.
2006-08-17 08:14:38 +00:00
marko
f4f5606fb6 branches/zip: Merge revisions 634:713 from trunk. 2006-08-11 11:49:38 +00:00
marko
09e017ca70 branches/zip: btr_cur_search_to_nth_level(): Do not invoke page_zip_validate()
if rw_latch == RW_NO_LATCH.
2006-08-07 08:07:47 +00:00
marko
b152ee5655 branches/zip: Zero out the BLOB pointers when decoding deleted records.
Improve diagnostics.

btr_cur_pessimistic_update(): Add page_zip_validate() assertion.

page_zip_decompress(): Initialize all BLOB pointers.

page_zip_clear_rec(): Add page_zip_header_cmp() assertion.

page_delete_rec_list_end(): Add page_zip_validate() assertion.
2006-08-03 08:06:45 +00:00
marko
011035566a branches/zip: Fix a bug in consistent reads of rows containing BLOB data.
btr_rec_copy_externally_stored_field(): Add parameter zip_size.
Do not call buf_block_align(rec), because rec can also be in
dynamically allocated memory.  buf_block_align() can only be invoked
on addresses inside the buffer pool.

page_zip_clear_rec(): Improve formatting.
2006-07-31 06:43:25 +00:00
marko
a201d0c159 branches/zip: btr_store_big_rec_extern_fields(),
btr_free_externally_stored_field(): Replace mlog_write_ulint()
with mach_write_to_4() when page_zip != NULL.  The operation is
logged by page_zip_write_blob_ptr().
2006-07-27 12:32:12 +00:00
marko
12ccbd8ae0 branches/zip: Remove a bogus page_zip_validate() assertion failure found
by running index_merge_ror_cpk on 1-kilobyte compressed pages.

page_delete_rec_list_start(): Remove the page_zip_validate() assertion.

btr_page_split_and_insert(): Add page_zip_validate() assertions about
page and new_page after moving the records.
2006-07-07 10:42:41 +00:00
marko
3e670d86c7 branches/zip: btr_parse_page_reorganize(): Add parameter page_zip. 2006-07-04 21:15:30 +00:00
marko
6b077aa8e3 branches/zip: Eliminate page corruption in btr_compress() when
page_zip_reorganize() was invoked.

btr_compress(): Obtain orig_pred and orig_succ after copying the records.
Add a debug assertion about FIL_PAGE_PREV.

page_copy_rec_list_end(), page_copy_rec_list_start(): Change the return
type from ibool to rec_t.  Adjust the return value after invoking
page_zip_reorganize().
2006-06-28 12:01:29 +00:00
marko
44175381a5 branches/zip: Make page_zip_validate() independent of UNIV_DEBUG.
Replace most occurrences of #if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
with #ifdef UNIV_ZIP_DEBUG.
2006-06-20 19:35:59 +00:00
marko
b43effdd9c branches/zip: Add assertions.
btr_compress(): Invoke page_zip_validate() on the page being compressed.

recv_parse_or_apply_log_rec_body(): Assert that MLOG_WRITE_STRING is
never used on compressed B-tree pages.
2006-06-19 11:08:46 +00:00
marko
7f8cb7aab9 branches/zip: Merge revisions 583:634 from trunk. 2006-06-13 20:23:26 +00:00
marko
2117ec5a96 branches/zip: Add page_zip_validate() assertions and remove a bogus
page_zip_assertion() failure in page_copy_rec_list_end().

btr_root_raise_and_insert(), btr_lift_page_up(), btr_compress():
Add page_zip_validate() assertions.

btr_compress(): Only copy FIL_PAGE_PREV when UNIV_BTR_DEBUG is defined.

page_cur_delete_rec(): Document why the page_zip_validate() assertion
was removed.

page_copy_rec_list_end(): Remove the page_zip_validate() assertion and
document why.

page_move_rec_list_end(): Add page_zip_validate() assertion.
2006-06-13 08:24:26 +00:00
marko
8f6de3bba2 branches/zip: Add page_zip_validate() checks.
page_cur_delete_rec(): Do not call page_zip_validate() in the beginning,
because btr_set_min_rec_mark() in btr_cur_pessimistic_delete() will
cause a temporary mismatch.

Document temporary mismatches caused by btr_set_min_rec_mark() calls
and explain why they will not cause any problems.
2006-06-12 12:37:54 +00:00
marko
8378c349e9 branches/zip: Replace all ut_ad(page_zip_validate()) assertions with
ut_a(page_zip_validate()) that are enabled if UNIV_DEBUG or
UNIV_ZIP_DEBUG is defined.
2006-06-07 11:06:12 +00:00
marko
1dd4d56863 branches/zip: Write compressed pages to disk.
os_aio_simulated_handle(): Temporarily disable os_file_check_page_trailers(),
which cannot be invoked on compressed pages.

dict_table_add_system_columns(): New function, split from
dict_table_add_to_cache().

mlog_parse_index(): Add system columns to the dummy table and identify
DB_TRX_ID and DB_ROLL_PTR in the dummy index.

buf_LRU_get_free_block(): Note that page_zip->data should be allocated from
an aligned memory pool.

buf_flush_buffered_writes(): Write compressed pages to disk.

buf_flush_post_to_doublewrite_buf(): Copy compressed pages to the
doublewrite buffer.  Zero fill any excess space.

buf_flush_init_for_writing(): Treat all compressed pages the same.

buf_read_page_low(): Read compressed pages from disk.

buf_page_io_complete(): Process compressed pages.

trx_sys_doublewrite_init_or_restore_page(): Process compressed pages.

mlog_write_initial_log_record_fast(): Enable a debug printout
#ifdef UNIV_LOG_DEBUG.

fsp_header_init(), fsp_fill_free_list(): Pass the compressed page size
to buf_page_create().

page_zip_compress_write_log(): Flatten the if-else if-else logic.

page_zip_parse_write_blob_ptr(): Do not test page_zip if page==NULL.

page_zip_parse_write_node_ptr(): Do not test page_zip if page==NULL.
Invoke mlog_close() correctly.

row_sel_store_row_id_to_prebuilt(): Add UNIV_UNLIKELY hint to an
assertion-like test.
2006-05-30 09:04:57 +00:00
marko
80915cdf91 branches/zip: Merge revisions 560:583 from trunk. 2006-05-22 09:30:34 +00:00
marko
168fa020f3 branches/zip: Try to reorganize the page when compression fails.
page_zip_compress_write_log(): Make static.

page_zip_compress(): Add optional parameter mtr for redo logging.

page_zip_reorganize(): Low-level counterpart of btr_page_reorganize().

page_zip_copy(): Add debug assertions about mtr_memo_contains.

page_cur_insert_rec_low(): Try page_zip_reorganize() and seek to the
new position of insert_rec if it succeeds.

page_copy_rec_list_end(), page_copy_rec_list_start():
Try page_zip_reorganize().

page_move_rec_list_end(): Remove bogus comment.
2006-05-16 14:17:43 +00:00
marko
2779bdc7ff branches/zip: btr_root_raise_and_insert(): Remove a bogus assertion. 2006-05-16 12:01:20 +00:00
marko
2c3b224796 branches/zip: Shorten the log record MLOG_ZIP_PAGE_COMPRESS.
page_zip_copy(), page_zip_compress_write_log(): Add parameter 'index'.

page_zip_parse_write_header(): Check for !page_zip only if page != NULL.

page_zip_compress_write_log(), page_zip_parse_compress(): Omit some
fields in the page header.  Omit the unused bytes between the modification
log and the page trailer.

parse_or_apply_log_rec_body(): Remove a bogus debug assertion.
2006-05-16 07:58:10 +00:00
marko
64678b8bc9 branches/zip: btr_page_split_and_insert(): Implement fallbacks for
page_move_rec_list_start() and page_move_rec_list_end().  Relax the
conditions on insert_will_fit if page_zip is set.

page_delete_rec_list_start(): Make public.

page_zip_copy(): Clear REC_INFO_MIN_REC_FLAG if FIL_PAGE_PREV != FIL_NULL.
2006-05-15 11:43:35 +00:00
marko
9c7913d92a branches/zip: btr_compress(): When merging a compressed page to the right,
set the FIL_PAGE_PREV field of merge_page to FIL_NULL before copying the
records in order not to break the assumption of page_zip_compress() that
min_rec_mark is always set on the first user record of a non-leaf page
whose FIL_PAGE_PREV field is FIL_NULL, and never otherwise.
2006-05-12 13:49:04 +00:00
marko
1d406a014d branches/zip: Fix a bug that was triggered during purge.
btr_compress(): Defer any tree modifications until the records
have successfully been copied.

row_purge_remove_sec_if_poss_low(): Simplify the setting of
the return status.
2006-05-12 11:36:17 +00:00
marko
27d21c0f89 branches/zip: Remove a potential assertion failure.
btr_lift_page_up(): If page_copy_rec_list_end() fails, resort to
page_zip_copy().

page_zip_copy(): Validate the copy of the page.
2006-05-12 09:35:56 +00:00
marko
3b21e1478b branches/zip: After merge fix, and cleanup.
btr_validate_level(): Add missing parameter to added buf_page_print() calls.

btr_root_raise_and_insert(): Replace low-level code with page_zip_copy().

page_zip_copy(): New function to copy the data payload of a compressed page,
byte for byte.  The file page header and trailer are not copied, to avoid
overwriting the fields FIL_PAGE_OFFSET, FIL_PAGE_PREV and FIL_PAGE_NEXT.
2006-05-11 18:23:10 +00:00