Commit graph

215 commits

Author SHA1 Message Date
vasil
c6232c06fa branches/zip:
To the files touched by the Google patch from c4144 (excluding
include/os0sync.ic because later we removed Google code from that file):

* Remove the Google license
* Remove old Innobase copyright lines
* Add a reference to the Google license and to the GPLv2 license at the top,
as recommended by the lawyers at Oracle Legal.
2009-02-17 07:56:33 +00:00
marko
25f45c0d1c branches/zip: Make innodb_thread_concurrency=0 the default.
The old default was 8.
2009-02-11 22:14:19 +00:00
marko
ecda78f01c branches/zip: get_share(), free_share(): Make table locking case sensitive.
If lower_case_table_names=1, MySQL will pass the table names in lower case.
Thus, we can use a binary comparison (strcmp) in the hash table.

rb://87 approved by Heikki Tuuri, to address Bug #41676 and Issue #167.
2009-02-10 09:51:43 +00:00
inaam
a1bb700fd2 branches/zip rb://30
This patch changes the innodb mutexes and rw_locks implementation.
On supported platforms it uses GCC builtin atomics. These changes
are based on the patch sent by Mark Callaghan of Google under BSD
license. More technical discussion can be found at rb://30

Approved by: Heikki
2009-02-09 23:36:25 +00:00
marko
6aab391620 branches/zip: Make innodb_adaptive_hash_index settable.
btr_search_disabled: Rename to btr_search_enabled and change the type
to char, so that it can be directly linked to the MySQL parameters.
Note that the variable is protected by btr_search_latch and
btr_search_enabled_mutex, a new mutex introduced in this patch.

btr_search_enabled_mutex: A new mutex, to protect btr_search_enabled
together with btr_search_latch.

buf_pool_drop_hash_index(): New function, to be called from
btr_search_disable().

btr_search_disable(), btr_search_enable(): Fix bugs.  These functions
were previously unused.

btr_search_guess_on_hash(), btr_search_build_page_hash_index():
Check btr_search_enabled once more, while holding btr_search_latch.

btr_cur_search_to_nth_level(): Note that the reads of btr_search_enabled
may be dirty and explain why it should not be a problem.

innobase_adaptive_hash_index: Remove. The variable btr_search_enabled will be used directly instead.

innodb_adaptive_hash_index_update(): New function, an update callback for
innodb_adaptive_hash_index.  This will call either btr_search_disable()
or btr_search_enable() when the value is assigned.  The functions will
be called even if the value does not appear to be changed, e.g., when
setting from TRUE to TRUE or FALSE to FALSE.

rb://85 approved by Heikki Tuuri.  This addresses Issue #163.
2009-01-30 21:30:29 +00:00
marko
635268b769 branches/zip: ibuf_use_t: Add the constant IBUF_USE_COUNT, to eliminate
a gcc warning about an assertion that trivially holds.
The warning was introduced in r4061, in the merge of
branches/innodb+ -r4053.

ibuf_insert(): Let an assertion fail if ibuf_use is unknown.
2009-01-30 10:58:56 +00:00
marko
8b025adba6 branches/zip: Port the applicable parts of r4053 from branches/innodb+:
Implement the global variable innodb_change_buffering, with the
following values:

none - buffer nothing
inserts - buffer inserts (the default)

Approved by Ken Jacobs.
2009-01-29 09:27:09 +00:00
calvin
533afa46ce branches/zip: Merge revisions 4032:4035 from branches/5.1
All InnoDB related tests passed on Windows, except
known failure in partition_innodb_semi_consistent.

The inadvertent change to btr0sea.c in this commit is reverted in r4060.

  ------------------------------------------------------------------------
  r4035 | vasil | 2009-01-26 09:26:25 -0600 (Mon, 26 Jan 2009) | 23 lines

  branches/5.1:

  Merge a change from MySQL:

    ------------------------------------------------------------
    revno: 2646.161.4
    committer: Tatiana A. Nurnberg <azundris@mysql.com>
    branch nick: 51-31177v2
    timestamp: Mon 2009-01-12 06:32:49 +0100
    message:
      Bug#31177: Server variables can't be set to their current values

      Bounds-checks and blocksize corrections were applied to user-input,
      but constants in the server were trusted implicitly. If these values
      did not actually meet the requirements, the user could not set change
      a variable, then set it back to the (wonky) factory default or maximum
      by explicitly specifying it (SET <var>=<value> vs SET <var>=DEFAULT).

      Now checks also apply to the server's presets. Wonky values and maxima
      get corrected at startup. Consequently all non-offsetted values the user
      sees are valid, and users can set the variable to that exact value if
      they so desire.
2009-01-29 01:06:41 +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
d019dd3797 branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)

innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.

innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.

check_trx_exists(): Use the above two functions.

ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().

innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available.  Otherwise, use
innobase_trx_allocate().

rb://69 accepted by Heikki Tuuri
2009-01-07 14:22:18 +00:00
marko
6c9b61690a branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
  r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines

  branches/5.1: Make
  SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
  a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
  This fixes an error that was introduced in r370, causing
  semi-consistent read not to not unlock rows in READ COMMITTED mode.
  (Bug #41671, Issue #146)

  rb://67 approved by Heikki Tuuri
  ------------------------------------------------------------------------
2009-01-05 10:54:53 +00:00
inaam
09a089ecf8 branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.

rb://62 approved by Marko
2009-01-02 13:10:50 +00:00
marko
e940107e2d branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0.  Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.

Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).

create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.

The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
2009-01-02 09:02:44 +00:00
marko
d4d4e50285 branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.

struct st_innobase_share: Make table_name const uchar*.  Add the member
table_name_hash.

innobase_open_tables: Change the type from HASH to hash_table_t*.

innobase_get_key(): Remove.

innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.

get_share(), free_share(): Use the InnoDB hash functions.

innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.

rb://65 approved by Heikki Tuuri.  This addresses Issue #104.
2008-12-30 20:33:31 +00:00
marko
d1b5613fa0 branches/zip: Merge revisions 3479:3598 from branches/5.1:
------------------------------------------------------------------------
  r3588 | inaam | 2008-12-18 14:26:54 +0200 (Thu, 18 Dec 2008) | 8 lines

  branches/5.1

  It is a bug in unused code. If we don't calculate the hash value when
  calculating the mutex number then two pages which map to same hash
  value can get two different mutex numbers.

  Approved by: Marko
  ------------------------------------------------------------------------
  r3590 | marko | 2008-12-18 15:33:36 +0200 (Thu, 18 Dec 2008) | 11 lines

  branches/5.1: When converting a record to MySQL format, copy the default
  column values for columns that are SQL NULL.  This addresses failures in
  row-based replication (Bug #39648).

  row_prebuilt_t: Add default_rec, for the default values of the columns in
  MySQL format.

  row_sel_store_mysql_rec(): Use prebuilt->default_rec instead of
  padding columns.

  rb://64 approved by Heikki Tuuri
  ------------------------------------------------------------------------
  r3598 | marko | 2008-12-22 15:28:03 +0200 (Mon, 22 Dec 2008) | 6 lines

  branches/5.1: ibuf_delete_rec(): When the record cannot be found and
  the tablespace has been dropped, commit the mini-transaction, so that
  InnoDB will not hold the insert buffer tree latch in exclusive mode,
  causing a potential deadlock.  This bug was introduced in the fix of
  Bug #27276 in r2924.
  ------------------------------------------------------------------------
2008-12-22 13:41:47 +00:00
marko
4ce5c4a19a branches/zip: ha_innodb.cc: Do not include some unnecessary MySQL header files. 2008-12-18 13:24:44 +00:00
vasil
7ed448ce95 branches/zip:
Merge 2929:3458 from branches/5.1 (resolving conflict in c3257,
note also that r3363 reverted r2933 so there are not changes in
mysql-test/innodb-autoinc.result with the current merge):

  ------------------------------------------------------------------------
  r2933 | calvin | 2008-10-30 02:57:31 +0200 (Thu, 30 Oct 2008) | 10 lines
  Changed paths:
     M /branches/5.1/mysql-test/innodb-autoinc.result
  
  branches/5.1: correct the result file innodb-autoinc.result
  
  Change the followings:
    auto_increment_increment
    auto_increment_offset
  
  to
    auto-increment-increment
    auto-increment-offset
  
  ------------------------------------------------------------------------
  r2981 | marko | 2008-11-07 14:54:10 +0200 (Fri, 07 Nov 2008) | 5 lines
  Changed paths:
     M /branches/5.1/row/row0mysql.c
  
  branches/5.0: row_mysql_store_col_in_innobase_format(): Correct a misleading
  comment. In the UTF-8 encoding, ASCII takes 1 byte per character, while
  the "latin1" character set (normally ISO-8859-1, but in MySQL it actually
  refers to the Windows Code Page 1252 a.k.a. CP1252, WinLatin1)
  takes 1 to 3 bytes (1 to 2 bytes for the ISO-8859-1 subset).
  ------------------------------------------------------------------------
  r3114 | calvin | 2008-11-14 20:31:48 +0200 (Fri, 14 Nov 2008) | 8 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
  
  branches/5.1: fix bug#40386: Not flushing query cache after truncate
  
  ha_statistics.records can not be 0 unless the table is empty, set to
  1 instead. The original problem of bug#29507 is fixed in the server.
  
  Additional test was done with the fix of bug#29507 in the server.
  
  Approved by: Heikki (on IM)
  ------------------------------------------------------------------------
  r3257 | inaam | 2008-11-24 22:06:50 +0200 (Mon, 24 Nov 2008) | 13 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
     M /branches/5.1/srv/srv0srv.c
     M /branches/5.1/trx/trx0trx.c
  
  branches/5.1 bug#40760
  
  The config param innodb_thread_concurrency is dynamically set and is
  read when a thread enters/exits innodb. If the value is changed between
  the enter and exit time the behaviour becomes erratic.
  The fix is not to use srv_thread_concurrency when exiting, instead use
  the flag trx->declared_to_be_inside_innodb.
  
  rb://57
  
  Approved by: Marko
  
  
  ------------------------------------------------------------------------
  r3363 | calvin | 2008-12-04 19:00:20 +0200 (Thu, 04 Dec 2008) | 13 lines
  Changed paths:
     M /branches/5.1/mysql-test/innodb-autoinc.result
  
  branches/5.1: revert the changes in r2933
  
  The changes in r2933 causes test failure on Linux.
  More investigation is needed for Windows.
  
  Change the followings in innodb-autoinc.result:
    auto-increment-increment
    auto-increment-offset
  
  back to:
    auto_increment_increment
    auto_increment_offset
  
  ------------------------------------------------------------------------
  r3412 | vasil | 2008-12-05 10:46:18 +0200 (Fri, 05 Dec 2008) | 7 lines
  Changed paths:
     M /branches/5.1/trx/trx0undo.c
  
  branches/5.1:
  
  Add the traditional 2 spaces after the timestamp so the message does
  not look like:
  
  070223 13:26:01InnoDB: Warning: canno....
  
  ------------------------------------------------------------------------
  r3458 | vasil | 2008-12-09 11:21:08 +0200 (Tue, 09 Dec 2008) | 51 lines
  Changed paths:
     M /branches/5.1/mysql-test/innodb_bug34300.test
  
  branches/5.1:
  
  Merge a change from MySQL to fix the failing innodb_bug34300 mysql-test:
  
    main.innodb_bug34300           [ fail ]
    
    mysqltest: At line 11: query 'SET @@max_allowed_packet=16777216' failed: 1621: SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
    
    Aborting: main.innodb_bug34300 failed in default mode. 
  
  The changeset is this:
  
    ------------------------------------------------------------
    revno: 2709.1.10
    committer: Staale Smedseng <staale.smedseng@sun.com>
    branch nick: b22891-51-bugteam
    timestamp: Thu 2008-11-20 08:51:48 +0100
    message:
      A fix for Bug#22891 "session level max_allowed_packet can be
      set but is ignored".
    
      This patch makes @@session.max_allowed_packed and
      @@session.net_buffer_length read-only as suggested in the bug
      report. The user will have to use SET GLOBAL (and reconnect)
      to alter the session values of these variables.
    
      The error string ER_VARIABLE_IS_READONLY is introduced.
    
      Tests are modified accordingly.
    modified:
      mysql-test/r/func_compress.result
      mysql-test/r/max_allowed_packet_basic.result
      mysql-test/r/max_allowed_packet_func.result
      mysql-test/r/net_buffer_length_basic.result
      mysql-test/r/packet.result
      mysql-test/r/union.result
      mysql-test/r/variables.result
      mysql-test/t/func_compress.test
      mysql-test/t/innodb_bug34300.test
      mysql-test/t/max_allowed_packet_basic.test
      mysql-test/t/max_allowed_packet_func.test
      mysql-test/t/net_buffer_length_basic.test
      mysql-test/t/packet.test
      mysql-test/t/union.test
      mysql-test/t/variables.test
      sql/set_var.cc
      sql/set_var.h
      sql/share/errmsg.txt
    ------------------------------------------------------------
  
  
  ------------------------------------------------------------------------
2008-12-09 09:49:03 +00:00
vasil
23a752360e branches/zip:
Revert our temporary fix for Bug#40360 Binlog related errors with binlog off

This bug was fixed in MySQL code.

Our fix went into r2944 and r2947, but this patch does not entirely revert
those revisions because we want to leave the test case that was introduced
and also r2944 itself reverted r2935 and r2936. So if we completely revert
r2944 and r2947 then we would loose the test and will restore r2935 and
r2936.

This resolves Issue#108 We should remove ib_bin_log_is_engaged() once mysql
add an equivallent, see Bug#40360
2008-12-04 16:49:24 +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
michael
337c4d9561 branches/zip: rb://53
Final version of rb://53, fixes the styling of a comment, makes
the definition and the declaration of thd_supports_xa() identical commentwise.
2008-11-17 14:02:01 +00:00
michael
c6227f3766 branches/zip:
rb://53

Improve innodb_supports_xa system variable handling and 
reduces the number of retrievals of the value from MySQL.

Approved by: Marko, over IM
2008-11-17 12:56:56 +00:00
marko
426fccde9f branches/zip: ha_innobase::create(): Remove the dependences on
DICT_TF_ZSSIZE_MAX, so that the code can be compiled with a different
uncompressed page size by redefining UNIV_PAGE_SIZE_SHIFT in univ.i.
Currently, the allowed values are 12, 13, or 14 (4k, 8k, 16k).

Make the default compressed page size half the uncompressed page size.
The previous default was 8 kilobytes, which is the same when compiling
with the default 16k uncompressed page size.

rb://50 approved by Pekka Lampio and Sunny Bains.
2008-11-11 07:28:37 +00:00
vasil
375e975071 branches/zip:
Fix Mantis issue#106 plugin init error:InnoDB: stats_on_metadata in static
InnoDB (flags=0x2401) differs from stats_on_metadata in dynamic InnoDB (fl

Ignore the NOSYSVAR flag in addition to ignoring the READONLY flag.

Approved by:	Marko (https://svn.innodb.com/rb/r/42/)
2008-10-31 09:39:07 +00:00
vasil
729ff1ad34 branches/zip:
Revert our temporary fix for "Bug#40360 Binlog related errors with binlog off"
(r2935, r2936) and deploy MySQL's one, but put the function
mysql_bin_log_is_engaged() inside mysql_addons.cc instead of in mysql's log.cc
and use a different name for it so there is no collision when MySQL adds this
function in log.cc.

[note from the future: the windows part of this patch went into r2947]

Approved by:	Marko (https://svn.innodb.com/rb/r/41/)
2008-10-31 07:44:16 +00:00
vasil
c368f38f4d branches/zip:
Fix "Bug#40360 Binlog related errors with binlog off" in InnoDB code in order
to have a Bug#40360-free InnoDB Plugin 1.0.2.

The fix does check whether binary logging is enabled in MySQL by accessing the
opt_bin_log global variable that is defined in sql/mysqld.cc.

In case MySQL does develop another solution to this via Bug#40360 then we can
revert this patch (except the mysql-tests).

The windows-plugin part of this fix will be committed as a separate commit to
ease eventual merge into branches/5.1 [note from the future: the separate
commit went into r2936].

Approved by:	Marko (https://svn.innodb.com/rb/r/39)
2008-10-30 10:17:23 +00:00
marko
bd3514db33 branches/zip: Merge revisions 2854:2929 from branches/5.1,
except r2924, which was merged from branches/zip r2866 to branches/5.1
and except r2879 which was merged separately by Calvin:

  ------------------------------------------------------------------------
  r2902 | vasil | 2008-10-28 12:10:25 +0200 (Tue, 28 Oct 2008) | 10 lines

  branches/5.1:

  Fix Bug#38189 innodb_stats_on_metadata missing

  Make the variable innodb_stats_on_metadata visible to the users and
  also settable at runtime. Previously it was only "visible" as a command
  line startup option to mysqld.

  Approved by:    Marko (https://svn.innodb.com/rb/r/36)
  ------------------------------------------------------------------------
  r2929 | marko | 2008-10-29 21:26:14 +0200 (Wed, 29 Oct 2008) | 13 lines

  branches/5.1: dtype_get_sql_null_size(): return the correct storage
  size of a SQL NULL column. (Bug #40369)

  When MySQL Bug #20877 was fixed in r834, this function was
  accidentally modified to return 0 or 1. Apparently, the only impact of
  this bug is that fixed-length columns cannot be updated in-place from
  or to SQL NULL, even in ROW_FORMAT=REDUNDANT.  After this fix,
  fixed-length columns in ROW_FORMAT=REDUNDANT will have a constant
  storage size as they should, no matter if NULL or non-NULL.  The bug
  caused fixed-length NULL columns to occupy 1 byte.

  rb://37 approved by Heikki over IM.
  ------------------------------------------------------------------------
2008-10-29 19:39:24 +00:00
marko
e2656dba61 branches/zip: ha_innodb.cc: Make some functions static, so that they will
not be compiled as weak global symbols.  These functions must not be
redirected to the built-in InnoDB.
2008-10-29 09:43:23 +00:00
calvin
191409aaa7 branches/zip: fix a problem introduced in r2917 - dyn is not
initialized. Move the check into for().
2008-10-28 22:08:11 +00:00
marko
b80665e409 branches/zip: innodb_plugin_init(): Do not copy session variables,
even when the variable is a global variable in the built-in InnoDB.
2008-10-28 21:53:23 +00:00
calvin
fd6831625c branches/zip: implement the delayloading of externals for the plugin
on Windows, which includes:

 * Load mysqld.map and insert all symbol/address pairs into hash for
   quick access
 * Resolves all external data variables. The delayloading mechanism
   in MSVC does not support automatic imports of data variables.
   A workaround is to explicitly handle the data import using the delay
   loader during the initialization of the plugin.
 * Resolves all external functions during run-time, by implementing
   the delayed loading helper function delayLoadHelper2, which is
   called by run-time as well as HrLoadAllImportsForDll. 

The delay loader reuses the hash implementation in InnoDB. The normal
hash_create (in hash0hash.c) creates hash tables in buffer pool. But
the delay loader is invoked before the engine is initialized, and 
buffer pools are not ready yet. Instead, the delay loader has its own
implementation of hash_create() and hash_table_free(), called
wdl_hash_create() and wdl_hash_table_free().

This patch should be used with other two patches in order to build
a dynamically linked plugin on Windows:
 * patch for tmpfile functions (r2886)
 * patch for "build" files (to be committed)
 
The list of file changed:

handler/handler0vars.h: new file, defines a list of external data
variables (no external functions).

handler/win_delay_loader.cc: new file, the implementation of the delay
loader for Windows plugin.

handler/ha_innodb.cc: add a header file, and changes for copying the
system variables.

handler/handler0alter.cc: add a header file

handler/i_s.cc: add a header file

rb://27

Reviewed by:	Sunny, Marko
Approved by:	Sunny
2008-10-27 20:48:29 +00:00
calvin
ed35fc5852 branches/zip: This patch is to solve the issue that file handles can
not cross DLL/EXE boundaries on Windows. In builtin InnoDB, it makes
call to MySQL server for creating tmp files. innobase_mysql_tmpfile
is now rewritten for the plugin. 

rb://5

Approved by:	Marko
2008-10-27 20:39:11 +00:00
marko
d8fd1aec8d branches/zip: Clean up the file format stamping.
trx_sys_file_format_max_upgrade(): Rename from
trx_sys_file_format_max_update().  Improve the documentation.  Add a
const qualifier to the parameter "name".  Replace the parameter
"flags" with "format_id", because this function should deal with file
format identifiers, not with table flags.

trx_sys_file_format_max_write(), trx_sys_file_format_max_set(): Add a
const qualifier to the parameter "name".

ha_innodb.cc: Correct the spelling in some comments: "side effect".
Remove redundant prototypes for some static callback functions.

innodb_file_format_name_update(), innodb_file_format_check_update():
Correct the function signature.  Use appropriate pointer type conversions.

MYSQL_SYSVAR_STR(file_format), MYSQL_SYSVAR_STR(file_format_check):
Remove the type conversions from the callback function pointers.  When
the function signatures match, no type conversion is needed.  The type
conversions would only prevent compilation warnings for any mismatch.

Approved by Sunny in rb://25.
2008-10-23 08:27:15 +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
sunny
f9c42d81e7 branches/zip:
Merge revisions 2837:2852 from branches/5.1:

  ------------------------------------------------------------------------
  r2849 | sunny | 2008-10-22 12:01:18 +0300 (Wed, 22 Oct 2008) | 8 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
     M /branches/5.1/include/row0mysql.h
     M /branches/5.1/row/row0mysql.c
  
  branches/5.1: Return the actual error code encountered when allocating
  a new autoinc value. The change in behavior (bug) was introduced in 5.1.22
  when we introduced the new AUTOINC locking model.
  
  rb://31
  
  Bug#40224 New AUTOINC changes mask reporting of deadlock/timeout errors
  
  ------------------------------------------------------------------------
  r2852 | sunny | 2008-10-23 01:42:24 +0300 (Thu, 23 Oct 2008) | 9 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
     M /branches/5.1/handler/ha_innodb.h
  
  branches/5.1: Backport r2724 from branches/zip
  
  Check column value against the col max value before updating the table's
  global autoinc counter value. This is part of simplifying the AUTOINC
  sub-system. We extract the type info from MySQL data structures at runtime.
  
  This fixes Bug#37788 InnoDB Plugin: AUTO_INCREMENT wrong for compressed tables
  
  
  ------------------------------------------------------------------------
2008-10-23 05:29:46 +00:00
sunny
2a71ad87b5 branches/zip: Add missing UNIV_INTERN. 2008-10-22 21:52:09 +00:00
vasil
49589d0ae2 branches/zip:
Merge 2744:2837 from branches/5.1 (skipping r2782 and r2826):

  ------------------------------------------------------------------------
  r2832 | vasil | 2008-10-21 10:08:30 +0300 (Tue, 21 Oct 2008) | 10 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
  
  branches/5.1:
  
  In ha_innobase::info():
  
  Replace sql_print_warning() which prints to mysqld error log with
  push_warning_printf() which sends the error message to the client.
  
  Suggested by:	Marko, Sunny, Michael
  Objected by:	Inaam
  
  ------------------------------------------------------------------------
  r2837 | vasil | 2008-10-21 12:07:44 +0300 (Tue, 21 Oct 2008) | 32 lines
  Changed paths:
     M /branches/5.1/mysql-test/innodb-semi-consistent.result
     M /branches/5.1/mysql-test/innodb-semi-consistent.test
     M /branches/5.1/mysql-test/innodb.result
     M /branches/5.1/mysql-test/innodb.test
  
  branches/5.1:
  
  Merge a change from MySQL (this fixes the failing innodb and
  innodb-semi-consistent tests):
  
    revno: 2757
    committer: Georgi Kodinov <kgeorge@mysql.com>
    branch nick: B39812-5.1-5.1.29-rc
    timestamp: Fri 2008-10-03 15:24:19 +0300
    message:
      Bug #39812: Make statement replication default for 5.1 (to match 5.0)
      
      Make STMT replication default for 5.1.
      Add a default of MIXED into the config files
      Fix the tests that needed MIXED replication mode.
    modified:
      mysql-test/include/mix1.inc
      mysql-test/r/innodb-semi-consistent.result
      mysql-test/r/innodb.result
      mysql-test/r/innodb_mysql.result
      mysql-test/r/tx_isolation_func.result
      mysql-test/t/innodb-semi-consistent.test
      mysql-test/t/innodb.test
      mysql-test/t/tx_isolation_func.test
      sql/mysqld.cc
      support-files/my-huge.cnf.sh
      support-files/my-innodb-heavy-4G.cnf.sh
      support-files/my-large.cnf.sh
      support-files/my-medium.cnf.sh
      support-files/my-small.cnf.sh
  
  
  ------------------------------------------------------------------------
2008-10-21 08:49:27 +00:00
marko
77a229843f branches/zip: Merge revisions 2722:2744 from branches/5.1:
------------------------------------------------------------------------
  r2742 | inaam | 2008-10-08 22:02:15 +0300 (Wed, 08 Oct 2008) | 11 lines

  branches/5.1:

  Fix Bug#39939 DROP TABLE/DISCARD TABLESPACE takes long time in
  buf_LRU_invalidate_tablespace()

  Improve implementation of buf_LRU_invalidate_tablespace by attempting
  hash index drop in batches instead of doing it one by one.

  Reviewed by: Heikki, Sunny, Marko
  Approved by: Heikki
  ------------------------------------------------------------------------
  r2744 | marko | 2008-10-09 10:53:09 +0300 (Thu, 09 Oct 2008) | 5 lines

  branches/5.1: ha_innobase::delete_all_rows(): In response to a user asking
  <http://forums.innodb.com/read.php?4,215,215> why DELETE FROM t is not
  mapped to TRUNCATE TABLE t as it is in MyISAM, note in a comment that
  DELETE is transactional while TRUNCATE is not.
  ------------------------------------------------------------------------
2008-10-09 08:48:58 +00:00
sunny
581de59921 branches/zip: Check for autoinc next value overflow explicitly when offset
is > 1. This is safer and easier to understand.
2008-10-05 23:44:30 +00:00
sunny
f1591a52a1 branches/zip: Fix the handler class method return type. Change ulong to ulint
so that it conforms to InnoDB's internal error/return code type.
2008-10-04 06:34:54 +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
b5020016ee branches/zip: Check column value against the col max value before updating
the table's global autoinc counter value. This is part of simplifying the
AUTOINC sub-system. We extract the type info from MySQL data structures at
runtime.

This fixes Bug#37788 InnoDB Plugin: AUTO_INCREMENT wrong for compressed tables
2008-10-04 03:47:18 +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
be56c64772 branches/zip: Make innodb_lock_wait_timeout a settable session variable
(Bug #36285, rb://9).

innodb-index.test, innodb-index.result: Set innodb_lock_wait_timeout as
a session variable instead of relying on the global value.

innodb-index-master.opt: Remove.

innodb-timeout.test: Test that setting the innodb_lock_wait_timeout
works as advertised.

thd_lock_wait_timeout(): New function, to retrieve the lock wait timeout
for a given MySQL client connection (thd), or the global value (thd==NULL).

srv_lock_wait_timeout, innobase_lock_wait_timeout: Remove.

Replace MYSQL_SYSVAR_LONG(lock_wait_timeout)
with MYSQL_THDVAR_ULONG(lock_wait_timeout).
2008-10-03 09:24:23 +00:00
marko
3b90e70d74 branches/zip: Merge revisions 2630:2702 from branches/5.1:
------------------------------------------------------------------------
  r2702 | sunny | 2008-09-30 11:41:56 +0300 (Tue, 30 Sep 2008) | 13 lines

  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.
  ------------------------------------------------------------------------
  rb://18
2008-10-01 05:37:35 +00:00
marko
3ab2bac4b8 branches/zip: thd_is_strict(): Add missing UNIV_INTERN qualifier as well. 2008-09-25 09:14:27 +00:00
marko
0e7c8d7fac branches/zip: thd_is_strict(): Add missing extern "C" qualifier. 2008-09-25 08:15:18 +00:00
marko
d36b83e65b branches/zip: Map current_thd to NULL in the Windows plugin, and use
ha_thd() whenever possible.

EQ_CURRENT_THD(thd): New predicate, for use in assertions.

innobase_drop_database(): Tolerate current_thd == NULL, so that the
Windows plugin will work.  In the Windows plugin, it will be
impossible to skip foreign key checks in this function.  However,
DROP DATABASE will drop each table (that MySQL knows about) individually
before calling this function.  Thus, the foreign key checks can be disabled
also in the Windows plugin, unless some .frm files are missing.
2008-09-18 13:14:29 +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
7d0834170d branches/zip: Merge r2617:r2630 from branches/5.1:
bug#39483 InnoDB hang on adaptive hash because of out of order ::open()
call by MySQL

Forward port of r2629

Under some conditions MySQL calls ::open with search_latch leading
to a deadlock as we try to acquire dict_sys->mutex inside ::open
breaking the latching order. The fix is to release search_latch.

Reviewed by: Heikki
2008-09-17 10:54:28 +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