Commit graph

26727 commits

Author SHA1 Message Date
Alexander Nozdrin
893dced429 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.
2010-05-31 17:38:02 +04:00
Gleb Shchepa
3ca98f7669 Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY
when it should use index

Sometimes the LEFT/RIGHT JOIN with an empty table caused an
unnecessary filesort.

Sample query, where t1.i1 is indexed and t3 is empty:

  SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2
                       LEFT JOIN t3 ON t2.i2 = t3.i3
    ORDER BY t1.i1 LIMIT 5;

The server erroneously used an item of empty outer-joined
table as a common constant of a Item_equal (multi-equivalence
expression).
By the fix for the bug 16590 the constant status of such
an item has been propagated to st_table::const_key_parts
map bits related to other Item_equal argument-related
key parts (those are obviously not constant in our case).
As far as test_if_skip_sort_order function skips constant
prefixes of testing keys, this caused an ignorance of
available indices, since some prefixes were marked as
constant by mistake.
2010-05-31 16:52:19 +04:00
Sergey Glukhov
f75f58007e test case fix 2010-05-31 12:38:45 +04: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
Alexander Nozdrin
4e633ec234 Auto-merge from mysql-trunk. 2010-05-28 09:47:58 +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
Mattias Jonsson
b3259e93ea pre push fix of test results 2010-05-26 09:56:55 +02:00
Mattias Jonsson
2e1ade56f8 merge 2010-05-25 17:41:11 +02:00
Mattias Jonsson
e596ae0795 merge 2010-05-25 17:26:48 +02:00
Mattias Jonsson
39d9765297 post push fix 2010-05-25 11:34:36 +02:00
Mattias Jonsson
2b846b39c1 merge 2010-05-25 08:35:48 +02:00
Mattias Jonsson
b0ecceb95b merge 2010-05-24 23:21:08 +02:00
Alexander Nozdrin
f54464035a Fix for Bug#53925 (valgrind failures in rpl.rpl_get_master_version_and_clock
in mysql-trunk-merge).

There were two problems:
  - a mistake during merge of a patch for Bug 52629 from 5.1;
  - MTR treated auxilary output of newer valgrind as an error.

The fixes are:
  - Fix merge error;
  - Teach MTR to skip 'HEAP summary' section of valgrind output.
2010-05-24 22:57:25 +04:00
Alexey Kopytov
71929d76d0 Fixed an incorrectly merged .result file. 2010-05-24 18:13:00 +04:00
Mattias Jonsson
d7e7afd403 Merge of bug#51851.
Also moved HA_DATA_PARTITION from ha_partition.cc to table.h.
2010-05-24 14:51:59 +02:00
Alexey Kopytov
b69a31fad5 Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts:

   conflict      Makefile.am
   conflict      mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
   conflict      mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
   conflict      sql/opt_sum.cc
   conflict      sql/set_var.cc
   conflict      sql/sql_base.cc
   conflict      sql/sql_priv.h
   conflict      sql/sql_show.cc
2010-05-24 00:41:18 +04:00
Gleb Shchepa
6e34b8b0ce Bug #53804: serious flaws in the alter database .. upgrade
data directory name command

The check_db_name function has been modified to validate tails of
#mysql50#-prefixed database names for compliance with MySQL 5.0
database name encoding rules (the check_table_name function call
has been reused).
2010-05-21 22:47:32 +04:00
Jon Olav Hauglid
ac9bae9e04 merge from mysql-trunk-runtime 2010-05-21 15:49:15 +02:00
Alexander Nozdrin
dfec05be05 Backporting a test case for Bug#30036 (SHOW TABLE TYPES causes the debug client
to crash) from mysql-6.0-codebase.
2010-05-21 17:36:59 +04:00
Dmitry Lenev
6ceacd4fb9 Follow-up for the fix for bug #46947 "Embedded SELECT without
FOR UPDATE is causing a lock".
 
This patch tries to address problems which were exposed 
during backporting of original patch to 5.1 tree.
 
- It ensures that we don't change locking behavior of simple
  SELECT statements on InnoDB tables when they are executed
  under LOCK TABLES ... READ and with @@innodb_table_locks=0.
  Also we no longer pass TL_READ_DEFAULT/TL_WRITE_DEFAULT 
  lock types, which are supposed to be parser-only, to 
  handler::start_stmt() method.
- It makes check_/no_concurrent_insert.inc auxiliary scripts 
  more robust against changes in test cases that use them
  and also ensures that they don't unnecessarily change 
  environment of caller.
2010-05-21 16:41:24 +04:00
Sven Sandberg
836bb54c26 BUG#52987: mysqldump fails if umask=0077
Problem: The test case mysqldump reads a file that must
be world-readable. The test did not force the file to be
world-readable, so if the tree was branched with a umask
of 0077, the test would fail.
Fix: chmod the file.
2010-05-20 17:38:01 +02:00
Alexander Nozdrin
eff442964a 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
Sergey Glukhov
7132ccd7ca Bug#52884 mysql-test-run does not work with --debug option
Server crashes on 64bit linux with 'double free or corruption'
message, on 32bit mysql-test-run silently fails on bootstrap
stage. The problem is that FreeState() is called twice
for init_settings struct in _db_end_ function.
The fix is to remove superfluous FreeState() call.
Additional fix:
fixed discrepancy of result file when
debug & valgrind options are enabled
for MTR.
2010-05-20 10:31:03 +04:00
Luis Soares
ce3194c1c8 BUG 53621: automerged bzr bundle from bug report. 2010-05-20 00:52:03 +01:00
Luis Soares
4ed6fc0457 BUG 52868: automerged bzr bundle from bug report. 2010-05-20 00:50:42 +01:00
Luis Soares
e7eb43a859 BUG 49522: automerged bzr bundle from bug report. 2010-05-20 00:49:18 +01:00
Alexander Nozdrin
091bcacc79 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
Alexander Nozdrin
2f7945b8b9 Backporting a patch for Bug#43358 from 6.0 to trunk-bugfixing. 2010-05-19 16:33:51 +04:00
Alexander Nozdrin
796fd24e15 Backport test cases for Bug#46198 and Bug#38054
from 6.0 to trunk-bugfixing.
2010-05-19 16:31:18 +04:00
Jon Olav Hauglid
c09eb2afc3 Bug #53798 OPTIMIZE TABLE breaks repeatable read
The problem was that OPTMIZE TABLE was allowed to run on a table
in use by a transaction in a different connection. This caused
repeatable read to break.

This bug was fixed by the introduction of metadata locking, WL#4284.
OPTIMIZE TABLE will now be blocked until the transaction using the
table, has ended.

This patch contains a regression test added to innodb_mysql_lock.test
and no code changes.
2010-05-19 13:32:21 +02:00
Tor Didriksen
a22c69b233 Backport from next-mr-bugfixing of tor.didriksen@sun.com-20100106140051-3j2iuag63eltsr2e
Bug #50087 Interval arithmetic for Event_queue_element is not portable.

Subtraction of two unsigned months yielded a (very large) positive value.
Conversion of this to a signed value was not necessarily well defined.
              
Solution: do the subtraction on signed values.
2010-05-19 11:18:59 +02:00
Andrei Elkin
b530d5660e reverting fixes for Bug@50316 in mysql-trunk 2010-05-18 18:32:44 +03:00
Jon Olav Hauglid
1c02ed3e67 manual merge from mysql-trunk-bugfixing 2010-05-18 14:52:51 +02:00
Andrei Elkin
1579ae040b rpl_ndb tests fixing results files due to Master_Info_File of bug#50316 2010-05-18 11:07:31 +03:00
Andrei Elkin
2c966ddda1 merging bug#50316 fixes 2010-05-18 10:13:37 +03:00
Alexander Nozdrin
5d3833f51b Patch for Bug#52410 (Test "mysqld--help-*": further output differences).
That was a pure test issue -- filter implementation in Perl did not work
on some platform (the bug occurred on Windows Server 2008 with
Cygwin Perl 5.10.0).
2010-05-17 19:28:50 +04:00
Andrei Elkin
f7e999ed77 removing disabled line for rpl_row_create_table due to Bug#45576. Anyway, the test is still there because of Bug#51574 2010-05-16 22:28:20 +03:00
Andrei Elkin
9e3c410ae7 bug#50316 Add Master_info_file to SHOW SLAVE STATUS
pushing to next-mr-bugfixing from working branch
2010-05-16 21:40:56 +03:00
Andrei Elkin
f59684b86e pushing bug#50942 fixes to 5.1-bt 2010-05-16 20:03:32 +03:00
Alfranio Correia
6400d6d54a BUG#50410: rpl_ndb tests should run with binlog_format=row
Post-fix: Updated a test case after the patch for BUG#50410,
because the patch makes ndb to run in the row format and as
such unsafe warning messages are not printed out.
2010-05-16 12:45:21 +01:00
Alexander Nozdrin
5c4333bc85 Patch for Bug#27863 (excessive memory usage for many small queries in a
multiquery packet).

Background:

  - a query can contain multiple SQL statements;

  - the server frees resources allocated to process a query when the
    whole query is handled. In other words, resources allocated to process
    one SQL statement from a multi-statement query are freed when all SQL
    statements are handled.

The problem was that the parser allocated a buffer of size of the whole
query for each SQL statement in a multi-statement query. Thus, if a query
had many SQL-statements (so, the query was long), but each SQL statement
was short, ther parser tried to allocate huge amount of memory (number of
small SQL statements * length of the whole query).

The memory was allocated for a so-called "cpp buffer", which is intended to
store pre-processed SQL statement -- SQL text without version specific
comments.

The fix is to allocate memory for the "cpp buffer" once for all SQL
statements (once for a query).
2010-05-14 22:11:25 +04:00
Gleb Shchepa
09b6efcc76 Bug #53450: Crash / assertion "virtual int
ha_myisam::index_first(uchar*)") at assert.c:81

Single-table DELETE crash/assertion similar to single-table
UPDATE bug 14272.

Same resolution as for the bug 14272:
Don't run index scan when we should use quick select.
This could cause failures because there are table handlers (like federated)
that support quick select scanning but do not support index scanning.
2010-05-14 15:36:27 +04:00
Alexander Nozdrin
7752ccec48 Patch for Bug#21818 (Return value of ROW_COUNT() is incorrect
for ALTER TABLE, LOAD DATA).

ROW_COUNT is now assigned according to the following rules:

  - In my_ok():
    - for DML statements: to the number of affected rows;
    - for DDL statements: to 0.

  - In my_eof(): to -1 to indicate that there was a result set.

    We derive this semantics from the JDBC specification, where int
    java.sql.Statement.getUpdateCount() is defined to (sic) "return the
    current result as an update count; if the result is a ResultSet
    object or there are no more results, -1 is returned".

  - In my_error(): to -1 to be compatible with the MySQL C API and
    MySQL ODBC driver.

  - For SIGNAL statements: to 0 per WL#2110 specification. Zero is used
    since that's the "default" value of ROW_COUNT in the diagnostics area.
2010-05-14 09:28:51 +04:00
Konstantin Osipov
c40277d8cd Merge trunk -> trunk-runtime. 2010-05-13 19:40:33 +04:00
Luis Soares
a602950080 BUG#53621: check_testcase fails for rpl_do_grant in mysql-5.1-bugteam
MTR sporadically reported that rpl_do_grant does not
clean up after itself.

We fix this by backporting BUG 50984 fix. This deploys
missing synchronization between master and slave.

Additionally, it also fixes the check_testcase for
rpl_tmp_table_and_DDL.
2010-05-13 16:40:31 +01:00
Ramil Kalimullin
a882f7e683 Fix for bug#52051: Aggregate functions incorrectly returns
NULL from outer join query
      
      Problem: optimising MIN/MAX() queries without GROUP BY clause
      by replacing the aggregate expression with a constant, we may set it
      to NULL disregarding the fact that there may be outer joins involved.
      
      Fix: don't replace MIN/MAX() with NULL if there're outer joins.
      
      Note: the fix itself is just
      - if (!count)
      + if (!count && !outer_tables)
          set to NULL
      
      The rest of the patch eliminates repeated code to improve speed
      and for easy maintenance of the code.
2010-05-12 20:10:33 +04:00
Jonathan Perkin
5b85121ca6 Changes to build using CMake according to existing release packages:
- Update/fix file layouts for each package type, add new types for
   native package formats including deb, rpm and svr4.

 - Build all plugins, including debug versions

 - Update compiler flags to match current release

 - Add missing @VAR@ expansions

 - Install correct mysqclient library symlinks

 - Fix icc/ia64 builds

 - Fix install of libmysqld-debug

 - Don't include mysql_embedded

 - Remove unpackaged manual pages to avoid missing files warnings

 - Don't install mtr's test suite
2010-05-12 12:51:23 +01:00
Staale Smedseng
44fe4c707b Bug #49756 Rows_examined is always 0 in the slow query log for
update statements
      
Only SELECT statements report any examined rows in the slow
log. Slow UPDATE, DELETE and INSERT statements report 0 rows
examined, unless the statement has a condition including a
SELECT substatement.
      
This patch adds counting of examined rows for the UPDATE and
DELETE statements. An INSERT ... VALUES statement will still 
not report any rows as examined.
2010-05-12 13:19:12 +02:00
Alexander Nozdrin
a68a68bf45 A follow-up for Bug#50373: remove a commented-out part of the loaddata.test. 2010-05-12 15:13:47 +04:00