Commit graph

81 commits

Author SHA1 Message Date
marko
f3f2de1614 branches/zip: dict_str_starts_with_keyword(): Removed this unused function.
Spotted by Sunny.
2008-10-28 06:36:39 +00:00
sunny
119142d2d1 branches/zip:
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
  
  
  ------------------------------------------------------------------------
2008-10-23 06:24:33 +00:00
marko
bb4b3f4008 branches/zip: Skip the undo log size check on REDUNDANT and COMPACT tables.
In ROW_FORMAT=DYNAMIC and ROW_FORMAT=COMPRESSED, column prefix indexes
require that prefixes of externally stored columns be written to the
undo log. This may make the undo log record bigger than the record on
the B-tree page.  The maximum size of an undo log record is the page
size.  That must be checked for, in dict_index_add_to_cache().

dict_index_add_to_cache(): Skip the undo log size check for REDUNDANT
and COMPACT tables. These tables store prefixes of externally stored
columns locally within the clustered index record.  There are no special
considerations for the undo log record size.

innodb-index.test: Ensure that the check exists for ROW_FORMAT=DYNAMIC,
but not for ROW_FORMAT=COMPACT.

This fixes issue #99.  rb://28 approved by Sunny.
2008-10-16 05:41:13 +00:00
sunny
0eff3d3ca6 branches/zip: 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.

This also fixes Bug#39830 Table autoinc value not updated on first insert.
rb://16
2008-10-04 06:24:56 +00:00
marko
75fe6fa6a4 branches/zip: When creating an index in innodb_strict_mode, check that
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.
2008-09-18 12:31:17 +00:00
marko
c1cc5b1316 branches/zip: innobase_convert_from_id(), innobase_convert_from_table_id():
Add the parameter struct charset_info_st* cs, so that the call
thd_charset(current_thd) can be avoided.  The macro current_thd has no
defined value in the Windows plugin.
2008-09-17 10:07:36 +00:00
marko
5dc842cf08 branches/zip: Non-functional change: Move the declarations of the
functions innobase_convert_from_table_id(), innobase_convert_from_id(),
innobase_casedn_str(), and innobase_get_charset() to ha_prototypes.h.
2008-09-17 10:03:43 +00:00
inaam
b5d1e283af branches/zip
Add missing semicolon. Introduced in r2602 which was obviously not
compiled with UNIV_DEBUG.
2008-09-13 11:44:14 +00:00
marko
f19cbe507d branches/zip: ha_innobase::prepare_drop_index(): When there is a
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.
2008-09-09 11:05:56 +00:00
marko
f4f8113488 branches/zip: Minor cleanup.
dict_table_get_referenced_constraint(), dict_table_get_foreign_constraint():
Simplify the iteration loop.

dict_table_find_equivalent_index(): Correct the function comment.
2008-08-21 10:56:01 +00:00
marko
0d0e36741f branches/zip: Cleanup: make dict_scan_to() a static function. 2008-08-20 11:53:11 +00:00
inaam
208ba019de branches/zip: Merge 2524:2537 from branches/5.1:
------------------------------------------------------------------------
  r2537 | inaam | 2008-07-15 20:46:03 +0300 (Tue, 15 Jul 2008) | 12 lines
  
  branches/5.1   issue# 4
  
  Fixed a timing hole where a thread dropping an index can free the
  in-memory index struct while another thread is still using
  that structure to remove entries from adaptive hash index belonging
  to one of the pages that belongs to the index being dropped.
  
  The fix is to have a reference counter in the index struct and to
  wait for this counter to drop to zero beforing freeing the struct.
  
  Reviewed by: Heikki
  
  ------------------------------------------------------------------------
2008-07-15 17:38:53 +00:00
marko
60ae240d23 branches/zip: Merge 2367:2384 from branches/5.1. 2008-03-26 17:14:00 +00:00
marko
77d8c98735 branches/zip: Rename ib_ulonglong to ib_uint64_t and ib_longlong to ib_int64_t. 2008-03-17 14:19:04 +00:00
marko
ebdb9daa9b branches/zip: Merge 2295:2367 from branches/5.1. 2008-03-17 14:09:44 +00:00
marko
94c7701081 branches/zip: dict_table_print_low(): Print table->flags, so that users
can create the table innodb_table_monitor and see in the error log which
tables are incompatible with older versions of InnoDB.
2008-03-11 08:57:25 +00:00
marko
583ce8e896 branches/zip: Fix two more bogus MSVC C4090 warnings on constness differences
(Warning C4090 is incorrectly issued when using Visual C++ .NET 2003,
bug 101661, http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101661)

dict_table_find_equivalent_index(): Cast away constness in the mem_free()
call.  MSVC seems to think that an array of pointers to const data is
const itself.

UT_SORT_FUNCTION_BODY(): Cast away constness in the memcpy() call.
MSVC seems to think that an array of pointers to const data is const itself.
2008-03-05 09:54:48 +00:00
marko
997de88df6 branches/zip: dict0dict.c: Add the #include "ha_prototypes.h" that should
have been added in r2327.
2008-02-28 08:33:19 +00:00
vasil
26402257da branches/zip:
Use innobase_strcasecmp() insteaed of strcasecmp() in i_s.cc and get rid
of strings.h (that file is not present on Windows).

Move the prototype of innobase_strcasecmp() from ha_innodb.cc and
dict0dict.c to ha_prototypes.h.

Approved by:	Heikki
2008-02-27 16:53:56 +00:00
marko
2c2b06ad75 branches/zip: Introduce UNIV_INTERN, a linkage specifier for InnoDB-global
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.
2008-02-06 14:17:36 +00:00
marko
7d34b71cb9 branches/zip: Introduce the accessor function dict_index_is_ibuf()
for determining if an index is the insert buffer B-tree.
2008-01-25 08:13:12 +00:00
marko
463141d149 branches/zip: Implement a limit for the size of undo log records.
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.
2007-12-19 14:03:39 +00:00
marko
b33d8c401d branches/zip: dict0dict.c: Minor cleanup.
dict_index_copy(): Remove the prototype, because this static function
will be defined before its first use.  Add const qualifier to "table".

dict_index_build_internal_clust(), dict_index_build_internal_non_clust():
Add const qualifier to "table".  Correct the comment about setting indexed[].
2007-12-19 11:58:46 +00:00
marko
5a6cc2130c branches/zip: dict_table_copy_types(): Initialize all fields to the SQL NULL
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.
2007-12-07 09:12:57 +00:00
marko
a7344bc8e1 branches/zip: Merge 2015:2093 from trunk. 2007-11-16 13:57:27 +00:00
marko
8758ac866f branches/zip: dict_index_copy_rec_order_prefix(): Add const qualifiers. 2007-10-01 08:00:24 +00:00
marko
23f80a6f54 branches/zip: Merge 1862:1894 from trunk, except 1866. 2007-09-27 11:17:45 +00:00
marko
d0631476b6 branches/zip: Minor cleanup.
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().
2007-09-26 09:59:17 +00:00
marko
5c9122e753 branches/zip: Add some const qualifiers or in/out comments to the
dict_index_t* and dict_table_t* parameters of some functions.
2007-09-24 13:29:18 +00:00
marko
52a8928693 branches/zip: Simplify crash recovery in fast index creation.
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.
2007-09-05 10:18:03 +00:00
marko
d1be7f720e branches/zip: Remove trx->sync_cb. Call dict_rename_indexes() directly
from ha_innobase::add_index().

dict_rename_indexes(): Remove the redundant parameter commit_flag.
2007-08-21 12:36:13 +00:00
marko
a2565facc8 branches/zip: dict_table_rename_in_cache(): Improve the diagnostic printout
for the error cases.  Avoid copying the old table->name; the string will
remain valid in table->heap.
2007-08-20 09:43:30 +00:00
marko
e1c3be5e03 branches/zip: Rename mem_heap_calloc() and mem_calloc() to
mem_heap_zalloc() and mem_zalloc(), because calloc() in the C runtime
library takes two size parameters, not one.

mem_heap_zalloc(): Add debug assertions.  Document that the return value
is never NULL.
2007-08-16 13:25:56 +00:00
marko
31ba41df9f branches/zip: Remove redundant type casts. Change the parameter type
of ut_strcmp() from const void* to const char*.
2007-08-16 09:09:08 +00:00
marko
11665dc32a branches/zip: Ensure that the dictionary updates are atomic by keeping
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.
2007-08-02 10:55:25 +00:00
marko
d662c3c656 branches/zip: Merge 1575:1664 from trunk. 2007-08-01 11:18:43 +00:00
marko
54113d6d9f branches/zip: HASH_SEARCH(): Add the parameter TYPE, for the type of DATA.
C++ requires explicit type casts when converting from void*, and *.ic files
are now inlined in ha_innodb.cc.

fil_space_get_by_id(), fil_space_get_by_name(): New inline functions, to
replace occurrences of the HASH_SEARCH() macro in fil0fil.c.  This should
improve readability.
2007-08-01 08:13:22 +00:00
marko
f29addba49 branches/zip: Enable calls to inlined InnoDB functions in ha_innodb.cc,
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.
2007-06-20 08:26:26 +00:00
marko
71e8cceeab branches/zip: Define mem_heap_calloc() and mem_calloc(). Use them
when allocating zero-filled memory.
2007-06-19 09:39:27 +00:00
marko
c09c8a27d1 branches/zip: Document dict_rename_indexes() better. 2007-06-07 09:47:59 +00:00
marko
7fbc04fcdc branches/zip: Merge 1533:1553 from trunk. 2007-06-06 11:07:37 +00:00
marko
d75e64f98a branches/zip: Merge 1493:1533 from trunk.
Make use of UT_BITS_IN_BYTES().
2007-05-29 08:48:16 +00:00
marko
e7284367dc branches/zip: Merge revisions 1402:1493 from trunk.
Remove mysql.patch, because the configuration parameter interface has changed.
2007-05-14 09:07:15 +00:00
marko
b90b4f59b4 branches/zip: Make use of the function dict_index_is_unique(). 2007-04-16 09:21:39 +00:00
marko
a47b9e64e6 branches/zip: Merge branches/fast-index-creation -r1413.
Fix some bugs.  The tests innodb and innodb-index fail, but that might
be due to an old MySQL source tree being used.
2007-04-04 11:05:33 +00:00
marko
33c1125d55 branches/zip: Merge revisions 1322:1402 from trunk. 2007-04-02 05:39:41 +00:00
marko
8332c1f717 branches/zip: Merge revisions 1271:1322 from trunk. 2007-03-01 13:53:57 +00:00
marko
17f87488fb branches/zip: dict_table_copy_types(), dict_index_copy_types(): Add const
qualifiers.  Correct the documentation of the parameters.
2007-02-28 16:04:19 +00:00
marko
0178dba161 branches/zip: Avoid memory fragmentation when adding column definitions
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".
2007-01-30 09:24:18 +00:00
marko
d8536b0de8 branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. 2007-01-18 18:29:12 +00:00