transactions that are started before the rollback of incomplete
transactions has finished may have an inconsistent view of the
secondary indexes.
dict_index_is_sec_or_ibuf(): Auxiliary function for controlling
updates and checks of PAGE_MAX_TRX_ID: check whether an index is a
secondary index or the insert buffer tree.
page_set_max_trx_id(), page_update_max_trx_id(),
lock_rec_insert_check_and_lock(),
lock_sec_rec_modify_check_and_lock(), btr_cur_ins_lock_and_undo(),
btr_cur_upd_lock_and_undo(): Add the parameter mtr.
page_set_max_trx_id(): Allow mtr to be NULL. When mtr==NULL, do not
attempt to write to the redo log. This only occurs when creating a
page or reorganizing a compressed page. In these cases, the
PAGE_MAX_TRX_ID will be set correctly during the application of redo
log records, even though there is no explicit log record about it.
btr_discard_only_page_on_level(): Preserve PAGE_MAX_TRX_ID. This
function should be unreachable, though.
btr_cur_pessimistic_update(): Update PAGE_MAX_TRX_ID.
Add some assertions for checking that PAGE_MAX_TRX_ID is set on all
secondary index leaf pages.
rb://115 tested by Michael, fixes Issue #211
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal
[Step 6/28]
Merge revisions 2852:2854 from branches/5.1:
------------------------------------------------------------------------
r2854 | sunny | 2008-10-23 08:30:32 +0300 (Thu, 23 Oct 2008) | 13 lines
Changed paths:
M /branches/5.1/dict/dict0dict.c
M /branches/5.1/dict/dict0mem.c
M /branches/5.1/handler/ha_innodb.cc
M /branches/5.1/handler/ha_innodb.h
M /branches/5.1/include/dict0dict.h
M /branches/5.1/include/dict0mem.h
M /branches/5.1/row/row0mysql.c
branches/5.1: Backport changes from branches/zip r2725
Simplify the autoinc initialization code. This removes the
non-determinism related to reading the table's autoinc value for the first
time. This change has also reduced the sizeof dict_table_t by sizeof(ibool)
bytes because we don't need the dict_table_t::autoinc_inited field anymore.
Bug#39830 Table autoinc value not updated on first insert.
Bug#35498 Cannot get table test/table1 auto-inccounter value in ::info
Bug#36411 Failed to read auto-increment value from storage engine" in 5.1.24 auto-inc
rb://16
------------------------------------------------------------------------
non-determinism related to reading the table's autoinc value for the first
time. This change has also reduced the sizeof dict_table_t by sizeof(ibool)
bytes because we don't need the dict_table_t::autoinc_inited field anymore.
This also fixes Bug#39830 Table autoinc value not updated on first insert.
rb://16
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.
foreign key constraint, find a truly equivalent index for it.
If none is available, refuse to drop the index. MySQL can drop
an index when creating a "stronger" index.
This was reported as Mantis issue #70 and MySQL Bug #38786.
innodb-index.test: Add a test case.
dict_foreign_find_equiv_index(): New function, to replace the
incorrectly written function dict_table_find_equivalent_index().
dict_table_replace_index_in_foreign_list(): Simplify the implementation.
dict_table_get_referenced_constraint(), dict_table_get_foreign_constraint():
Simplify the iteration loop.
dict_table_find_equivalent_index(): Correct the function comment.
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.
in *.h files, so that the function signatures in the *.h and *.c files fully
match each other.
ut_dulint_sort(): Add a UNIV_INTERN qualifier also to the function definition.
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.
value. Document this change in behaviour, and make all callers invoke
the function right after dtuple_create().
dict_create_sys_fields_tuple(): Add a missing "break" statement to the loop
that checks if there are any column prefixes in the index.
row_get_prebuilt_insert_row(): Do not set the fields to the SQL NULL value,
now that dict_table_copy_types() takes care of it.
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().
trx_t: Remove dict_undo_list and dict_redo_list.
innobase_create_temporary_tablename(): Replace TEMP_TABLE_PREFIX with
a table name suffix "#1" or "#2". In this way, the user can restore
precious data, should anything go wrong. It is possible to reach an
inconsistent state, because the creation, deletion and renaming of
single-table tablespaces are not transactional.
ut_print_namel(), fil_make_ibd_name(), innobase_rename_table(): Remove
the special treatment of TEMP_TABLE_PREFIX.
Introduce TEMP_INDEX_PREFIX == 0xff for temporary indexes. This byte
cannot occur in index names since MySQL 4.1. However, it might have
been possible to use this byte in MySQL 4.0.
recv_recovery_from_checkpoint_finish(): Call the new function
row_merge_drop_temp_indexes(), to drop all indexes whose name starts
with the byte 0xff.
row_merge_rename_indexes(): Renamed from row_merge_rename_index().
Remove the parameter "index".
row_drop_table_for_mysql(): Unconditionally call trx_commit_for_mysql().
row_drop_table_for_mysql_no_commit(): Correct the function commit,
based on the corrected comment of row_drop_table_for_mysql(). Rely on
table->to_be_dropped instead of TEMP_TABLE_PREFIX.
ha_innobase::add_index(): Simplify the control flow.
innobase_create_key_def(), row_table_got_default_clust_index(),
row_get_mysql_key_number_for_index(): Add a const qualifier.
dict_table_get_first_index(), dict_table_get_next_index(): Define
as a const-preserving macro. Preserve the old function for UNIV_DEBUG,
but add a const qualifier to the parameter and cast away the constness.
the data dictionary locked across the operations.
dict_table_decrement_handle_count(), row_prebuilt_free(): Add the flag
dict_locked, to prevent the acquisition of dict_sys->mutex.
innobase_rename_table(): Rename commit_flag to lock_and_commit,
and do not acquire dict_sys->mutex or flush the log unless the flag is set.
Remove bogus comment about utility threads, because the threads will
be waken up by the upper-level function ha_innobase::rename_table().
ha_innobase::add_index(): After creating a primary key, hold dict_sys->mutex
across all dictionary operations.
now that all of InnoDB code is built from a single Makefile and it should
not be possible to build the modules with mutually incompatible options.
#define INSIDE_HA_INNOBASE_CC: Remove.
srv_sizeof_trx_t_in_ha_innodb_cc: Remove.
dict_table_get_low_noninlined(): Remove. This function was unused.
Remove all _noninline functions. Remove the _noninline suffix from
all function calls in ha_innodb.cc.
during fast index creation.
TEMP_TABLE_PREFIX: Move the definition from dict0dict.h to ut0ut.h.
ut_print_namel(): Check if the name starts with TEMP_TABLE_PREFIX.
innobase_rename_table(): Print all names with ut_print_name().
row_prebuilt_free(): Replace assert() with ut_a().
The creation of the primary key does not work. We will have to flag
externally stored columns and copy the externally stored part from
the old table.
row_build_index_for_mysql(): Rename to row_merge_build_indexes().
Move from row0mysql.c to row0merge.c.
Remove private declarations from row0merge.h. Make many functions static
in row0merge.c.
cmp_rec_rec_simple(): A new comparison function.
dict_index_get_min_size(): New function.
OS_FILE_FROM_FD(fd): A macro for converting from int to os_file_t.
rec_convert_dtuple_to_rec_comp(): Make the interface lower-level.
rec_get_converted_size_comp(): Return also extra_size.
UT_SORT_FUNCTION_BODY(): Remove reference to an obsolete test program.
row_rec_to_index_entry_low(): New function.
row0merge.c: Implement merge sort based on file streams instead of
fixed-size blocks. Sort the small blocks as arrays of dfield_t*,
because it is faster than invoking rec_get_offsets() for every
comparison.
dict_index_is_unique(): New function.
row_merge_rec_fits_to_block(), row_merge_store_rec_to_block():
Add const qualifiers to rec, offsets.
row_merge_select(): Rename to row_merge_cmp(), simplify the interface.
row_merge_sort_linked_list(): Change the return type to ibool.
Replace sec_offs1,sec_offs2 with offsets1,offsets2. Replace offset_heap
with heap. Define a func_exit label.
row_merge_block_merge(): Reduce the scope of rec_offsets.
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".
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.