Commit graph

405 commits

Author SHA1 Message Date
Sergei Golubchik
745cc74c33 5.1.51 merge 2010-10-19 15:58:35 +02:00
Sergei Golubchik
44fec70b79 build dynamic plugins with the -shared libtool option to avoid
double compilation
2010-09-09 15:35:47 +02:00
Jimmy Yang
9b3a3944e4 Merge from mysql-5.1-bugteam to mysql-5.1-security 2010-09-01 17:43:02 -07:00
Michael Widenius
ad6d95d3cb Merge with MySQL 5.1.50
- Changed to still use bcmp() in certain cases becasue
  - Faster for short unaligneed strings than memcmp()
  - Bettern when using valgrind
- Changed to use my_sprintf() instead of sprintf() to get higher portability for old systems
- Changed code to use MariaDB version of select->skip_record()
- Removed -%::SCCS/s.% from Makefile.am:s to remove automake warnings
2010-08-27 17:12:44 +03:00
Jimmy Yang
224261eec5 This is to resolve a hang situation in 5.1 builtin raised by
bug #49251 (deadlock/crash with concurrent truncate table and index
statistics calculation) by backporting a solution from #54678 fixed
for 5.1 plugin and 5.5.
2010-08-24 20:42:33 -07:00
Marko Mäkelä
634af8f446 Bug#55832: selects crash too easily when innodb_force_recovery>3
dict_update_statistics_low(): Create bogus statistics for those
indexes that cannot be accessed because of the innodb_force_recovery
setting.

ha_innobase::info(): Calculate statistics for each index, even if
innodb_force_recovery is set. Fill in bogus data for those indexes
that are not accessed because of the innodb_force_recovery setting.
2010-08-23 13:28:54 +03:00
Sunny Bains
81da9b3d72 Fix Bug #54538 - use of exclusive innodb dictionary lock limits performance.
This patch doesn't get rid of the need to acquire the dict_sys->mutex but
reduces the need to keep the mutex locked for the duration of the query
to fsp_get_available_space_in_free_extents() from ha_innobase::info().

rb://390.
2010-08-20 17:49:43 +10:00
Sunny Bains
3daf6d3d73 Fix Bug #55027: assertion: mutex_own(&dict_sys->mutex) in dict_table_get_on_id()
The callers should indicate that the dictionary is locked or not using
the trx->dict_operation_lock_mode == RW_X_LATCH mode. Checking explicitly
for system tables is unnecessary.

Approved by Marko on IRC.
2010-08-20 12:57:04 +10: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
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
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
Michael Widenius
80204e051c Merge with MariaDB main 2010-08-02 12:40:01 +03:00
Michael Widenius
e0a6b02c5d Merge with MySQL 5.1.49
Fixed Bug#52005 'JOIN_TAB->dependent' may be incorrectly propageted for multilevel outer joins' in a better way (patch from Sergey Petrunya)
2010-08-02 12:01:24 +03: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
Vasil Dimov
c110066bda Merge mysql-5.1-bugteam -> mysql-5.1-innodb 2010-07-29 11:51:00 +03:00
Vasil Dimov
f43c9eff23 Merge mysql-5.1 -> mysql-5.1-innodb 2010-07-23 12:51:14 +03:00
Davi Arnaut
dfaf73a987 Merge of mysql-5.1 into mysql-5.1-bugteam. 2010-07-19 15:34:28 -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
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
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
Jimmy Yang
f2dfe5e8a5 Fix Bug #54044 Create temporary tables and using innodb crashes. 2010-06-24 01:20:25 -07: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
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
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
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
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
Sergey Glukhov
60a66c451a Bug#38999 valgrind warnings for update statement in function compare_record()
Valgrind warning happpens because of uninitialized null bytes.
In row_sel_push_cache_row_for_mysql() function we fill fetch cache
with necessary field values, row_sel_store_mysql_rec() is called
for this and leaves null bytes untouched.
Later row_sel_pop_cached_row_for_mysql() rewrites table record
buffer with uninited null bytes. We can see the problem from the
test case:
At 'SELECT...' we call row_sel_push...->row_sel_store...->row_sel_pop_cached...
chain which rewrites table->record[0] buffer with uninitialized null bytes.
When we call 'UPDATE...' statement, compare_record uses this buffer and
valgrind warning occurs.
The fix is to init null bytes with default values.


mysql-test/suite/innodb/r/innodb_mysql.result:
  test case
mysql-test/suite/innodb/t/innodb_mysql.test:
  test case
mysql-test/t/ps_3innodb.test:
  enable valgrind testing
storage/innobase/row/row0sel.c:
  init null bytes with default values as they might be
  left uninitialized in some cases and these uninited bytes
  might be copied into mysql record buffer that leads to
  valgrind warnings on next use of the buffer.
2010-06-09 16:07:34 +04:00
Marko Mäkelä
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
Bo Thorsen
310f4438b5 Disable the old innobase again 2010-06-01 08:40:36 +02:00
Michael Widenius
4aa9d903c1 Merge with MySQL 5.1.47
Fixed some bugs introduced in 5.1.47
Disabled some tests until we have merged with latest Xtradb

configure.in:
  Added testing if valgrind/memcheck.h exists
storage/pbxt/src/ha_pbxt.cc:
  LOCK_plugin is not anymore locked in init
2010-05-26 21:55:40 +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
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
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
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ä
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
Marko Mäkelä
264942661b Add Valgrind diagnostics to track down Bug #38999. 2010-05-05 12:53:28 +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ä
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 Makela
c144a091db recv_sys_init(), recv_sys_empty_hash(): Shrink recv_sys->addr_hash.
This addresses Bug #53122 in the built-in InnoDB.
2010-04-29 15:41:47 +02:00
Marko Makela
0ca989eaaf Reduce the next-key locking of READ UNCOMMITTED to match that of
READ COMMITTED in the built-in InnoDB. (Bug #48607)
2010-04-29 15:29:45 +02:00
unknown
b1e00b6be8 Merge MySQL 5.1.46 into MariaDB.
Still two test failures to be solved: main.myisam and main.subselect.
2010-04-28 14:52:24 +02:00
Marko Makela
91702fd313 Merge r6103 from InnoDB Plugin to the built-in InnoDB to fix Bug #53202:
------------------------------------------------------------------------
  r6103 | marko | 2009-10-26 15:46:18 +0200 (Mon, 26 Oct 2009) | 4 lines
  Changed paths:
     M /branches/zip/row/row0ins.c

  branches/zip: row_ins_alloc_sys_fields(): Zero out the system columns
  DB_TRX_ID, DB_ROLL_PTR and DB_ROW_ID, in order to avoid harmless
  Valgrind warnings about uninitialized data.  (The warnings were
  harmless, because the fields would be initialized at a later stage.)
  ------------------------------------------------------------------------
2010-04-28 08:33:25 +02:00
Vasil Dimov
a1bdbe8a0c Do not define UNIV_DEBUG_VALGRIND when HAVE_purify because
this results in some valgrind errors.

Bug#53202 valgrind: uninitialized bytes in dtuple_print()
has been opened to track this.
2010-04-27 17:05:41 +03:00
Marko Mäkelä
4d646bd16e lock_rec_queue_validate(): Disable a bogus check that
a transaction that holds a lock on a clustered index record
also holds a lock on the secondary index record.
2010-04-26 16:10:29 +03:00
Marko Mäkelä
063928ba05 row_search_for_mysql(): Never try semi-consistent read in unique searches.
They are only useful in table scans. (Bug #52663)
2010-04-26 13:27:25 +03:00
Marko =?ISO-8859-1?Q?M=E4kel=E4?=
ca85feba83 Enable UNIV_DEBUG_VALGRIND when HAVE_purify is set. 2010-04-19 13:36:03 +03:00
Vasil Dimov
3e7b21ca55 Merge from innodb-branches-5.1 2010-04-07 21:59:02 +03:00
Vasil Dimov
292add1cf8 Rename the newly added mysql-tests from InnoDB to their proper location. 2010-03-31 16:07:55 +03:00
Vasil Dimov
6f2f0704cb Merge from innodb-branches-5.1 2010-03-31 16:06:13 +03:00