Commit graph

292 commits

Author SHA1 Message Date
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
113101682f branches/zip: Merge revisions 4400:4481 from branches/5.1:
------------------------------------------------------------------------
  r4481 | marko | 2009-03-19 15:01:48 +0200 (Thu, 19 Mar 2009) | 6 lines

  branches/5.1: row_unlock_for_mysql(): Do not unlock records that were
  modified by the current transaction.  This bug was introduced or unmasked
  in r4400.

  rb://97 approved by Heikki Tuuri
  ------------------------------------------------------------------------
2009-03-19 13:23:32 +00:00
marko
48070b5332 branches/zip: Merge revisions 4359:4400 from branches/5.1:
------------------------------------------------------------------------
  r4399 | marko | 2009-03-12 09:38:05 +0200 (Thu, 12 Mar 2009) | 2 lines

  branches/5.1: row_sel_get_clust_rec_for_mysql(): Store the cursor position
  also for unlock_row().  (Bug #39320)
  ------------------------------------------------------------------------
  r4400 | marko | 2009-03-12 10:06:44 +0200 (Thu, 12 Mar 2009) | 5 lines

  branches/5.1: Fix a bug in multi-table semi-consistent reads.
  Remember the acquired record locks per table handle (row_prebuilt_t)
  rather than per transaction (trx_t), so that unlock_row should successfully
  unlock all non-matching rows in multi-table operations.
  This deficiency was found while investigating Bug #39320.
  ------------------------------------------------------------------------

These were submitted as rb://94 and rb://96 and approved by Heikki Tuuri.
2009-03-12 08:26:40 +00:00
vasil
98b586daf2 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 26/28]
2009-02-17 10:09:16 +00:00
vasil
4ec7ccb227 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 25/28]
2009-02-17 10:05:45 +00:00
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
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
fe6e7f8656 branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
2009-01-13 09:54:01 +00:00
marko
9415843cba branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes.  Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery.  (Issue #152)

Approved by Heikki Tuuri
2009-01-07 14:42:42 +00:00
marko
7a30af3eb0 branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL.  While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)

rb://70 approved by Heikki Tuuri
2009-01-07 14:17:47 +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
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
5697b755e6 branches/zip: Pass the caller's file name and line number to
row_mysql_lock_data_dictionary(), row_mysql_freeze_data_dictionary(),
to better track down locking issues that involve dict_operation_lock.
2008-12-22 10:27:16 +00:00
marko
37187e09f1 branches/zip: row_sel_try_search_shortcut(), row_sel(): Adjust two
debug assertions that should have been adjusted in r3575.
2008-12-17 20:40:38 +00:00
marko
4856b4ba61 branches/zip: Remove update-in-place-in-select from the internal SQL
interpreter.  It was only used for updating the InnoDB internal data
dictionary when renaming or dropping tables.  It could have caused
deadlocks after acquiring latches on insert buffer bitmap pages.
This and r3544 should fix Issue #135.

Furthermore, the update-in-place-in-select does not account for
compression failure.  That was not a problem yet, since the InnoDB SQL
interpreter has so far assumed ROW_FORMAT=REDUNDANT.

rb://63 approved by Heikki Tuuri
2008-12-17 12:40:59 +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
marko
0b04505e8a branches/zip: row_purge_remove_sec_if_poss_low(): Allocate mtr_vers
from the stack, not with mem_alloc().
2008-12-09 08:31:26 +00:00
marko
7c16a58d4b branches/zip: row_undo_mod_del_mark_or_remove_sec_low(): Do not
complain if the record is not found.  Explain that this is possible
when a deadlock occurs during an update.  Heikki investigated this
in Issue #134.
2008-12-05 08:02:54 +00:00
marko
e6acdb3c82 branches/zip: row_undo_mod_del_mark_or_remove_sec_low(): Complain if
the secondary index entry cannot be found, and this is not an incomplete
transaction that is being rolled back in crash recovery.  The source code
comments were suggested by Heikki.
2008-11-28 14:18:43 +00:00
marko
afe9ee1f86 branches/zip: row_merge_drop_temp_indexes(): Replace the WHILE 1 with
WHILE 1=1 in the SQL procedure, so that the loop will actually be
entered and temporary indexes be dropped during crash recovery.
Thanks to Sunny Bains for pointing this out.

Tested as follows:

Set a breakpoint in row_merge_rename_indexes.

CREATE TABLE t(a INT)ENGINE=InnoDB;
CREATE INDEX a ON t(a);

-- The breakpoint will be reached.  Kill and restart mysqld.
SHOW CREATE TABLE t;
-- This shows the MySQL .frm file, without and index.
CREATE TABLE innodb_table_monitor(a INT)ENGINE=InnoDB;
-- This will dump the InnoDB dictionary to the error log, without the index.
2008-11-26 08:00:28 +00:00
marko
106d894efd branches/zip: Note that it is legitimate for a secondary index record not
to be found during purge.  This tries to address Issue #129.  The comments
were supplied by Heikki.
2008-11-24 16:01:42 +00:00
marko
69a89b02b4 branches/zip: row_vers_impl_x_locked_off_kernel(): Remove compilation
warnings about prev_trx_id and vers_del being possibly uninitialized,
by handling the case prev_version == NULL in a single if block.

rb://45 approved by Inaam Rana.
2008-11-12 11:52:57 +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
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
vasil
8ac83c39b3 branches/zip:
Print the table name via ut_print_name() and add two spaces before InnoDB.

Suggested by:	Marko
2008-10-20 09:41:04 +00:00
vasil
2453a49a50 branches/zip:
Fix Mantis issue#61:

In row_undo_ins_parse_undo_rec(): if we find that a table has no indexes
(dict_table_get_first_index() returns NULL) do not try to call
trx_undo_rec_get_row_ref() with a NULL pointer because that would lead to
a crash. Instead, print a warning and set node->table to NULL just like
it is done if the .ibd file is missing.

Approved by:	Heikki (via IM)
2008-10-16 15:57:58 +00:00
marko
8ec95fc761 branches/zip: When the server crashes while freeing an externally stored
column of a compressed table, the BTR_EXTERN_LEN field in the BLOB pointer
will be written as 0.  Tolerate this in the functions that deal with
externally stored columns.  This fixes Issue #80 and was posted at rb://26.

Note that the clustered index record is always deleted or purged last,
after any secondary index records referring to it have been deleted.

btr_free_externally_stored_field(): On an uncompressed table, zero out
the BTR_EXTERN_LEN, so that half-deleted BLOBs can be detected after
crash recovery.

btr_copy_externally_stored_field_prefix(): Return 0 if the BLOB has been
half-deleted.

row_upd_ext_fetch(): Assert that the externally stored column exists.

row_ext_cache_fill(): Allow btr_copy_externally_stored_field_prefix()
to return 0.

row_sel_sec_rec_is_for_blob(): Return FALSE if the BLOB has been half-deleted.
This is correct, because the clustered index record would have been deleted
or purged last, after any secondary index records referring to it had been
deleted.
2008-10-15 10:27:42 +00:00
marko
344481d597 branches/zip: row_create_table_for_mysql(), row_create_index_for_mysql():
Note that the dictionary object will be freed.
2008-10-15 06:00:06 +00:00
marko
959d8deb5c branches/zip: row_merge_rename_indexes(): Add a missing semicolon that
was forgotten when splitting a ut_ad() assertion in r2763.
2008-10-11 18:58:47 +00:00
marko
41953325b9 branches/zip: Fix some locking issues, mainly in fast index creation.
This should hopefully address Issue #85.

ha_innobase::add_index(): Lock the data dictionary before invoking
row_merge_rename_indexes() or row_merge_drop_indexes(), because neither
function will commit the transaction.

ha_innobase::final_drop_index(): Commit the transactions before
unlocking the data dictionary.

row_merge_drop_index(), row_merge_drop_indexes(), row_merge_rename_tables(),
row_merge_rename_indexes(): Note and assert that the data dictionary must
have been exclusively locked by the caller, because the transaction will
not be committed.

row_drop_database_for_mysql(): Commit the transaction immediately after
dropping each table.  When MySQL is holding open handles to some tables,
it can otherwise occur than the data dictionary is unlocked while the
transaction has not been committed.  This bug was introduced in r2739,
which changed the semantics of row_drop_table_for_mysql().

row_drop_database_for_mysql(): Postpone mem_free(table_name), so that
an error printout will not dereference freed memory.
2008-10-10 11:44:27 +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
108b2db677 branches/zip: row_undo_mod_del_unmark_sec_and_undo_update():
Return earlier when this function is called on an index that
is being created.  Luckily, mtr_start() does not allocate any
resources.  Thus, there was no memory leak.
2008-09-24 10:47:45 +00:00
marko
e053f0ad2c branches/zip: row_purge_remove_sec_if_poss_low(): Add a const qualifier. 2008-09-24 09:39:48 +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
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
vasil
22ecced647 branches/zip:
Merge 2537:2605 from branches/5.1:

  ------------------------------------------------------------------------
  r2545 | vasil | 2008-07-25 17:24:23 +0300 (Fri, 25 Jul 2008) | 37 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
  
  branches/5.1:
  
  Fix Bug#38185 ha_innobase::info can hold locks even when called with HA_STATUS_NO_LOCK
  
  The fix is to call fsp_get_available_space_in_free_extents() from
  ha_innobase::info() only if HA_STATUS_NO_LOCK is not present in the flag
  *AND*
  change get_schema_tables_record() in MySQL's sql/sql_show.cc to call
  ::info() *without* HA_STATUS_NO_LOCK whenever a user issues SELECT FROM
  information_schema.tables;
  
  Without the change to sql/sql_show.cc this patch would lead to Bug#32440
  resurfacing. I.e. delete_length would never be updated in ::info() and
  will remain 0 forever, resulting in the free space not being shown
  anywhere.
  
  This is the change to sql/sql_show.cc for reference, it needs to be
  committed to the MySQL repo before or at the same time with this change
  to ha_innodb.cc:
  
   --- patch begins here ---
   --- sql/sql_show.cc.orig	2008-07-23 09:32:14.000000000 +0300
   +++ sql/sql_show.cc	2008-07-23 09:32:19.000000000 +0300
   @@ -3549,8 +3549,7 @@ static int get_schema_tables_record(THD 
    
        if(file)
        {
   -      file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_AUTO |
   -                 HA_STATUS_NO_LOCK);
   +      file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_AUTO);
          enum row_type row_type = file->get_row_type();
          switch (row_type) {
          case ROW_TYPE_NOT_USED:
   --- patch ends here ---
  
  Approved by:	Heikki
  
  ------------------------------------------------------------------------
  r2603 | marko | 2008-08-21 16:25:05 +0300 (Thu, 21 Aug 2008) | 10 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
     M /branches/5.1/include/ha_prototypes.h
     M /branches/5.1/row/row0sel.c
  
  branches/5.1: Identify SELECT statements by thd_sql_command() == SQLCOM_SELECT
  instead of parsing the query string.  This fixes MySQL Bug #37885 without
  us having to implement lexical analysis of SQL comments in yet another place.
  
  thd_is_select(): A new predicate.
  
  row_search_for_mysql(): Use thd_is_select().
  
  Approved by Heikki.
  
  ------------------------------------------------------------------------
2008-08-21 14:23:46 +00:00
marko
ba78ee0d47 branches/zip: In the rollback of incomplete transactions after crash
recovery, tolerate clustered index records whose externally stored
columns have not been written.  This should remove the assertion failures
that were reported as Mantis issue#58, issue#62, issue#64.

trx_is_recv(): New function: TRUE if this transaction is rolling back
an incomplete transaction in crash recovery.

enum trx_rbmode: Rollback modes: no rollback, normal rollback, crash recovery.

btr_cur_pessimistic_delete(), btr_free_externally_stored_field(),
btr_rec_free_externally_stored_fields():
Replace the ibool parameter with enum trx_rbmode.

btr_free_externally_stored_field(): If field_ref is zero, return
but assert ut_a(rbmode == RB_RECOVERY).  Unless InnoDB has crashed
while inserting a clustered index record, field_ref should not be zero.

btr_rec_free_updated_extern_fields(): Add the parameter enum trx_rbmode.

btr_cur_pessimistic_update(): Pass the rbmode parameter to
btr_rec_free_updated_extern_fields().

row_undo_ins(), row_undo_mod_upd_del_sec(): If row_build_index_entry()
fails, assert trx_is_recv() and skip this secondary index.

row_undo_mod_upd_del_sec(): Empty the heap at the end of each loop
iteration in order to conserve memory and to reduce the number of
low-level memory allocations.
2008-08-06 08:48:34 +00:00
marko
cd124b7524 branches/zip: Always display a newline after ut_print_buf(stderr, ...). 2008-08-06 08:10:21 +00:00
inaam
e0ce800fa7 branches/zip issue# 33
This fix makes two basic changes in blob handling:
(The bug was introduced in r2252)

1) The blob prefixes are no longer stored in the undo if
  a) We are modifying a delete marked record and
  b) The record was delete marked by an already committed trx.

2) When building old row version to check if one of these versions
can hold an implicit lock on the record we stop our probe if
  a) The version is delete marked and
  b) The delete marking is done by a trx which is different from
     the current active trx on the record.

Reviewed by: Heikki
2008-07-29 17:06:18 +00:00
inaam
48075f147c branches/zip: fixes issue# 36
Fixed the issue where an unchanged blob column that is part of the
primary key as well is lost if it is externally stored.

The fix is provided by Marko.

Reviewed by: Sunny
2008-06-18 22:20:53 +00:00
vasil
55db138b95 branches/zip: Merge 2384:2423 from branches/5.1:
------------------------------------------------------------------------
  r2386 | vasil | 2008-03-27 07:45:02 +0200 (Thu, 27 Mar 2008) | 22 lines
  
  branches/5.1:
  
  Merge change from MySQL (this fixes the failing innodb test):
  
  ChangeSet@1.1810.3601.4, 2008-02-07 02:33:21+04:00, gshchepa@host.loc +9 -0
    Fixed bug#30059.
    Server handles truncation for assignment of too-long values
    into CHAR/VARCHAR/TEXT columns in a different ways when the
    truncated characters are spaces:
    1. CHAR(N) columns silently ignore end-space truncation;
    2. TEXT columns post a truncation warning/error in the
       non-strict/strict mode.
    3. VARCHAR columns always post a truncation note in
       any mode.
  
    Space truncation processing has been synchronised over
    CHAR/VARCHAR/TEXT columns: current behavior of VARCHAR
    columns has been propagated as standard.
  
    Binary-encoded string/BLOB columns are not affected.
  
  
  ------------------------------------------------------------------------
  r2387 | vasil | 2008-03-27 08:49:05 +0200 (Thu, 27 Mar 2008) | 8 lines
  
  branches/5.1:
  
  Check whether *trx->mysql_query_str is != NULL in addition to
  trx->mysql_query_str. This adds more safety.
  
  This may or may not fix Bug#35226 RBR event crashes slave.
  
  
  ------------------------------------------------------------------------
  r2388 | vasil | 2008-03-27 14:02:34 +0200 (Thu, 27 Mar 2008) | 7 lines
  
  branches/5.1:
  
  Swap the order in which mysql_thd, mysql_query_str and *mysql_query_str
  are checked for non-NULL.
  
  Suggested by:	Marko
  
  ------------------------------------------------------------------------
  r2419 | vasil | 2008-04-23 19:08:06 +0300 (Wed, 23 Apr 2008) | 9 lines
  
  branches/5.1:
  
  Change the fix for Bug#32440 to show bytes instead of kilobytes in
  INFORMATION_SCHEMA.TABLES.DATA_FREE.
  
  Suggested by:	Domas Mituzas <domas@mysql.com>
  Approved by:	Heikki
  
  
  ------------------------------------------------------------------------
  r2420 | calvin | 2008-04-24 15:25:30 +0300 (Thu, 24 Apr 2008) | 4 lines
  
  branches/5.1: Fix bug#29507 TRUNCATE shows to many rows effected
  
  In InnoDB, the row count is only a rough estimate used by SQL
  optimization. InnoDB is now return row count 0 for TRUNCATE operation.
  ------------------------------------------------------------------------
  r2421 | calvin | 2008-04-24 15:32:30 +0300 (Thu, 24 Apr 2008) | 6 lines
  
  branches/5.1: Fix bug#35537 - Innodb doesn't increment handler_update
  and handler_delete
  
  Add the calls to ha_statistic_increment() in ha_innobase::delete_row()
  and ha_innobase::update_row().
  
  ------------------------------------------------------------------------
  r2422 | vasil | 2008-04-24 16:00:30 +0300 (Thu, 24 Apr 2008) | 11 lines
  
  branches/5.1:
  
  Fix Bug#36169 create innodb compressed table with too large row size crashed
  
  Sometimes it is possible that
  row_drop_table_for_mysql(index->table_name, trx, FALSE); is invoked in
  row_create_index_for_mysql() when the index object is freed so copy the
  table name to a safe place beforehand and use the copy.
  
  Approved by:	Sunny
  
  ------------------------------------------------------------------------
2008-04-30 05:42:56 +00:00
vasil
a5b8b883c8 branches/zip:
Fix Bug#36169 create innodb compressed table with too large row size crashed

Sometimes it is possible that
row_drop_table_for_mysql(index->table_name, trx, FALSE); is invoked in
row_create_index_for_mysql() when the index object is freed, so copy the
table name to a safe place beforehand and use the copy.

Approved by:	Sunny
2008-04-23 05:45:19 +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
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