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.
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().
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.
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.
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().
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.
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).
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.
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.
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.
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.
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.
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().
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.
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.
btr_cur_compress_if_useful(): Replace if () return(); return() with return.
page_rec_get_next_low(): New function.
page_rec_get_prev(): Invoke page_is_comp() outside the loop.
Replace page_rec_get_next() with loop-specific instances of
page_rec_get_next_low().
page_copy_rec_list_end(): Add some debug assertions.
Introduce FIL_PAGE_ZBLOB_DATA as a synonym for FIL_PAGE_FILE_FLUSH_LSN.
btr_store_big_rec_extern_fields(): Make the assertion about
dict_table_zip_size() more accurate.
buf_LRU_get_free_block(), buf_block_alloc(): Add parameter zip_size.
buf_calc_zblob_page_checksum(): Remove. Replace with page_zip_calc_checksum().
buf_page_init(): Remove parameter zip_size.
buf_page_io_complete(): Add a placeholder for handling compressed pages.
trx_doublewrite_page_inside(): Remove redundant function.
page_zip_write_rec(): Relax an overly tight assertion about blob_no.
btr_page_reorganize_low(): Rename new_page to temp_page.
btr_store_big_rec_extern_fields(): FIL_PAGE_TYPE is 2 bytes, not 4.
buf_page_init(), buf_page_create(), buf_read_page_low(),
buf_page_init_for_read(): Add parameter zip_size.
buf_page_init_for_backup_restore(),
recv_apply_log_recs_for_backup(): Enclose in #ifdef UNIV_HOTBACKUP.
Enclose some debug code in #ifdef UNIV_LOG_REPLICATE.
page_zip_write_header_log(): Replace page_zip with a pointer to
the uncompressed page.
page_zip_write_rec(): Relax an assertion about blob_no + n_ext.
page_copy_rec_list_to_created_page_write_log(): Allow logging to be disabled.
and to the file space header (FSP_PAGE_ZIP_SIZE, renamed from
FSP_LOWEST_NO_WRITE).
fil_space_struct: Add zip_size.
dict_table_struct: Embed zip_size in flags.
dict_table_zip_size(): Infer zip_size from table->flags.
dict_sys_tables_get_zip_size(): Read zip_size from SYS_TABLES.TYPE.
fil_space_get_zip_size(): Read zip_size from the file space header.
Add the redo log entry type MLOG_ZIP_FILE_CREATE.
page_zip_alloc(): Add parameter "mtr" and log successful calls
to page_zip_compress().
page_zip_write_blob_ptr(), page_zip_write_node_ptr(): Write the offset on
the uncompressed page, because mlog_write_initial_log_record_fast()
does not do so.
page_zip_write_header_log(), page_zip_parse_write_header(): Encode the
offset in one byte.
MLOG_ZIP_COMPRESS and MLOG_ZIP_DECOMPRESS with higher-level entry types.
Implement the logging and crash recovery of MLOG_ZIP_PAGE_CREATE.
page_create_zip(): New function for creating a compressed B-tree page.
page_parse_create_zip(): New function for applying a MLOG_ZIP_PAGE_CREATE
redo log record.
btr_page_create(): Remove the prototype. Add parameters page_zip, level,
prev, and next.
btr0btr.c: Eliminate page_zip_compress() calls where possible.
page_zip_alloc(), page_zip_compress(), page_zip_decompress(),
page_zip_clear_rec(): Remove parameter mtr.
recv_parse_or_apply_log_rec_body(): Handle MLOG_ZIP_PAGE_CREATE.
Add TODO comments for the other added redo log entry types.
dict_mem_table_create(): Account for DICT_TF_COMPRESSED in a debug assertion.
btr_store_big_rec_extern_fields(), btr_free_externally_stored_field(),
btr_copy_externally_stored_field(): Implement the disk format for
compressed BLOB pages.
btr_copy_externally_stored_field(): Improve error reporting and handling
when decompressing BLOB pages.
buf_flush_init_for_writing(), buf_page_is_corrupted(), buf_page_print():
Account for compressed BLOB pages (FIL_PAGE_TYPE_ZBLOB).
buf_calc_zblob_page_checksum(): New function.