Commit graph

65886 commits

Author SHA1 Message Date
Dmitry Lenev
c7395690c6 Yet another follow-up for the 5.5 version of fix for
bug #46947 "Embedded SELECT without FOR UPDATE is causing 
a lock".

Fixed comments in tests. Improved comments and performance of
auxiliary scripts.
2010-05-30 13:27:44 +04:00
Dmitry Lenev
c4b2cf2da5 Follow-up for patch that addresses bug #53976 "ALTER TABLE
RENAME is allowed on views (not documented, broken)".

Adjusted test cases in funcs_1 suite after removing support
of ALTER TABLE RENAME for views.
2010-05-30 11:48:22 +04:00
Dmitry Lenev
d99aeb19fb Fixed typo which was introduced by pre-requisite patch for
bug #51263 "Deadlock between transactional SELECT and ALTER
TABLE ... REBUILD PARTITION" and has been causing compilation
error when server was built with NDB support.
2010-05-30 11:43:19 +04:00
Alexey Kopytov
966d6d2fb0 Bug #48537: difference of index selection between rpm binary
and .tar.gz, windows vs linux..

On Intel x86 machines index selection by the MySQL query
optimizer could sometimes depend on the compiler version and
optimization flags used to build the server binary.

The problem was a result of a known issue with floating point
calculations on x86: since internal FPU precision (80 bit)
differs from precision used by programs (32-bit float or 64-bit
double), the result of calculating a complex expression may
depend on how FPU registers are allocated by the compiler and
whether intermediate values are spilled from FPU to memory. In
this particular case compiler versions and optimization flags
had an effect on cost calculation when choosing the best index
in best_access_path().

A possible solution to this problem which has already been
implemented in mysql-trunk is to limit FPU internal precision
to 64 bits. So the fix is a backport of the relevant code to
5.1 from mysql-trunk.
2010-05-29 22:16:45 +04:00
Davi Arnaut
aa28461510 Backport: remove dead code.
Reorganize function to reflect that it does not actually uses curses
and that there is no curses variant.
2010-05-28 19:53:26 -03:00
Davi Arnaut
570c6cc87a Backport: Remove unused and ancient files, functions, and facilities. 2010-05-28 19:13:31 -03:00
Davi Arnaut
b2fda7cfa8 Remove build files which relied on the now defunct make-ccc files. 2010-05-28 18:17:02 -03:00
Davi Arnaut
25eb8e2c37 Backport: remove ancient and unused strings files. 2010-05-28 18:11:31 -03:00
Davi Arnaut
d60a0ce9be Backport a old cleanup patch.
Formatting cleanup: removing tabs and trailing spaces
to conform to MySQL Internals Coding Guidelines.
2010-05-28 18:00:18 -03:00
oystein.grovlen@sun.com
80fc19ade7 Bug#52168 decimal casting catastrophes: crashes and valgrind errors on simple casts
The problem is that if a NULL is stored in an Item_cache_decimal object,
the associated my_decimal object is not initialized.  However, it is still
accessed when val_int() is called. The fix is to check for null_value
within val_int(), and return without accessing the my_decimal object when
the cached value is NULL.

Bug#52122 reports the same issue for val_real(), and this patch also includes
fixes for val_real() and val_str() and corresponding test cases from that
bug report.  

Also, NULL is returned from val_decimal() when value is null. This will
avoid that callers access an uninitialized my_decimal object.

Made similar changes to all other Item_cache classes.  Now all val_*
methods should return a well defined value when actual value is NULL.
2010-05-28 17:30:39 +02:00
Daniel Fischer
89205a3bf6 post-merge fix 1 2010-05-28 16:50:23 +02:00
Vasil Dimov
f8179235f4 Merge mysql-trunk-innodb from bk-internal into my local tree 2010-05-28 17:16:46 +03:00
Jimmy Yang
bba92ac8a4 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
Mattias Jonsson
7e33652495 Manual merge of bug#49161 into mysql-trunk-merge
(Added a real error message instead of ER_UNKNOWN_ERROR)
2010-05-28 15:14:43 +02:00
Jonathan Perkin
507621cec8 Differentiate between Oracle Enterprise Linux and Red Hat Enterprise Linux. 2010-05-28 13:56:57 +01:00
Mattias Jonsson
6498472b9d merge 2010-05-28 14:49:25 +02:00
Jonathan Perkin
0ac4bc17cb Merge 2010-05-28 12:53:55 +01:00
Calvin Sun
5c11f02904 mysql-trunk-innodb: undo r3119 of disabling test cases.
r3119 does not prevent the crash even the test is disabled.
The crash occurs during shutdown.
2010-05-28 02:41:03 -05:00
Alexander Nozdrin
4e633ec234 Auto-merge from mysql-trunk. 2010-05-28 09:47:58 +04:00
Dmitry Lenev
1fbdf160b4 Patch that addresses bug #53976 "ALTER TABLE RENAME
is allowed on views (not documented, broken)".

Remove support of ALTER TABLE RENAME for views as:
a) this feature was not documented,
c) does not add any compatibility with other databases,
b) its implementation doesn't follow metadata locking
   protocol by accessing .FRM without holding any
   metadata lock,
c) its implementation complicates ALTER TABLE's code
   by introducing  yet another separate branch to it.

After this patch one can rename a view by using the
documented way - RENAME TABLE statement.
2010-05-28 09:25:11 +04:00
8cf9db67d1 Manual merge 2010-05-28 11:21:20 +08:00
5873b972d9 Postfix for BUG#49741
Add code to waiting for a set of errors.
Add code to waiting for an error instead of waiting for io thread to stop, as
after 'START SLAVE', the status of io thread is still not running.
But it doesn't mean slave io thread encounters an error.
2010-05-28 10:57:45 +08:00
Davi Arnaut
a3d61b0bb2 Fix type mismatch. Table names are represented as LEX_STRING
objects whose length is stored in a size_t type.
2010-05-27 18:28:24 -03:00
Davi Arnaut
3cc56cb5ad Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
Post-merge fix: Pass the right parameter type to open_and_lock_tables.
Passing FALSE ensures that derived table handling is disabled, truncate
only operates on base tables.
2010-05-27 18:11:55 -03:00
Davi Arnaut
2d3e5019d4 Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
Post-merge fix: Retrieve handler statistics to workaround quirks
of the archive storage engine.
2010-05-27 17:40:54 -03:00
Dmitry Lenev
fae1efb5f8 Null-merged the 5.1-only version of fix for bug #46947
"Embedded SELECT without FOR UPDATE is causing a lock"
into 5.5 tree. One of 5.5 trees already contains a
more thorough version of the fix.
2010-05-28 00:18:43 +04:00
Dmitry Lenev
78c6a8ca30 A 5.1-only version of fix for bug #46947 "Embedded SELECT
without FOR UPDATE is causing a lock".

SELECT statements with subqueries referencing InnoDB tables
were acquiring shared locks on rows in these tables when they
were executed in REPEATABLE-READ mode and with statement or
mixed mode binary logging turned on.

This was a regression which were introduced when fixing
bug 39843.

The problem was that for tables belonging to subqueries
parser set TL_READ_DEFAULT as a lock type. In cases when
statement/mixed binary logging at open_tables() time this
type of lock was converted to TL_READ_NO_INSERT lock at
open_tables() time and caused InnoDB engine to acquire
shared locks on reads from these tables. Although in some
cases such behavior was correct (e.g. for subqueries in
DELETE) in case of SELECT it has caused unnecessary locking.

This patch implements minimal version of the fix for the
specific problem described in the bug-report which supposed
to be not too risky for pushing into 5.1 tree.
The 5.5 tree already contains a more appropriate solution
which also addresses other related issues like bug 53921
"Wrong locks for SELECTs used stored functions may lead
to broken SBR".

This patch tries to solve the problem by ensuring that
TL_READ_DEFAULT lock which is set in the parser for
tables participating in subqueries at open_tables()
time is interpreted as TL_READ_NO_INSERT or TL_READ.
TL_READ is used only if we know that this is a SELECT
and that this particular table is not used by a stored
function.

Test coverage is added for both InnoDB and MyISAM.

This patch introduces an "incompatible" change in locking
scheme for subqueries used in SELECT ... FOR UPDATE and
SELECT .. IN SHARE MODE.

In 4.1 (as well as in 5.0 and 5.1 before fix for bug 39843)
the server would use a snapshot InnoDB read for subqueries
in SELECT FOR UPDATE and SELECT .. IN SHARE MODE statements,
regardless of whether the binary log is on or off.

If the user required a different type of read (i.e. locking
read), he/she could request so explicitly by providing FOR
UPDATE/IN SHARE MODE clause for each individual subquery.

The patch for bug 39843 broke this behaviour (which was not
documented or tested), and started to use locking reads for
all subqueries in SELECT ... FOR UPDATE/IN SHARE MODE.
This patch restores 4.1 behaviour.

This patch should be mostly null-merged into 5.5 tree.
2010-05-28 00:07:40 +04:00
Vasil Dimov
ef681d4205 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
Joerg Bruehe
87dfc8ef1d Get rid of the "net retry count" difference which
is not needed any more with current versions of FreeBSD.
(Entries 52410 and 52412 in the Bug DB)

That change is based on Dan Nelson replying on the
FreeBSD mailing list, freebsd-questions@freebsd.org
in a thread running from 2010-Apr-29 to 2010-May-1 titled
     "Need info about FreeBSD and interrupted system
      calls for MySQL code"

Also, ensure the cmake settings correspond to the autotools
ones: Add "HAVE_BROKEN_REALPATH" to cmake.
2010-05-27 19:02:19 +02:00
Inaam Rana
8cd8a83a44 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
063574c379 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
Sergey Glukhov
20bd61a6e1 Bug#52430 Incorrect key in the error message for duplicate key error involving BINARY type
For BINARY(N) strip trailing zeroes to make the error message nice-looking
2010-05-27 20:01:43 +04:00
Sergey Glukhov
6f55a81074 Bug#52856 concurrent show columns or show full columns causes a crash!!!1
We should avoid any SHARE fields assignments as
this is shared structure and assignments may
affect other therads. To avoid this
copy of SHARE struct is created and
stored into TABLE struct which is
used in get_schema_coulumns_record later.
2010-05-27 19:54:43 +04:00
Alfranio Correia
9fbf4b723d BUG#53437 @@session.sql_bin_log support in substatements is incorrect
The thd->variables.option_bits & OPTION_BIN_LOG is currently abused: 
it's both a system variable and an implementation switch. The current
approach to this option bit breaks the session variable encapsulation. 
      
Besides it is allowed to change @@session.sql_bin_log within a
transaction what may lead to not correctly logging a transaction.
      
To fix the problems,  we created a thd->variables variable to represent
the "sql_log_bin" and prohibited its update inside a transaction or
sub-statement.
2010-05-27 16:43:08 +01:00
Sergey Glukhov
d7c73e79bd mysql-5.1-bugteam->mysql-trunk-merge 2010-05-27 19:20:10 +04:00
Sergey Glukhov
fa3570f96a Bug#52005 'JOIN_TAB->dependent' may be incorrectly propageted for multilevel outer joins
There are two problems:
1. In simplify_joins function we calculate table dependencies. If STRAIGHT_JOIN hint
is used for whole SELECT we do not count it and as result some dependendecies
might be lost. It leads to incorrect table order which is returned by
join_tab_cmp_straight() function.
2. make_join_statistics() calculate the transitive closure for relations a particular
JOIN_TAB is 'dependent on'.
We aggregate the dependent table_map of a JOIN_TAB by adding dependencies from other
tables which we depend on. However, this may also cause new dependencies to be
available after we have completed processing a certain JOIN_TAB.
Both these problems affect condition pushdown and as result condition might be pushed
into wrong table which leads to crash or even omitted which leads to wrong result.
The fix:
1. Use modified 'transitive closure' algorithm provided by Ole John Aske
2. Update table dependences in simplify_joins according to 
   global STRAIGHT_JOIN hint.
Note: the patch also fixes bugs 46091 & 51492
2010-05-27 19:13:53 +04:00
Daniel Fischer
5f5d488978 merge 2010-05-27 16:11:13 +02:00
Vasil Dimov
8dff6a64d2 Merge mysql-trunk-innodb from bk-internal into my local tree 2010-05-27 15:07:08 +03:00
Jonathan Perkin
7609b38454 Fix HP-UX localtime_r issue correctly, patch from mats. 2010-05-27 12:52:01 +01:00
Jimmy Yang
a51779c7c2 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
Jonathan Perkin
ce34f3d809 Split OEL/RHEL 2010-05-27 12:51:26 +02:00
Alexey Kopytov
eaea879db3 Fixed an incorrect merge from 5.1-bugteam. 2010-05-27 14:48:50 +04:00
Alexey Kopytov
17325b8d67 Manual merge from mysql-5.1-bugteam to mysql-trunk-merge.
Null-merged patch for bug 53907.

Conflicts:

   conflict      sql/sql_parse.cc
2010-05-27 14:42:12 +04:00
Alexey Kopytov
54a006fa0f Automerge. 2010-05-27 14:14:27 +04:00
Alexey Kopytov
b19c880522 Automerge. 2010-05-27 14:08:44 +04:00
Vasil Dimov
96c47c4df1 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
Tor Didriksen
2857b55a46 Bug #53445 Build with -Wall and fix warnings that it generates
Post-push fix: -Wall implies -Wunused on some platforms,
which will generate thousands of warnings about unused parameters.
2010-05-27 09:42:48 +02:00
Vasil Dimov
0efa64d440 Fix a compiler warning introduced in
jimmy.yang@oracle.com-20100526014433-bx0t9794mnvkiaft
2010-05-27 08:51:03 +03:00
Dmitry Lenev
303fe45abf Fix for bug #53238 "mdl_sync fails sporadically".
The problem was that mdl_sync.test was failing sporadically,
due to fact that part of the test didn't take into account
effects of MyISAM's concurrent insert.

This patch solves the problem by making test case robust
against concurrent insert.
2010-05-26 23:58:16 +04:00
Kristofer Pettersson
fd75f56fd5 automerge 2010-05-26 17:17:33 +02:00