Commit graph

150 commits

Author SHA1 Message Date
marko
759f763644 branches/zip: dict_table_check_for_dup_indexes(): Assert that the
data dictionary mutex is being held while table->indexes is accessed.
This is already the case.

Currently, only dict_table_get_next_index() and dict_table_get_first_index()
are being invoked without holding dict_sys->mutex.
2009-12-03 12:47:12 +00:00
marko
b1d5011cb1 branches/zip: Suppress errors about non-found temporary tables.
Write the is_temp flag to SYS_TABLES.MIX_LEN.

dict_table_t:🎏 Add a flag for is_temporary, DICT_TF2_TEMPORARY.
Unlike other flags, this will not be written to the tablespace flags
or SYS_TABLES.TYPE, but only to SYS_TABLES.MIX_LEN.

dict_build_table_def_step(): Only pass DICT_TF_BITS to tablespaces.

dict_check_tablespaces_and_store_max_id(), dict_load_table():
Suppress errors about temporary tables not being found.

dict_create_sys_tables_tuple(): Write the DICT_TF2_TEMPORARY flag
to SYS_TABLES.MIX_LEN.

fil_space_create(), fil_create_new_single_table_tablespace(): Add assertions
about space->flags.

row_drop_table_for_mysql(): Do not complain about non-found temporary tables.

rb://160 approved by Heikki Tuuri.  This addresses the second part of
Bug #41609 Crash recovery does not work for InnoDB temporary tables.
2009-11-30 10:50:11 +00:00
marko
ae82e81e3c branches/zip: dict_index_too_big_for_undo(): Correct a typo. 2009-11-04 13:24:28 +00:00
marko
dda7217e08 branches/zip: Free all resources at shutdown. Set pointers to NULL, so
that Valgrind will not complain about freed data structures that are
reachable via pointers.  This addresses Bug #45992 and Bug #46656.

This patch is mostly based on changes copied from branches/embedded-1.0,
mainly c5432, c3439, c3134, c2994, c2978, but also some other code was
copied.  Some added cleanup code is specific to MySQL/InnoDB.

rb://199 approved by Sunny Bains
2009-11-02 09:42:56 +00:00
marko
6f14c55872 branches/zip: Merge revisions 5622:5912 from branches/5.1, except r5700
(changes to CMakeLists.txt)

  ------------------------------------------------------------------------
  r5622 | vasil | 2009-08-03 15:27:00 +0300 (Mon, 03 Aug 2009) | 20 lines
  Changed paths:
     M /branches/5.1/Makefile.am

  branches/5.1:

  Merge a change from MySQL:

    ------------------------------------------------------------
    revno: 2988
    committer: Satya B <satya.bn@sun.com>
    branch nick: mysql-5.1-bugteam
    timestamp: Wed 2009-07-01 11:06:05 +0530
    message:
      Fix build failure after applying Innodb snapshot 5.1-ss5282

      After applying Innodb snapshot 5.1-ss5282, build was broken
      because of missing header file.

      Adding the header file to Makefile.am after informing the
      innodb developers.
    modified:
      storage/innobase/Makefile.am
  ------------------------------------------------------------------------
  r5740 | jyang | 2009-09-03 06:33:47 +0300 (Thu, 03 Sep 2009) | 5 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
     M /branches/5.1/include/db0err.h
     A /branches/5.1/mysql-test/innodb_bug46000.result
     A /branches/5.1/mysql-test/innodb_bug46000.test

  branches/5.1: Disallow creating index with the name of
  "GEN_CLUST_INDEX" which is reserved for the default system
  primary index. (Bug #46000) rb://149 approved by Sunny Bains.
  ------------------------------------------------------------------------
  r5741 | jyang | 2009-09-03 07:16:01 +0300 (Thu, 03 Sep 2009) | 5 lines
  Changed paths:
     M /branches/5.1/dict/dict0dict.c
     M /branches/5.1/handler/ha_innodb.cc
     A /branches/5.1/mysql-test/innodb_bug44369.result
     A /branches/5.1/mysql-test/innodb_bug44369.test
     M /branches/5.1/row/row0mysql.c

  branches/5.1: Block creating table with column name conflicting
  with Innodb reserved key words. (Bug #44369) rb://151 approved
  by Sunny Bains.
  ------------------------------------------------------------------------
  r5757 | jyang | 2009-09-04 04:26:13 +0300 (Fri, 04 Sep 2009) | 3 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
     M /branches/5.1/include/db0err.h
     D /branches/5.1/mysql-test/innodb_bug46000.result
     D /branches/5.1/mysql-test/innodb_bug46000.test

  branches/5.1: Revert change in 5740. Making the fix in a subsequent
  check in.
  ------------------------------------------------------------------------
  r5760 | jyang | 2009-09-04 07:07:34 +0300 (Fri, 04 Sep 2009) | 3 lines
  Changed paths:
     M /branches/5.1/dict/dict0dict.c
     M /branches/5.1/handler/ha_innodb.cc
     D /branches/5.1/mysql-test/innodb_bug44369.result
     D /branches/5.1/mysql-test/innodb_bug44369.test
     M /branches/5.1/row/row0mysql.c

  branches/5.1: This is to revert change 5741. A return status for
  create_table_def() needs to be fixed.
  ------------------------------------------------------------------------
  r5797 | calvin | 2009-09-09 18:26:29 +0300 (Wed, 09 Sep 2009) | 3 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc

  branches/5.1: merge change from 5.1.38

  HA_ERR_TOO_MANY_CONCURRENT_TRXS is added in 5.1.38.
  ------------------------------------------------------------------------
  r5799 | calvin | 2009-09-09 20:47:31 +0300 (Wed, 09 Sep 2009) | 10 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc

  branches/5.1: fix bug#46256

  Allow tables to be dropped even if the collation is not found,
  but issue a warning.

  Could not find an easy way to add mysql-test since it requires
  changes to charsets and restarting the server. Tests were
  executed manually.

  Approved by: Heikki (on IM)
  ------------------------------------------------------------------------
  r5805 | vasil | 2009-09-10 08:41:48 +0300 (Thu, 10 Sep 2009) | 7 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc

  branches/5.1:

  Fix a compilation warning caused by c5799:

  handler/ha_innodb.cc: In function 'void innobase_get_cset_width(ulint, ulint*, ulint*)':
  handler/ha_innodb.cc:830: warning: format '%d' expects type 'int', but argument 2 has type 'ulint'
  ------------------------------------------------------------------------
  r5834 | jyang | 2009-09-11 00:43:05 +0300 (Fri, 11 Sep 2009) | 5 lines
  Changed paths:
     M /branches/5.1/dict/dict0dict.c
     M /branches/5.1/handler/ha_innodb.cc
     A /branches/5.1/mysql-test/innodb_bug44369.result
     A /branches/5.1/mysql-test/innodb_bug44369.test
     M /branches/5.1/row/row0mysql.c

  branches/5.1: Block creating table with column name conflicting
  with Innodb reserved key words. (Bug #44369) rb://151 approved
  by Sunny Bains.
  ------------------------------------------------------------------------
  r5895 | jyang | 2009-09-15 03:39:21 +0300 (Tue, 15 Sep 2009) | 5 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
     A /branches/5.1/mysql-test/innodb_bug46000.result
     A /branches/5.1/mysql-test/innodb_bug46000.test

  branches/5.1: Disallow creating index with the name of
  "GEN_CLUST_INDEX" which is reserved for the default system
  primary index. (Bug #46000) rb://149 approved by Marko Makela.
  ------------------------------------------------------------------------
2009-09-16 08:54:43 +00:00
marko
1a9bfd68d0 branches/zip: dict_index_find_cols(): On column name lookup failure,
return DB_CORRUPTION (HA_ERR_CRASHED) instead of abnormally
terminating the server.  Also, disable the previously added diagnostic
output to the error log, because mysql-test-run does not like extra
output in the error log.  (Bug #44571)

dict_index_add_to_cache(): Handle errors from dict_index_find_cols().

mysql-test/innodb_bug44571.test: A test case for triggering the bug.

rb://135 approved by Sunny Bains.
2009-08-27 10:56:24 +00:00
marko
3d5e2e868d branches/zip: Replace <number> with NUMBER in some comments,
to avoid problems with Doxygen XML output.
2009-08-05 10:06:55 +00:00
sunny
8cc05e7713 branches/zip: The dict_table_t::autoinc_mutex field is not used in HotBackup. 2009-07-20 06:29:14 +00:00
marko
dcd851bcbe branches/zip: dict_index_find_cols(): Print diagnostic on name mismatch.
This addresses Bug #44571 but does not fix it.
rb://135 approved by Sunny Bains.
2009-06-25 09:45:57 +00:00
marko
a4401ad069 branches/zip: Merge revisions 5148:5233 from branches/5.1:
------------------------------------------------------------------------
  r5150 | vasil | 2009-05-27 18:56:03 +0300 (Wed, 27 May 2009) | 4 lines

  branches/5.1:

  Whitespace fixup.
  ------------------------------------------------------------------------
  r5191 | vasil | 2009-05-30 17:46:05 +0300 (Sat, 30 May 2009) | 19 lines

  branches/5.1:

  Merge a change from MySQL (this fixes the failing innodb_mysql test):

    ------------------------------------------------------------
    revno: 1810.3894.10
    committer: Sergey Glukhov <Sergey.Glukhov@sun.com>
    branch nick: mysql-5.0-bugteam
    timestamp: Tue 2009-05-19 11:32:21 +0500
    message:
      Bug#39793 Foreign keys not constructed when column has a '#' in a comment or default value
      Internal InnoDN FK parser does not recognize '\'' as quotation symbol.
      Suggested fix is to add '\'' symbol check for quotation condition
      (dict_strip_comments() function).
    modified:
      innobase/dict/dict0dict.c
      mysql-test/r/innodb_mysql.result
      mysql-test/t/innodb_mysql.test
  ------------------------------------------------------------------------
  r5233 | marko | 2009-06-03 15:12:44 +0300 (Wed, 03 Jun 2009) | 11 lines

  branches/5.1: Merge the test case from r5232 from branches/5.0:
    ------------------------------------------------------------------------
    r5232 | marko | 2009-06-03 14:31:04 +0300 (Wed, 03 Jun 2009) | 21 lines

    branches/5.0: Merge r3590 from branches/5.1 in order to fix Bug #40565
    (Update Query Results in "1 Row Affected" But Should Be "Zero Rows").

    Also, add a test case for Bug #40565.

    rb://128 approved by Heikki Tuuri
    ------------------------------------------------------------------------
  ------------------------------------------------------------------------
2009-06-03 11:26:41 +00:00
marko
68a1ee9960 branches/zip: Add some Doxygen comments for many structs, typedefs,
#defines and global variables.  Many are still missing.
2009-05-26 12:28:49 +00:00
marko
11ff89d994 branches/zip: Add @file comments, and convert decorative
/*********************************
comments to Doxygen /** style like this:
/*****************************//**

This conversion was performed by the following command:

perl -i -e 'while(<ARGV>){if (m|^/\*{30}\**$|) {
s|\*{4}$|//**| if ++$com>1; $_ .= "\@file $ARGV\n" if $com==2}
print; if(eof){$.=0;undef $com}}' */*[ch] include/univ.i
2009-05-25 09:52:29 +00:00
marko
d075e80c49 branches/zip: Split some long lines that were introduced in r5091. 2009-05-25 08:09:45 +00:00
marko
a45e6d2bae branches/zip: Adjust some function comments after r5091. 2009-05-25 05:54:17 +00:00
marko
e49dee377b branches/zip: Convert the function comments to Doxygen format.
This patch was created by running the following commands:

for i in */*[ch]; do doxygenify.pl $i; done
perl -i -pe 's#\*{3} \*/$#****/#' */*[ch]

where doxygenify.pl is
https://svn.innodb.com/svn/misc/trunk/tools/doxygenify.pl r510

Verified the consistency as follows:

(0) not too many /* in: */ or /* out: */ comments left in the code:
grep -l '/\*\s*\(in\|out\)[,:/]' */*[ch]

(1) no difference when ignoring blank lines, after stripping all
C90-style /* comments */, including multi-line ones, before and after
applying this patch:

perl -i -e 'undef $/;while(<ARGV>){s#/\*(.*?)\*/##gs;print}' */*[ch]
diff -I'^\s*$' --exclude .svn -ru TREE1 TREE2

(2) after stripping @return comments and !<, generated a diff and omitted
the hunks where /* out: */ function return comments were removed:

perl -i -e'undef $/;while(<ARGV>){s#!<##g;s#\n\@return\t.*?\*/# \*/#gs;print}'\
 */*[ch]
svn diff|
perl -e 'undef $/;$_=<>;s#\n-\s*/\* out[:,]([^\n]*?)(\n-[^\n]*?)*\*/##gs;print'

Some unintended changes were left.  These will be removed in a
subsequent patch.
2009-05-25 05:30:14 +00:00
vasil
1b3cac5689 branches/zip:
Whitespace fixup.
2009-05-21 04:27:00 +00:00
marko
288a29458b branches/zip: Clean up some comments. 2009-05-20 10:06:59 +00:00
marko
6ec131d6f7 branches/zip: Merge revisions 4746:4976 from branches/5.1:
------------------------------------------------------------------------
  r4976 | marko | 2009-05-13 15:44:54 +0300 (Wed, 13 May 2009) | 6 lines

  branches/5.1: Display DB_ROLL_PTR in the COLUMNS section of the
  innodb_table_monitor output.  It was accidentally omitted due to an
  off-by-one loop condition.  (Bug #44320)

  rb://116 approved by Heikki Tuuri
  ------------------------------------------------------------------------
2009-05-13 11:49:38 +00:00
marko
a0714b182c branches/zip: univ.i: Define REFMAN as the base URL of the
MySQL Reference Manual and use it in every string.
This fixes Issue #221.
2009-04-16 12:02:27 +00:00
marko
cd1909f6b3 branches/zip: Hide unnecessarily visible globals.
dict_ind_redundant, dict_ind_compact: Declare these UNIV_INTERN.
innodb_hton_ptr: Declare static.  We do not attempt to access the
built-in InnoDB any more.
trx_roll_savepoints_free(): Declare UNIV_INTERN.
2009-04-08 10:24:49 +00:00
marko
ab341009d7 branches/zip: Allow in-place updates of UTF-8 CHAR columns
from or to NULL in ROW_FORMAT=REDUNDANT. (Bug #44032)

rb://107 approved by Heikki Tuuri.
2009-04-07 11:45:28 +00:00
marko
ab67f4eb4a branches/zip: Refuse to use newly created indexes that may lack
history.  This addresses Mantis issue #116.

dict_index_t: Enable the storage of trx_id.

row_prebuilt_t: Make many fields bit-fields to reduce the memory
footprint. Add index_usable.

ha_innobase::change_active_index(): Check if the index is usable and
set prebuilt->index_usable accordingly. Unfortunately, the return
status of this function is ignored by MySQL, and the actual refusal to
use the index must be made in row_search_for_mysql().

row_search_for_mysql(): Return DB_MISSING_HISTORY if
!prebuilt->index_usable.

convert_error_code_to_mysql(): Map DB_MISSING_HISTORY to
HA_ERR_TABLE_DEF_CHANGED.

innodb-index.test: Add a test case where access to a newly created
secondary index must be blocked for old transactions.

rb://100 approved by Heikki Tuuri
2009-04-02 12:23:12 +00:00
marko
349090707c branches/zip: Remove references to UNIV_HOTBACKUP from files that are
not used when building InnoDB Hot Backup.  Declare
innobase_invalidate_query_cache() in ha_prototypes.h.
2009-03-24 12:02:29 +00:00
marko
d90bea085a branches/zip: Remove unneeded definitions and dependencies
from UNIV_HOTBACKUP builds.
2009-03-23 14:21:34 +00:00
marko
184ee4885c branches/zip: Non-functional change for reducing dependencies in InnoDB Hot Backup:
Replace srv_sys->dummy_ind1 and srv_sys->dummy_ind2 with
dict_ind_redundant and dict_ind_compact, initialized in dict_init().
2009-03-20 10:33:33 +00:00
vasil
4e0e5e1e53 branches/zip:
* 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 2/28]
2009-02-17 08:15:06 +00:00
vasil
9bc861b4e8 branches/zip:
* 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 1/28]
2009-02-17 08:12:02 +00:00
marko
bef98e3442 branches/zip: Remove some redundant #include statements. 2009-01-23 09:04:49 +00:00
marko
2341d537a4 branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
  r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines

  branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
  InnoDB previously treated savepoints as a stack e.g.,
    SAVEPOINT a;
    SAVEPOINT b;
    SAVEPOINT c;
    SAVEPOINT b; <- This would delete b and c.

  This fix changes the behavior to:
    SAVEPOINT a;
    SAVEPOINT b;
    SAVEPOINT c;
    SAVEPOINT b; <- Does not delete savepoint c
  ------------------------------------------------------------------------
  r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines

  branches/5.1: dict_load_table(): If dict_load_indexes() fails,
  invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
  so that the data dictionary will not point to freed data.
  (Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
  ------------------------------------------------------------------------
2009-01-14 14:06:22 +00:00
marko
2f7bcc7d99 branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.

HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.

dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.

HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().

dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).

dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).

fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).

fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).

buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).

buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).

get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).

This was posted as rb://75 for tracking down errors similar to Issue #153.
2009-01-13 19:46:22 +00:00
marko
6bdab319ad branches/zip: Always check for "row too large" when executing SQL to create
an index or table.  We have to skip this check when loading table definitions
from the data dictionary, because we could otherwise refuse to load old
tables (even uncompressed ones).  This addresses Issue #119.

The first "row too large" check was implemented in MySQL 5.0.3
to address MySQL Bug #5682.  In the InnoDB Plugin 1.0.2, a more
accurate check was implemented in innodb_strict_mode.  We now
make the check unconditional.

dict_create_index_step(): Pass strict=TRUE to dict_index_add_to_cache().

trx_is_strict(), thd_is_strict(): Remove.

innodb-zip.test: Test in innodb_strict_mode=OFF.

innodb_bug36169.test: Ensure that none of the tables can be created.

rb://56 approved by Sunny Bains.
2008-11-20 10:22:40 +00:00
sunny
7fed1c703e branches/zip:
1. We add a vector of locks to trx_t. This array contains the autoinc
  locks granted to a transaction. There is one per table.

  2. We enforce releasing of these locks in the reverse order from the
  one in which they are acquired. The assumption is that since the
  AUTOINC locks are statement level locks. Nested statements introduced
  by triggers are stacked it should hold.

There was some cleanup done to the vector code too by adding const and
some new functions. Rename dict_table_t::auto_inc_lock to autoinc_lock.

Fix Bug#26316 Triggers create duplicate entries on auto-increment columns
rb://22
2008-10-31 07:40:29 +00:00
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
marko
a9a21fb983 branches/zip: Do not release the data dictionary latch while holding locks
to the data dictionary records.  This should fix Issue #83.

row_drop_table_for_mysql_no_commit(): Rename back to
row_drop_table_for_mysql().  Commit the transaction if the data
dictionary was not locked when the function was called.  Otherwise,
neither commit the transaction nor unlock the data dictionary.

row_merge_drop_table(): Let row_drop_table_for_mysql() take care of
locking the data dictionary.

dict_create_or_check_foreign_constraint_tables(),
trx_rollback_active(), row_create_table_for_mysql(),
row_create_index_for_mysql(), row_table_add_foreign_constraints():
Explicitly commit the transaction, because row_drop_table_for_mysql()
would no longer commit it, given that the data dictionary will be
locked during the calls.

Approved by Sunny (over IM). rb://23
2008-10-08 08:54:16 +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
sunny
cb0cacc2d8 branches/zip: Merge revisions 2702:2722 from branches/5.1:
------------------------------------------------------------------------
  r2702 | sunny | 2008-09-30 11:41:56 +0300 (Tue, 30 Sep 2008) | 13 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
  
  branches/5.1: Since handler::get_auto_increment() doesn't allow us
  to return the cause of failure we have to inform MySQL using the
  sql_print_warning() function to return the cause for autoinc failure.
  Previously we simply printed the error code, this patch prints the
  text string representing the following two error codes:
  
  DB_LOCK_WAIT_TIMEOUT
  DB_DEADLOCK.
  
  Bug#35498 Cannot get table test/table1 auto-inccounter value in ::info
  
  Approved by Marko.
  
  ------------------------------------------------------------------------
  r2709 | vasil | 2008-10-01 10:13:13 +0300 (Wed, 01 Oct 2008) | 10 lines
  Changed paths:
     M /branches/5.1/include/lock0lock.h
     M /branches/5.1/lock/lock0lock.c
     A /branches/5.1/mysql-test/innodb_bug38231.result
     A /branches/5.1/mysql-test/innodb_bug38231.test
     M /branches/5.1/row/row0mysql.c
  
  branches/5.1:
  
  Fix Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK
  
  In TRUNCATE TABLE and discard tablespace: do not remove table-level S
  and X locks and do not assert on such locks not being wait locks.
  Leave such locks alone.
  
  Approved by:	Heikki (rb://14)
  
  ------------------------------------------------------------------------
  r2710 | vasil | 2008-10-01 14:13:58 +0300 (Wed, 01 Oct 2008) | 6 lines
  Changed paths:
     M /branches/5.1/include/sync0sync.ic
  
  branches/5.1:
  
  Silence a compilation warning in UNIV_DEBUG.
  
  Approved by:	Marko (via IM)
  
  ------------------------------------------------------------------------
  r2719 | vasil | 2008-10-03 18:17:28 +0300 (Fri, 03 Oct 2008) | 49 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
     A /branches/5.1/mysql-test/innodb_bug39438-master.opt
     A /branches/5.1/mysql-test/innodb_bug39438.result
     A /branches/5.1/mysql-test/innodb_bug39438.test
  
  branches/5.1:
  
  Fix Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch
  
  In ha_innobase::info() - do not try to get the free space for a tablespace
  which has been discarded with ALTER TABLE ... DISCARD TABLESPACE or if the
  .ibd file is missing for some other reason.
  
  ibd_file_missing and tablespace_discarded are manipulated only in
  row_discard_tablespace_for_mysql() and in row_import_tablespace_for_mysql()
  and the manipulation is protected/surrounded by
  row_mysql_lock_data_dictionary()/row_mysql_unlock_data_dictionary() thus we
  do the same in ha_innobase::info() when checking the values of those members
  to avoid race conditions. I have tested the code-path with UNIV_DEBUG and
  UNIV_SYNC_DEBUG.
  
  Looks like it is not possible to avoid mysqld printing warnings in the
  mysql-test case and thus this test innodb_bug39438 must be added to the
  list of exceptional test cases that are allowed to print warnings. For this,
  the following patch must be applied to the mysql source tree:
  
    --- cut ---
    === modified file 'mysql-test/lib/mtr_report.pl'
    --- mysql-test/lib/mtr_report.pl	2008-08-12 10:26:23 +0000
    +++ mysql-test/lib/mtr_report.pl	2008-10-01 11:57:41 +0000
    @@ -412,7 +412,10 @@
     
                     # When trying to set lower_case_table_names = 2
                     # on a case sensitive file system. Bug#37402.
    -                /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive.  Now setting lower_case_table_names to 0 to avoid future problems./
    +                /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive.  Now setting lower_case_table_names to 0 to avoid future problems./ or
    +
    +                # this test is expected to print warnings
    +                ($testname eq 'main.innodb_bug39438')
     		)
                 {
                   next;                       # Skip these lines
    
    --- cut ---
  
  The mysql-test is currently somewhat disabled (see inside
  innodb_bug39438.test), after the above patch has been applied to the mysql
  source tree, the test can be enabled.
  
  rb://20
  
  Reviewed by:	Inaam, Calvin
  Approved by:	Heikki
  
  ------------------------------------------------------------------------
  r2720 | vasil | 2008-10-03 19:52:39 +0300 (Fri, 03 Oct 2008) | 8 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
  
  branches/5.1:
  
  Print a warning if an attempt is made to get the free space for a table
  whose .ibd file is missing or the tablespace has been discarded. This is a
  followup to r2719.
  
  Suggested by:	Inaam
  
  ------------------------------------------------------------------------
  r2721 | sunny | 2008-10-04 02:08:23 +0300 (Sat, 04 Oct 2008) | 6 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
  
  branches/5.1: We need to send the messages to the client because
  handler::get_auto_increment() doesn't allow a way to return the
  specific error for why it failed.
  
  rb://18
  
  ------------------------------------------------------------------------
  r2722 | sunny | 2008-10-04 02:48:04 +0300 (Sat, 04 Oct 2008) | 18 lines
  Changed paths:
     M /branches/5.1/dict/dict0mem.c
     M /branches/5.1/handler/ha_innodb.cc
     M /branches/5.1/include/dict0mem.h
     M /branches/5.1/include/row0mysql.h
     M /branches/5.1/mysql-test/innodb-autoinc.result
     M /branches/5.1/mysql-test/innodb-autoinc.test
     M /branches/5.1/row/row0mysql.c
  
  branches/5.1: This bug has always existed but was masked by other errors. The
  fix for bug# 38839 triggered this bug. When the offset and increment are > 1
  we need to calculate the next value taking into consideration the two
  variables. Previously we simply assumed they were 1 particularly offset was
  never used. MySQL does its own calculation and that's probably why it seemed
  to work in the past. We would return what we thought was the correct next
  value and then MySQL would recalculate the actual value from that and return
  it to the caller (e.g., handler::write_row()). Several new tests have been
  added that try and catch some edge cases. The tests exposed a wrap around
  error in MySQL next value calculation which was filed as bug#39828. The tests
  will need to be updated once MySQL fix that bug.
  
  One good side effect of this fix is that dict_table_t size has been
  reduced by 8 bytes because we have moved the autoinc_increment field to
  the row_prebuilt_t structure. See review-board for a detailed discussion.
  
  rb://3
  
  ------------------------------------------------------------------------
2008-10-04 03:22:36 +00:00
marko
d9317eb699 branches/zip: Non-functional change:
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.
2008-09-22 06:59:58 +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
93f57e92dc branches/zip: Clean up: do not assign index->id as a special case
in fast index creation.  In r1399, we wrote undo log records about
creating indexes.  The special undo log records were deemed
unnecessary later, but this special handling was not removed then.

row_merge_create_index(): Do not assign index->id.

dict_build_index_def_step(): Unconditionally assign index->id.
2008-08-29 09:13:16 +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
15c670988f branches/zip: Pass the tablespace flags correctly when creating or opening
single-table tablespaces.  This bug was reported by Sunny as Mantis issue #26.

fil_space_create(), fil_create_new_single_table_tablespace(),
fil_open_single_table_tablespace(), fsp_header_init_fields():
Add ut_a(flags != DICT_TF_COMPACT).

dict_build_table_def_step(), row_import_tablespace_for_mysql(),
row_truncate_table_for_mysql(): Pass correct flags to
fil_create_new_single_table_tablespace() or fil_open_single_table_tablespace().
2008-03-18 10:10:51 +00:00