Commit graph

61714 commits

Author SHA1 Message Date
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
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
Alexander Nozdrin
677bc2e719 Follow-up patch for Bug#27863 (excessive memory usage for many small queries
in a multiquery packet): fix NDB test failures.
2010-05-17 16:10:26 +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
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
Konstantin Osipov
d63caa0c30 Committing on behalf of Valdislav Vaintroub (reviewed and
approved):

3161 Vladislav Vaintroub       2010-04-29                 
 Bug#53196 : CMake builds don't support 'make tags' and 
'make ctags' targets.  
   - Added tags and ctags targets
2010-05-14 18:42:10 +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
Dmitry Lenev
017d66b5c8 Small clean-up. Removed standalone enum_open_table_action enum
type, which some time ago became part of Open_table_context class.
Apparently standalone enum type was erroneously re-introduced
during one of merges.
2010-05-13 13:36:49 +04:00
Dmitry Lenev
8a6953dbc5 Fix compiler warning about "assignment used as truth value"
which was introduced by fix for bug 47459 "Assertion in
Diagnostics_area::set_eof_status on OPTIMIZE TABLE.
2010-05-13 13:24:59 +04:00
Jonathan Perkin
89aedeb06d Revert back to new CMake names for audit_null/daemon_example plugins. 2010-05-12 16:32:31 +01:00
Jonathan Perkin
9d33e95474 Remove comments. 2010-05-12 16:25:53 +01: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
Jonathan Perkin
cb327fd8c2 Large number of changes to support building RPMs using CMake, along
with other merges from the old distribution-specific spec file.

 - update copyright notices

 - remove __os_install_post override, it was only necessary as a
   hack to build debuginfo packages - now that we no longer make
   them we can revert to the distribution macro which likely has
   other useful bits we might want

 - remove _unpackaged_files_terminate_build override, we want to
   know of any orphaned files

 - include native distribution support

 - no longer build separate debuginfo RPMs, instead just include
   debug/symbols in all binaries, which is more useful for support

 - include support for building commercial RPMs, requires a
   commercial source tree

 - remove cluster RPM support, we don't build them from this
   source tree

 - use CMake for building, and update package lists to match the
   new install layout/files.  Remove any options which were only
   useful for automake builds (e.g. yassl/zlib).

 - other minor cleanups
2010-05-12 12:46:23 +01:00
Mats Kindahl
7f514f45e6 Bug #52737: plugin_dir is set to /usr/local/mysql/lib/plugin while starting
via mysqld_safe

Plugin dir was set to a hard-coded path instead of relative the base dir.

This patch fixes this by using a path relative the basedir instead of the
plugin directory indicated by the configuration.
2010-05-11 15:55:52 +02:00
Alexander Nozdrin
3511c2e45a Make innodb.innodb_information_schema experimental due to Bug 48883. 2010-05-11 16:00:24 +04:00
Alexander Nozdrin
a2d5ef0557 Null-merge from mysql-trunk. 2010-05-07 13:22:38 +04:00
Alexander Nozdrin
19fac19a93 Auto-merge from mysql-trunk-bugfixing. 2010-05-07 13:16:55 +04:00
Konstantin Osipov
cca59e83d7 Clean-up, give better names, add comments to
thd->in_multi_stmt_transaction() and thd->active_transaction().
2010-05-06 02:02:08 +04:00
Magne Mahre
24a14875bc Bug#49193 CREATE TABLE reacts differently depending on whether
data is selected or not

Temporary and permanent tables should live in different 
namespaces.  In this case, resolving a permanent table
name gave the temporary table, resulting in a name
collision.
2010-05-05 23:28:58 +02:00
Alexander Nozdrin
d91c271b2b Patch for Bug#50511 (Sometimes wrong handling of user variables containing NULL).
The bug happened under the following condition:
  - there was a user variable of type REAL, containing NULL value
  - there was a table with a NOT_NULL column of any type but REAL, having
    default value (or auto increment);
  - a row was inserted into the table with the user variable as value.
    A warning was emitted here.

The problem was that handling of NULL values of REAL type was not properly
implemented: it didn't expect that REAL NULL value can be assigned to other
data type.

Basically, the problem was that set_field_to_null() was used instead of
set_field_to_null_with_conversions().

The fix is to use the right function, or more generally, to allow conversion of
REAL NULL values to other data types.
2010-05-05 15:00:59 +04:00
Alexander Barkov
25d31b8f7c Bug#51571 load xml infile causes server crash
Problem:
  item->name was NULL for Item_user_var_as_out_param
  which made strcmp(something, item->name) crash in the LOAD XML code.
  
  Fix:
  - item_func.h: Adding set_name() in constuctor for Item_user_var_as_out_param
  - sql_load.cc: Changing the condition in write_execute_load_query_log_event() which
  distiguished between Item_user_var_as_out_param and Item_field
  from
    if (item->name == NULL)
  to
    if (item->type() == Item::FIELD_ITEM)
  - loadxml.result, loadxml.test: adding tests
2010-05-05 14:34:20 +04:00
Magne Mahre
1cf9861f86 Bug#48800 CREATE TABLE t...SELECT fails if t is a temporary
table

If a temporary table A exists, and a (permanent) table 
with the same name is attempted created with 
"CREATE TABLE ... AS SELECT", the create would fail with 
an error.
   1050: Table 'A' already exists

The error occured in MySQL 5.1 releases, but is not
present in MySQL 5.5.   This patch adds a regression
test to ensure that the problem does not reoccur.
2010-05-05 12:17:07 +02:00
Alexander Barkov
6bf10a8623 Bug#52849 [Com]: datetime index not work
Problem: after introduction of "WL#2649 Number-to-string conversions"

This query:
  SET NAMES cp850; -- Or any other non-latin1 ASCII-based character set
  SELECT * FROM t1
  WHERE datetime_column='2010-01-01 00:00:00'
started to add extra character set conversion: 
  SELECT * FROM t1
  WHERE CONVERT(datetime_column USING cp850)='2010-01-01 00:00:00';

so index on DATETIME column was not used anymore.
Fix:
  avoid convertion of NUMERIC/DATETIME items
  (i.e. those with derivation DERIVATION_NUMERIC).
2010-05-05 13:28:37 +04:00
Horst.Hunger
8975d4766f Patch for 47759 to trunk-bugfixing. 2010-05-05 09:35:38 +02:00
Jon Olav Hauglid
27da41cc2e merge from mysql-trunk-bugfixing 2010-05-05 09:25:04 +02:00
Omer BarNir
3cf56bb21b Changes to result files in the engine suite - missed from previous commit 2010-05-04 13:39:17 -07:00
Omer BarNir
1c731cb0c6 Updates to test and result files in the 'engine' suites following changes in 5.5 2010-05-04 11:10:17 -07:00
Alexander Nozdrin
a0e2f8866c Include mysql/innodb_priv.h into 'make dist'. 2010-05-04 19:44:29 +04:00
Jon Olav Hauglid
efe69e7c42 Followup to Bug#42546 Backup: RESTORE fails, thinking it finds an existing table
Fixes a bug where bool* was used as an argument to a function where the parameter
was of type bool.
2010-05-04 16:33:42 +02:00
Alexander Nozdrin
a7cc09e01a Mark 3 test cases experimental on FreeBSD due to Bug 43020, Bug 38965. 2010-05-04 16:17:46 +04:00
Alexander Nozdrin
c784ee2782 Patch for Bug#52356: query_cache_debug fails on Linux.
There were two problems here:
  1. misleading error message
  2. abusing KILL QUERY in the test case

1. The server reported "'DELETE FROM t1' failed: 1689: Wait on a lock was
aborted due to a pending exclusive lock", while the proper error message
should be "'DELETE FROM t1' failed: 1317: Query execution was interrupted".

The problem is that the server has two different flags for
signalling that a query is being killed: THD::killed and
mysys_var::abort. The test case triggers a race: sometimes
mysys_var::abort is set earlier than THD::killed. That leads
to the following situation:

  - thr_lock() checks mysys_var::abort and returns error status,
    since mysys_var::abort is set;

  - the caller (mysql_lock_tables()) gets an error from thr_lock(),
    but THD::killed is not set, so it decides that thr_lock() couldn't
    get a lock due to a pending exclusive lock.

This is a known issue with the server and it's not going to be fixed soon.

5.5 differs from 5.1 here as follows: when thr_lock() returns an error:
  - 5.1 continues trying thr_lock() until success;
  - 5.5 propagates the error

2. The test case uses KILL QUERY is a highly concurent environment.

The fix is to wait for the dying statement to rest in peace before
executing another DELETE FROM t1.
2010-04-30 16:12:41 +04:00
Alfranio Correia
ae2eafc098 Post-merge fix for BUG#51894, BUG#53075
thread_temporary_used is not initialized causing
valgrind's warnings.
2010-04-29 11:43:54 +01:00
Konstantin Osipov
f41933c436 Bug#46947 "Embedded SELECT without FOR UPDATE is causing a lock"
Update the result file to minor tweaks of the comments in the
test case.
2010-04-28 17:43:25 +04:00
Sven Sandberg
a651824329 BUG#50670: Slave stops with error code 1644
Clarified error messages related to unsafe statements:
 - avoid the internal technical term "row injection"
 - use 'binary log' instead of 'binlog'
 - avoid the word 'unsafeness'
2010-04-28 14:47:49 +02:00
Konstantin Osipov
8280fdd3c3 Committing on behalf or Dmitry Lenev:
Fix for bug #46947 "Embedded SELECT without FOR UPDATE is
causing a lock", with after-review fixes.

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 tries to solve this problem by rethinking our
approach to how we handle locking for SELECT and subqueries.
Now we always set TL_READ_DEFAULT lock type for all cases
when we read data. When at open_tables() time this lock
is interpreted as TL_READ_NO_INSERT or TL_READ depending
on whether this statement as a whole or call to function
which uses particular table should be written to the
binary log or not (if yes then statement should be properly
serialized with concurrent statements and stronger lock
should be acquired).

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 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.
On of the patches for 5.0 broke this behaviour (which was not documented
or tested), and started to use locking reads fora all subqueries in SELECT ... 
FOR UPDATE/IN SHARE MODE. This patch restored 4.1 behaviour.
2010-04-28 14:04:11 +04:00
fa28ba8ba6 Bug #51839 mixup of DDL causes slave to stop
Stored routine DDL statements use statement-based replication
regardless of the current binlog format. The problem here was
that if a DDL statement failed during metadata lock acquisition
or opening of mysql.proc, the binlog format would not be reset
before returning. So the following DDL or DML statements are 
binlogged with a wrong binlog format, which causes the slave 
to stop.

The problem can be resolved by grabbing an exclusive MDL lock firstly
instead of clearing the current binlog format. So that the binlog
format will not be affected when the lock grab returns directly with
an error. The same way is taken to open a proc table for update.
2010-04-28 11:26:47 +08:00
Luis Soares
a1b3955f32 BUG#53101: binlog.binlog_tmp_table fails on sol10 sparc64 max in
parallel mode
      
The failure has nothing to do with parallel, but rather on the
order the tests are executed. In this case, the test
binlog_tmp_table (lets call it test2) was not ensuring that the
binary logs would be reset when it started. Later the test issues
a mysqlbinlog .../master-bin.000002 | mysql ... If the test that
was executed before this one (lets call it test1) had issued a
flush logs, then the file in use in test1 (master-bin.000002)
would not actually match the one that was expected. Eventually,
this would cause the statements logged in test1 to be replayed,
instead of the ones logged in the beginning of test2.
    
We fix this by:
  1. adding RESET MASTER to the beginning of binlog_tmp_table
  2. setting dynamically the file to use in binlog_tmp_table
     
Only #1 was needed, but the two make the tests cases more robust.
2010-04-27 12:25:55 +01:00
Alexander Nozdrin
30fcc5f698 Auto-merge from remote repository. 2010-04-27 13:49:59 +04:00
Alexander Nozdrin
1ffdb5d691 Empty merge from mysql-trunk. 2010-04-27 13:45:41 +04:00
Alexander Nozdrin
0c8c4a7133 Auto-merge from mysql-trunk-bugfixing. 2010-04-27 13:38:04 +04:00
Vladislav Vaintroub
147d1c854e Bug#48042 The description for Event ID ( 100 ) in Source ( MySQL ) cannot be found.
The problem is that message resource  (message.rc) is compiled as part of static library
sql.lib rather than with executable mysqld.exe. resource files do not work in static
libraries.
      
The fix is to add message.rc to mysqld.exe source files list.
2010-04-27 11:37:46 +02:00
Horst.Hunger
4f4ed5d9e1 only This is a backport of the patch for 47739 into trunk. 2010-04-26 21:39:24 +02:00
Horst.Hunger
63e7004bcc backport of patch for blckhole plugin (47748) to trunk-bugfixing. 2010-04-26 20:44:10 +02:00
Horst.Hunger
fca2aa6a4d backport of cset for 47146 to trunk. 2010-04-26 18:23:20 +02:00
Alexander Nozdrin
b6131a36a2 Making few tests experimental as they fail on Open Solaris constantly. 2010-04-26 18:51:56 +04:00