Commit graph

40444 commits

Author SHA1 Message Date
Ramil Kalimullin
36e019c933 Auto-merge. 2009-12-10 09:51:08 +04:00
He Zhenxing
9168949047 Post fix for bug#45520
mysql-test/include/kill_query.inc:
  Error 1034 can be generated when change MyISAM table indexes was interrupted
mysql-test/r/rpl_killed_ddl.result:
  table t4 may not exists because the ALTER above was interrupted
mysql-test/t/rpl_killed_ddl.test:
  table t4 may not exists because the ALTER above was interrupted
2009-12-10 11:44:19 +08:00
He Zhenxing
b3d9f78478 removed rpl_killed_ddl from disabled list 2009-12-09 14:27:46 +08:00
He Zhenxing
bc2b3d2ccc BUG#45520 rpl_killed_ddl fails sporadically in pb2
There are three issues that caused rpl_killed_ddl fails sporadically
in pb2:

 1) thd->clear_error() was not called before create Query event
if operation is executed successfully.
 2) DATABASE d2 might do exist because the statement to CREATE or
ALTER it was killed
 3) because of bug 43353, kill the query that do DROP FUNCTION or
    DROP PROCEDURE can result in SP not found

This patch fixed all above issues by:
 1) Called thd->clear_error() if the operation succeeded.
 2) Add IF EXISTS to the DROP DATABASE d2 statement
 3) Temporarily disabled testing DROP FUNCTION/PROCEDURE IF EXISTS.

mysql-test/t/rpl_killed_ddl.test:
  DATABASE d2 might not exists, add IF EXITS to the DROP statement
sql/sql_db.cc:
  Called thd->clear_error() if the operation succeeded
2009-12-09 14:13:56 +08:00
Staale Smedseng
63ff2b4c2e Bug #47391 no stack trace printed to error log on
solaris after a crash
      
This patch adds a Solaris-specific version of
print_stacktrace() which uses printstack(2), available on all
Solaris versions since Solaris 9. (While Solaris 11 adds
support for the glibc functions backtrace_*() as of
PSARC/2007/162, printstack() is used for consistency over all
Solaris versions.)

The symbol names are mangled, so use of c++filt may be
required as described in the MySQL documentation.


sql/stacktrace.c:
  Added Solaris-specific print_stacktrace().
2009-12-06 18:11:37 +01:00
Ramil Kalimullin
f5b51bc1e2 Fix for bug#49199: Optimizer handles incorrectly:
field='const1' AND field='const2' in some cases

Building multiple equality predicates containing
a constant which is compared as a datetime (with a field)
we should take this fact into account and compare the 
constant with another possible constatns as datetimes 
as well.

E.g. for the
SELECT ... WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'
we should compare '2001-01-01' with '2001-01-01 00:00:00' as
datetimes but not as strings.


mysql-test/r/select.result:
  Fix for bug#49199: Optimizer handles incorrectly: 
  field='const1' AND field='const2' in some cases
    - test result.
mysql-test/t/select.test:
  Fix for bug#49199: Optimizer handles incorrectly: 
  field='const1' AND field='const2' in some cases
    - test case.
sql/item_cmpfunc.cc:
  Fix for bug#49199: Optimizer handles incorrectly: 
  field='const1' AND field='const2' in some cases
    - adding a constant to Item_equal compare it as
  a datetime value with stored one if there's a 
  date[time] field in a equality predicate.
sql/item_cmpfunc.h:
  Fix for bug#49199: Optimizer handles incorrectly: 
  field='const1' AND field='const2' in some cases
    - adding a constant to Item_equal compare it as
  a datetime value with stored one if there's a 
  date[time] field in a equality predicate.
sql/sql_select.cc:
  Fix for bug#49199: Optimizer handles incorrectly: 
  field='const1' AND field='const2' in some cases
    - adding a constant to Item_equal compare it as
  a datetime value with stored one if there's a 
  date[time] field in a equality predicate.
2009-12-04 21:58:40 +04:00
Evgeny Potemkin
026541c662 Auto-merged. 2009-12-03 16:21:53 +03:00
Evgeny Potemkin
8fa282cc68 Bug#48508: Crash on prepared statement re-execution.
Test case cleanup.

mysql-test/r/ps.result:
  Test case cleanup for bug#48508.
mysql-test/t/ps.test:
  Test case cleanup for bug#48508.
2009-12-03 16:15:20 +03:00
Evgeny Potemkin
d969cbc578 Auto-merged fix for the bug#48508. 2009-12-02 16:47:12 +03:00
Georgi Kodinov
61b5d08f20 tree name change to -main 2009-12-02 09:58:30 +02:00
Evgeny Potemkin
7853f553be Bug#48508: Crash on prepared statement re-execution.
Actually there is two different bugs.
The first one caused crash on queries with WHERE condition over views
containing WHERE condition. A wrong check for prepared statement phase led
to items for view fields being allocated in the execution memory and freed
at the end of execution. Thus the optimized WHERE condition refers to
unallocated memory on the second execution and server crashed.
The second one caused by the Item_cond::compile function not saving changes
it made to the item tree. Thus on the next execution changes weren't
reverted and server crashed on dereferencing of unallocated space.

The new helper function called is_stmt_prepare_or_first_stmt_execute
is added to the Query_arena class.
The find_field_in_view function now uses
is_stmt_prepare_or_first_stmt_execute() to check whether
newly created view items should be freed at the end of the query execution.
The Item_cond::compile function now saves changes it makes to item tree.

mysql-test/r/ps.result:
  Added a test case for the bug#48508.
mysql-test/t/ps.test:
  Added a test case for the bug#48508.
sql/item_cmpfunc.cc:
  Bug#48508: Crash on prepared statement re-execution.
  The Item_cond::compile function now saves changes it makes to item tree.
sql/sql_base.cc:
  Bug#48508: Crash on prepared statement re-execution.
  The find_field_in_view function now uses
  is_stmt_prepare_or_first_stmt_execute() to check whether
  newly created view items should be freed at the end of the query execution.
sql/sql_class.h:
  Bug#48508: Crash on prepared statement re-execution.
  The Query_arena::is_stmt_prepare_or_first_sp_execute function now correctly
  do its check.
2009-12-01 21:28:45 +03:00
Gleb Shchepa
ee136e3fa5 Bug #38883 (reopened): thd_security_context is not thread safe, crashes?
The bug 38816 changed the lock that protects THD::query from
LOCK_thread_count to LOCK_thd_data, but didn't update the associated
InnoDB functions.

1. The innobase_mysql_prepare_print_arbitrary_thd and the
innobase_mysql_end_print_arbitrary_thd InnoDB functions have been
removed, since now we have a per-thread mutex: now we don't need to wrap
several inter-thread access tries to THD::query with a single global
LOCK_thread_count lock, so we can simplify the code.

2. The innobase_mysql_print_thd function has been modified to lock
LOCK_thd_data in direct way.
2009-12-01 14:24:44 +04:00
Georgi Kodinov
b7ed14638f Addendum to bug #48872: disable output in the test case because errors are
dependent on the case mode
2009-11-27 18:07:31 +02:00
Georgi Kodinov
d877f0a045 added the missing remove of the temp file 2009-11-27 16:36:22 +02:00
Georgi Kodinov
514d33c866 Addendum to Bug #27884: fixed test incompatibility on windows. 2009-11-27 15:46:54 +02:00
Georgi Kodinov
2ac344ecf6 Bug #48872 : Privileges for stored functions ignored if function name
is mixed case

Transcode the procedure name to lowercase when searching for it in the 
hash. This is the missing part of the fix for bug #41049.
2009-11-27 11:59:44 +02:00
Satya B
97d74332c2 Applying InnoDB snapshot 5.0-ss6230, part 2. Fixes BUG#46000
BUG#46000 - using index called GEN_CLUST_INDEX crashes server

Detailed revision comments:

r6180 | jyang | 2009-11-17 10:54:57 +0200 (Tue, 17 Nov 2009) | 7 lines
branches/5.0: Merge/Port fix for bug #46000 from branches/5.1
-r5895 to branches/5.0. Disallow creating index with the
name of "GEN_CLUST_INDEX" which is reserved for the default
system primary index. Minor adjusts on table name screening
format for added tests.
2009-11-25 15:29:25 +05:30
Satya B
2bf2e8f9dd Applying InnoDB snapshot 5.0-ss6230, Part 1. Fixes BUG#47777
BUG#47777 - innodb dies with spatial pk: Failing assertion: buf <= original_buf + buf_len

Detailed revision comments:

r6178 | jyang | 2009-11-17 08:52:11 +0200 (Tue, 17 Nov 2009) | 6 lines
branches/5.0: Merge fix for bug #47777 from branches/5.1 -r6045
to bracnches/5.0. Treat the Geometry data same as Binary BLOB
in ha_innobase::store_key_val_for_row(), since the Geometry
data is stored as Binary BLOB in Innodb.
2009-11-25 15:08:52 +05:30
Jim Winstead
84c5abbd33 Backport fix for Bug #27884. 2009-11-23 14:38:08 -08:00
Alexey Kopytov
6780169613 Automerge. 2009-11-23 13:05:35 +03:00
Georgi Kodinov
02938963f5 merge 2009-11-20 15:38:21 +02:00
Georgi Kodinov
ed9e3409e4 Bug#48864: MySQL fails to compile on 64 bit Fedora 12
Fixed 2 errors in comp_err executable : 
1. Wrong (off by 1) length passed to my_checksum()
2. strmov() was used on overlapping strings. This is
 not legal according to the docs in stpcpy(). Used 
the overlap safe memmove() instead.
2009-11-18 17:24:10 +02:00
Kent Boortz
f881a7baa1 Include the "mysql-test/collections" directory when creating windows ZIP archive 2009-11-17 17:49:24 +01:00
Alexey Kopytov
8cfa50e677 Bug #48472: Loose index scan inappropriately chosen for some
WHERE conditions 
 
check_group_min_max() checks if the loose index scan 
optimization is applicable for a given WHERE condition, that is 
if the MIN/MAX attribute participates only in range predicates 
comparing the corresponding field with constants. 
 
The problem was that it considered the whole predicate suitable 
for the loose index scan optimization as soon as it encountered 
a constant as a predicate argument. This is obviously wrong for 
cases when a constant is the first argument of a predicate 
which does not satisfy the above condition. 
 
Fixed check_group_min_max() so that all arguments of the input 
predicate are considered to decide if it passes the test, even 
though a constant has already been encountered.

mysql-test/r/group_min_max.result:
  Added a test case for bug #48472.
mysql-test/t/group_min_max.test:
  Added a test case for bug #48472.
sql/opt_range.cc:
  Fixed check_group_min_max() so that all arguments of the input 
  predicate are considered to decide if it passes the test, even 
  though a constant has already been encountered.
2009-11-17 17:07:14 +03:00
Luis Soares
9c23a442b2 BUG#48738: Backport patch for Bug 34582 to 5.0 codebase.
From BUG 34582 commit message:

Issuing 'FLUSH LOGS' does not close and reopen indexfile.
Instead a SEEK_SET is performed.
            
This patch makes index file to be closed and reopened whenever a
rotation happens (FLUSH LOGS is issued or binary log exceeds 
maximum configured size).
2009-11-13 10:30:56 +00:00
Alexey Kopytov
b31c544eec Automerge. 2009-11-12 20:13:08 +03:00
Alexey Kopytov
fb2e17903f Fixed a gcc warning introduced by the patch for bug #48475. 2009-11-12 20:11:33 +03:00
Andrei Elkin
f1abd015dc Bug #47210 first execution of "start slave until" stops too early
Until-pos guarding did not distiguish the master originated events from ones that the slave 
can introduce to the relay log e.g Rotate to the next relay log at slave restarting.
The local Rotate's coordinate are incomparable with the Until-master-pos.
That led to the unexpectable stop this bug describes.

Fixed with to avoid Until-master-pos comparison for a local slave's event.
Notice that if --replicate-same-server is true such event is treated as coming from
the master side.


mysql-test/r/rpl_until.result:
  results changed.
mysql-test/t/rpl_until.test:
  regression test for bug#47210 is added.
sql/slave.cc:
  st_relay_log_info::is_until_satisfied() is augmented with avoidance of 
  Until-master-pos comparison for a local slave's event.
  if --replicate-same-server is true such event is treated as coming from
  the master side.
sql/slave.h:
  signature of is_until_satisfied() changed to supply THD and Event to the routine.
2009-11-12 17:10:19 +02:00
unknown
c7b07ff0cb Raise version number after cloning 5.0.88 2009-11-09 19:22:35 +01:00
Georgi Kodinov
4519d5e4f1 Bug #48458: simple query tries to allocate enormous amount of
memory

The server was doing a bad class typecast causing setting of 
wrong value for the maximum number of items in an internal
structure used in equality propagation.
Fixed by not doing the wrong typecast and asserting the type
of the Item where it should be done.
2009-11-09 16:09:46 +02:00
Georgi Kodinov
ddd90017e7 Bug #42760: Select doesn't return desired results when we have null
values
 
 We should re-set the access method functions when changing the access
 method when switching to another index to avoid sorting.
 
 Fixed by doing a little re-engineering : encapsulating all the function
 assignment into a special function and calling it when flipping the 
 indexes.
2009-11-10 10:21:41 +02:00
Alexey Kopytov
58ee6c80eb Automerge. 2009-11-06 17:56:51 +03:00
Alexey Kopytov
39f9a3ffd0 Bug #48475: DISTINCT is ignored with GROUP BY WITH ROLLUP and
only const tables

The problem was caused by two shortcuts in the optimizer that
are inapplicable in the ROLLUP case.

Normally in a case when only const tables are involved in a
query, DISTINCT clause can be safely optimized away since there
may be only one row produced by the join. Similarly, we don't
need to create a temporary table to resolve DISTINCT/GROUP
BY/ORDER BY. Both of these are inapplicable when the WITH
ROLLUP modifier is present.

Fixed by disabling the said optimizations for the WITH ROLLUP
case.

mysql-test/r/olap.result:
  Added a test case for bug #48475.
mysql-test/t/olap.test:
  Added a test case for bug #48475.
sql/sql_select.cc:
  Disabled const-only table optimizations for the WITH ROLLUP
  case.
2009-11-06 09:44:01 +03:00
Timothy Smith
43358bccd1 auto-merge 2009-11-04 16:06:49 -07:00
Timothy Smith
b93268ba80 Fix for Bug#40700: aclocal warnings for missing cache-id's
Just change mysql_foo to mysql_cv_foo for one cache-id variable name.  There
was only one bad variable name, present in 5.0 and 5.1, but not in the -pe
branch.
2009-11-04 15:34:42 -07:00
Timothy Smith
ebaf8997ad auto-merge 2009-11-04 14:08:31 -07:00
Georgi Kodinov
252cb16f20 version change 2009-11-04 11:13:55 +02:00
Georgi Kodinov
d66b794ec5 Disabled the rpl_killed_ddl test in 5.0 because of bug #45520 2009-11-04 11:13:22 +02:00
Timothy Smith
345054c916 Add a few comments to clarify do_query() return values in mysql_secure_installation.pl 2009-11-03 14:34:01 -07:00
Timothy Smith
e29b7ef5b8 Bug#48031: mysql_secure_installation -- bash bug regarding passwords with
special chars

This script failed when the user tried passwords with multiple spaces, \, # or
' characters.  Now proper escaping and quoting is used in all contexts.

This problem occurs in the Perl version of this script, too, so fix it in both
places.
2009-11-03 13:50:28 -07:00
Timothy Smith
d31e4636b6 Bug#48086: mysql_secure_installation does NOT work on Solaris
Remove a bash-ism (if ! ...).
2009-11-03 13:32:12 -07:00
Davi Arnaut
69859d8d83 Fix compiler warnings -- tag unused parameters. 2009-11-03 16:17:06 -02:00
Konstantin Osipov
06c9d62a9f A fix and a test case for
Bug#41756 "Strange error messages about locks from InnoDB".

In JT_EQ_REF (join_read_key()) access method,
don't try to unlock rows in the handler, unless certain that
a) they were locked
b) they are not used.

Unlocking of rows is done by the logic of the nested join loop,
and is unaware of the possible caching that the access method may
have. This could lead to double unlocking, when a row
was unlocked first after reading into the cache, and then
when taken from cache, as well as to unlocking of rows which
were actually used (but taken from cache).

Delegate part of the unlocking logic to the access method,
and in JT_EQ_REF count how many times a record was actually
used in the join. Unlock it only if it's usage count is 0.

Implemented review comments.


mysql-test/r/bug41756.result:
  Add result file (Bug#41756)
mysql-test/t/bug41756-master.opt:
  Use --innodb-locks-unsafe-for-binlog, as in 5.0 just
  using read_committed isolation is not sufficient to 
  reproduce the bug.
mysql-test/t/bug41756.test:
  Add a test file (Bug#41756)
sql/item_subselect.cc:
  Complete struct READ_RECORD initialization with a new
  member to unlock records.
sql/records.cc:
  Extend READ_RECORD API with a method to unlock read records.
sql/sql_select.cc:
  In JT_EQ_REF (join_read_key()) access method,
  don't try to unlock rows in the handler, unless certain that
  a) they were locked
  b) they are not used.
sql/sql_select.h:
  Add members to TABLE_REF to count TABLE_REF buffer usage count.
sql/structs.h:
  Update declarations.
2009-11-03 19:58:54 +03:00
unknown
9819885177 BUG#48216 Replication fails on all slaves after upgrade to 5.0.86 on master
When a sessione is closed, all temporary tables of the session are automatically 
dropped and are binlogged. But it will be binlogged with wrong database names when
the length of the temporary tables' database names are greater than the 
length of the current database name or the current database is not set.

Query_log_event's db_len is forgot to set when Query_log_event's db is set.
This patch wrote code to set db_len immediately after db has set.
2009-11-03 17:00:41 +08:00
Davi Arnaut
e077bb49d7 Bug#44952: Ndbd file system inconsistency error
Backport a ndb patch: fix bug with crash during restart, where
a mbyte incorrectly could be skipped, leading to "end of log
wo/ finding gci".
2009-11-02 18:10:21 -02:00
Timothy Smith
141e796163 Bug#35106: mysql_secure_installation fails on Windows, missing "use
Term::ReadKey"

Add the missing module import.  Also, while here, fix a few glaring problems
with the script, and ensure that it behaves properly.  It seems this script
may have never been working correctly (e.g., reading password didn't chomp()
the result, so password was set with \n at the end; comparing the re-typed
password to original was done with inverted test).

Add END { cleanup(); } block to ensure the script removes temporary working
files.

Add SIG{INT} / SIG{QUIT} handler.

Do a bit of reorganization to make the code easier to understand.

Limit failed connection attempts to 3.

Use ./bin/mysql if it exists, and then fall back on mysql in PATH (before it
assumed 'mysql' in the path).  Print a nicer error if 'mysql' can't be called.

This has been tested on Windows (ActivePerl from cmd.exe, no cygwin needed)
and Linux.
2009-10-30 14:28:33 -06:00
Alexey Kopytov
7f9656369f Automerge. 2009-10-30 19:16:25 +03:00
Alexey Kopytov
b67cdaa351 Bug #48131: crash group by with rollup, distinct, filesort,
with temporary tables

There were two problems the test case from this bug was
triggering:

1. JOIN::rollup_init() was supposed to wrap all constant Items
into another object for queries with the WITH ROLLUP modifier
to ensure they are never considered as constants and therefore
are written into temporary tables if the optimizer chooses to
employ them for DISTINCT/GROUP BY handling.

However, JOIN::rollup_init() was called before
make_join_statistics(), so Items corresponding to fields in
const tables could not be handled as intended, which was
causing all kinds of problems later in the query execution. In
particular, create_tmp_table() assumed all constant items
except "hidden" ones to be removed earlier by remove_const()
which led to improperly initialized Field objects for the
temporary table being created. This is what was causing crashes
and valgrind errors in storage engines.

2. Even when the above problem had been fixed, the query from
the test case produced incorrect results due to some
DISTINCT/GROUP BY optimizations being performed by the
optimizer that are inapplicable in the WITH ROLLUP case.

Fixed by disabling inapplicable DISTINCT/GROUP BY optimizations
when the WITH ROLLUP modifier is present, and splitting the
const-wrapping part of JOIN::rollup_init() into a separate
method which is now invoked after make_join_statistics() when
the const tables are already known.

mysql-test/r/olap.result:
  Added a test case for bug #48131.
mysql-test/t/olap.test:
  Added a test case for bug #48131.
sql/sql_select.cc:
  1. Disabled inapplicable DISTINCT/GROUP BY optimizations when
  the WITH ROLLUP modifier is present.
  2. Split the const-wrapping part of JOIN::rollup_init() into a
  separate method.
sql/sql_select.h:
  Added rollup_process_const_fields() declaration.
2009-10-30 18:54:53 +03:00
Georgi Kodinov
ecef6c3308 merge from 5.0-main 2009-10-30 16:34:54 +02:00
Georgi Kodinov
9d96cd6dcb Bug #48291 : crash with row() operator,select into @var, and
subquery returning multiple rows

Error handling was missing when handling subqueires in WHERE 
and when assigning a SELECT result to a @variable.
This caused crash(es). 

Fixed by adding error handling code to both the WHERE 
condition evaluation and to assignment to an @variable.
2009-10-30 15:15:43 +02:00