buf_block_dbg_add_level(block, level): Define as an empty macro when
UNIV_SYNC_DEBUG is not defined. Remove #ifdef UNIV_SYNC_DEBUG around
all invocations.
the maximum record size will never exceed the B-tree page size limit.
For uncompressed tables, there should always be enough space for two
records in an empty B-tree page. For compressed tables, there should
be enough space for storing two node pointer records or one data
record in an empty page in uncompressed format.
dict_build_table_def_step(): Remove the inaccurate check for table row
size.
dict_index_too_big_for_tree(): New function: check if the index
records would be too big for a B-tree page.
dict_index_add_to_cache(): Add the parameter "strict". Invoke
dict_index_too_big_for_tree() if it is set.
trx_is_strict(), thd_is_strict(): New functions, for determining if
innodb_strict_mode is enabled for the current transaction.
dict_create_index_step(): Pass the new parameter strict of
dict_index_add_to_cache() as trx_is_strict(trx). All other callers
pass it as FALSE.
innodb.test: Enable innodb_strict_mode before attempting to create a
table with a too big record size.
innodb-zip.test: Remove the test of inserting random data. Add tests
for checking that the maximum record lengths are enforced at table
creation time.
recovery, tolerate clustered index records whose externally stored
columns have not been written. This should remove the assertion failures
that were reported as Mantis issue#58, issue#62, issue#64.
trx_is_recv(): New function: TRUE if this transaction is rolling back
an incomplete transaction in crash recovery.
enum trx_rbmode: Rollback modes: no rollback, normal rollback, crash recovery.
btr_cur_pessimistic_delete(), btr_free_externally_stored_field(),
btr_rec_free_externally_stored_fields():
Replace the ibool parameter with enum trx_rbmode.
btr_free_externally_stored_field(): If field_ref is zero, return
but assert ut_a(rbmode == RB_RECOVERY). Unless InnoDB has crashed
while inserting a clustered index record, field_ref should not be zero.
btr_rec_free_updated_extern_fields(): Add the parameter enum trx_rbmode.
btr_cur_pessimistic_update(): Pass the rbmode parameter to
btr_rec_free_updated_extern_fields().
row_undo_ins(), row_undo_mod_upd_del_sec(): If row_build_index_entry()
fails, assert trx_is_recv() and skip this secondary index.
row_undo_mod_upd_del_sec(): Empty the heap at the end of each loop
iteration in order to conserve memory and to reduce the number of
low-level memory allocations.
variable innodb_file_format. Implement file format version stamping of
*.ibd files and SYS_TABLES.TYPE.
This change breaks introduces an incompatible change for for
compressed tables. We can do this, as we have not released yet.
innodb-zip.test: Add tests for stricter KEY_BLOCK_SIZE and ROW_FORMAT
checks.
DICT_TF_COMPRESSED_MASK, DICT_TF_COMPRESSED_SHIFT: Replace with
DICT_TF_ZSSIZE_MASK, DICT_TF_ZSSIZE_SHIFT.
DICT_TF_FORMAT_MASK, DICT_TF_FORMAT_SHIFT, DICT_TF_FORMAT_51,
DICT_TF_FORMAT_ZIP: File format version, stored in table->flags,
in the .ibd file header, and in SYS_TABLES.TYPE.
dict_create_sys_tables_tuple(): Write the table flags to SYS_TABLES.TYPE
if the format is at least DICT_TF_FORMAT_ZIP. For old formats
(DICT_TF_FORMAT_51), write DICT_TABLE_ORDINARY as the table type.
DB_TABLE_ZIP_NO_IBD: Remove the error code. The error handling is done
in ha_innodb.cc; as a failsafe measure, dict_build_table_def_step() will
silently clear the compression and format flags instead of returning this
error.
dict_mem_table_create(): Assert that no extra bits are set in the flags.
dict_sys_tables_get_zip_size(): Rename to dict_sys_tables_get_flags().
Check all flag bits, and return ULINT_UNDEFINED if the combination is
unsupported.
dict_boot(): Document the SYS_TABLES columns N_COLS and TYPE.
dict_table_get_format(), dict_table_set_format(),
dict_table_flags_to_zip_size(): New accessors to table->flags.
dtuple_convert_big_rec(): Introduce the auxiliary variables
local_len, local_prefix_len. Store a 768-byte prefix locally
if the file format is less than DICT_TF_FORMAT_ZIP.
dtuple_convert_back_big_rec(): Restore the columns.
srv_file_format: New variable: innodb_file_format.
fil_create_new_single_table_tablespace(): Replace the parameter zip_size
with table->flags.
fil_open_single_table_tablespace(): Replace the parameter zip_size_in_k
with table->flags. Check the flags.
fil_space_struct, fil_space_create(), fil_op_write_log():
Replace zip_size with flags.
fil_node_open_file(): Note a TODO item for InnoDB Hot Backup.
Check that the tablespace flags match.
fil_space_get_zip_size(): Rename to fil_space_get_flags(). Add a
wrapper for fil_space_get_zip_size().
fsp_header_get_flags(): New function.
fsp_header_init_fields(): Replace zip_size with flags.
FSP_SPACE_FLAGS: New name for the tablespace flags. This field used
to be called FSP_PAGE_ZIP_SIZE, or FSP_LOWEST_NO_WRITE. It has always
been written as 0 in MySQL/InnoDB versions 4.1 to 5.1.
MLOG_ZIP_FILE_CREATE: Rename to MLOG_FILE_CREATE2. Add a 32-bit
parameter for the tablespace flags.
ha_innobase::create(): Check the table attributes ROW_FORMAT and
KEY_BLOCK_SIZE. Issue errors if they are inappropriate, or warnings
if the inherited attributes (in ALTER TABLE) will be ignored.
PAGE_ZIP_MIN_SIZE_SHIFT: New constant: the 2-logarithm of PAGE_ZIP_MIN_SIZE.
symbols. Use it for all definitions of non-static variables and functions.
lexyy.c, make_flex.sh: Declare yylex as UNIV_INTERN, not static. It is
referenced from pars0grm.c.
Actually, according to
nm .libs/ha_innodb.so|grep -w '[ABCE-TVXYZ]'
the following symbols are still global:
* The vtable for class ha_innodb
* pars0grm.c: The function yyparse() and the variables yychar, yylval, yynerrs
The required changes to the Bison-generated file pars0grm.c will be addressed
in a separate commit, which will add a script similar to make_flex.sh.
The class ha_innodb is renamed from class ha_innobase by a #define. Thus,
there will be no clash with the builtin InnoDB. However, there will be some
overhead for invoking virtual methods of class ha_innodb. Ideas for making
the vtable hidden are welcome. -fvisibility=hidden is not available in GCC 3.
innodb-index.test: Add a test with a large number of externally stored
columns. Check that there may not be prefix indexes on too many columns.
dict_index_too_big_for_undo(): New function: Check if the undo log may
overflow.
dict_index_add_to_cache(): Return DB_SUCCESS or DB_TOO_BIG_RECORD.
Postpone the creation and linking of some data structures, so that
when dict_index_too_big_for_undo() holds, it will be easier to clean up.
Check the return status in all callers.
contents end up with conflicting versions of a record's state. The zipped
page record was not being marked as "(un)deleted" because we were not
passing the zipped page contents to the (un)delete function, which first
(un)delete marks the uncompressed version and then based on whether
page_zip is NULL or not (un)delete marks the record in the compressed page.
buf_page_get_release_on_io(): Removed this unused function.
ibuf_build_entry_from_ibuf_rec(): Justify why it is not necessary to
add system columns to the dummy table pointed to by the dummy secondary index.
page_zip_rec_set_deleted(): Add a page_zip_validate() assertion.
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.
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().
the insert buffer bitmap.
ibuf_set_free_bits_func(): Never disable redo logging.
ibuf_update_free_bits_zip(): Remove.
btr_page_reorganize_low(), page_zip_reorganize(): Do not update the insert
buffer bitmap. Instead, document that callers will have to take care of it,
and adapt the callers.
btr_compress(): On error, reset the insert buffer free bits.
btr_cur_insert_if_possible(): Do not modify the insert buffer bitmap.
btr_compress(), btr_cur_optimistic_insert(): On compressed pages,
reset the insert buffer bitmap. Document why.
btr_cur_update_alloc_zip(): Document why it is necessary and sufficient
to reset the insert buffer free bits.
btr_cur_update_in_place(), btr_cur_optimistic_update(),
btr_cur_pessimistic_update(): Update the free bits in the same
mini-transaction. Document that the mini-transaction must be
committed before latching any further pages. Verify that this
is the case in all execution paths.
row_ins_sec_index_entry_by_modify(), row_ins_clust_index_entry_by_modify(),
row_undo_mod_clust_low(): Because these functions call
btr_cur_update_in_place(), btr_cur_optimistic_update(), or
btr_cur_pessimistic_update(), document that the mini-transaction must be
committed before latching any further pages. Verify that this is the case
in all execution paths.
mtr_commit(): Do not acquire the log mutex if no log records are to be written.
ibuf_set_free_bits_func(): Do not clear mtr.modifications, because that would
prevent the dirty insert buffer bitmap block from being moved to the flush
list. Instead, assume that mtr_commit() will not acquire log_sys->mutex
because redo logging is disabled.
buf_page_init_for_read(): I/O-fix the block before buf_buddy_alloc(), because
the newly allocated block could otherwise be reused by the compressed page.
crash recovery is in progress. This avoids a hang when
btr_parse_page_reorganize(), called from an I/O handler thread,
attempts to acquire log_sys->mutex while it is being held by
the main thread (the one that runs innobase_init()). This change
was committed accidentally. It may be unsafe to clear
mtr.modifications, because buf_page_release() at mtr_commit() may
forget to put modified pages to the flush list.
Cleanup: Remove the "type" parameter from many ibuf functions.
Let the caller check that !dict_index_is_clust(). This should avoid
function calls and register spilling.
ibuf_set_free_bits_func(), ibuf_set_free_bits(): Remove the parameter "type".
ibuf_reset_free_bits_with_type(): Rename to ibuf_reset_free_bits().
Remove the parameter "type".
ibuf_update_free_bits_if_full(), ibuf_update_free_bits_zip(),
ibuf_update_free_bits_low(), ibuf_update_free_bits_for_two_pages_low():
Remove the parameter "index".
failing insert. Reorganization will have been attempted in
page_cur_tuple_insert() or page_cur_rec_insert().
page_zip_reorganize(): Recompute the insert buffer free bits for
leaf pages of secondary indexes.
ibuf_data_enough_free_for_insert(): Simplify.
page_zip_max_ins_size(): New function.
btr_cur_optimistic_insert(), btr_cur_optimistic_delete(),
btr_page_split_and_insert(), btr_compress(): Do not update the
ibuf free bits for non-leaf pages or pages belonging to a clustered index.
The insert buffer only covers operations on leaf pages of secondary indexes.
For pages covered by the insert buffer, limit the max_ins_size to
page_zip_max_ins_size().
buf_page_get_gen(): Merge the insert buffer after decompressing the page.
buf_page_io_complete(): Relax the assertion about ibuf_count. For
compressed-only pages, the insert buffer merge takes place
in buf_page_get_gen().
ibuf_index_page_calc_free_bits(), ibuf_index_page_calc_free_from_bits(),
ibuf_index_page_calc_free(), ibuf_update_free_bits_if_full(),
ibuf_update_free_bits_low(), ibuf_update_free_bits_for_two_pages_low(),
ibuf_set_free_bits_low(): Add the parameter zip_size. Limit the maximum
insert size to page_zip_max_ins_size().
to tables.
dict_mem_table_add_col(): Add the parameter "heap" for temporary memory
allocation. Allow it and "name" to be NULL. These parameters are NULL
when creating dummy indexes.
dict_add_col_name(): Remove calls to ut_malloc() and ut_free().
dict_table_get_col_name(): Allow table->col_names to be NULL.
dict_table_add_system_columns(), dict_table_add_to_cache():
Add the parameter "heap".
buf_page_get_gen(). This saves one mutex operation per block request.
buf_page_get_gen(), various macros and functions: Add parameter zip_size.
btr_node_ptr_get_child(): Add parameter index.
fil_space_get_latch(): Add optional output parameter zip_size.
fil_space_get_zip_size(): Return 0 for space id==0, because the
system tablespace is never compressed.
fsp_header_init(): Remove the parameter zip_size.
ibuf_free_excess_pages(): Remove the parameter zip_size.
trx_rseg_t, trx_undo_t: Add field zip_size.
xdes_lst_get_next(): Remove, unused.
rec_get_nth_field_offs_old(): Split from rec_get_nth_field_old().
rec_get_nth_field_old(): Reimplement as a constness-preserving macro.
dict_drop_index_tree(), dict_truncate_index_tree(): Note that rec is
an in/out parameter, as the B-tree root page number will be updated.
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().
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.
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.
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.