Commit graph

147 commits

Author SHA1 Message Date
Jimmy Yang
5c15a5a103 Merge from mysql-5.1-innodb to mysql-5.5-innodb 2010-10-11 05:56:44 -07:00
Jimmy Yang
820e1bc6f4 A more complete fix for bug #57345 btr_pcur_store_position abort for load
with concurrent lock/unlock tables

Approved by Marko
2010-10-11 05:36:13 -07:00
Vasil Dimov
1852090266 Merge mysql-5.5-innodb from bk-internal to my local tree 2010-10-04 13:46:41 +03:00
Marko Mäkelä
80961a0a25 Merge Bug#56716 from 5.1 2010-10-04 13:38:05 +03:00
Marko Mäkelä
678bc90ed8 Bug#56716 InnoDB locks a record gap without locking the table
row_search_for_mysql(): Acquire an intention lock on the table
before locking the first record gap.
2010-10-04 13:05:21 +03:00
Vasil Dimov
1f1c2e22eb Merge mysql-5.5-innodb -> mysql-5.5-bugteam 2010-10-01 16:36:35 +03:00
Vasil Dimov
f7c8352193 Fix Bug#56340 innodb updates index stats too frequently after non-index updates
This is a manual merge from mysql-5.1-innodb of:

  revno: 3618
  revision-id: vasil.dimov@oracle.com-20100930124844-yglojy7c3vaji6dx
  parent: vasil.dimov@oracle.com-20100930102618-s9f9ytbytr3eqw9h
  committer: Vasil Dimov <vasil.dimov@oracle.com>
  branch nick: mysql-5.1-innodb
  timestamp: Thu 2010-09-30 15:48:44 +0300
  message:
    Fix Bug#56340 innodb updates index stats too frequently after non-index updates

    This is a simple optimization issue. All stats are related to only indexed
    columns, index size or number of rows in the whole table. UPDATEs that touch
    only non-indexed columns cannot affect stats and we can avoid calling the
    function row_update_statistics_if_needed() which may result in unnecessary I/O.

    Approved by:	Marko (rb://466)

In addition to the above message: we know that
row_update_cascade_for_mysql() (the other place where
row_update_statistics_if_needed is called) always updates indexed
columns (FK-related), so there is no need to add this cond there.
2010-10-01 10:34:21 +03:00
Vasil Dimov
eaaea8eb7d Fix Bug#56340 innodb updates index stats too frequently after non-index updates
This is a simple optimization issue. All stats are related to only indexed
columns, index size or number of rows in the whole table. UPDATEs that touch
only non-indexed columns cannot affect stats and we can avoid calling the
function row_update_statistics_if_needed() which may result in unnecessary I/O.

Approved by:	Marko (rb://466)
2010-09-30 15:48:44 +03:00
Vasil Dimov
70a486c7e7 (row0vers.c:74) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 2010-09-20 19:17:20 +03:00
Vasil Dimov
d4a2abcd2f (row0umod.c:117) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 2010-09-20 19:10:33 +03:00
Vasil Dimov
17cc7b76be (row0purge.c:789) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 2010-09-20 19:09:30 +03:00
Vasil Dimov
00c6e219c6 (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
row/row0vers.c: In function 'row_vers_impl_x_locked_off_kernel':
row/row0vers.c:62:9: error: variable 'err' set but not used [-Werror=unused-but-set-variable]
2010-09-14 14:50:13 +03:00
Vasil Dimov
c283946dd6 (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
row/row0upd.c: In function 'row_upd_in_place_in_select':
row/row0upd.c:2040:9: error: variable 'err' set but not used [-Werror=unused-but-set-variable]
2010-09-14 14:46:13 +03:00
Vasil Dimov
67c388410b (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
row/row0umod.c: In function 'row_undo_mod_clust_low':
row/row0umod.c:92:9: error: variable 'success' set but not used [-Werror=unused-but-set-variable]
2010-09-14 14:09:36 +03:00
Vasil Dimov
1bdcd70fad (partially) Fix Bug#55227 Fix compiler warnings in innodb with gcc 4.6
Fix compiler warning:
row/row0purge.c: In function 'row_purge_step':
row/row0purge.c:660:9: error: variable 'err' set but not used [-Werror=unused-but-set-variable]

(row_purge() always returns DB_SUCCESS)
2010-09-14 13:56:29 +03:00
Marko Mäkelä
618d6e7220 Merge Bug#55626 fix from mysql-5.1-innodb:
revno: 3545
revision-id: marko.makela@oracle.com-20100818110110-zfs0i1vfrccfb4yw
parent: vasil.dimov@oracle.com-20100817193934-1yl7zz2odikxauf8
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Wed 2010-08-18 14:01:10 +0300
message:
  Bug#55626: MIN and MAX reading a delete-marked record from secondary index

  Remove a bogus debug assertion that triggered the bug.
  Add assertions precisely where records must not be delete-marked.
  And a comment to clarify when the record is allowed to be delete-marked.
2010-08-18 14:40:02 +03:00
Sunny Bains
3c4d4e0a25 Merge from -c3476 mysql-5.1-security.
------------------------------------------------------------
     revno: 3476
     committer: Sunny Bains <Sunny.Bains@Oracle.Com>
     branch nick: 5.1-security
     timestamp: Thu 2010-08-05 19:18:17 +1000
     message:
       Fix bug# 55543 - InnoDB Plugin: Signal 6: Assertion failure in file fil/fil0fil.c line 4306

         The bug is due to a double delete of a BLOB, once via:

               rollback -> btr_cur_pessimistic_delete()

         and the second time via purge.

         The bug is in row_upd_clust_rec_by_insert(). There we relinquish ownership
         of the non-updated BLOB columns in btr_cur_mark_extern_inherited_fields()
         before building the row entry that will be inserted and whose contents will
         be logged in the UNDO log. However, we don't set the BLOB column later to
         INHERITED so that a possible rollback will not free the original row's
         non-updated BLOB entries. This is because the condition that checks for
         that is in :

     		    	if (node->upd_ext) {}.

         node->upd_ext is non-NULL only if a BLOB column was updated and that column
         is part of some key ordering (see row_upd_replace()). This results in the
         non-update BLOB columns being deleted during a rollback and subsequently by
         purge again.

         rb://413
2010-08-16 12:05:49 +10:00
Vasil Dimov
7f8627e36b Manually merge a changeset from mysql-5.1-security:
------------------------------------------------------------
  revno: 3475
  revision-id: jimmy.yang@oracle.com-20100804103744-vbpeghipkz6pyc9z
  parent: jimmy.yang@oracle.com-20100804101133-c38qqbm0fkwn9jhc
  committer: Jimmy Yang <jimmy.yang@oracle.com>
  branch nick: mysql-5.1-security
  timestamp: Wed 2010-08-04 03:37:44 -0700
  message:
    Fix bug #54678, InnoDB, TRUNCATE, ALTER, I_S SELECT, crash or deadlock
    
    rb://399 approved by Sunny Bains
  modified:
    storage/innodb_plugin/ChangeLog 2425@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2FChangeLog
    storage/innodb_plugin/include/dict0dict.h 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fdict0dict.h
    storage/innodb_plugin/include/dict0dict.ic 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fdict0dict.ic
    storage/innodb_plugin/row/row0mysql.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Frow%2Frow0mysql.c
2010-08-13 15:52:11 +03:00
Vasil Dimov
5ba3936517 Merge mysql-trunk-bugfixing -> mysql-trunk-innodb
(resolving conflicts in mysql-test/suite/rpl/t/rpl_sync-slave.opt and
configure.cmake)
2010-07-21 17:22:29 +03:00
Marc Alff
ef27448469 Implemented code review comments.
Fixed style according to the specific innodb style, for innodb code.
2010-07-14 10:23:21 -06:00
Marc Alff
ec41287630 Bug#55087 Performance schema: optimization of the instrumentation interface
This change is for performance optimization.

Fixed the performance schema instrumentation interface as follows:
- simplified mysql_unlock_mutex()
- simplified mysql_unlock_rwlock()
- simplified mysql_cond_signal()
- simplified mysql_cond_broadcast()

Changed the get_thread_XXX_locker apis to have one extra parameter,
to provide memory to the instrumentation implementation.
This API change allows to use memory provided by the caller,
to avoid having to use thread local storage.
Using this extra parameter will be done in a separate fix,
this change is for the interface only.

Adjusted all the code and unit tests accordingly.
2010-07-09 17:00:24 -06:00
Marko Mäkelä
75a5aaf2ad Merge a Bug #54358 error handling correction from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3534
revision-id: marko.makela@oracle.com-20100630093847-7gkr1lh3bh2xksy0
parent: marko.makela@oracle.com-20100630093149-wmc37t128gic933v
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Wed 2010-06-30 12:38:47 +0300
message:
  Bug#54358 follow-up: Correct some error handling.
2010-06-30 12:55:10 +03:00
Marko Mäkelä
533d430d2c Merge Bug #54358 comment corrections from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3533
revision-id: marko.makela@oracle.com-20100630093149-wmc37t128gic933v
parent: marko.makela@oracle.com-20100629131219-pjbkpk5rsqztmw27
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Wed 2010-06-30 12:31:49 +0300
message:
  Correct some comments that were added in the fix of Bug #54358
  (READ UNCOMMITTED access failure of off-page DYNAMIC or COMPRESSED columns).

  Records that lack incompletely written externally stored columns may
  be accessed by READ UNCOMMITTED transaction even without involving a
  crash during an INSERT or UPDATE operation. I verified this as follows.

  (1) added a delay after the mini-transaction for writing the clustered
  index 'stub' record was committed (patch attached)
  (2) started mysqld in gdb, setting breakpoints to the where the
  assertions about READ UNCOMMITTED were added in the bug fix
  (3) invoked ibtest3 --create-options=key_block_size=2
  to create BLOBs in a COMPRESSED table
  (4) invoked the following:
  yes 'set transaction isolation level read uncommitted;
  checksum table blobt3;select sleep(1);'|mysql -uroot test
  (5) noted that one of the breakpoints was triggered
  (return(NULL) in btr_rec_copy_externally_stored_field())

  === modified file 'storage/innodb_plugin/row/row0ins.c'
  --- storage/innodb_plugin/row/row0ins.c	2010-06-30 08:17:25 +0000
  +++ storage/innodb_plugin/row/row0ins.c	2010-06-30 08:17:25 +0000
  @@ -2120,6 +2120,7 @@ function_exit:
   		rec_t*	rec;
   		ulint*	offsets;
   		mtr_start(&mtr);
  +		os_thread_sleep(5000000);
   
   		btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
   					    BTR_MODIFY_TREE, &cursor, 0,
  
  === modified file 'storage/innodb_plugin/row/row0upd.c'
  --- storage/innodb_plugin/row/row0upd.c	2010-06-30 08:11:55 +0000
  +++ storage/innodb_plugin/row/row0upd.c	2010-06-30 08:11:55 +0000
  @@ -1763,6 +1763,7 @@ row_upd_clust_rec(
   		rec_offs_init(offsets_);
   
   		mtr_start(mtr);
  +		os_thread_sleep(5000000);
   
   		ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
   		rec = btr_cur_get_rec(btr_cur);
2010-06-30 12:52:41 +03:00
Marko Mäkelä
6ea69ffe79 Merge Bug#54408 fix from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3531
revision-id: marko.makela@oracle.com-20100629130058-1ilqaj51u9sj9vqe
parent: marko.makela@oracle.com-20100629125653-t799e5x30h31cvrd
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Tue 2010-06-29 16:00:58 +0300
message:
  Bug#54408: txn rollback after recovery: row0umod.c:673
  dict_table_get_format(index->table)

  The REDUNDANT and COMPACT formats store a local 768-byte prefix of
  each externally stored column. No row_ext cache is needed, but we
  initialized one nevertheless. When the BLOB pointer was zero, we would
  ignore the locally stored prefix as well. This triggered an assertion
  failure in row_undo_mod_upd_exist_sec().

  row_build(): Allow ext==NULL when a REDUNDANT or COMPACT table
  contains externally stored columns.

  row_undo_search_clust_to_pcur(), row_upd_store_row(): Invoke
  row_build() with ext==NULL on REDUNDANT and COMPACT tables.

  rb://382 approved by Jimmy Yang
2010-06-29 16:21:05 +03:00
Marko Mäkelä
7c718cdb01 Merge Bug#54358 fix from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3529
revision-id: marko.makela@oracle.com-20100629125518-m3am4ia1ffjr0d0j
parent: jimmy.yang@oracle.com-20100629024137-690sacm5sogruzvb
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Tue 2010-06-29 15:55:18 +0300
message:
  Bug#54358: READ UNCOMMITTED access failure of off-page DYNAMIC or COMPRESSED
  columns

  When the server crashes after a record stub has been inserted and
  before all its off-page columns have been written, the record will
  contain incomplete off-page columns after crash recovery. Such records
  may only be accessed at the READ UNCOMMITTED isolation level or when
  rolling back a recovered transaction in recv_recovery_rollback_active().
  Skip these records at the READ UNCOMMITTED isolation level.

  TODO: Add assertions for checking the above assumptions hold when an
  incomplete BLOB is encountered.

  btr_rec_copy_externally_stored_field(): Return NULL if the field is
  incomplete.

  row_prebuilt_t::templ_contains_blob: Clarify what "BLOB" means in this
  context. Hint: MySQL BLOBs are not the same as InnoDB BLOBs.

  row_sel_store_mysql_rec(): Return FALSE if not all columns could be
  retrieved. Previously this function always returned TRUE.  Assert that
  the record is not delete-marked.

  row_sel_push_cache_row_for_mysql(): Return FALSE if not all columns
  could be retrieved.

  row_search_for_mysql(): Skip records containing incomplete off-page
  columns. Assert that the transaction isolation level is READ
  UNCOMMITTED.

  rb://380 approved by Jimmy Yang
2010-06-29 16:19:07 +03:00
Marko Mäkelä
142e8417dc Bug#52199 utf32: mbminlen=4, mbmaxlen=4, type->mbminlen=0, type->mbmaxlen=4
Merge and adjust a forgotten change to fix this bug.
rb://393 approved by Jimmy Yang
  ------------------------------------------------------------------------
  r3794 | marko | 2009-01-07 14:14:53 +0000 (Wed, 07 Jan 2009) | 18 lines

  branches/6.0: Allow the minimum length of a multi-byte character to be
  up to 4 bytes. (Bug #35391)

  dtype_t, dict_col_t: Replace mbminlen:2, mbmaxlen:3 with mbminmaxlen:5.
  In this way, the 5 bits can hold two values of 0..4, and the storage size
  of the fields will not cross the 64-bit boundary.  Encode the values as
  DATA_MBMAX * mbmaxlen + mbminlen.  Define the auxiliary macros
  DB_MBMINLEN(mbminmaxlen), DB_MBMAXLEN(mbminmaxlen), and
  DB_MINMAXLEN(mbminlen, mbmaxlen).

  Try to trim and pad UTF-16 and UTF-32 with spaces as appropriate.

  Alexander Barkov suggested the use of cs->cset->fill(cs, buff, len, 0x20).
  ha_innobase::store_key_val_for_row() now does that, but the added function
  row_mysql_pad_col() does not, because it doesn't have the MySQL TABLE object.

  rb://49 approved by Heikki Tuuri
  ------------------------------------------------------------------------
2010-06-29 14:32:48 +03:00
Sunny Bains
7299858763 Fix bug#54583. This change reverses rsvn:1350 by getting rid of a bogus assertion
and clarifies the invariant in dict_table_get_on_id().
      
In Mar 2007 Marko observed a crash during recovery, the crash resulted from
an UNDO operation on a system table. His solution was to acquire an X lock on
the data dictionary, this in hindsight was an overkill. It is unclear what
caused the crash, current hypothesis is that it was a memory corruption.
      
The X lock results in performance issues by when undoing changes due to
rollback during normal operation on regular tables.
      
Why the change is safe:
======================
The InnoDB code has changed since the original X lock change was made. In the
new code we always lock the data dictionary in X mode during startup when
UNDOing operations on the system tables (this is a given). This ensures that
the crash Marko observed cannot happen as long as all transactions that update
the system tables follow the standard rules by setting the appropriate DICT_OP
flag when writing the log records when they make the changes.
      
If transactions violate the above mentioned rule then during recovery (at
startup) the rollback code (see trx0roll.c) will not acquire the X lock
and we will see the crash again.  This will however be a different bug.
2010-06-25 18:18:41 +10:00
Sunny Bains
1d329468ab Fix bug#54583. This change reverses r1530 by getting rid of a bogus assertion
and clarifies the invariant in dict_table_get_on_id().
  
In Mar 2007 Marko observed a crash during recovery, the crash resulted from
an UNDO operation on a system table. His solution was to acquire an X lock on
the data dictionary, this in hindsight was an overkill. It is unclear what
caused the crash, current hypothesis is that it was a memory corruption.
  
The X lock results in performance issues by when undoing changes due to
rollback during normal operation on regular tables.
  
Why the change is safe:
======================
The InnoDB code has changed since the original X lock change was made. In the
new code we always lock the data dictionary in X mode during startup when
UNDOing operations on the system tables (this is a given). This ensures that
the crash Marko observed cannot happen as long as all transactions that update
the system tables follow the standard rules by setting the appropriate DICT_OP
flag when writing the log records when they make the changes.
  
If transactions violate the above mentioned rule then during recovery (at
startup) the rollback code (see trx0roll.c) will not acquire the X lock
and we will see the crash again.  This will however be a different bug.
2010-06-25 12:59:37 +10:00
Marko Mäkelä
c1567ecebd Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
Vasil Dimov
3ca1a91eb0 Merge Bug#47991 fix from mysql-5.1-innodb
------------------------------------------------------------
  revno: 3517
  revision-id: vasil.dimov@oracle.com-20100622163043-dc0lxy0byg74viet
  parent: marko.makela@oracle.com-20100621095148-8g73k8k68dpj080u
  committer: Vasil Dimov <vasil.dimov@oracle.com>
  branch nick: mysql-5.1-innodb
  timestamp: Tue 2010-06-22 19:30:43 +0300
  message:
    Fix Bug#47991 InnoDB Dictionary Cache memory usage increases indefinitely
    when renaming tables
    
    Allocate the table name using ut_malloc() instead of table->heap because
    the latter cannot be freed.
    
    Adjust dict_sys->size calculations all over the code.
    
    Change dict_table_t::name from const char* to char* because we need to
    ut_malloc()/ut_free() it.
    
    Reviewed by:	Inaam, Marko, Heikki (rb://384)
    Approved by:	Heikki (rb://384)
  ------------------------------------------------------------
2010-06-23 10:17:21 +03:00
Inaam Rana
d860510452 Fixes bug#39168.
Make a call to log_free_check() on all DML paths.
2010-06-21 11:52:09 -04:00
Marko Mäkelä
28ec745704 Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3506
revision-id: sergey.glukhov@sun.com-20100609121718-04mpk5kjxvnrxdu8
parent: sergey.glukhov@sun.com-20100609120734-ndy2281wau9067zv
committer: Sergey Glukhov <Sergey.Glukhov@sun.com>
branch nick: mysql-5.1-innodb
timestamp: Wed 2010-06-09 16:17:18 +0400
message:
  Bug#38999 valgrind warnings for update statement in function compare_record()
  (InnoDB plugin branch)

 @ mysql-test/suite/innodb_plugin/r/innodb_mysql.result
    test case

 @ mysql-test/suite/innodb_plugin/t/innodb_mysql.test
    test case

 @ storage/innodb_plugin/row/row0sel.c
    init null bytes with default values as they might be
    left uninitialized in some cases and these uninited bytes
    might be copied into mysql record buffer that leads to
    valgrind warnings on next use of the buffer.
2010-06-14 09:35:01 +03:00
Sergey Glukhov
60a66c451a Bug#38999 valgrind warnings for update statement in function compare_record()
Valgrind warning happpens because of uninitialized null bytes.
In row_sel_push_cache_row_for_mysql() function we fill fetch cache
with necessary field values, row_sel_store_mysql_rec() is called
for this and leaves null bytes untouched.
Later row_sel_pop_cached_row_for_mysql() rewrites table record
buffer with uninited null bytes. We can see the problem from the
test case:
At 'SELECT...' we call row_sel_push...->row_sel_store...->row_sel_pop_cached...
chain which rewrites table->record[0] buffer with uninitialized null bytes.
When we call 'UPDATE...' statement, compare_record uses this buffer and
valgrind warning occurs.
The fix is to init null bytes with default values.


mysql-test/suite/innodb/r/innodb_mysql.result:
  test case
mysql-test/suite/innodb/t/innodb_mysql.test:
  test case
mysql-test/t/ps_3innodb.test:
  enable valgrind testing
storage/innobase/row/row0sel.c:
  init null bytes with default values as they might be
  left uninitialized in some cases and these uninited bytes
  might be copied into mysql record buffer that leads to
  valgrind warnings on next use of the buffer.
2010-06-09 16:07:34 +04:00
Marko Mäkelä
a2b9532188 Merge from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3495
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Wed 2010-06-02 13:37:14 +0300
message:
  Bug#53674: InnoDB: Error: unlock row could not find a 4 mode lock on the record

  In semi-consistent read, only unlock freshly locked non-matching records.

  lock_rec_lock_fast(): Return LOCK_REC_SUCCESS,
  LOCK_REC_SUCCESS_CREATED, or LOCK_REC_FAIL instead of TRUE/FALSE.

  enum db_err: Add DB_SUCCESS_LOCKED_REC for indicating a successful
  operation where a record lock was created.

  lock_sec_rec_read_check_and_lock(),
  lock_clust_rec_read_check_and_lock(), lock_rec_enqueue_waiting(),
  lock_rec_lock_slow(), lock_rec_lock(), row_ins_set_shared_rec_lock(),
  row_ins_set_exclusive_rec_lock(), sel_set_rec_lock(),
  row_sel_get_clust_rec_for_mysql(): Return DB_SUCCESS_LOCKED_REC if a
  new record lock was created. Adjust callers.

  row_unlock_for_mysql(): Correct the function documentation.

  row_prebuilt_t::new_rec_locks: Correct the documentation.
2010-06-02 14:37:33 +03:00
Jimmy Yang
0f3b6ab18b Port bug fix #53592 from mysql-5.1-innodb to mysql-trunk-innodb. 2010-06-02 04:04:00 -07:00
Marko Mäkelä
306e1338a5 Bug#53674: InnoDB: Error: unlock row could not find a 4 mode lock on the record
In semi-consistent read, only unlock freshly locked non-matching records.

Define DB_SUCCESS_LOCKED_REC for indicating a successful operation
where a record lock was created.

lock_rec_lock_fast(): Return LOCK_REC_SUCCESS,
LOCK_REC_SUCCESS_CREATED, or LOCK_REC_FAIL instead of TRUE/FALSE.

lock_sec_rec_read_check_and_lock(),
lock_clust_rec_read_check_and_lock(), lock_rec_enqueue_waiting(),
lock_rec_lock_slow(), lock_rec_lock(), row_ins_set_shared_rec_lock(),
row_ins_set_exclusive_rec_lock(), sel_set_rec_lock(),
row_sel_get_clust_rec_for_mysql(): Return DB_SUCCESS_LOCKED_REC if a
new record lock was created. Adjust callers.

row_unlock_for_mysql(): Correct the function documentation.

row_prebuilt_t::new_rec_locks: Correct the documentation.
2010-06-02 13:26:37 +03:00
Marko Mäkelä
ab6a5b4724 Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3490
  revision-id: marko.makela@oracle.com-20100601120751-1uq7bbta5n7ts0qr
  parent: marko.makela@oracle.com-20100601120521-q48hk05ne4j1s2o0
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-06-01 15:07:51 +0300
  message:
    Minor cleanup.

    lock_rec_unlock(): Cache first_lock and rewrite while() loops as for().

    btr_cur_optimistic_update(): Use common error handling return.

    row_create_prebuilt(): Add Valgrind instrumentation.
2010-06-01 15:09:33 +03:00
Marko Mäkelä
0902cd6bdd Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3488
  revision-id: marko.makela@oracle.com-20100601103738-upm8awahesmeh9dr
  parent: vasil.dimov@oracle.com-20100531163540-9fu3prbn2asqwdi5
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-06-01 13:37:38 +0300
  message:
    Bug#53812: assert row/row0umod.c line 660 in txn rollback after crash recovery
    row_undo_mod_upd_exist_sec(): Tolerate a failure to build the index entry
    for a DYNAMIC or COMPRESSED table during crash recovery.
2010-06-01 15:05:01 +03:00
Marko Mäkelä
dfe03adad1 Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3478.1.4
  revision-id: marko.makela@oracle.com-20100525125352-hgafpmqhrrj7pv5i
  parent: marko.makela@oracle.com-20100525123748-pmpehbg29oyhc1ns
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-05-25 15:53:52 +0300
  message:
    row_search_for_mysql(): Add assertions to track down Bug #53627.
2010-06-01 14:40:15 +03:00
Jimmy Yang
60d4288272 Check in the support for Information Schema System Table Views. Users
can now view the content of InnoDB System Tables through following
information schema tables:

information_schema.INNODB_SYS_TABLES
information_schema.INNODB_SYS_INDEXES
information_schema.INNODB_SYS_COUMNS
information_schema.INNODB_SYS_FIELDS
information_schema.INNODB_SYS_FOREIGN
information_schema.INNODB_SYS_FOREIGN_COLS
information_schema.INNODB_SYS_TABLESTATS

rb://330 Approved by Marko
2010-05-25 18:44:33 -07:00
Marko Mäkelä
68ce054f5d Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3479
revision-id: marko.makela@oracle.com-20100524110439-fazi70rlmt07tzd9
parent: vasil.dimov@oracle.com-20100520133157-42uk5q3pp0vsinac
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Mon 2010-05-24 14:04:39 +0300
message:
  Bug#53578: assert on invalid page access, in fil_io()

  Store the max_space_id in the data dictionary header in order to avoid
  space_id reuse.

  DICT_HDR_MIX_ID: Renamed to DICT_HDR_MAX_SPACE_ID, DICT_HDR_MIX_ID_LOW.

  dict_hdr_get_new_id(): Return table_id, index_id, space_id or a subset of them.

  fil_system_t: Add ibool space_id_reuse_warned.

  fil_create_new_single_table_tablespace(): Get the space_id from the caller.

  fil_space_create(): Issue a warning if the fil_system->max_assigned_id
  is exceeded.

  fil_assign_new_space_id(): Return TRUE/FALSE and take a pointer to the
  space_id as a parameter. Make the function public.

  fil_init(): Initialize all fil_system fields by mem_zalloc(). Remove
  explicit initializations of certain fields to 0 or NULL.
2010-05-24 14:45:24 +03:00
Vasil Dimov
6788201e76 Use the correct len instead of sizeof(void) in posix_fadvise()
Also explain in the comment the units of the "offset" parameter
2010-05-21 21:09:51 +03:00
Vasil Dimov
5862a54b86 Move os_file_write() before posix_fadvise(POSIX_FADV_DONTNEED).
It is wrong to tell the OS that a block is not going to be accessed and
write to it immediately afterwards.
2010-05-21 20:56:47 +03:00
Vasil Dimov
34096d47b0 Fix comment on row_merge_write() 2010-05-21 20:53:37 +03:00
Vasil Dimov
094a1f1e58 Merge from mysql-trunk-innodb into mysql-5.1-innodb/storage/innobase:
------------------------------------------------------------
  revno: 3094
  revision-id: vasil.dimov@oracle.com-20100513074652-0cvlhgkesgbb2bfh
  parent: vasil.dimov@oracle.com-20100512173700-byf8xntxjur1hqov
  committer: Vasil Dimov <vasil.dimov@oracle.com>
  branch nick: mysql-trunk-innodb
  timestamp: Thu 2010-05-13 10:46:52 +0300
  message:
    Followup to Bug#51920, fix binlog.binlog_killed
    
    This is a followup to the fix of
    
    Bug#51920 Innodb connections in row lock wait ignore KILL until lock wait
    timeout
    
    in that fix (rb://279) the behavior was changed to honor when a trx is
    interrupted during lock wait, but the returned error code was still
    "lock wait timeout" when it should be "interrupted".
    
    This change fixes the non-deterministically failing test binlog.binlog_killed,
    that failed like this:
    
    binlog.binlog_killed 'stmt'              [ fail ]
            Test ended at 2010-05-12 11:39:08
    
    CURRENT_TEST: binlog.binlog_killed
    mysqltest: At line 208: query 'reap' failed with wrong errno 1205: 'Lock wait timeout exceeded; try restarting transaction', instead of 0...
    
    Approved by:	Sunny Bains (rb://344)
  ------------------------------------------------------------

This merge is non-trivial since it has to introduce the DB_INTERRUPTED
error code.

Also revert vasil.dimov@oracle.com-20100408165555-9rpjh24o0sa9ad5y
which adjusted the binlog.binlog_killed test to the new (wrong) behavior
2010-05-20 10:39:02 +03:00
Sunny Bains
553c9c3647 Fix a bug reported by PushBuild on OSX 10.6.3. It turned out to be a compiler
bug. The code has been changed to work around it. To reprocude the bug simply
revert this change and build the binary with:

GCC Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5659~1/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5659)

export LDFLAGS='-g -arch i386'
export CFLAGS='-g -no-cpp-precomp -arch i386 -O2'
export CXXFLAGS='-g -no-cpp-precomp -arch i386 -O2'

./configure --enable-thread-safe-client --enable-local-infile --with-pic --with-client-ldflags=-static --with-mysqld-ldflags=-static --with-zlib-dir=bundled --without-ndb-debug --with-big-tables --with-ssl --with-readline --with-embedded-server --with-archive-storage-engine --with-blackhole-storage-engine --with-csv-storage-engine --with-example-storage-engine --with-federated-storage-engine --with-partition --with-extra-charsets=all --with-innodb --with-ndbcluster --with-libevent --target=i386-apple-darwin --program-transform-name=

Approved by Marko on IM.
2010-05-19 20:19:27 +10:00
Marko Mäkelä
b6fa4b1194 Merge from mysql-5.1-innodb:
Post-merge fixes: Remove the MYSQL_VERSION_ID checks, because they only
apply to the InnoDB Plugin. Fix potential race condition accessing
trx->op_info and trx->detailed_error.
------------------------------------------------------------
revno: 3466
revision-id: marko.makela@oracle.com-20100514130815-ym7j7cfu88ro6km4
parent: marko.makela@oracle.com-20100514130228-n3n42nw7ht78k0wn
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: mysql-5.1-innodb2
timestamp: Fri 2010-05-14 16:08:15 +0300
message:
  Make the InnoDB FOREIGN KEY parser understand multi-statements. (Bug #48024)
  Also make InnoDB thinks that /*/ only starts a comment. (Bug #53644).

  This fixes the bugs in the InnoDB Plugin.

  ha_innodb.h: Use trx_query_string() instead of trx_query() when
  available (MySQL 5.1.42 or later).

  innobase_get_stmt(): New function, to retrieve the currently running
  SQL statement.

  struct trx_struct: Remove mysql_query_str. Use innobase_get_stmt() instead.

  dict_strip_comments(): Add and observe the parameter sql_length. Treat
  /*/ as the start of a comment.

  dict_create_foreign_constraints(), row_table_add_foreign_constraints():
  Add the parameter sql_length.
2010-05-14 16:31:44 +03:00
Marko Mäkelä
c3c2279cbd Make the InnoDB FOREIGN KEY parser understand multi-statements. (Bug #48024)
Also make InnoDB thinks that /*/ only starts a comment. (Bug #53644).

struct trx_struct: Add mysql_query_len.

ha_innodb.cc: Use trx_query_string() instead of trx_query() and
initialize trx->mysql_query_len.

INNOBASE_COPY_STMT(thd, trx): New macro, to initialize
trx->mysql_query_str and trx->mysql_query_len.

dict_strip_comments(): Add and observe the parameter sql_length. Treat
/*/ as the start of a comment.

dict_create_foreign_constraints(), row_table_add_foreign_constraints():
Add the parameter sql_length.
2010-05-14 16:02:28 +03:00
Vasil Dimov
2d299d84f9 Followup to Bug#51920, fix binlog.binlog_killed
This is a followup to the fix of

Bug#51920 Innodb connections in row lock wait ignore KILL until lock wait
timeout

in that fix (rb://279) the behavior was changed to honor when a trx is
interrupted during lock wait, but the returned error code was still
"lock wait timeout" when it should be "interrupted".

This change fixes the non-deterministically failing test binlog.binlog_killed,
that failed like this:

binlog.binlog_killed 'stmt'              [ fail ]
        Test ended at 2010-05-12 11:39:08

CURRENT_TEST: binlog.binlog_killed
mysqltest: At line 208: query 'reap' failed with wrong errno 1205: 'Lock wait timeout exceeded; try restarting transaction', instead of 0...

Approved by:	Sunny Bains (rb://344)
2010-05-13 10:46:52 +03:00
Marko Mäkelä
9ac5b183e0 Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3460
  revision-id: marko.makela@oracle.com-20100512053925-ovwmpo0838fs2roo
  parent: marko.makela@oracle.com-20100511165845-lsw7seixftgzpfqt
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: mysql-5.1-innodb
  timestamp: Wed 2010-05-12 08:39:25 +0300
  message:
    row_merge_drop_temp_indexes(): Do not reference freed memory.
    (Bug #53471)
2010-05-12 09:21:46 +03:00