Commit graph

4407 commits

Author SHA1 Message Date
Jon Olav Hauglid
02863b4180 Merge from mysql-5.5-runtime to mysql-5.5-bugfixing. 2010-08-20 10:24:32 +02:00
Marko Mäkelä
cb73a044f8 Bug#56114 Disallow trx->dict_operation_lock_mode==RW_X_LATCH in srv_suspend_mysql_thread()
Issue an error message to the error log when
trx->dict_operation_lock_mode == RW_X_LATCH in
srv_suspend_mysql_thread(). Transactions that modify InnoDB
data dictionary tables must be free of lock waits, because they
must be holding the data dictionary latch in exclusive mode.
The transactions must not be accessing any other tables other than
the data dictionary tables.

The handling of RW_X_LATCH was accidentally added in the InnoDB Plugin,
as a wrong fix of an assertion failure. (Fast index creation was accessing
both data dictionary tables and user tables in the same transaction.)
2010-08-19 13:36:37 +03:00
Alexander Barkov
f827ef9ed4 Backporting Bug#32391 Character sets: crash with --character-set-server
from mysql-trunk-bugfixing (5.6.1-m5) from mysql-5.5-bugfixing (5.5.6-m3).
2010-08-19 10:00:43 +04:00
Jimmy Yang
97a780f1f9 Bug #48026 Log start and end of InnoDB buffer pool initialization to
the error log
2010-08-18 21:16:47 -07: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
Jon Olav Hauglid
eb498cce4d Manual merge from mysql-5.5-bugfixing to mysql-5.5-runtime. 2010-08-18 13:29:04 +02:00
Marko Mäkelä
5a296bb07c 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:01:10 +03:00
Magne Mahre
6293c44ff6 Bug #55547 InnoDB is not included when configuring by default
Added InnoDB to the 'default' plugin group, and modified 
the autoconf script so the 'default' group is actually 
built by default.
      
(i.e  ./configure.am == ./configure.am --with-plugins=default ,
instead of being ./configure.am --with-plugins=none )
2010-08-18 10:14:55 +02:00
Alexander Nozdrin
e28d6ee66a Auto-merge from mysql-5.5. 2010-08-18 11:48:38 +04:00
Vasil Dimov
ec4209255f Merge mysql-5.5-bugfixing -> mysql-5.5-innodb 2010-08-18 10:14:06 +03:00
Marko Mäkelä
085bb22ab2 A non-functional change:
dict_load_index_low(): Rename the parameter "cached" to "allocated"
and clarify the comments.
2010-08-17 15:07:54 +03:00
Jimmy Yang
b17b122b7d Fix bug #53496 Use Lock_time in slow query log output for InnoDB row
lock wait time. Including the InnoDB lock time in the exiting "Lock_time"
output.
2010-08-17 01:19:24 -07:00
Vasil Dimov
7f62ec7b38 Fix Bug#53761 RANGE estimation for matched rows may be 200 times different
Improve the range estimation algorithm.

Previously:
For a given level the algo knows the number of pages in the requested range and the n

With this change:
Same idea, but peek a few (10) of the intermediate pages to get a better estimate of 

In the bug report one of the examples has a btree with a snippet of the leaf level li
page1(899 records), page2(1 record), page3(1 record), page4(1 record)
so when trying to estimate, the previous algo, assumed there are average (899+1)/2=45
Fix Bug#53761 RANGE estimation for matched rows may be 200 times different

Improve the range estimation algorithm.

Previously:
For a given level the algo knows the number of pages in the requested range
and the number of records on the leftmost and the rightmost page. Then it
assumes all pages in between contain the average between the two border pages
and multiplies this average number by the number of intermediate pages.

With this change:
Same idea, but peek a few (10) of the intermediate pages to get a better
estimate of the average number of records per page. If there are less than 10
intermediate pages then all of them will be scanned and the result will be
precise, not an estimation.

In the bug report one of the examples has a btree with a snippet of the leaf
level like this:
page1(899 records), page2(1 record), page3(1 record), page4(1 record)
so when trying to estimate, the previous algo, assumed there are average
(899+1)/2=450 records per page which went terribly wrong. With this change
page2 and page3 will be read and the exact number of records will be returned.

Approved by:	Sunny (rb://401)
2010-08-16 17:23:29 +03:00
Mats Kindahl
b0836bd309 Merging with mysql-5.5-stage. 2010-08-16 14:50:27 +02:00
Alexander Nozdrin
98f69947aa Auto-merge from mysql-5.5. 2010-08-16 10:46:21 +04:00
Alexander Nozdrin
aadd49573c Auto-merge from mysql-5.5. 2010-08-16 10:38:26 +04: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
Sunny Bains
adde4bac98 Fix Bug #55277 - Failing assertion: auto_inc > 0
Handle overflow when reading value from SELECT MAX(C) FROM T;

Call ha_innobase::info() after initializing the autoinc value
in ha_innobase::open().

Fix for both the builtin and plugin.

rb://402

Merge from mysql-5.1-security.
2010-08-16 11:59:43 +10:00
Inaam Rana
1a649603f8 Change default for innodb_strict_mode to FALSE.
Note that this was originally pushed by Calvin but the was later
reverted by mistake.

bug#54702
2010-08-13 15:07:22 -04:00
Inaam Rana
50af6a8aea Undo changes to innodb_strict_mode that went in by mistake in r3149 2010-08-13 12:14:59 -04: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
Alexander Nozdrin
8b645bed97 Patch for Bug#55854 (MySQL AB should not be AUTHOR, copyright incorrect).
Fixing copyright text.
2010-08-12 19:19:57 +04:00
Marc Alff
26f1efd981 Bug#55416 Renaming of performance_schema tables for 5.5
Removed table SETUP_OBJECTS.
      
Renamed table PROCESSLIST to THREADS.
      
Renamed table EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
to EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME.
      
Adjusted Makefiles, code and tests accordingly.
2010-08-12 08:08:52 -06:00
Sunny Bains
34a05995df Fix bug #52263 innodb does not compile on OpenSolaris with gcc4.3.2
Disable the GCC visibility attribute on all sun platforms.

Approved by Marko on IRC.
2010-08-12 20:00:07 +10:00
Marc Alff
a1d90f124f Bug#55462 Performance schema: reduce the overhead of PFS_events_waits::m_wait_class
This is a performance improvement fix.

Removed the "volatile" property of PFS_events_waits::m_wait_class.
Simplified the code accordingly.
2010-08-12 03:51:58 -06:00
Marko Mäkelä
271e6ae341 Bug#54914: InnoDB: performance drop with innodb_change_buffering=all
Reduce ibuf_mutex and ibuf_pessimistic_insert_mutex contention further.

Protect ibuf->empty by the insert buffer root page latch, not ibuf_mutex.

ibuf_tree_root_get(): Assert that ibuf_mutex is owned by the
caller. Assert that the stamped page number is correct. Assert that
ibuf->empty agrees with the root page.

ibuf_size_update(): Do not update ibuf->empty.

ibuf_init_at_db_start(): Update ibuf->empty while holding the root page latch.

ibuf_add_free_page(): Return TRUE/FALSE instead of DB_SUCCESS/DB_STRONG_FAIL.

ibuf_remove_free_page(): Release ibuf_pessimistic_insert_mutex as
early as possible.

ibuf_contract_ext(): Rely on a dirty read of ibuf->empty, unless the
server is being shut down. Never acquire ibuf_mutex. Eliminate n_stored.

ibuf_contract_after_insert(): Never acquire ibuf_mutex. Perform dirty
reads of ibuf->size and ibuf->max_size.

ibuf_insert_low(): Only acquire ibuf_mutex for mode==BTR_MODIFY_TREE.
Perform dirty reads of ibuf->size and ibuf->max_size. Update
ibuf->empty while holding the root page latch.

ibuf_delete_rec(): Update ibuf->empty while holding the root page latch.

ibuf_is_empty(): Release ibuf_mutex earlier.
2010-08-10 13:22:48 +03:00
Marko Mäkelä
a4c5cf7ca9 Reduce the ibuf_mutex hold time. This does not fix the update
regression in Bug #54914, but it does speed up the execution for
innodb_change_buffering=inserts.

ibuf_add_ops(), ibuf_merge_or_delete_for_page(),
ibuf_delete_for_discarded_space(): Use atomic built-ins instead of
ibuf_mutex, when available.

ibuf_add_free_page(), ibuf_remove_free_page(), ibuf_contract_ext():
Release ibuf_mutex earlier.

ibuf_free_excess_pages(): Release ibuf_mutex before a conditional branch.

ibuf_insert_low(): Release ibuf_mutex before a conditional
branch. Create ibuf_entry before re-acquiring ibuf_mutex. Simplify a
loop to reduce code footprint. Release ibuf_mutex before mtr_commit()
[btr_pcur_close()].

ibuf_is_empty(): Release ibuf_mutex before mtr_commit().
2010-08-09 11:58:37 +03:00
Davi Arnaut
76382d2746 Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Post-merge fix: remove --with-debug=full, it was only used for safemalloc.

BUILD/compile-pentium-mysqlfs-debug:
  Remove build script for a feature that is long gone.
2010-08-06 09:59:38 -03:00
Jimmy Yang
531c0eee52 Address bug #55465 ERROR 1280 (42000): Incorrect index name '<index name>',
adding a couple FK related messages.

rb://409 approved by Sunny Bains
2010-08-06 02:49:22 -07:00
Inaam Rana
9943e3f472 merge 2010-08-05 11:42:11 -04:00
Inaam Rana
0812058d02 Backport of revno 3148 mysql-innodb-trunk
Currently we do a full validation of AHI whenever check tables is
  called on any table. This patch fixes this by only doing this full
  check in debug versions.
  
  bug#55716
  rb://423
  approved by: Marko
2010-08-05 11:34:44 -04:00
Inaam Rana
b4a25f462e Currently we do a full validation of AHI whenever check tables is
called on any table. This patch fixes this by only doing this full
check in debug versions.

bug#55716
rb://423
approved by: Marko
2010-08-05 11:09:05 -04:00
Georgi Kodinov
ae64b6f7ab merge 2010-08-05 15:34:19 +03:00
Sunny Bains
09eb23d50b Fix Bug #55277 - Failing assertion: auto_inc > 0
Handle overflow when reading value from SELECT MAX(C) FROM T;

Call ha_innobase::info() after initializing the autoinc value
in ha_innobase::open().

Fix for both the builtin and plugin.

rb://402
2010-08-05 19:24:34 +10:00
Sunny Bains
b37256b1ab 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-05 19:18:17 +10:00
Georgi Kodinov
b1a8b3aa6e Bug #42144: plugin_load fails
Reverted the ulong->uint diff
Re-applied the first diff.
The original commit message follows:

enum plugin system variables are ulong internally, not int.
On systems where long is not the same as an int it causes
problems. 
Fixed by correct typecasting. Removed the test from the 
experimental list.
2010-08-04 15:58:09 +03:00
Jimmy Yang
ad90d1942e Fix bug #54678, InnoDB, TRUNCATE, ALTER, I_S SELECT, crash or deadlock
rb://399 approved by Sunny Bains
2010-08-04 03:37:44 -07:00
Jimmy Yang
04970a2ff1 Fix Bug #54582 stack overflow when opening many tables linked with
foreign keys at once

rb://391 approved by Heikki
Z
2010-08-04 03:11:33 -07:00
Alexander Nozdrin
aeeafbb396 Auto-merge from mysql-5.5. 2010-08-04 12:18:32 +04:00
Jimmy Yang
666dfaf090 Backport "NULL pointer check for ut_free()" from mysql-trunk-innodb to
mysql-5.1-innodb plugin to fix bug #55627 segv in ut_free pars_lexer_close
innobase_shutdown innodb-use-sys-malloc=0.
2010-08-03 20:20:55 -07:00
Georgi Kodinov
efc8a27935 merge 2010-08-03 19:21:13 +03:00
Georgi Kodinov
5eeb6488cf Bug #42144: plugin_load fails
The enum system variables were handled inconsistently 
as ints, unsigned int and unsigned long on various places.
This caused problems on platforms on which 
sizeof(int) != sizeof(long).
Fixed by homogenizing the type of the enum variables
to unsigned int, since it's size compatible with the C enum
type. 
Removed the test from the experimental list.
2010-08-03 19:01:30 +03:00
Calvin Sun
b003544f65 Bug #54702: revert the default of innodb_strict_mode to false. 2010-08-03 01:12:03 -05:00
Jimmy Yang
190ec75c35 Fix Bug #55382 Assignment with SELECT expressions takes unexpected S locks
in READ COMMITTED

rb://410 Approved by Sunny Bains
2010-08-01 22:25:57 -07:00
Inaam Rana
e3e0c290dd merge from parent 2010-07-30 10:41:59 -04:00
Inaam Rana
0f9c818545 When the caller of buf_flush_list() provides us with the number of
pages that it wants to flush then we should honor that value as in
not going beyond that in our eagerness to flush the neighbors of
the selected victim.
2010-07-30 10:39:16 -04:00
Alexander Nozdrin
32f3ab7933 Auto-merge from mysql-trunk-merge. 2010-07-29 16:32:11 +04:00
Konstantin Osipov
d85c628180 Merge trunk-bugfixing -> trunk-runtime. 2010-07-29 14:18:13 +04:00
Vasil Dimov
ca090321bf Merge mysql-trunk-bugfixing -> mysql-trunk-innodb 2010-07-29 12:42:55 +03:00
Vasil Dimov
c110066bda Merge mysql-5.1-bugteam -> mysql-5.1-innodb 2010-07-29 11:51:00 +03:00
Jimmy Yang
277b055f14 Fix bug #55581 by backporting fix of #52546 from mysql-trunk-innodb
to mysql-5.1-innodb plugin.
2010-07-28 03:20:44 -07:00
Vasil Dimov
3ced6488a4 Fix trailing whitespace on ha_innodb.cc:1259 2010-07-28 09:15:07 +03:00
Vasil Dimov
c02859352b Remove trailing whitespace on ha_innodb.cc:574 2010-07-28 08:38:28 +03:00
Konstantin Osipov
c4c678f653 Merge trunk-bugfixing -> trunk-runtime. 2010-07-27 18:32:42 +04:00
Davi Arnaut
e4cbcaf942 Bug#45377: ARCHIVE tables aren't discoverable after OPTIMIZE
The problem was that the optimize method of the ARCHIVE storage
engine was not preserving the FRM embedded in the ARZ file when
rewriting the ARZ file for optimization. The ARCHIVE engine stores
the FRM in the ARZ file so it can be transferred from machine to
machine without also copying the FRM -- the engine restores the
embedded FRM during discovery.

The solution is to copy over the FRM when rewriting the ARZ file.
In addition, some initial error checking is performed to ensure
garbage is not copied over.


mysql-test/t/archive.test:
  Add test case for Bug#45377.
storage/archive/azio.c:
  Add error checking to ensure that the I/O operations are
  successful.
storage/archive/ha_archive.cc:
  Copy over the embedded FRM.
2010-07-26 12:54:20 -03:00
Jimmy Yang
84a827018c Fix Bug #55395 INNODB_TRX duplicates columns
rb://408 approved by Sunny Bains
2010-07-26 03:07:36 -07:00
Davi Arnaut
8011a429b5 Add a maintainer target to the warning-mode of the build scripts.
Fix assorted warnings in order for the warning-mode to be effective.
2010-07-24 10:31:48 -03:00
Davi Arnaut
73188c913b Backport fixes for some of the more noise compiler warnings in ndb. 2010-07-24 09:54:27 -03:00
Davi Arnaut
7f80eb46e9 Bug#42733: Type-punning warnings when compiling MySQL
Post-merge fix: remove remaining casts which are now
unnecessary and are actually causing warnings.
2010-07-24 09:24:44 -03:00
Davi Arnaut
e001970cc7 WL#5498: Remove dead and unused source code
Remove workarounds for ancient systems.

mysys/default.c:
  Make cast more explicit to ensure a correct offset.
2010-07-23 17:17:55 -03:00
Davi Arnaut
75e2212397 WL#5498: Remove dead and unused source code
Remove unused macros or macro which are always defined.

include/my_global.h:
  Remove unused macros and move macros which aren't used globally.
2010-07-23 17:16:29 -03:00
Davi Arnaut
cc3a26289d WL#5498: Remove dead and unused source code
Remove the ancient and dead raid code. By now, even the server side
has been removed.
2010-07-23 17:15:07 -03:00
Davi Arnaut
bc4ba28cab WL#5498: Remove dead and unused source code
Remove unused variables.
2010-07-23 17:13:36 -03:00
Davi Arnaut
97c3182312 WL#5498: Remove dead and unused source code
Remove code that has been disabled for a long time.
2010-07-23 17:09:27 -03:00
Vasil Dimov
6c4335b4cd Increment InnoDB Plugin version to 1.0.11.
InnoDB Plugin 1.0.10 has been released with MySQL 5.1.49.
2010-07-23 19:32:38 +03:00
Vasil Dimov
f43c9eff23 Merge mysql-5.1 -> mysql-5.1-innodb 2010-07-23 12:51:14 +03:00
Sunny Bains
424250c26c Remove code that was added during the flush list mutex refactoring. We cannot
release a dirty page in the middle of a mini-transaction. Replace the code
with an assertion that checks for this condition.

Original svn revision was: r6330.
2010-07-22 14:46:12 +10:00
Sunny Bains
e27f4b3a4b Bug#54583 InnoDB: Assertion failure sync/sync0sync.c:1226
Silence the UNIV_SYNC_DEBUG assertion failure while upgrading old data files
to multiple rollback segments during server startup. Because the upgrade
takes place while InnoDB is running a single thread, we can safely ignore the
latching order checks without fearing deadlocks.
      
innobase_start_or_create_for_mysql(): Set srv_is_being_started = FALSE
only after trx_sys_create_rsegs() has completed.
      
sync_thread_add_level(): If srv_is_being_started, ignore latching order
violations for SYNC_TRX_SYS_HEADER and SYNC_IBUF_BITMAP.

Create all the non-IO threads after creating the extra rollback segments.

Patch originally from Marko with some additions by Sunny.
2010-07-22 09:16:19 +10:00
Sunny Bains
779741921c Bug 54617 - During shutdown: Failing assertion: arr->n_reserved == 0
Get rid of at least on suspicious path. Ensure that the purge thread
doesn't acquire a mutex after it has signalled shutdown.
2010-07-22 07:41:51 +10:00
Vasil Dimov
f867d5c1dc Increment InnoDB version to 1.1.2
InnoDB 1.1.1 was released with MySQL 5.5.5-m3
2010-07-21 20:19:59 +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
Calvin Sun
0802e5da69 Improve InnoDB synchronization primitives on Windows
This patch was originally developed by Vladislav Vaintroub.
The main changes are:

 * Use TryEnterCriticalSection in os_fast_mutex_trylock().
 * Use lightweight condition variables on Vista or later Windows;
   but fall back to events on older Windows, such as XP.

This patch also fixes the following bugs:
  bug# 52102 InnoDB Plugin shows performance drop compared to InnoDB
             on Windows
  bug# 53204 os_fastmutex_trylock is implemented incorrectly on Windows

rb://363 approved by Inaam Rana
2010-07-20 15:42:31 -05:00
Davi Arnaut
182599dd13 Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-20 16:30:10 -03:00
Davi Arnaut
9a5fa17fd3 Bug#45288: pb2 returns a lot of compilation warnings on linux
Fix warnings flagged by the new warning option -Wunused-but-set-variable
that was added to GCC 4.6 and that is enabled by -Wunused and -Wall. The
option causes a warning whenever a local variable is assigned to but is
later unused. It also warns about meaningless pointer dereferences.

client/mysql.cc:
  Meaningless pointer dereferences.
client/mysql_upgrade.c:
  Check whether reading from the file succeeded.
extra/comp_err.c:
  Unused.
extra/yassl/src/yassl_imp.cpp:
  Skip instead of reading data that is discarded.
include/my_pthread.h:
  Variable is only used in debug builds.
include/mysys_err.h:
  Add new error messages.
mysys/errors.c:
  Add new error message for permission related functions.
mysys/mf_iocache.c:
  Variable is only checked under THREAD.
mysys/my_copy.c:
  Raise a error if chmod or chown fails.
mysys/my_redel.c:
  Raise a error if chmod or chown fails.
regex/engine.c:
  Use a equivalent variable for the assert.
server-tools/instance-manager/instance_options.cc:
  Unused.
sql/field.cc:
  Unused.
sql/item.cc:
  Unused.
sql/log.cc:
  Do not ignore the return value of freopen: only set buffer if
  reopening succeeds.
  
  Adjust doxygen comment to the right function.
  
  Pass message lenght to log function.
sql/mysqld.cc:
  Do not ignore the return value of freopen: only set buffer if
  reopening succeeds.
sql/partition_info.cc:
  Unused.
sql/slave.cc:
  No need to set pointer to the address of '\0'.
sql/spatial.cc:
  Unused. Left for historical purposes.
sql/sql_acl.cc:
  Unused.
sql/sql_base.cc:
  Pointers are always set to the same variables.
sql/sql_parse.cc:
  End statement if reading fails.
  
  Store the buffer after it has actually been updated.
sql/sql_repl.cc:
  No need to set pointer to the address of '\0'.
sql/sql_show.cc:
  Put variable under the same ifdef block.
sql/udf_example.c:
  Set null pointer flag appropriately.
storage/csv/ha_tina.cc:
  Meaningless dereferences.
storage/example/ha_example.cc:
  Return the error since it's available.
storage/myisam/mi_locking.c:
  Remove unused and dead code.
2010-07-20 15:07:36 -03:00
Alexander Nozdrin
fdfbb82964 Auto-merge from mysql-trunk-merge. 2010-07-20 12:09:51 +04:00
Davi Arnaut
84d2ae22fe Merge into mysql-trunk-merge.. 2010-07-19 16:03:59 -03:00
Davi Arnaut
dfaf73a987 Merge of mysql-5.1 into mysql-5.1-bugteam. 2010-07-19 15:34:28 -03:00
Jon Olav Hauglid
7467ee7bc6 merge from mysql-trunk-bugfixing 2010-07-19 10:27:53 +02:00
Davi Arnaut
59c0e16d62 Merge of mysql-trunk-merge into mysql-trunk-bugfixing. 2010-07-16 17:02:40 -03:00
Davi Arnaut
92f3fc92f3 Bug#48327: Some crashes specific to FreeBSD ("embedded")
Bug#47139: Test "merge" crashes in "embedded" run

Backport patch for Bug#47139
2010-07-16 14:33:35 -03:00
Marc Alff
102d04dd65 Bug#52134 performance schema file io, symlink in path
Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)
2010-07-15 19:25:03 -06:00
Marc Alff
3725080c25 Bug#53617 Missing performance schema tables not reported in the server log at startup
Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)
2010-07-15 19:18:44 -06:00
Marc Alff
e04de9783a Bug#52502 Performance schema does not start with large mutex_instance buffers
Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)
2010-07-15 19:03:08 -06:00
Marc Alff
36e80ced63 Bug#52586 Misleading error message on attempt to access a P_S table using a wrong name
Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)
2010-07-15 18:50:39 -06:00
Marc Alff
bc6092a497 Bug#53566 SHOW ENGINE PERFORMANCE_SCHEMA STATUS reports less memory than really used
Backporting the fix from myql-next-mr (5.6) to mysql-trunk (5.5)
2010-07-15 18:28:52 -06:00
Marc Alff
aa2daceebc Bug#53148 Remove PFS_readonly_table
This fix is for cleanup, to resolve a remaining code review item.
Backport from mysql-next-mr (5.6) to mysql-trunk (5.5).
2010-07-15 18:06:33 -06:00
Marc Alff
4b1f459ae0 Fixed Copyright headers in storage/perfschema
Fixed minor merge issues with #includes
2010-07-15 17:44:45 -06:00
Davi Arnaut
711c318c07 Merge of mysql-trunk-bugfixing into mysql-trunk-merge. 2010-07-15 10:47:50 -03:00
Davi Arnaut
6420d6dc4a WL#5486: Remove code for unsupported platforms
Remove VMS specific code.
2010-07-15 08:26:38 -03:00
Davi Arnaut
13f7a1d244 WL#5486: Remove code for unsupported platforms
Remove MS-DOS specific code.
2010-07-15 08:16:06 -03:00
Davi Arnaut
07e7b4d6fe WL#5486: Remove code for unsupported platforms
Remove Netware specific code.
2010-07-15 08:13:30 -03:00
Sunny Bains
17fd8dec1d Fix bug# 54901 assert during recovery when binlog enabled.
Remove the pure attribute from a function. The function doesn't qualify as
a pure function because it has a side-effect (modifies its parameter). Add
a clarifying comment to another function's declaration.
2010-07-15 11:55:15 +10: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
Davi Arnaut
4972f4d803 Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-14 10:16:10 -03:00
Davi Arnaut
ce78970202 Bug#48327: Some crashes specific to FreeBSD ("embedded")
Backport fixes from ndb: Rework the constructors of some static
object's to not call dbug functions since the constructors will
be called before main, and consequently, before the dbug library
is initialized.
2010-07-14 10:10:12 -03:00
Jimmy Yang
29bde8a0ce Fix Bug #55095 innodb_file_format_check: no warning for illegal value
rb://397 approved by Sunny Bains
2010-07-13 02:58:39 -07:00
Jon Olav Hauglid
f45523188e merge from mysql-trunk-bugfixing 2010-07-13 10:39:24 +02:00
Davi Arnaut
47a4a88160 Add the cmake option MYSQL_MAINTAINER_MODE which is equivalent
to the autotools option mysql-maintainer-mode. This option is
intended to set a few flags that should be activated by anyone
doing MySQL development, regardless of the build type. Also, the
flags are only set by the very end of the platform checks as
to not disturb fragile checks.
2010-07-12 13:39:00 -03: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
Davi Arnaut
1c924a1652 Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-09 09:28:51 -03:00
unknown
6ad06b1522 Fix bug #55039 Failing assertion: space_id > 0 in fil0fil.c. 2010-07-09 14:23:48 +02:00
Davi Arnaut
11fae04527 Bug#45288: pb2 returns a lot of compilation warnings on linux
Although the C standard mandates that sprintf return the number
of bytes written, some very ancient systems (i.e. SunOS 4)
returned a pointer to the buffer instead. Since these systems
are not supported anymore and are hopefully long dead by now,
simply remove the portability wrapper that dealt with this
discrepancy. The autoconf check was causing trouble with GCC.
2010-07-09 09:00:17 -03:00
Davi Arnaut
cd37b73fe5 Bug#53445: Build with -Wall and fix warnings that it generates
Introduce a MySQL maintainer/developer mode that enables
a set of warning options for the C/C++ compiler. This mode
is intended to help improve the overall quality of the code.

The warning options are:

C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Werror"
CXX_WARNINGS="$C_WARNINGS -Wno-unused-parameter"

Since -Wall is essentially a moving target, autoconf checks
are not run with warning options enabled, in particualr -Werror.
This decision might be revisited in the future. The patch also
fixes a mistake in the makefiles, where automake CXXFLAGS would
be set to CFLAGS.

config/ac-macros/maintainer.m4:
  Add a set of default compiler flags used when in maintainer mode.
configure.in:
  Hook into the maintainer mode. Disabled by default.
2010-07-09 08:37:51 -03:00
Jimmy Yang
143c8b5a6c Merge fix for bug #55039 from mysql-5.1-security to mysql-trunk-security.
bug #55039 Failing assertion: space_id > 0 in fil0fil.c line 2618 .

rb://396 approved by Sunny Bains
2010-07-09 02:01:05 -07:00
Jimmy Yang
74f23d7e8f Fix bug #55039 Failing assertion: space_id > 0 in fil0fil.c.
rb://396, approved by Sunny Bains.
2010-07-09 01:39:20 -07:00
Davi Arnaut
f56dd32bf7 Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.

Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.

Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost. 

The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.

Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.

client/mysqldump.c:
  Pass my_free directly as its signature is compatible with the
  callback type -- which wasn't the case for free_table_ent.
2010-07-08 18:20:08 -03:00
Jimmy Yang
b7269520bd Fix Bug #54764 memory allocated in os_aio_array_create is not
freed at shutdown

rb://395, approved by Sunny Bains
2010-07-08 00:05:59 -07:00
Davi Arnaut
cd41cd953d Bug#22320: my_atomic-t unit test fails
The atomic operations implementation on 5.1 has a few problems,
which might cause tests to abort randomly. Since no code in 5.1
uses atomic operations, simply remove the code.
2010-07-05 09:00:39 -03:00
Georgi Kodinov
22f4498cd6 merge 2010-07-05 12:35:24 +03:00
Vasil Dimov
f219357a09 Merge mysql-5.1-innodb -> mysql-5.1-security
Merge up to sunny.bains@oracle.com-20100625081841-ppulnkjk1qlazh82 .
There are 8 more changesets in mysql-5.1-innodb, but PB2 shows a
failure for a test added in one of them. If that is resolved quickly
then those 8 more changesets will be merged too.
2010-07-04 10:12:44 +03:00
Davi Arnaut
54a5c00de9 Unset the execute bit where it's not needed. 2010-07-03 20:17:03 -03:00
Davi Arnaut
5641fb64b4 Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-02 16:38:04 -03:00
Davi Arnaut
0eb26fdfa8 Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings
generated by GCC 4.4.4 -Wall and -Wextra flags.

One major source of warnings was the in-house function my_bcmp
which (unconventionally) took pointers to unsigned characters
as the byte sequences to be compared. Since my_bcmp and bcmp
are deprecated functions whose only difference with memcmp is
the return value, every use of the function is replaced with
memcmp as the special return value wasn't actually being used
by any caller.

There were also various other warnings, mostly due to type
mismatches, missing return values, missing prototypes, dead
code (unreachable) and ignored return values.

BUILD/SETUP.sh:
  Remove flags that are implied by -Wall and -Wextra.
  Do not warn about unused parameters in C++.
BUILD/check-cpu:
  Print only the compiler version instead of verbose banner.
  Although the option is gcc specific, the check was only
  being used for GCC specific checks anyway.
client/mysql.cc:
  bcmp is no longer defined.
client/mysqltest.cc:
  Pass a string to function expecting a format string.
  Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
  Always define _GNU_SOURCE when compiling GNU readline.
  Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
  Condition for the code to be meaningful.
configure.in:
  Remove check for bcmp.
extra/comp_err.c:
  Use appropriate type.
extra/replace.c:
  Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
  Do not ignore the return value of fgets. Retrieve the file
  position if fgets succeed -- if it fails, the function will
  bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
  Use a single array instead of accessing positions of the sbox_
  through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
  One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
  Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
  Do not define type within a anonymous union.
  Use a variable to return a value instead of
  leaving the result in a register -- compiler
  does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
  Define handler for pure virtual functions.
  Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
  Function must have C language linkage.
include/m_string.h:
  Remove check which relied on bcmp being defined -- they weren't
  being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
  Remove bogus helpers which were used only in a few files and
  were causing warnings about dead code.
include/my_global.h:
  Due to G++ bug, always silence false-positive uninitialized
  variables warnings when compiling C++ code with G++.
  Remove bogus helper.
libmysql/Makefile.shared:
  Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
  Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
  Leave space of the ending nul.
mysys/mf_pack.c:
  Replace bcmp with memcmp.
mysys/my_bitmap.c:
  Dead code removal.
mysys/my_gethwaddr.c:
  Remove unused variable.
mysys/my_getopt.c:
  Silence bogus uninitialized variable warning.
  Do not cast away the constant qualifier.
mysys/safemalloc.c:
  Cast to expected type.
mysys/thr_lock.c:
  Silence bogus uninitialized variable warning.
sql/field.cc:
  Replace bogus helper with a more appropriate logic which is
  used throughout the code.
sql/item.cc:
  Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
  Simplify code to avoid signedness related warnings.
sql/log_event.cc:
  Replace use of bcmp with memcmp.
  No need to use helpers for simple bit operations.
sql/log_event_old.cc:
  Replace bmove_align with memcpy.
sql/mysqld.cc:
  Move use declaration of variable to the ifdef block where it
  is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
  Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
  Cast to expected type and silence bogus warning.
sql/sql_class.h:
  Don't use enum values as bit flags, the supposed type safety is
  bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
  Only declare variable when necessary.
sql/unireg.h:
  Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
  Silence bogus warning.
storage/myisam/mi_open.c:
  Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
  char.
storage/myisam/mi_page.c:
  Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
  char.
strings/bcmp.c:
  Remove built-in bcmp.
strings/ctype-ucs2.c:
  Silence bogus warning.
tests/mysql_client_test.c:
  Use a appropriate type as expected by simple_command().
2010-07-02 15:30:47 -03:00
Konstantin Osipov
05617af025 A fix and a test case for Bug#36171 "CREATE TEMPORARY TABLE and
MERGE engine".
Backport the patch from 6.0 by Ingo Struewing:
revid:ingo.struewing@sun.com-20091028183659-6kmv1k3gdq6cpg4d
Bug#36171 - CREATE TEMPORARY TABLE and MERGE engine

In former MySQL versions, up to 5.1.23/6.0.4 it was possible to create
temporary MERGE tables with non-temporary MyISAM tables.
        
This has been changed in the mentioned version due to Bug 19627
(temporary merge table locking). MERGE children were locked through
the parent table. If the parent was temporary, it was not locked and
so the children were not locked either. Parallel use of the MyISAM
tables corrupted them.
       
Since 6.0.6 (WL 4144 - Lock MERGE engine children), the children are
locked independently from the parent. Now it is possible to allow
non-temporary children with a temporary parent. Even though the
temporary MERGE table itself is not locked, each non-temporary
MyISAM table is locked anyway.
        
NOTE: Behavior change: In 5.1.23/6.0.4 we prohibited non-temporary
children with a temporary MERGE table. Now we re-allow it.
An important side-effect is that temporary tables, which overlay
non-temporary MERGE children, overlay the children in the MERGE table.


mysql-test/r/merge.result:
  Update results (Bug#36171).
mysql-test/r/merge_mmap.result:
  Update results (Bug#36171).
mysql-test/t/merge.test:
  Add tests for Bug#36171
mysql-test/t/merge_mmap.test:
  Add tests for Bug#36171.
storage/myisammrg/ha_myisammrg.cc:
  Changed constraint for temporary state of tables.
2010-07-02 20:07:57 +04:00
Konstantin Osipov
1afe6ff03a A test case for Bug#50788 "main.merge fails on HPUX",
and a backport of relevant changes from the 6.0
version of the fix done by Ingo Struewing.
The bug itself was fixed by the patch for Bug#54811.


MyISAMMRG engine would try to use MMAP on its children
even on platforms that don't support it and even if
myisam_use_mmap option was off.
This lead to an infinite hang in INSERT ... SELECT into 
a MyISAMMRG table when the destination MyISAM table
was also selected from.

A bug in duplicate detection fixed by 54811 was essential to 
the hang - when a duplicate is detected, the optimizer 
disables the use of memory mapped files, and it wasn't the case.

The patch below is also to not turn on MMAP on children tables
if myisam_use_mmap is off.
A test case is added to cover MyISAMMRG and myisam_use_mmap
option.


mysql-test/r/merge_mmap.result:
  Result file - Bug#50788.
mysql-test/t/merge_mmap-master.opt:
  An option file for the test for Bug#50788 -- use mmap.
mysql-test/t/merge_mmap.test:
  Try INSERT ... SELECT into a merge table when myisam_use_mmap is on (Bug#50788).
storage/myisam/mi_statrec.c:
  Fixed misinterpretation of the return value of my_b_read().
storage/myisammrg/ha_myisammrg.cc:
  Skip HA_EXTRA_MMAP if MyISAM memory mapping is disabled.
2010-07-02 19:21:07 +04:00
Sergey Vojtovich
3670dcf38d BUG#54832 - Comment for MyISAM says it is a default engine
Fixed MyISAM storage engine comment, so it doesn't anymore
state that MyISAM is default storage engine.
2010-07-02 14:56:54 +04:00
Jimmy Yang
7f19cc824f Port fix for bug #54311 from mysql-trunk-innodb to mysql-5.1-innodb codeline.
Bug #54311: Crash on CHECK PARTITION after concurrent LOAD DATA
and adaptive_hash_index=OFF
2010-06-30 22:06:01 -07:00
Jimmy Yang
6180fa31d3 Fix bug #54311 Crash on CHECK PARTITION after concurrent LOAD DATA
and adaptive_hash_index=OFF

rb://389 approved by Marko
2010-06-30 21:52:47 -07: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ä
38d8ca8cec Bug#54358 follow-up: Correct some error handling. 2010-06-30 12:38:47 +03:00
Marko Mäkelä
707a3bef6e 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:31:49 +03:00
Mark Leith
6cb46973dc Bug#54726 - Inconsistent reporting between mutex and RW lock spin rounds
- Add round counts to the output for RW s/x locks
2010-06-30 10:11:04 +01:00
Jon Olav Hauglid
83920a72fd merge from mysql-trunk-bugfixing 2010-06-30 08:47:49 +02:00
Konstantin Osipov
c3b1a5751a Salvage comments added by Ingo while working on
Bug#52114 and Bug#50788.
The bugs themselves are regressions that are introduced
by an incomplete fix for Bug#36171 and will not be pushed.
2010-06-29 18:28:36 +04: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ä
d842130094 ChangeLog entry for Bug #54408 2010-06-29 16:12:19 +03:00
Marko Mäkelä
63c44558dc 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:00:58 +03:00
Marko Mäkelä
4ee0dc7cca ChangeLog entry for Bug #54358 2010-06-29 15:56:53 +03:00
Marko Mäkelä
62084feb55 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 15:55:18 +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
Jimmy Yang
1b31b3a38a Check in fix for bug #53756: "ALTER TABLE ADD PRIMARY KEY affects
crash recovery"

rb://369 approved by Marko
2010-06-28 19:41:37 -07:00
Vasil Dimov
8847387ecd Disable UNIV_DEBUG when WITH_DEBUG is enabled
It causes lots of failures due to
Bug#54861 Additional connections not handled properly in mtr --embedded
should be re-enabled when that bug is resolved
2010-06-28 15:52:24 +03:00
Alexander Nozdrin
8f521b41ba Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
 
   The server crashed on an attempt to optimize a MERGE table with
   non-existent child table.
 
   mysql_admin_table() relied on the table to be successfully open
   if a table object had been allocated.
 
   Changed code to check return value of the open function before
   calling a handler:: function on it.

mysql-test/r/merge.result:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
      Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
      Updated result file.
mysql-test/t/merge.test:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
      Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
      Changed tests to respect changed TEMPORARY MERGE locking (unrelated).
      Changed tests to respect changed CREATE TABLE ... LIKE (unrelated).
      Changed tests to respect that no new tables can be created
      under LOCK TABLE (unrelated).
      Added test for Bug#47633.
  Changed error numbers to symbolic names.
  Added test for child locking for ALTER under LOCK TABLE.
  
  Since Bug 36171 is not pushed yet, not the whole patch has been backported.
mysys/my_delete.c:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
      Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
      Fixed error reporting.
      Fixed indentation.
mysys/my_mmap.c:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
      Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
      Added DBUG.
sql/item_func.cc:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
  Added Debug Sync point, required by merge_sync.test.
sql/sql_table.cc:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
      Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
      Do not call handler:: functions if the table was not opened
      successfully.
  Added Debug Sync point, required by merge_sync.test.
storage/myisam/mi_check.c:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
      Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
      Unmap memory before exchanging data files. Needed on Windows.
storage/myisammrg/ha_myisammrg.cc:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
  Added Debug Sync point, required by merge_sync.test.
  
  merge_sync.test will be introduced by a patch for Bug 36171,
  which is not pushed yet.
2010-06-25 19:32:59 +04: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
Vasil Dimov
2844ae6be9 Merge a lost changeset inaam.rana@oracle.com-20100624124450-2m3mg1238ewvakgx 2010-06-25 11:08:52 +03:00
Jimmy Yang
dcbca85bb0 Moved fix for Bug#54044 to security branch. Undo revno:3116 2010-06-24 22:14:20 -07: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
Inaam Rana
4cf3e93339 Add ChangeLog for bug#39168 2010-06-24 08:44:50 -04:00
Marko Mäkelä
e375c45c29 Merge Bug #54679 fix from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3523
revision-id: marko.makela@oracle.com-20100624104620-pklunowaigv7quu9
parent: jimmy.yang@oracle.com-20100624021010-oh2hnp8e1xbaax6u
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Thu 2010-06-24 13:46:20 +0300
message:
  Bug#54679: alter table causes compressed row_format to revert to compact

  ha_innobase::create(): Add the local variable row_type = form->s->row_type.
  Adjust it to ROW_TYPE_COMPRESSED when ROW_FORMAT is not specified or inherited
  but KEY_BLOCK_SIZE is. Observe the inherited ROW_FORMAT even when it is not
  explicitly specified.

  innodb_bug54679.test: New test, to test the bug and to ensure that there are
  no regressions. (The only difference in the test result without the patch
  applied is that the first ALTER TABLE changes ROW_FORMAT to Compact.)
2010-06-24 14:06:52 +03:00
Marko Mäkelä
79f71e1915 Add ChangeLog entry for Bug#54679 2010-06-24 13:48:20 +03:00
Marko Mäkelä
42011fb716 Bug#54679: alter table causes compressed row_format to revert to compact
ha_innobase::create(): Add the local variable row_type = form->s->row_type.
Adjust it to ROW_TYPE_COMPRESSED when ROW_FORMAT is not specified or inherited
but KEY_BLOCK_SIZE is. Observe the inherited ROW_FORMAT even when it is not
explicitly specified.

innodb_bug54679.test: New test, to test the bug and to ensure that there are
no regressions. (The only difference in the test result without the patch
applied is that the first ALTER TABLE changes ROW_FORMAT to Compact.)
2010-06-24 13:46:20 +03:00
Jimmy Yang
1082c98d97 Port fix for bug #54044 from mysql-5.1-security to mysql-trunk-security:
------------------------------------------------------------
revno: 3438
committer: Jimmy Yang <jimmy.yang@oracle.com>
branch nick: mysql-5.1-security
timestamp: Thu 2010-06-24 01:20:25 -0700
message:
  Fix Bug #54044 Create temporary tables and using innodb crashes.
2010-06-24 01:49:22 -07:00
Jimmy Yang
f2dfe5e8a5 Fix Bug #54044 Create temporary tables and using innodb crashes. 2010-06-24 01:20:25 -07:00
Marko Mäkelä
2ad32ccf79 trx_undo_parse_page_header(): Silence a bogus warning. 2010-06-24 10:21:40 +03:00
Marko Mäkelä
0c5a717d8e After-review cleanup of Bug#57428: replace the dulint struct with a 64-bit int
trx_undo_build_roll_ptr(): Clarify the assertion on is_insert being 0 or 1.

TRX_SYS_FILE_FORMAT_TAG: Remove "extra" space after period in the comment.
See also http://desktoppub.about.com/cs/typespacing/a/onetwospaces.htm
2010-06-24 09:09:29 +03:00
Marko Mäkelä
1703834dd9 mach_ull_parse_compressed(): Move to .ic file to silence a GCC warning
about trx_id being possibly uninitialized in trx_undo_parse_page_header().
The warning remains when UNIV_DEBUG or UNIV_MUST_NOT_INLINE is enabled.
2010-06-24 09:08:42 +03:00
Marko Mäkelä
bdf60d165f ut_ull_create(): Fix a typo in ut_ad(): ULINT32_MASK instead of ULINT32_MAX. 2010-06-24 09:01:46 +03:00
Jimmy Yang
08a801e409 Move the fix for bug #54044 to security branch, and revert commit -r3520:3521. 2010-06-23 19:10:10 -07:00
Marko Mäkelä
c1567ecebd Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
Jimmy Yang
eb07ae4605 Merge Bug#54044 fix from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3520
committer: Jimmy Yang <jimmy.yang@oracle.com>
branch nick: mysql-5.1-innodb
timestamp: Tue 2010-06-22 19:04:31 -0700
message:
  Fix bug #54044, Create temporary tables and using innodb crashes. Screen
  out NULL type columns, and return without creating the table.
  
  rb://378 approved by Marko
------------------------------------------------------------
2010-06-23 03:46:57 -07:00
Vasil Dimov
1161ec0836 Enable InnoDB's UNIV_DEBUG if MySQL's WITH_DEBUG[_FULL] is defined
This will make PB2 test InnoDB with UNIV_DEBUG on its *_debug platforms

Discussed with:	Marko (on IRC)
2010-06-23 13:02:49 +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
Jimmy Yang
95586f2c83 Port fix for "bug #54044 Create temporary tables and using innodb crashes"
to 5.1 plugin codeline.

rb://378, approved by Marko
2010-06-22 19:39:20 -07:00
Jimmy Yang
1ac84a45df Fix bug #54044, Create temporary tables and using innodb crashes. Screen
out NULL type columns, and return without creating the table.

rb://378 approved by Marko
2010-06-22 19:04:31 -07:00
Vasil Dimov
d17ee9f8ec Merge mysql-5.1-innodb from bk-internal to my local tree 2010-06-22 20:12:05 +03:00
Vasil Dimov
e42ab1af8d Add ChangeLog entry for the fix of Bug#47991 2010-06-22 20:04:54 +03:00
Vasil Dimov
ba04d53826 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-22 19:30:43 +03:00
Marko Mäkelä
fdafbdfb86 Merge Bug#54686 fix from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3517
revision-id: marko.makela@oracle.com-20100622115215-kxtzx7xuugcxd375
parent: marko.makela@oracle.com-20100621095148-8g73k8k68dpj080u
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Tue 2010-06-22 14:52:15 +0300
message:
  Bug#54686 "field->col->mtype == type" assertion error at row/row0sel.c
  ha_innobase::index_read(), ha_innobase::records_in_range(): Check that
  the index is useable before invoking row_sel_convert_mysql_key_to_innobase().

  This fix is based on a suggestion by Yasufumi Kinoshita.
2010-06-22 15:05:33 +03:00
Marko Mäkelä
31939e0d14 ChangeLog for Bug#54686 "field->col->mtype == type" assertion error at row/row0sel.c 2010-06-22 14:59:49 +03:00
Marko Mäkelä
a1ac083fc3 Bug#54686 "field->col->mtype == type" assertion error at row/row0sel.c
ha_innobase::index_read(), ha_innobase::records_in_range(): Check that
the index is useable before invoking row_sel_convert_mysql_key_to_innobase().

This fix is based on a suggestion by Yasufumi Kinoshita.
2010-06-22 14:52:15 +03:00
Marko Mäkelä
0d44ea07dc buf_flush_insert_in_flush_rbt(), buf_flush_validate_low():
Silence GCC warnings about dereferencing a type-punned pointer.
Approved by Jimmy Yang.
2010-06-22 13:43:17 +03:00
Marko Mäkelä
2ec45a26b6 dict_load_column_low(): Initialize pos. Improve documentation.
Approved by Jimmy Yang.
2010-06-22 13:42:39 +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ä
e475440f1b Merge Bug #54658 fix from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3515
revision-id: marko.makela@oracle.com-20100621094008-o9fa153s3f09merw
parent: vasil.dimov@oracle.com-20100618085155-xnm469cbhedqea96
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Mon 2010-06-21 12:40:08 +0300
message:
  Bug #54658: InnoDB: Warning: allocated tablespace %lu, old maximum was 0

  dict_check_tablespaces_and_store_max_id(): Initialize max_space_id
  and fil_system->max_assigned_id from DICT_HDR_MAX_SPACE_ID.

  fil_space_create(): Suppress the warning unless !recv_recovery_on
  (do not complain while applying the redo log).
2010-06-21 13:32:39 +03:00
Marko Mäkelä
a6c1d93e02 Bug#54658: Add ChangeLog entry 2010-06-21 12:51:48 +03:00
Marko Mäkelä
aebf6c06c4 Bug #54658: InnoDB: Warning: allocated tablespace %lu, old maximum was 0
dict_check_tablespaces_and_store_max_id(): Initialize max_space_id
and fil_system->max_assigned_id from DICT_HDR_MAX_SPACE_ID.

fil_space_create(): Suppress the warning unless !recv_recovery_on
(do not complain while applying the redo log).
2010-06-21 12:40:08 +03:00
Vasil Dimov
c66ce15fe3 Merge mysql-5.1-innodb from bk-internal to my local repo 2010-06-18 11:51:55 +03:00
Vasil Dimov
40c13ca9bd Increment InnoDB Plugin version from 1.0.9 to 1.0.10, after
1.0.9 has been released with MySQL 5.1.48.
2010-06-18 10:00:01 +03:00
Jimmy Yang
4d446d4c10 Check in fix for Bug #52814 InnoDB: Use the new ha_data interfaces
rb://290, approved by Sunny
2010-06-17 22:38:22 -07:00
Magne Mahre
32b7e60e42 WL#5349 Change default storage engine to InnoDB
The default storage engine is changed from MyISAM to
InnoDB, in all builds except for the embedded server.

In addition, the following system variables are 
changed:

  * innodb_file_per_table is enabled
  * innodb_strict_mode is enabled
  * innodb_file_format_name_update is changed
    to 'Barracuda'

The test suite is changed so that tests that do not
explicitly include the have_innodb.inc are run with
--default-storage-engine=MyISAM.  This is to ease the
transition, so that most regression tests are run
with the same engine as before.

Some tests are disabled for the embedded server
regression test, as the output of certain statements
will be different that for the regular server
(i.e SELECT @@default_storage_engine).  This is to
ease transition.



mysql-test/mysql-test-run.pl:
  The regression test suite now adds a
  --default-storage-engine=MyISAM for all non-innodb 
  tests.  This behaviour can be controlled by the
  default-myisam switch in mysql-test-run
mysql-test/t/bootstrap-master.opt:
  The bootstrap test can only be run without InnoDB
  as it starts several mysqld instances on the same
  datadir. This is possible with MyISAM, but not
  with InnoDB.
storage/innobase/CMakeLists.txt:
  Build InnoDB per default
storage/innobase/handler/ha_innodb.cc:
  Change default values for system variables
  
    Enable file_per_table
    Enable strict_mode
    Upgrade default file format to Barracuda
2010-06-17 22:51:35 +02:00
Jimmy Yang
69bc6dd01c Fix an overly asserted assertion during previous checkin for bug #54330. 2010-06-17 10:33:03 -07:00
Konstantin Osipov
cc6dabba37 Merge trunk-bugfixing -> trunk-runtime 2010-06-17 17:31:51 +04:00
Vasil Dimov
b31987c141 Merge mysql-trunk-bugfixing -> mysql-trunk-innodb 2010-06-17 12:41:20 +03:00
Vasil Dimov
028bb395b7 Decrement version number from 1.1.2 to 1.1.1, this latest tree
is going to be 1.1.1.
2010-06-17 12:35:23 +03:00
Jimmy Yang
0cbc668fc2 This change splits innodb_file_format_check into innodb_file_format_check
and innodb_file_format_max two system variables. And this also fixes
bug #53654 after 2nd shutdown innodb_file_format_check attains strange
values.

rb://366 approved by Marko
2010-06-17 02:13:53 -07:00
Sunny Bains
70cef4f851 Merge from parent. 2010-06-17 17:48:14 +10:00
Jimmy Yang
3c0be2c7b3 Fix Bug #54330 Broken fast index creation. Add additional array to
account for each merge run's start offset, so correct offsets are
paired up for multiple merge runs.

rb://377 approved by Marko
2010-06-16 19:12:04 -07:00
Sunny Bains
8ccbb4211b Revert a change that should have been a part of 3008.2.76..3008.2.78. 2010-06-17 11:06:13 +10:00
Vasil Dimov
5a0b9cd296 Increment InnoDB version number from 1.1.1 to 1.1.2,
the 1.1.1 release will be included inside MySQL 5.5.5 and is
up to (inclusive):
vasil.dimov@oracle.com-20100602124314-21l3cb27w4rbfqrq
2010-06-15 17:51:57 +03:00
Konstantin Osipov
65428955cd Fix a build break with cmake: remove the custom defines
that prevented hp_test2 to link in non-debug builds.

storage/heap/hp_test2.c:
  Don't try to define DBUG if we're building without
  DBUG -- that won't work,since dbug libary will be empty
  in non-debug builds and cmake.
2010-06-15 15:15:42 +04:00
Jimmy Yang
8e7ce2e9d8 Add checkin description for bug #47622 to ChangeLog. 2010-06-15 02:33:26 -07:00
Vasil Dimov
c9a66cdf43 Merge mysql-trunk-bugfixing -> mysql-trunk-innodb 2010-06-14 14:46:36 +03: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
Konstantin Osipov
5d4082e22d Fix the cmake rule that builds heap tests, added
to cmake build with the patch for WL#5419.
Add missing libraries.
2010-06-12 00:50:41 +04:00
Konstantin Osipov
33c57e2f9e WL#5419 "LOCK_open scalability: make tdc_refresh_version
an atomic counter"

Split the large LOCK_open section in open_table(). 
Do not call open_table_from_share() under LOCK_open.
Remove thd->version.

This fixes
Bug#50589 "Server hang on a query evaluated using a temporary 
table"
Bug#51557 "LOCK_open and kernel_mutex are not happy together"
Bug#49463 "LOCK_table and innodb are not nice when handler 
instances are created".

This patch has effect on storage engines that rely on
ha_open() PSEA method being called under LOCK_open.
In particular:

1) NDB is broken and left unfixed. NDB relies on LOCK_open
being kept as part of ha_open(), since it uses auto-discovery.
While previously the NDB open code was race-prone, now
it simply fails on asserts.

2) HEAP engine had a race in ha_heap::open() when
a share for the same table could be added twice
to the list of shares, or a dangling reference to a share
stored in HEAP handler. This patch aims to address this
problem by 'pinning' the newly created share in the 
internal HEAP engine share list until at least one
handler instance is created using that share.


include/heap.h:
  Add members to HP_CREATE_INFO.
  Declare heap_release_share().
sql/lock.cc:
  Remove thd->version, use thd->open_tables->s->version instead.
sql/repl_failsafe.cc:
  Remove thd->version.
sql/sql_base.cc:
  - close_thread_table(): move handler cleanup code outside the critical section protected by LOCK_open.
  - remove thd->version
  - split the large critical section in open_table() that
  opens a new table from share and is protected by LOCK_open
  into 2 critical sections, thus reducing the critical path.
  - make check_if_table_exists() acquire LOCK_open internally.
  - use thd->open_tables->s->version instead of thd->refresh_version to make sure that all tables in
  thd->open_tables are in the same refresh series.
sql/sql_base.h:
  Add declaration for check_if_table_exists().
sql/sql_class.cc:
  Remove init_open_tables_state(), it's now equal to
  reset_open_tables_state().
sql/sql_class.h:
  Remove thd->version, THD::init_open_tables_state().
sql/sql_plugin.cc:
  Use table->m_needs_reopen to mark the table as stale
  rather than manipulate with thd->version, which is no more.
sql/sql_udf.cc:
  Use table->m_needs_reopen to mark the table as stale
  rather than manipulate with thd->version, which is no more.
sql/table.h:
  Remove an unused variable.
sql/tztime.cc:
  Use table->m_needs_reopen to mark the table as stale
  rather than manipulate with thd->version, which is no more.
storage/heap/CMakeLists.txt:
  Add heap tests to cmake build files.
storage/heap/ha_heap.cc:
  Fix a race when ha_heap::ha_open() could insert two 
  HP_SHARE objects into the internal share list or store
  a dangling reference to a share in ha_heap instance,
  or wrongly set implicit_emptied.
storage/heap/hp_create.c:
  Optionally pin a newly created share in the list of shares
  by increasing its open_count. This is necessary to 
  make sure that a newly created share doesn't disappear while
  a HP_INFO object is being created to reference it.
storage/heap/hp_open.c:
  When adding a new HP_INFO object to the list of objects
  in the heap share, make sure the open_count is not increased
  twice.
storage/heap/hp_test1.c:
  Adjust the test to new function signatures.
storage/heap/hp_test2.c:
  Adjust the test to new function signatures.
2010-06-11 19:28:18 +04:00
Davi Arnaut
db2fe44c84 Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-06-10 22:30:49 -03:00
Davi Arnaut
0f9ddfa9d8 Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations.

One somewhat major source of strict-aliasing violations and
related warnings is the SQL_LIST structure. For example,
consider its member function `link_in_list` which takes
a pointer to pointer of type T (any type) as a pointer to
pointer to unsigned char. Dereferencing this pointer, which
is done to reset the next field, violates strict-aliasing
rules and might cause problems for surrounding code that
uses the next field of the object being added to the list.

The solution is to use templates to parametrize the SQL_LIST
structure in order to deference the pointers with compatible
types. As a side bonus, it becomes possible to remove quite
a few casts related to acessing data members of SQL_LIST.

sql/handler.h:
  Use the appropriate template type argument.
sql/item.cc:
  Remove now-unnecessary cast.
sql/item_subselect.cc:
  Remove now-unnecessary casts.
sql/item_sum.cc:
  Use the appropriate template type argument.
  Remove now-unnecessary cast.
sql/mysql_priv.h:
  Move SQL_LIST structure to sql_list.h
  Use the appropriate template type argument.
sql/sp.cc:
  Remove now-unnecessary casts.
sql/sql_delete.cc:
  Use the appropriate template type argument.
  Remove now-unnecessary casts.
sql/sql_derived.cc:
  Remove now-unnecessary casts.
sql/sql_lex.cc:
  Remove now-unnecessary casts.
sql/sql_lex.h:
  SQL_LIST now takes a template type argument which must
  match the type of the elements of the list. Use forward
  declaration when the type is not available, it is used
  in pointers anyway.
sql/sql_list.h:
  Rename SQL_LIST to SQL_I_List. The template parameter is
  the type of object that is stored in the list.
sql/sql_olap.cc:
  Remove now-unnecessary casts.
sql/sql_parse.cc:
  Remove now-unnecessary casts.
sql/sql_prepare.cc:
  Remove now-unnecessary casts.
sql/sql_select.cc:
  Remove now-unnecessary casts.
sql/sql_show.cc:
  Remove now-unnecessary casts.
sql/sql_table.cc:
  Remove now-unnecessary casts.
sql/sql_trigger.cc:
  Remove now-unnecessary casts.
sql/sql_union.cc:
  Remove now-unnecessary casts.
sql/sql_update.cc:
  Remove now-unnecessary casts.
sql/sql_view.cc:
  Remove now-unnecessary casts.
sql/sql_yacc.yy:
  Remove now-unnecessary casts.
storage/myisammrg/ha_myisammrg.cc:
  Remove now-unnecessary casts.
2010-06-10 17:45:22 -03:00
Davi Arnaut
6f3a540c37 Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations.

Essentially, the problem is that large parts of the server were
developed in simpler times (last decades, pre C99 standard) when
strict aliasing and compilers supporting such optimizations were
rare to non-existent. Thus, when compiling the server with a modern
compiler that uses strict aliasing rules to perform optimizations,
there are several places in the code that might trigger undefined
behavior.

As evinced by some recent bugs, GCC does a somewhat good of job
misoptimizing such code, but on the other hand also gives warnings
about suspicious code. One problem is that the warnings aren't
always accurate, yet we can't afford to just shut them off as we
might miss real cases. False-positive cases are aggravated mostly
by casts that are likely to trigger undefined behavior.

The solution is to start a cleanup process focused on fixing and
reducing the amount of strict-aliasing related warnings produced
by GCC and others compilers. A good deal of noise reduction can
be achieved by just removing useless casts that are product of
historical cruft and are likely to trigger undefined behavior if
dereferenced.

client/mysql.cc:
  Remove now-unnecessary casts.
  Break up large strings.
client/mysql_upgrade.c:
  Remove now-unnecessary casts.
client/mysqladmin.cc:
  Remove now-unnecessary casts.
  Break up large strings.
client/mysqlbinlog.cc:
  Remove now-unnecessary casts.
client/mysqlcheck.c:
  Remove now-unnecessary casts.
client/mysqldump.c:
  Remove now-unnecessary casts.
client/mysqlimport.c:
  Remove now-unnecessary casts.
client/mysqlshow.c:
  Remove now-unnecessary casts.
client/mysqlslap.c:
  Remove now-unnecessary casts.
client/mysqltest.cc:
  Remove now-unnecessary casts.
extra/comp_err.c:
  Remove now-unnecessary casts.
extra/my_print_defaults.c:
  Remove now-unnecessary casts.
  Break up large strings.
extra/mysql_waitpid.c:
  Remove now-unnecessary casts.
extra/perror.c:
  Remove now-unnecessary casts.
extra/resolve_stack_dump.c:
  Remove now-unnecessary casts.
extra/resolveip.c:
  Remove now-unnecessary casts.
include/my_getopt.h:
  Use a void pointer type as the opaque type to avoid problems with type
  incompatibility -- GCC issues warnings when the type name is not type
  compatible with a operand. As a side bonus, a explicit cast won't be
  necessary anymore.
include/sslopt-longopts.h:
  Remove now-unnecessary casts.
  Break up large strings.
mysys/my_getopt.c:
  Update opaque type and introduce a type definition for the
  argument to my_getopt_register_get_addr.
server-tools/instance-manager/options.cc:
  Remove now-unnecessary casts.
sql/mysqld.cc:
  Remove now-unnecessary casts.
  Break up large strings.
  Update mysql_getopt_value prototype (the old prototype
  was different from the definition anyway).
sql/sql_plugin.cc:
  The type of a pointer to a function must be compatible with the
  pointed-to function type, otherwise the behavior is undefined.
sql/table.cc:
  The variable buf pointer to pointer to pointer to constant char
  could improperly alias a incompatible type in call to fix_type_
  pointers. Since this was actually dead code, it is simply removed.
sql/unireg.cc:
  Remove call to get_form_pos. The code creates a new FRM file which
  is always truncated and writes the form position as 0. Hence, no
  need to retrieve it, we now for sure it is 0.
storage/archive/archive_reader.c:
  Remove now-unnecessary casts.
storage/myisam/ft_nlq_search.c:
  Read weight directly from the buffer.
storage/myisam/fulltext.h:
  Add explanation about the type duality of a key buffer.
  Add accessor macro to retrieve a FT float value.
storage/myisam/mi_test1.c:
  Remove now-unnecessary casts.
storage/myisam/myisam_ftdump.c:
  Read weight directly from the buffer.
storage/myisam/myisamchk.c:
  Remove now-unnecessary casts.
storage/myisam/myisamlog.c:
  A pointer to char was used to alias a pointer to pointer to
  unsigned char, thus violating strict aliasing rules.
storage/myisam/myisampack.c:
  Remove now-unnecessary casts.
strings/decimal.c:
  Remove aliasing violation, printing the value is enough for
  debugging purposes.
tests/mysql_client_test.c:
  Remove now-unnecessary casts.
2010-06-10 17:16:43 -03:00
Inaam Rana
0e5eb364a2 merge from parent 2010-06-10 10:35:39 -04:00
Inaam Rana
e7c672cbd9 Add a debug assertion. 2010-06-10 10:31:28 -04:00
Inaam Rana
e40c3b9763 Formatting changes 2010-06-10 09:58:11 -04:00
Sergey Glukhov
022e2ef800 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-09 16:17:18 +04: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
Inaam Rana
28187edf33 Add call to log_free_check() in the DML code paths that were missing
this before.
2010-06-08 14:14:08 -04:00
Marko Mäkelä
a9c223cf05 Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3503
revision-id: marko.makela@oracle.com-20100608121041-l7t9r6lrpx6lh361
parent: marko.makela@oracle.com-20100608114055-7b04ytuqz0lde6v1
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Tue 2010-06-08 15:10:41 +0300
message:
  Bug#54009: Server crashes when data is selected from non backed up table
  for InnoDB plugin

  dict_load_table(): Pass the correct tablespace flags to
  fil_open_single_table_tablespace(). For ROW_FORMAT=COMPACT and REDUNDANT,
  the tablespace flags are 0. The table flags would be 0 or DICT_TF_COMPACT.
2010-06-08 15:26:45 +03:00
Marko Mäkelä
76a7cda35c Document Bug#54009 in the InnoDB Plugin ChangeLog. 2010-06-08 15:12:15 +03:00
Marko Mäkelä
627c14d9e8 Bug#54009: Server crashes when data is selected from non backed up table
for InnoDB plugin

dict_load_table(): Pass the correct tablespace flags to
fil_open_single_table_tablespace(). For ROW_FORMAT=COMPACT and REDUNDANT,
the tablespace flags are 0. The table flags would be 0 or DICT_TF_COMPACT.
2010-06-08 15:10:41 +03:00
Marko Mäkelä
d264c3afbc Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3502
revision-id: marko.makela@oracle.com-20100608114055-7b04ytuqz0lde6v1
parent: jimmy.yang@oracle.com-20100603134448-itzduhwgbw0b8nlh
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Tue 2010-06-08 14:40:55 +0300
message:
  buf_page_get_gen(): Pass file,line to rw_lock_x_lock().
2010-06-08 14:47:34 +03:00
Marko Mäkelä
55acf60c93 buf_page_get_gen(): Pass file,line to rw_lock_x_lock(). 2010-06-08 14:40:55 +03:00
Mats Kindahl
aaf2bdde94 WL#5363: Thread Pool Service Interface
In order to allow thread schedulers to be dynamically loaded,
it is necessary to make the following changes to the server:

- Two new service interfaces

- Modifications to InnoDB to inform the thread scheduler of state changes.

- Changes to the VIO subsystem for checking if data is available on a socket.

- Elimination of remains of the old thread pool implementation.

The two new service interfaces introduces are:

my_thread_scheduler
  A service interface to register a thread
  scheduler.

thd_wait
  A service interface to inform thread scheduler
  that the thread is about to start waiting.

In addition, the patch adds code that:

- Add a call to thd_wait for table locks in mysys
  thd_lock.c by introducing a set function that
  can be used to set a callback to be used when
  waiting on a lock and resuming from waiting.

- Calling the mysys set function from the server
  to set the callbacks correctly.
2010-06-07 16:01:39 +02:00
Konstantin Osipov
cc90cbbe60 A fix for Bug#52432 "Crash in check_table_is_closed on an
information_schema query.
Porting a fix done for a feature tree by Ingo Struewing.
No test case since the crash only occurs under a stress
load.

storage/myisam/mi_dbug.c:
  Iterate over the list of MyISAM shares and access the MyISAM 
  share internals under a lock.
2010-06-07 16:05:34 +04:00
Jimmy Yang
d80f8c07d6 Remove unncessary name comapre in innobase_get_mysql_key_number_for_index()
introduced in bug fix #53592, since dict_table_t can sufficiently unique
identify the the table.
2010-06-03 06:44:48 -07:00
Jimmy Yang
5f336d9956 Remove the unneccesary innobase_strcasecmp() in
innobase_get_mysql_key_number_for_index() created as a bug fix for
#53592 since dict_table_t could already unique identify
the table.
2010-06-03 06:37:01 -07:00
Vasil Dimov
ee07d63945 Merge mysql-trunk-innodb -> mysql-trunk-bugfixing 2010-06-02 15:40:49 +03:00
Marko Mäkelä
eaf7013d6b ut_strerr(): Handle DB_SUCCESS_LOCKED_REC. 2010-06-02 14:52:11 +03: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
Marko Mäkelä
8f5d78c28b Merge from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3493
revision-id: marko.makela@oracle.com-20100602101940-60x32xiivtqj9va1
parent: marko.makela@oracle.com-20100601135802-hgplcpr8089ura8g
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Wed 2010-06-02 13:19:40 +0300
message:
  fil_print_orphaned_tablespaces(): Unused function, remove.
2010-06-02 14:34:41 +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ä
3ac0b6f203 Document the Bug #53674 fix in the InnoDB Plugin 2010-06-02 13:39:03 +03:00
Marko Mäkelä
c84c4b107c 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 13:37:14 +03: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ä
b55ec58701 fil_print_orphaned_tablespaces(): Unused function, remove. 2010-06-02 13:19:40 +03:00
Jimmy Yang
ee9ce546b9 Fix bug #54159 InnoDB: New warnings on Windows. Provide "signed/unsigned"
parameter to virtual function store() for longlong data type.

rb://371 approved by Sunny.
2010-06-01 22:26:31 -07:00
Alfranio Correia
2fb387b084 BUG#50479 DDL stmt on row-only/stmt-only tables generate spurious binlog_format
errors
            
In the fix of BUG#39934 in 5.1-rep+3, errors are generated when
binlog_format=row and a statement modifies a table restricted to
statement-logging (ER_BINLOG_ROW_MODE_AND_STMT_ENGINE); or if
binlog_format=statement and a statement modifies a table restricted to
row-logging (ER_BINLOG_STMT_MODE_AND_ROW_ENGINE).
            
However, some DDL statements that lock tables (e.g. ALTER TABLE,
CREATE INDEX and CREATE TRIGGER) were causing spurious errors,
although no row might be inserted into the binary log.
            
To fix the problem, we tagged statements that may generate
rows into the binary log and thence the warning messages are
only printed out when the appropriate conditions hold and rows
might be changed.

sql/log_event.cc:
  Reorganized the Query_log_event's constructor based on the
  CF_CAN_GENERATE_ROW_EVENTS flag and as such any statement
  that has the associated flag should go through a cache
  before being written to the binary log.
sql/share/errmsg-utf8.txt:
  Improved the error message ER_BINLOG_UNSAFE_MIXED_STATEMENT according to Paul's
  suggestion.
sql/sql_class.cc:
  Created a hook to be used by innodb that checks if a statement
  may write rows to the binary log. In other words, if it has
  the CF_CAN_GENERATE_ROW_EVENTS flag associated.
sql/sql_class.h:
  Defined the CF_CAN_GENERATE_ROW_EVENTS flag.
sql/sql_parse.cc:
  Updated the sql_command_flags and added a function to check the 
  CF_CAN_GENERATE_ROW_EVENTS.
sql/sql_parse.h:
  Added a function to check the CF_CAN_GENERATE_ROW_EVENTS.
storage/innobase/handler/ha_innodb.cc:
  Added a call to the hook thd_generates_rows().
storage/innobase/handler/ha_innodb.h:
  Defined an external reference to the hook thd_generates_rows().
2010-06-02 00:25:08 +01:00
Marko Mäkelä
7d5e44460c Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3491
  revision-id: marko.makela@oracle.com-20100601134335-ccthwwru23kn09qw
  parent: marko.makela@oracle.com-20100601120751-1uq7bbta5n7ts0qr
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-06-01 16:43:35 +0300
  message:
    Bug#48197: Concurrent rw_lock_free may cause assertion failure

    rw_lock_t: Remove magic_n unless UNIV_DEBUG is defined.
    rw_lock_free(): Invalidate magic_n only after removing from rw_lock_list.
2010-06-01 17:03:55 +03:00
Marko Mäkelä
9f278a3682 Document Bug #48197 fix 2010-06-01 16:58:02 +03:00
Marko Mäkelä
6e569dd209 Bug#48197: Concurrent rw_lock_free may cause assertion failure
rw_lock_t: Remove magic_n unless UNIV_DEBUG is defined.
rw_lock_free(): Invalidate magic_n only after removing from rw_lock_list.
2010-06-01 16:43:35 +03:00
Alexander Nozdrin
bf158eed83 Auto-merge from mysql-trunk-bugfixing.
Due to a BZR bug, that merge was done by the following command:
bzr merge -r 'revid:tor.didriksen@sun.com-20100527074248-6qtv0p1ugy6o1hjo..' <mysql-trunk-bugfixing path>
2010-06-01 16:38:01 +04: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ä
90cb7fa432 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:07:51 +03:00
Marko Mäkelä
dd201037c2 Document the Bug #53812 fix. 2010-06-01 15:05:21 +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ä
c0dd84217c Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3478.1.3
  revision-id: marko.makela@oracle.com-20100525123748-pmpehbg29oyhc1ns
  parent: marko.makela@oracle.com-20100524114349-5kaw52sz0yh4szkb
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-05-25 15:37:48 +0300
  message:
    Suppress bogus Valgrind warnings about buf_buddy_relocate()
    accessing uninitialized memory in Valgrind-instrumented builds.
2010-06-01 14:56:22 +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
Marko Mäkelä
2caade5053 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 13:37:38 +03:00
Vasil Dimov
da0b6d611f Merge a change from mysql-trunk-innodb:
------------------------------------------------------------
  revno: 3127
  revision-id: vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1
  parent: vasil.dimov@oracle.com-20100531105923-kpjwl4rbgfpfj13c
  committer: Vasil Dimov <vasil.dimov@oracle.com>
  branch nick: mysql-trunk-innodb
  timestamp: Mon 2010-05-31 18:23:41 +0300
  message:
    Fix Bug #53947 InnoDB: Assertion failure in thread 4224 in file .\sync\sync0sync.c line 324
    
    Destroy the rw-lock object before freeing the memory it is occupying.
    If we do not do this, then the mutex that is contained in the rw-lock
    object btr_search_latch_temp->mutex gets "freed" and subsequently
    mutex_free() from sync_close() hits a mutex whose memory has been
    freed and crashes.
    
    Approved by:	Heikki (via IRC)
    Discussed with:	Calvin
2010-05-31 19:35:40 +03:00
Davi Arnaut
a8c288054e Bug#53445: Build with -Wall and fix warnings that it generates
Fix various mismatches between function's language linkage. Any
particular function that is declared in C++ but should be callable
from C must have C linkage. Note that function types with different
linkages are also distinct. Thus, if a function type is declared in
C code, it will have C linkage (same if declared in a extern "C"
block).

client/mysql.cc:
  Mismatch between prototype and declaration.
client/mysqltest.cc:
  mysqltest used to be C code. Use C linkage where appropriate.
cmd-line-utils/readline/input.c:
  Isolate unreachable code.
include/my_alloc.h:
  Function type must have C linkage.
include/my_base.h:
  Function type must have C linkage.
include/my_global.h:
  Add helper macros to avoid spurious namespace indentation.
include/mysql.h.pp:
  Update ABI file.
mysys/my_gethwaddr.c:
  Remove stray carriage return and fix coding style.
plugin/semisync/semisync_master_plugin.cc:
  Callback function types have C linkage.
plugin/semisync/semisync_slave_plugin.cc:
  Callback function types have C linkage.
sql/derror.cc:
  Expected function type has C linkage.
sql/field.cc:
  Use helper macro and fix indentation.
sql/handler.cc:
  Expected function type has C linkage.
sql/item_sum.cc:
  Correct function linkages. Remove now unnecessary cast.
sql/item_sum.h:
  Add prototypes with the appropriate linkage as otherwise they
  are distinct.
sql/mysqld.cc:
  Wrap functions in C linkage mode.
sql/opt_range.cc:
  C language linkage is ignored for class member functions.
sql/partition_info.cc:
  Add wrapper functions with C linkage for class member functions.
sql/rpl_utility.h:
  Use helper macro and fix indentation.
sql/sql_class.cc:
  Change type of thd argument -- THD is a class.
  Use helper macro and fix indentation.
sql/sql_class.h:
  Change type of thd argument -- THD is a class.
sql/sql_select.cc:
  Expected function type has C linkage.
sql/sql_select.h:
  Move prototype to sql_test.h
sql/sql_show.cc:
  Expected function type has C linkage.
sql/sql_test.cc:
  Fix required function prototype and fix coding style.
sql/sql_test.h:
  Removed unnecessary export and add another.
storage/myisammrg/ha_myisammrg.cc:
  Expected function type has C linkage.
storage/perfschema/pfs.cc:
  PSI headers are declared with C language linkage, which also
  applies to function types.
2010-05-31 12:29:54 -03:00
Vasil Dimov
567a1246aa Fix Bug #53947 InnoDB: Assertion failure in thread 4224 in file .\sync\sync0sync.c line 324
Destroy the rw-lock object before freeing the memory it is occupying.
If we do not do this, then the mutex that is contained in the rw-lock
object btr_search_latch_temp->mutex gets "freed" and subsequently
mutex_free() from sync_close() hits a mutex whose memory has been
freed and crashes.

Approved by:	Heikki (via IRC)
Discussed with:	Calvin
2010-05-31 18:23:41 +03:00
Alexander Nozdrin
fe5bcb475c Backport of
- revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
  - revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866

  BUG#35274 - merge table doesn't need any base tables, gives
              error 124 when key accessed

  SELECT queries that use index against a merge table with empty
  underlying tables list may return with error "Got error 124 from
  storage engine".

  The problem was that wrong error being returned.

mysql-test/r/merge.result:
  Backport of
    - revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
    - revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
  
    A test case for BUG#35274.
  
    Modified a test case according to fix for BUG#35274. Key based
    reads are now allowed for merge tables with no underlying tables
    defined.
mysql-test/t/merge.test:
  Backport of
    - revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
    - revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
  
    A test case for BUG#35274.
  
    Modified a test case according to fix for BUG#35274. Key based
    reads are now allowed for merge tables with no underlying tables
    defined.
storage/myisammrg/myrg_queue.c:
  Backport of
    - revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
    - revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
  
    Return "end of file" error instead of "wrong index" error when
    we got a merge table with empty underlying tables list.
  
    In 5.1 we cannot rely on info->open_tables value when checking
    if a merge table has no underlying tables defined.
    Use info->tables instead.
2010-05-31 17:38:02 +04:00
Vasil Dimov
f31af3125d Fix coding style 2010-05-31 13:59:23 +03:00
Davi Arnaut
1164841167 Backport: Remove unused and ancient files, functions, and facilities.
client/mysql.cc:
  Remove unused functions.
client/sql_string.cc:
  Remove unused functions.
include/my_pthread.h:
  Remove unused prototype.
mysys/my_pthread.c:
  Remove unused function.
sql/lock.cc:
  Remove unused function.
sql/lock.h:
  Remove unused and duplicated prototypes.
sql/sql_class.h:
  Removed unused variables.
sql/sql_const.h:
  Remove unused defines.
sql/sql_priv.h:
  Remove unused defines.
sql/sql_string.cc:
  Remove unused prototype.
sql/thr_malloc.cc:
  Remove unused function.
sql/thr_malloc.h:
  Remove unused prototype.
storage/myisam/CMakeLists.txt:
  Remove obsolete fulltext file.
storage/myisam/Makefile.am:
  Remove obsolete files (were already commented out).
storage/myisam/ft_eval.c:
  Remove obsolete fulltext file.
storage/myisam/ft_eval.h:
  Remove obsolete fulltext file.
storage/myisam/ft_stem.c:
  Remove obsolete fulltext file.
storage/myisam/ft_test1.c:
  Remove obsolete fulltext file.
storage/myisam/ft_test1.h:
  Remove obsolete fulltext file.
2010-05-28 19:13:31 -03:00
Vasil Dimov
bb8a7e66d2 Merge mysql-trunk-innodb from bk-internal into my local tree 2010-05-28 17:16:46 +03:00
Jimmy Yang
d02ec3463e This is to fix a special case for the fix on bug #53592, where the
err_index could be not a member of the share structure or prebuilt
structure passed from MySQL. For now, we resort to the traditional
way of scanning index->table for the index number.
2010-05-28 06:17:37 -07:00
Alexander Nozdrin
59a9912963 Auto-merge from mysql-trunk. 2010-05-28 09:47:58 +04:00
Vasil Dimov
9ff587c61c Add two debug assertions and a comment to make it clear that
consecutive_ios[0] cannot be NULL when slot is assigned.
2010-05-27 20:30:08 +03:00
Inaam Rana
cd1ee2b679 Fix the printout for long semaphore waits to not
list a thread doing a wait_ex as an s-lock waiter.
2010-05-27 12:53:39 -04:00
Inaam Rana
6734ce935e Fix the printout in for long semaphore waits to not
list a thread doing a wait_ex as an s-lock waiter.
2010-05-27 12:31:00 -04:00
Vasil Dimov
0732625a51 Merge mysql-trunk-innodb from bk-internal into my local tree 2010-05-27 15:07:08 +03:00
Jimmy Yang
52a7c91984 Fix an assertion failure with UNIV_DEBUG is set. Initialize a
dict_index_t structure to NULL in dict_load_index(), we could
enter SYS_INDEXES and got table id value comparision failure
for system tables such as SYS_TABLES. In addition, remove
dict_sys mutex assertion when fill I_S table, as we no longer
hold mutex accross the fill operation.

rb://367 approved by Marko.
2010-05-27 04:15:54 -07:00
Vasil Dimov
a8e06452fc Merge mysql-trunk-bugfixing -> mysql-trunk-innodb
(skipping the change to storage/innobase/os/os0file.c because
that issue has already been addressed in mysql-trunk-innodb)
2010-05-27 12:47:57 +03:00
Vasil Dimov
a0f33cc460 Fix a compiler warning introduced in
jimmy.yang@oracle.com-20100526014433-bx0t9794mnvkiaft
2010-05-27 08:51:03 +03:00
Tor Didriksen
85da8956e6 Bug #53445 Build with -Wall and fix warnings that it generates
Add -Wall to gcc/g++
Fix most warnings reported in dbg and opt mode.


cmd-line-utils/libedit/filecomplete.c:
  Remove unused auto variables.
configure.cmake:
  Add -Wall to gcc.
extra/comp_err.c:
  Cast to correct type.
extra/perror.c:
  Fix segfault (but warnings about deprecated features remain)
extra/yassl/taocrypt/include/runtime.hpp:
  Comparing two literals was reported as undefined behaviour.
include/my_global.h:
  Add a template for aligning character buffers.
mysys/lf_alloc-pin.c:
  Initialize pointer.
sql/mysqld.cc:
  Use UNINIT_VAR rather than LINT_INIT.
sql/partition_info.cc:
  Use UNINIT_VAR rather than LINT_INIT.
sql/rpl_handler.cc:
  Use char[] rather than unsigned long[] array for placement buffer.
sql/spatial.cc:
  Use char[] rather than unsigned void*[] array for placement buffer.
sql/spatial.h:
  Use char[] rather than unsigned void*[] array for placement buffer.
sql/sql_partition.cc:
  Initialize auto variable.
sql/sql_table.cc:
  Initialize auto variables.
  Add parens around assignment within if()
sql/sys_vars.cc:
  Use UNINIT_VAR.
storage/innobase/os/os0file.c:
  Init first slot in auto variable.
storage/myisam/mi_create.c:
  Use UNINIT_VAR rather than LINT_INIT.
storage/myisam/mi_open.c:
  Remove (wrong) casting.
storage/myisam/mi_page.c:
  Remove (wrong) casting.
storage/myisam/mi_search.c:
  Cast to uchar* rather than char*.
strings/ctype-ucs2.c:
  Use UNINIT_VAR rather than LINT_INIT.
  Add (uchar*) casting.
2010-05-26 16:12:23 +02:00
Alexander Nozdrin
de0f63c181 Patch for Bug#53937 (Junk make-ccc files included in MySQL Server bzr repo).
Remove make-ccc files.
2010-05-26 14:20:14 +04:00
Jimmy Yang
e20e3a2426 Update ChangeLog for bug fix regarding 53582. 2010-05-25 22:38:14 -07:00
Jimmy Yang
602bb5c0fe Fix Bug #53592 in plugin code, "crash replacing duplicates into table
after fast alter table added unique key". Look up MySQL index number should
go through index translation table.

rb://347, approved by Marko
2010-05-25 22:31:27 -07: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
Vasil Dimov
f230391cbb Merge mysql-5.1-innodb from bk-internal into my local tree 2010-05-25 17:21:33 +03:00
Marko Mäkelä
268e38753b row_search_for_mysql(): Add assertions to track down Bug #53627. 2010-05-25 15:53:52 +03:00
Marko Mäkelä
4ecd80297e Suppress bogus Valgrind warnings about buf_buddy_relocate()
accessing uninitialized memory in Valgrind-instrumented builds.
2010-05-25 15:37:48 +03:00
Vasil Dimov
88676110ec Merge mysql-5.1-innodb from bk-internal into my local tree 2010-05-25 12:14:57 +03:00
Vasil Dimov
10f9434f12 Fix comments on row_merge_write()
This is a port of
vasil.dimov@oracle.com-20100521175337-c1b1lqxgizqegb0w and
vasil.dimov@oracle.com-20100521180951-mef23h24k023xuwq
from mysql-trunk-innodb
2010-05-25 11:01:03 +03:00
Vasil Dimov
699a6c1de5 Merge mysql-trunk-innodb from bk-internal into my local tree 2010-05-24 20:58:02 +03: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
Marko Mäkelä
2dcd1ac65a Document the Bug #53578 fix. 2010-05-24 14:43:49 +03:00
Marko Mäkelä
d4fd7bb95e 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:04:39 +03:00
Vasil Dimov
ed4bd8ef5d Fix function decoration in Performance Schema code 2010-05-23 23:11:31 +03:00
Calvin Sun
c2b0ebb55b mysql-trunk-innodb: fix compile errors on Windows with UNIV_DEBUG defined. 2010-05-21 16:30:09 -05: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
f664def4da Merge mysql-5.1-innodb from bk-internal into my local tree 2010-05-20 16:31:57 +03:00
Marko Mäkelä
cc182a0943 Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3475
revision-id: marko.makela@oracle.com-20100520130734-ueow9mn60czp7o4m
parent: marko.makela@oracle.com-20100520104042-ma2nsscqdvwoph8k
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Thu 2010-05-20 16:07:34 +0300
message:
  buf_LRU_free_block(): Correct an error in the comment.
2010-05-20 16:16:32 +03:00
Marko Mäkelä
a426d6f9a8 buf_LRU_free_block(): Correct an error in the comment. 2010-05-20 16:07:34 +03:00
Vasil Dimov
8ae42ceb0c Merge mysql-5.1-innodb from bk-internal into my local tree 2010-05-20 15:54:03 +03:00
Alexander Nozdrin
dabd4a1c55 Manual merge from mysql-trunk.
Conflicts:
  - mysql-test/r/partition.result
  - mysql-test/r/variables_debug.result
  - mysql-test/t/partition.test
  - mysql-test/t/variables_debug.test
2010-05-20 16:35:28 +04:00
Marko Mäkelä
963b19861f Merge a change from mysql-5.1-innodb:
TO DO: Enable this in CMake-based builds.

------------------------------------------------------------
revno: 3474
revision-id: marko.makela@oracle.com-20100520104042-ma2nsscqdvwoph8k
parent: marko.makela@oracle.com-20100519081618-h38q02qxuvcowbtk
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Thu 2010-05-20 13:40:42 +0300
message:
  Bug#53593: Add some instrumentation to improve Valgrind sensitivity

  BUILD/*: Add valgrind_configs=--with-valgrind.
  BUILD/*: Remove -USAFEMALLOC from valgrind_flags.

  configure.in: Add AC_ARG_WITH(valgrind) and HAVE_VALGRIND.

  include/my_sys.h: Define a number of MEM_ wrappers for VALGRIND_ functions.
  include/my_sys.h: Make TRASH do MEM_UNDEFINED().

  include/m_string.h: Remove unused macro bzero_if_purify(A,B).

  _mymalloc(): Declare MEM_UNDEFINED() on the allocated memory.

  _myfree(): Declare MEM_NOACCESS() on the freed memory.

  storage/innobase/include/univ.i: Enable UNIV_DEBUG_VALGRIND based on
  HAVE_VALGRIND rather than HAVE_purify.

  Possible things to do:
   * In my_global.h, remove the defined(HAVE_purify) condition
     from the _WIN32 uint3korr().
   * In my_global.h *int*korr(), use | instead of +
     in order to keep the Valgrind V bits accurate
   * Consider replacing HAVE_purify with HAVE_VALGRIND
   * Use VALGRIND_CREATE_BLOCK, VALGRIND_DISCARD in mem_root and similar places
2010-05-20 14:43:06 +03:00
Marko Mäkelä
98406ba452 Bug#53593: Add some instrumentation to improve Valgrind sensitivity
BUILD/*: Add valgrind_configs=--with-valgrind.
BUILD/*: Remove -USAFEMALLOC from valgrind_flags.

configure.in: Add AC_ARG_WITH(valgrind) and HAVE_VALGRIND.

include/my_sys.h: Define a number of MEM_ wrappers for VALGRIND_ functions.
include/my_sys.h: Make TRASH do MEM_UNDEFINED().

include/m_string.h: Remove unused macro bzero_if_purify(A,B).

_mymalloc(): Declare MEM_UNDEFINED() on the allocated memory.

_myfree(): Declare MEM_NOACCESS() on the freed memory.

storage/innobase/include/univ.i: Enable UNIV_DEBUG_VALGRIND based on
HAVE_VALGRIND rather than HAVE_purify.

Possible things to do:
 * In my_global.h, remove the defined(HAVE_purify) condition
   from the _WIN32 uint3korr().
 * In my_global.h *int*korr(), use | instead of +
   in order to keep the Valgrind V bits accurate
 * Consider replacing HAVE_purify with HAVE_VALGRIND
 * Use VALGRIND_CREATE_BLOCK, VALGRIND_DISCARD in mem_root and similar places
2010-05-20 13:40:42 +03:00
Vasil Dimov
56586334f1 Merge from mysql-trunk-innodb into mysql-5.1-innodb/storage/innodb_plugin:
------------------------------------------------------------
  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)
  ------------------------------------------------------------
2010-05-20 10:50:07 +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
Vasil Dimov
dc4a8b35a0 Merge mysql-trunk-bugfixing -> mysql-trunk-innodb 2010-05-19 23:48:50 +03:00
Alexander Nozdrin
759d5bc535 Another incarnation of the patch for Bug#30708
(make relies GNU extentions). The patch was partially
backport from 6.0.

Original comment:
bug#30708: make relies GNU extensions.  Now that we no longer use
BitKeeper we can safely remove the SCCS handling with no loss of
functionality.
2010-05-19 17:00:23 +04:00
Sunny Bains
68f13abf54 Merge changes from parent. 2010-05-19 20:24:36 +10: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ä
db70a82142 Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3472
revision-id: marko.makela@oracle.com-20100519080743-5myf1g7v6pfysidt
parent: marko.makela@oracle.com-20100519080152-h3555oqmu3wo95so
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Wed 2010-05-19 11:07:43 +0300
message:
  Make UNIV_DEBUG Valgrind friendly. Use | instead of +,
  and mask out the dont-care bits in debug assertions.
2010-05-19 12:37:21 +03:00
Marko Mäkelä
9bf086dcff Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3471
revision-id: marko.makela@oracle.com-20100519080152-h3555oqmu3wo95so
parent: marko.makela@oracle.com-20100519075843-4gl3uijo6cwjtcf9
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Wed 2010-05-19 11:01:52 +0300
message:
  Silence some more bogus Valgrind warnings on non-32-bit systems. (Bug #53307)
2010-05-19 12:36:27 +03:00
Marko Mäkelä
3564a2643f Make UNIV_DEBUG Valgrind friendly in the built-in InnoDB.
Use | instead of +, and mask out the dont-care bits in debug assertions.
2010-05-19 11:16:18 +03:00
Marko Mäkelä
627074a6a4 Make UNIV_DEBUG Valgrind friendly. Use | instead of +,
and mask out the dont-care bits in debug assertions.
2010-05-19 11:07:43 +03:00
Marko Mäkelä
b8df3227da Silence some more bogus Valgrind warnings on non-32-bit systems. (Bug #53307) 2010-05-19 11:01:52 +03:00
Marko Mäkelä
72541c6b0d Add Valgrind checks to compressed BLOB access. 2010-05-19 10:58:43 +03:00
Inaam Rana
52223f7217 Initialize block->is_hashed to avoid valgrind warning. 2010-05-18 12:53:02 -04:00
Vasil Dimov
e47300bdda Add more valgrind checks for initialized memory.
Author:	Marko
2010-05-18 16:52:54 +03:00
Jimmy Yang
d754b57199 Fix bug #52546, crash on shutdown of plugin with innodb_use_sys_malloc=0.
rb://339, approved by Sunny Bains.
2010-05-17 01:57:42 -07:00
Vasil Dimov
a6142ed8e4 Silence a spurious valrgind warning:
==2229== Uninitialised byte(s) found during client check request
==2229==    at 0x9A599D: buf_page_get_gen (buf0buf.c:3003)
==2229==    by 0x9D58CD: fsp_header_init (fsp0fsp.c:974)
==2229==    by 0x95BEAE: innobase_start_or_create_for_mysql (srv0start.c:1537)
==2229==    by 0x91DDBB: innobase_init(void*) (ha_innodb.cc:2409)
==2229==    by 0x73AF1F: ha_initialize_handlerton(st_plugin_int*) (handler.cc:475)
==2229==    by 0x5DBAE3: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1057)
==2229==    by 0x5DD185: plugin_init(int*, char**, int) (sql_plugin.cc:1343)
==2229==    by 0x53830A: init_server_components() (mysqld.cc:4141)
==2229==    by 0x539048: mysqld_main(int, char**) (mysqld.cc:4742)
==2229==    by 0x52D412: main (main.cc:24)
==2229==  Address 0x998B00C is not stack'd, malloc'd or (recently) free'd
==2229== (Memcheck does not allow error to be suppressed)

Approved by:	Marko (rb://345)
2010-05-17 09:32:06 +03:00
Vasil Dimov
a82f643055 Merge mysql-trunk-innodb from bk-internal into my local branch 2010-05-14 16:44:14 +03:00
Vasil Dimov
1256e16611 Add a debug assertion to make it clear that we expect
to own the kernel mutex in fill_trx_row().
2010-05-14 16:38:32 +03: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ä
d32bf00e21 Document Bug #48024 and Bug #53644 in the ChangeLog 2010-05-14 16:10:50 +03:00
Marko Mäkelä
54f59fb55e 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:08:15 +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
Marko Mäkelä
162ab29157 Remove unused code. 2010-05-14 13:51:26 +03:00
Vasil Dimov
0ad0827fde Merge mysql-trunk-innodb from bk-internal locally 2010-05-13 10:53:09 +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
Sunny Bains
49f5ce6ddd Cover the srv_suspend_thread() call by the kernel mutex. This change was
forgotten when I reverted the kernel mutex split patch.
2010-05-13 06:58:43 +10:00
Vasil Dimov
2555cda8d7 Fix whitespace breakage introduced in
jimmy.yang@oracle.com-20100512153945-zg3suquj1ps6xn5z
2010-05-12 20:37:00 +03:00
Jimmy Yang
efc32dcf3f Check in patch for bug #53336, Improved InnoDB Transaction Reporting.
rb://335, Approved by Sunny Bains
2010-05-12 08:39:45 -07:00
Marko Mäkelä
f8b9bb194d Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3462
  revision-id: marko.makela@oracle.com-20100512104212-e2h9n1obxjb8tfg4
  parent: marko.makela@oracle.com-20100512060922-oh716ugpukfakwvh
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: mysql-5.1-innodb
  timestamp: Wed 2010-05-12 13:42:12 +0300
  message:
    ha_innobase::add_index(): Reset trx->error_state in error handling.
    (Bug #53591)
2010-05-12 14:19:26 +03:00
Marko Mäkelä
42a07d5040 Document the Bug #53591 fix in the ChangeLog. 2010-05-12 13:46:03 +03:00
Marko Mäkelä
bfdae6402c ha_innobase::add_index(): Reset trx->error_state in error handling.
(Bug #53591)
2010-05-12 13:42:12 +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
Marko Mäkelä
96853eed54 Document recent fixes in ChangeLog. 2010-05-12 09:09:22 +03:00
Marko Mäkelä
2c889b9dbc row_merge_drop_temp_indexes(): Do not reference freed memory.
(Bug #53471)
2010-05-12 08:39:25 +03:00
Sunny Bains
9eb93f225a Remove UNIV_DEBUG and UNIV_SYNC_DEBUG from univ.i. Left over from testing
the revert of kernel mutex split patch.
2010-05-12 12:33:59 +10:00
Sunny Bains
e9a072f48e Remove references to srv0que.h. 2010-05-12 12:20:26 +10:00
Sunny Bains
02fc9f0223 Revert the kernel mutex split phase I patch. Some artefacts have been left
in the code but they have nothing to do with the kernel mutex split code.
Some subsequent commits use the new functions. This patch has been tested
with: ./mtr --suite=innodb with UNIV_DEBUG and UNIV_SYNC_DEBUG enabled.
All tests were successful.
2010-05-12 11:18:10 +10:00
Marko Mäkelä
8079d0d635 Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3459
  revision-id: marko.makela@oracle.com-20100511105308-grp2t3prh3tqivw0
  parent: marko.makela@oracle.com-20100511105012-b2t7wvz6mu6bll74
  parent: marko.makela@oracle.com-20100505123901-xjxu93h1xnbkfkq0
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: mysql-5.1-innodb
  timestamp: Tue 2010-05-11 13:53:08 +0300
  message:
    Merge a patch from Facebook to fix Bug #53290

    commit e759bc64eb5c5eed4f75677ad67246797d486460
    Author: Ryan Mack
    Date:   3 days ago

        Bugfix for 53290, fast unique index creation fails on duplicate null values

        Summary:
        Bug in the fast index creation code incorrectly considers null
        values to be duplicates during block merging.  Innodb policy is that
        multiple null values are allowed in a unique index.  Null duplicates
        were correctly ignored while sorting individual blocks and with slow
        index creation.

        Test Plan:
        mtr, including new test, load dbs using deferred index creation

        License:
        Copyright (C) 2009-2010 Facebook, Inc.  All Rights Reserved.

        Dual licensed under BSD license and GPLv2.

        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        1. Redistributions of source code must retain the above copyright notice,
           this list of conditions and the following disclaimer.
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.

        THIS SOFTWARE IS PROVIDED BY FACEBOOK, INC. ``AS IS'' AND ANY EXPRESS OR
        IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
        MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
        EVENT SHALL FACEBOOK, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
        SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
        OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
        WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
        OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
        ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

        This program is free software; you can redistribute it and/or modify it
        under the terms of the GNU General Public License as published by the Free
        Software Foundation; version 2 of the License.

        This program is distributed in the hope that it will be useful, but WITHOUT
        ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
        more details.

        You should have received a copy of the GNU General Public License along with
        this program; if not, write to the Free Software Foundation, Inc., 59 Temple
        Place, Suite 330, Boston, MA  02111-1307  USA
      ------------------------------------------------------------
      revno: 3453.2.1
      revision-id: marko.makela@oracle.com-20100505123901-xjxu93h1xnbkfkq0
      parent: marko.makela@oracle.com-20100505120555-ukoq1gklpheslrxs
      committer: Marko Mäkelä <marko.makela@oracle.com>
      branch nick: 5.1-innodb
      timestamp: Wed 2010-05-05 15:39:01 +0300
      message:
        Merge a contribution from Ryan Mack at Facebook:

        Bugfix for 53290, fast unique index creation fails on duplicate null values

            Summary:
            Bug in the fast index creation code incorrectly considers null
            values to be duplicates during block merging.  Innodb policy is that
            multiple null values are allowed in a unique index.  Null duplicates
            were correctly ignored while sorting individual blocks and with slow
            index creation.

            Test Plan:
            mtr, including new test, load dbs using deferred index creation

            DiffCamp Revision: 110840
            Reviewed By: mcallaghan
            CC: mcallaghan, mysql-devel@lists
            Revert Plan:
            OK
2010-05-11 19:18:28 +03:00
Marko Mäkelä
dc322344fc Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3458
  revision-id: marko.makela@oracle.com-20100511105012-b2t7wvz6mu6bll74
  parent: marko.makela@oracle.com-20100511104910-nim8kgguawpis7zo
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: mysql-5.1-innodb
  timestamp: Tue 2010-05-11 13:50:12 +0300
  message:
    Do not demand that buf_page_t be fully initialized on 64-bit systems.
    There may be padding before buf_page_t::zip. (Bug #53307)
2010-05-11 18:46:17 +03:00
Marko Mäkelä
dca77d3f18 Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3457
  revision-id: marko.makela@oracle.com-20100511104910-nim8kgguawpis7zo
  parent: marko.makela@oracle.com-20100511104500-c6kzd0bg5s42p8e9
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: mysql-5.1-innodb
  timestamp: Tue 2010-05-11 13:49:10 +0300
  message:
    btr_page_split_and_insert(): Add an assertion
    suggested by Sunny Bains when reviewing Bug #52964.
2010-05-11 18:42:44 +03:00
Marko Mäkelä
3d9c6280c4 Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3456
  revision-id: marko.makela@oracle.com-20100511104500-c6kzd0bg5s42p8e9
  parent: vasil.dimov@oracle.com-20100510132852-cz457uqvj8iiy9mm
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: mysql-5.1-innodb2
  timestamp: Tue 2010-05-11 13:45:00 +0300
  message:
    Remove a stray expression. Spotted by Sunny Bains.
2010-05-11 18:39:19 +03:00
Vasil Dimov
a25ea4220f Merge mysql-trunk into mysql-trunk-innodb 2010-05-11 14:29:58 +03:00
Vasil Dimov
f4e5069f60 Merge mysql-5.1-innodb from bk-internal locally 2010-05-11 14:00:29 +03:00
Vasil Dimov
703309a3a8 Raise InnoDB Plugin version from 1.0.8 to 1.0.9.
1.0.8 will be released in MySQL 5.1.47, so
1.0.9 will be released in MySQL 5.1.48
2010-05-11 13:58:28 +03:00
Marko Mäkelä
537abedca7 Merge a patch from Facebook to fix Bug #53290
commit e759bc64eb5c5eed4f75677ad67246797d486460
Author: Ryan Mack
Date:   3 days ago

    Bugfix for 53290, fast unique index creation fails on duplicate null values

    Summary:
    Bug in the fast index creation code incorrectly considers null
    values to be duplicates during block merging.  Innodb policy is that
    multiple null values are allowed in a unique index.  Null duplicates
    were correctly ignored while sorting individual blocks and with slow
    index creation.

    Test Plan:
    mtr, including new test, load dbs using deferred index creation

    License:
    Copyright (C) 2009-2010 Facebook, Inc.  All Rights Reserved.

    Dual licensed under BSD license and GPLv2.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:
    1. Redistributions of source code must retain the above copyright notice,
       this list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright notice,
       this list of conditions and the following disclaimer in the documentation
       and/or other materials provided with the distribution.

    THIS SOFTWARE IS PROVIDED BY FACEBOOK, INC. ``AS IS'' AND ANY EXPRESS OR
    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
    EVENT SHALL FACEBOOK, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the Free
    Software Foundation; version 2 of the License.

    This program is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
    more details.

    You should have received a copy of the GNU General Public License along with
    this program; if not, write to the Free Software Foundation, Inc., 59 Temple
    Place, Suite 330, Boston, MA  02111-1307  USA
2010-05-11 13:53:08 +03:00
Marko Mäkelä
80142dd779 Do not demand that buf_page_t be fully initialized on 64-bit systems.
There may be padding before buf_page_t::zip. (Bug #53307)
2010-05-11 13:50:12 +03:00
Marko Mäkelä
b7cf210256 btr_page_split_and_insert(): Add an assertion
suggested by Sunny Bains when reviewing Bug #52964.
2010-05-11 13:49:10 +03:00
Marko Mäkelä
5acbc67f6e Remove a stray expression. Spotted by Sunny Bains. 2010-05-11 13:45:00 +03:00
Sunny Bains
658ce61215 Add missing ';'. 2010-05-11 13:55:47 +10:00
Sunny Bains
f77390bd1a Fix for bug#53541. We need to check whether the slot has been freed or not
before trying to access the transaction instance.

rb://336
2010-05-11 13:03:24 +10:00
Sunny Bains
e50bf39eba Second part of the fix for bug#53499. We decrement the active thread count
when the purge thread completes by calling srv_suspend_thread().
2010-05-11 12:57:11 +10:00
Vasil Dimov
85f8f09c3e Make dict_index_stat_mutex[] static because it is only used in dict0dict.c 2010-05-10 16:24:33 +03:00
Marko Makela
baf8f1155a Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3450
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Wed 2010-05-05 14:24:11 +0300
  message:
    row_merge_drop_temp_indexes(): Load the table via the dictionary cache.
    Allow multiple indexes to be dropped. (Bug #53256)
2010-05-10 14:34:14 +02:00
Sunny Bains
34860f74e4 Fix bug#53499 - purge thread is active during shutdown, assert buf/buf0buf.c line 4115.
Check that all background threads are suspended or shutdown instead of just
checking for the master thread.
rb://333
2010-05-10 13:17:17 +10:00
Calvin Sun
5995b23864 Fix compile errors on x64 Windows.
Change types of srv_purge_batch_size and srv_n_purge_threads
from ulint to ulong.
2010-05-07 16:40:30 -05:00
Calvin Sun
36663cc052 Clean up CMake file by removing duplicate entry for Windows.
Suggested by Vlad.
2010-05-07 15:37:34 -05:00
Alexander Nozdrin
762b535de2 Manual merge from mysql-trunk.
Conflicts:
  - mysql-test/suite/engines/funcs/t/disabled.def
  - mysql-test/suite/engines/iuds/t/disabled.def
  - mysql-test/suite/engines/iuds/t/insert_number.test
2010-05-07 13:37:16 +04:00
Marko Mäkelä
326d75bd41 Merge a contribution from Ryan Mack at Facebook:
Bugfix for 53290, fast unique index creation fails on duplicate null values

    Summary:
    Bug in the fast index creation code incorrectly considers null
    values to be duplicates during block merging.  Innodb policy is that
    multiple null values are allowed in a unique index.  Null duplicates
    were correctly ignored while sorting individual blocks and with slow
    index creation.

    Test Plan:
    mtr, including new test, load dbs using deferred index creation

    DiffCamp Revision: 110840
    Reviewed By: mcallaghan
    CC: mcallaghan, mysql-devel@lists
    Revert Plan:
    OK
2010-05-05 15:39:01 +03:00
Marko Mäkelä
dc4abe9481 Document Bug #53256 2010-05-05 14:50:11 +03:00
Marko Mäkelä
3ea54dbfa9 Note the 1.0.7 release 2010-05-05 14:45:13 +03:00
Marko Mäkelä
3f8a812d7a row_merge_drop_temp_indexes(): Load the table via the dictionary cache.
Allow multiple indexes to be dropped. (Bug #53256)
2010-05-05 14:24:11 +03:00
Marko Mäkelä
356d3a6ddb Merge 2010-05-05 13:37:33 +03:00
Marko Mäkelä
65aaedf93f Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3446
  revision-id: marko.makela@oracle.com-20100505100507-6kcd2hf32hruxbv7
  parent: marko.makela@oracle.com-20100505095328-vetnl0flhmhao7p5
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Wed 2010-05-05 13:05:07 +0300
  message:
    Add Valgrind diagnostics to track down Bug #38999.
  ------------------------------------------------------------
2010-05-05 13:14:06 +03:00
Marko Mäkelä
d4b1117768 Add Valgrind diagnostics to track down Bug #38999. 2010-05-05 13:05:07 +03:00
Jimmy Yang
9141b67822 Update ChangeLog for bug fix of #53165 2010-05-05 03:02:19 -07:00
Marko Mäkelä
264942661b Add Valgrind diagnostics to track down Bug #38999. 2010-05-05 12:53:28 +03:00
Horst.Hunger
9eae31abc4 Patch for 47759 to trunk-bugfixing. 2010-05-05 09:35:38 +02:00
Jimmy Yang
6bc1a96b31 Port fix for 53165 to InnoDB 5.1 plugin. The change buffering options
are different in 5.1 comparing to that of 5.5, so a hand port is
necessary to avoid wrong default option to be set by a simple
branch merge.
2010-05-04 21:52:24 -07:00
Jimmy Yang
00196be73a Fix bug #53165, Setting innodb_change_buffering=DEFAULT produces incorrect result.
rb://295 approved by Marko
2010-05-04 08:25:56 -07:00
Vasil Dimov
6327a4f0af Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3441
  revision-id: marko.makela@oracle.com-20100504130917-qmvzbj3pgil2nuat
  parent: marko.makela@oracle.com-20100504125510-gemcfhj7mefrhalo
  committer: Marko M?kel? <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-05-04 16:09:17 +0300
  message:
    fsp_init_file_page_low(): Zero out the page. (Bug #53306)
  modified:
    storage/innodb_plugin/fsp/fsp0fsp.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Ffsp%2Ffsp0fsp.c
  ------------------------------------------------------------
2010-05-04 16:57:09 +03:00
Vasil Dimov
77817e64bb Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3439
  revision-id: marko.makela@oracle.com-20100504124744-c1ivf5tm90nv7lc1
  parent: marko.makela@oracle.com-20100504105546-4ew7a77e9uhxmhho
  committer: Marko M?kel? <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-05-04 15:47:44 +0300
  message:
    Add Valgrind checks to catch uninitialized writes to data files.
    buf_flush_insert_into_flush_list(),
    buf_flush_insert_sorted_into_flush_list(),
    buf_flush_post_to_doublewrite_buf(): Check that the page is initialized.
  modified:
    storage/innodb_plugin/buf/buf0flu.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fbuf%2Fbuf0flu.c
  ------------------------------------------------------------
2010-05-04 16:50:08 +03:00
Vasil Dimov
3ba71f73be Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3438
  revision-id: marko.makela@oracle.com-20100504105546-4ew7a77e9uhxmhho
  parent: marko.makela@oracle.com-20100504093128-44v6glupe1dsh0ug
  committer: Marko M?kel? <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-05-04 13:55:46 +0300
  message:
    Remove UNIV_BTR_AVOID_COPY. It was broken because btr_attach_half_pages()
    would get the block, new_block in the wrong order.
    Fixing that would have complicated the function even further
    for this marginal case.
  modified:
    storage/innodb_plugin/ChangeLog 2425@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2FChangeLog
    storage/innodb_plugin/btr/btr0btr.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fbtr%2Fbtr0btr.c
    storage/innodb_plugin/include/univ.i 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Funiv.i
  ------------------------------------------------------------
2010-05-04 16:47:47 +03:00
Vasil Dimov
8e27737f17 Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3437
  revision-id: marko.makela@oracle.com-20100504093128-44v6glupe1dsh0ug
  parent: marko.makela@oracle.com-20100503122859-k73bl51re93o0mt4
  committer: Marko M?kel? <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-05-04 12:31:28 +0300
  message:
    btr_page_split_and_insert(): Correct the fix of Bug #52964.
    When split_rec==NULL, choose the correct node pointer key (first_rec).
  modified:
    storage/innodb_plugin/btr/btr0btr.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fbtr%2Fbtr0btr.c
  ------------------------------------------------------------
2010-05-04 16:45:44 +03:00
Marko Mäkelä
322dda2397 Document Bug #53306 in the InnoDB Plugin ChangeLog. 2010-05-04 16:15:17 +03:00
Marko Mäkelä
304daa7431 fsp_init_file_page_low(): Zero out the page. (Bug #53306) 2010-05-04 16:13:58 +03:00
Marko Mäkelä
54b01fbff1 fsp_init_file_page_low(): Zero out the page. (Bug #53306) 2010-05-04 16:09:17 +03:00
Marko Mäkelä
6e5619be2c Add Valgrind checks to catch uninitialized writes to data files.
buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(),
buf_flush_post_to_doublewrite_buf(): Check that the page is initialized.
2010-05-04 15:55:10 +03:00
Marko Mäkelä
19263724e4 Add Valgrind checks to catch uninitialized writes to data files.
buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(),
buf_flush_post_to_doublewrite_buf(): Check that the page is initialized.
2010-05-04 15:47:44 +03:00
Vasil Dimov
0f5326b417 Followup to vasil.dimov@oracle.com-20100504104629-0ovtc5lae2ghn7he :
Add the missing parameter to mutex_create().
2010-05-04 14:47:35 +03:00
Vasil Dimov
8d07cec06c Followup to vasil.dimov@oracle.com-20100504104629-0ovtc5lae2ghn7he :
Remove analyze_mutex_key now that this mutex does not exist.
2010-05-04 14:45:34 +03:00
Vasil Dimov
b0d1eaab03 Merge from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3436
  revision-id: marko.makela@oracle.com-20100503122859-k73bl51re93o0mt4
  parent: vasil.dimov@oracle.com-20100430100236-9ncldjxpi14ec7el
  committer: Marko M?kel? <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Mon 2010-05-03 15:28:59 +0300
  message:
    buf_zip_decompress(): Allow BUF_NO_CHECKSUM_MAGIC as the stamped checksum.
    buf_page_get_gen(): Assert that buf_zip_decompress() succeeds.
    Callers are not prepared for a NULL return value. (Bug #53248)
  modified:
    storage/innodb_plugin/ChangeLog 2425@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2FChangeLog
    storage/innodb_plugin/buf/buf0buf.c 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fbuf%2Fbuf0buf.c
  ------------------------------------------------------------
2010-05-04 13:58:43 +03:00