Commit graph

25537 commits

Author SHA1 Message Date
Luis Soares
7e889a8dc9 BUG 53621: automerged bzr bundle from bug report. 2010-05-20 00:52:03 +01:00
Luis Soares
779241bc94 BUG 52868: automerged bzr bundle from bug report. 2010-05-20 00:50:42 +01:00
Luis Soares
3b8cae37cc BUG 49522: automerged bzr bundle from bug report. 2010-05-20 00:49:18 +01:00
Tor Didriksen
5539f5ccf6 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.



mysql-test/r/events_scheduling.result:
  Add test case.
mysql-test/t/events_scheduling.test:
  Add test case.
sql/event_data_objects.cc:
  Convert month to signed before doing the subtraction.
2010-05-19 11:18:59 +02:00
Andrei Elkin
59b4dfccb5 pushing bug#50942 fixes to 5.1-bt 2010-05-16 20:03:32 +03:00
Alfranio Correia
cf7bac11ec 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
Gleb Shchepa
9cbb009b2e 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.


mysql-test/r/delete.result:
  Test case for bug #53450.
mysql-test/t/delete.test:
  Test case for bug #53450.
sql/sql_delete.cc:
  Bug #53450: Crash / assertion "virtual int
              ha_myisam::index_first(uchar*)") at assert.c:81
  
  The mysql_delete function has been modified to not to use
  init_read_record_idx instead of init_read_record for the
  quick select.
2010-05-14 15:36:27 +04:00
Luis Soares
fc11ce658f 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
feb03a82f2 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.


mysql-test/r/group_by.result:
          Fix for bug#52051: Aggregate functions incorrectly returns
          NULL from outer join query
            - test result.
mysql-test/t/group_by.test:
          Fix for bug#52051: Aggregate functions incorrectly returns
          NULL from outer join query
            - test case.
sql/opt_sum.cc:
          Fix for bug#52051: Aggregate functions incorrectly returns
          NULL from outer join query
            - optimising MIN/MAX() queries without GROUP BY clause by
          replacing them with a constant, take into account that
          there're may be outer joins involved.
            - repeated code for MIN/MAX optimization in the opt_sum_query()
          eliminated by introducing new functions that read MIN/MAX values
          using index and combining MIN/MAX cases to one.
2010-05-12 20:10:33 +04:00
Staale Smedseng
330864fcda 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.



sql/sql_class.h:
  Added more docs for THD::examined_row_count.
sql/sql_delete.cc:
  Add incrementing thd->examined_row_count.
sql/sql_update.cc:
  Add incrementing thd->examined_row_count.
2010-05-12 13:19:12 +02:00
Sven Sandberg
29c8c152b2 BUG#50410: rpl_ndb tests should run with binlog_format=row
Problem: The rpl_ndb did not set binlog_format explicitly. Since
the default is binlog_format=statement, it means that the suite
ran with that. ndb does not support binlog_format=statement,
and many tests were skipped because they sourced
include/have_binlog_format_row_or_mixed.inc
Fix: set binlog_format=row explicitly in the configuration file
for the rpl_ndb suite.


Makefile.am:
  Removed duplicate run of rpl_ndb suite with binlog_format=row.
  Now that rpl_ndb is run with binlog_format=row by default, this
  run that explicitly changes to binlog_format=row is not needed,
  because it is covered by the following run.
mysql-test/suite/rpl_ndb/my.cnf:
  cluster only supports binlog_format=row.
mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result:
  updated result file
mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test:
  This test is supposed to use binlog_format=STATEMENT on
  master. It uses innodb on master, so statement format is
  supported.
2010-05-12 12:29:02 +02:00
Mattias Jonsson
6fa04cad8f merge 2010-05-10 15:17:06 +02:00
Martin Hansson
6d0425b18d Bug#50939: Loose Index Scan unduly relies on engine to
remember range endpoints

The Loose Index Scan optimization keeps track of a sequence
of intervals. For the current interval it maintains the
current interval's endpoints. But the maximum endpoint was
not stored in the SQL layer; rather, it relied on the
storage engine to retain this value in-between reads. By
coincidence this holds for MyISAM and InnoDB. Not for the
partitioning engine, however.

Fixed by making the key values iterator 
(QUICK_RANGE_SELECT) keep track of the current maximum endpoint.
This is also more efficient as we save a call through the
handler API in case of open-ended intervals.

The code to calculate endpoints was extracted into 
separate methods in QUICK_RANGE_SELECT, and it was possible to
get rid of some code duplication as part of fix.
2010-05-10 09:23:23 +02:00
Alfranio Correia
209cccf55d BUG#49019 Mixing self-logging eng. and regular eng. does not switch to row in mixed mode
Backport of the patch for 5.1-bugteam.
2010-05-09 23:45:25 +01:00
Luis Soares
2646306cc9 BUG#49522: Replication problem with mixed MyISAM/InnoDB
When using a non-transactional table (t1) on the master 
and with autocommit disabled, no COMMIT is recorded 
in the binary log ending the statement. Therefore, if 
the slave has t1 in a transactional engine, then it will 
be as if a transaction is started but never ends. This is
actually BUG#29288 all over again.

We fix this by cherrypicking the cset for BUG#29288 which
was pushed to a later mysql version. The revision picked
was: mats@sun.com-20090923094343-bnheplq8n95opjay .

Additionally, a test case for covering the scenario depicted
in the bug report is included in this cset.
2010-05-07 18:48:35 +01:00
Martin Hansson
721ec08190 Merge of fix for Bug#52357 2010-05-07 09:12:16 +02:00
Sergey Glukhov
278ae9a8d5 Bug#53334 Incorrect result for InnoDB in LEFT JOIN with impossible condition
The fix actually reverts the change introduced
by the patch for bug 51494.
The fact is that patches for bugs 52177&48419
fix bugs 51194&50575 as well.



mysql-test/r/innodb_mysql.result:
  test case
mysql-test/t/innodb_mysql.test:
  test case
sql/sql_select.cc:
  reverted wrong fix for bug 51494
2010-05-07 10:38:42 +05:00
Gleb Shchepa
bd2a517b23 Bug #53088: mysqldump with -T & --default-character-set set
truncates text/blob to 766 chars

mysqldump and SELECT ... INTO OUTFILE truncated long BLOB/TEXT
values to size of 766 bytes (MAX_FIELD_WIDTH or 255 * 3 + 1).

The select_export::send_data method has been modified to
reallocate a conversion buffer for long field data.


mysql-test/r/mysqldump.result:
  Test case for bug #53088.
mysql-test/r/outfile_loaddata.result:
  Test case for bug #53088.
mysql-test/t/mysqldump.test:
  Test case for bug #53088.
mysql-test/t/outfile_loaddata.test:
  Test case for bug #53088.
sql/sql_class.cc:
  Bug #53088: mysqldump with -T & --default-character-set set
              truncates text/blob to 766 chars
  
  The select_export::send_data method has been modified to
  reallocate a conversion buffer for long field data.
2010-05-07 00:41:37 +04:00
Martin Hansson
0c82d3f3f4 Merge of fix for Bug#52357 2010-05-06 10:59:28 +02:00
Martin Hansson
1eada91053 Bug#52357: Assertion failed: join->best_read in
greedy_search optimizer_search_depth=0

The algorithm inside restore_prev_nj_state failed to
properly update the counters within the NESTED_JOIN
tree. The counter was decremented each time a table in the
node was removed from the QEP, the correct thing to do being
only to decrement it when the last table in the child node
was removed from the plan. This lead to node counters
getting negative values and the plan thus appeared
impossible. An assertion caught this.

Fixed by not recursing up the tree unless the last table in
the join nest node is removed from the plan
2010-05-06 10:45:00 +02:00
Omer BarNir
fb47b30384 Updates to README file of the 'engines' test suites 2010-05-04 14:24:36 -07:00
Andrei Elkin
efcc90b6eb Bug #50942 mix_innodb_myisam_side_effects.test is not deterministic
The test was used to fail because of 
 UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
did not prescribe the order of two row operations implied by the update.

Fixed with forcing the order with adding a where condition w/o
affecting the former bug fixes logics.

mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test:
  implemented the bug page suggestion to make a test deterministic.
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  results are updated and (!) corrected.
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  results are updated
2010-05-04 22:31:49 +03:00
Georgi Kodinov
71b453fa06 Bug #53371: COM_FIELD_LIST can be abused to bypass table level grants.
This is the 5.1 merge and extension of the fix.
The server was happily accepting paths in table name in all places a table
name is accepted (e.g. a SELECT). This allowed all users that have some 
privilege over some database to read all tables in all databases in all
mysql server instances that the server file system has access to.
Fixed by :
1. making sure no path elements are allowed in quoted table name when
constructing the path (note that the path symbols are still valid in table names
when they're properly escaped by the server).
2. checking the #mysql50# prefixed names the same way they're checked for
path elements in mysql-5.0.
2010-05-04 17:03:28 +03:00
Mattias Jonsson
f33075fd16 merge 2010-05-04 14:26:44 +02:00
Kristofer Pettersson
95e712b0b7 Automerge 2010-05-03 19:21:09 +02:00
Kristofer Pettersson
5dd5d70506 Bug#50373 --secure-file-priv=""
Iterative patch improvement. Previously committed patch
caused wrong result on Windows. The previous patch also
broke secure_file_priv for symlinks since not all file
paths which must be compared against this variable are
normalized using the same norm.

The server variable opt_secure_file_priv wasn't
normalized properly and caused the operations
LOAD DATA INFILE .. INTO TABLE ..
and
SELECT load_file(..)
to do different interpretations of the 
--secure-file-priv option.
     
The patch moves code to the server initialization
routines so that the path always is normalized
once and only once.
      
It was also intended that setting the option
to an empty string should be equal to 
lifting all previously set restrictions. This
is also fixed by this patch.


mysql-test/r/loaddata.result:
  * Removed test code which will currently break the much used --mem feature of mtr.
mysql-test/t/loaddata.test:
  * Removed test code which will currently break the much used --mem feature of mtr.
sql/item_strfunc.cc:
  * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms.
sql/mysql_priv.h:
  * Added signature for is_secure_file_path()
sql/mysqld.cc:
  * New function for checking if a path compatible with the secure path restriction.
  * Added initialization of the opt_secure_file_priv variable.
sql/sql_class.cc:
  * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms.
sql/sql_load.cc:
  * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms.
2010-05-03 18:14:39 +02:00
Georgi Kodinov
e038b56dab merged 5.1-innodb 2010-05-01 19:12:12 +03:00
Alexey Kopytov
26570994b2 Automerge. 2010-04-30 15:27:17 +04:00
Alexey Kopytov
97374a1184 Bug #48419: another explain crash..
WHERE predicates containing references to empty tables in a
subquery were handled incorrectly by the optimizer when
executing EXPLAIN. As a result, the optimizer could try to
evaluate such predicates rather than just stop with
"Impossible WHERE noticed after reading const tables" as 
it would do in a non-subquery case. This led to valgrind 
errors and crashes.

Fixed the code checking the above condition so that subqueries
are not excluded and hence are handled in the same way as top
level SELECTs.

mysql-test/r/explain.result:
  Added a test case for bug #48419.
mysql-test/r/ps.result:
  Updated test results to take the new (and more correct)
  "Extra" comments in execution plans.
mysql-test/t/explain.test:
  Added a test case for bug #48419.
sql/sql_select.cc:
  There is no point in excluding subqueries from checking
  for identically false WHERE conditions.
2010-04-30 15:10:48 +04:00
Vasil Dimov
3bffc40a24 Disable innodb.innodb, main.ps_3innodb and main.partition_innodb_plugin
mysql-tests because those emit (spurious?) valgrind warnings.
2010-04-30 13:02:36 +03:00
Vasil Dimov
c5ca0da1e8 Merge 3417..3421 from mysql-5.1-innodb 2010-04-27 09:16:45 +03:00
Vasil Dimov
777c194cda Split the innodb.innodb mysql-test.
Extract part of innodb.innodb into innodb.innodb_misc1

This is needed in order to be able to more easily debug this test,
under valgrind, it is too huge.
2010-04-27 09:09:08 +03:00
Alexey Kopytov
6d43510a42 Backport of the fix for bug #50335 to 5.0.
The problem was in an incorrect debug assertion. The expression
used in the failing assertion states that when finding
references matching ORDER BY expressions, there can be only one
reference to a single table. But that does not make any sense,
all test cases for this bug are valid examples with multiple
identical WHERE expressions referencing the same table which
are also present in the ORDER BY list.

Fixed by removing the failing assertion. We also have to take
care of the 'found' counter so that we count multiple
references only once. We rely on this fact later in
eq_ref_table().

mysql-test/r/join.result:
  Added a test case for bug #50335.
mysql-test/t/join.test:
  Added a test case for bug #50335.
sql/sql_select.cc:
  Removing the assertion in eq_ref_table() as it does not make
  any sense. We also have to take care of the 'found' counter so
  that we count multiple references only once. We rely on this
  fact later in eq_ref_table().
2010-04-27 00:06:00 +04:00
Marko Mäkelä
bd4a354c29 Add a test case for Bug #52745. 2010-04-26 14:08:56 +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
Calvin Sun
44bac2ea9c mysql-5.1-innodb: add error codes to innodb_bug51920.test
kill of active connection yields different error code
depending on platform.
2010-04-22 14:16:14 -05:00
Luis Soares
fbe81e3c97 BUG#52868: Wrong handling of NULL value during update, replication out
of sync

In RBR, sometimes the table->s->last_null_bit_pos can be zero. This
has impact at the slave when it compares records fetched from the
storage engine against records in the binary log event. If
last_null_bit_pos is zero the slave, while comparing in
log_event.cc:record_compare function, would set all bits in the last
null_byte to 1 (assumed all 8 were unused) . Thence it would loose the
ability to distinguish records that were similar in contents except
for the fact that some field was null in one record, but not in the
other. Ultimately this would cause wrong matches, and in the specific
case depicted in the bug report the same record would be updated
twice, resulting in a lost update.

Additionally, in the record_compare function the slave was setting the
X bit unconditionally. There are cases that the X bit does not exist
in the record header. This could also lead to wrong matches between
records.

We fix both by conditionally resetting the bits: (i) unused null_bits
are set if last_null_bit_pos > 0; (ii) X bit is set if
HA_OPTION_PACK_RECORD is in use.

mysql-test/extra/rpl_tests/rpl_record_compare.test:
  Shared part of the test case for MyISAM and InnoDB.
mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test:
  InnoDB test case.
mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test:
  MyISAM test case. Added also coverage for Field_bits case.
sql/log_event.cc:
  Deployed conditional setting of unused bits at record_compare.
sql/log_event_old.cc:
  Same change as in log_event.cc.
2010-04-21 13:47:55 +01:00
Marko Mäkelä
66e1700bed dict_create_index_step(): Be strict about DYNAMIC and COMPRESSED tables.
Bug #50495 is about REDUNDANT and COMPACT tables, after all.
2010-04-21 13:27:23 +03:00
Marko Mäkelä
b7a6240c41 Adjust tests for the Bug #50495 fix. 2010-04-21 12:40:32 +03:00
Kristofer Pettersson
3a626d1027 Bug#50373 --secure-file-priv=""
Correcting a patch misstake. The converted file path is placed in 'buff' not in opt_secure_file_priv.

mysql-test/r/loaddata.result:
  * Updated test case; Since secure_file_priv now is normalized the previous values are changed.
sql/mysqld.cc:
  * Fixed patch misstake
2010-04-20 16:17:34 +02:00
Marko =?ISO-8859-1?Q?M=E4kel=E4?=
6f58f36846 Enable innodb_plugin tests based on the presence of lib_innodb_plugin. 2010-04-19 12:44:05 +03:00
Marko =?ISO-8859-1?Q?M=E4kel=E4?=
68fcbba604 Do not require innodb for running innodb_plugin tests. 2010-04-19 12:21:13 +03:00
Kristofer Pettersson
95da93d7ac Automerge 2010-04-16 16:56:16 +02:00
Kristofer Pettersson
794a441317 Bug#50373 --secure-file-priv=""
The server variable opt_secure_file_priv wasn't
normalized properly and caused the operations
LOAD DATA INFILE .. INTO TABLE ..
and
SELECT load_file(..)
to do different interpretations of the 
--secure-file-priv option.

The patch moves code to the server initialization
routines so that the path always is normalized
once and only once.

It was also intended that setting the option
to an empty string should be equal to 
lifting all previously set restrictions. This
is also fixed by this patch.


sql/mysqld.cc:
  * If --secure_file_option is an empty string then the option variable
    should be unset.
  * opt_secure_file_option should be normalized once when the server starts.
sql/sql_load.cc:
  * moved variable normalization code to fix_paths()
2010-04-16 16:10:47 +02:00
Sergey Glukhov
649deaa8a1 Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
Arg_comparator initializes 'comparators' array in case of
ROW comparison and does not free this array on destruction.
It leads to memory leaks.
The fix:
-added Arg_comparator::cleanup() method which frees
 'comparators' array.
-added Item_bool_func2::cleanup() method which calls 
 Arg_comparator::cleanup() method


mysql-test/r/ps.result:
  test case
mysql-test/r/row.result:
  test case
mysql-test/t/ps.test:
  test case
mysql-test/t/row.test:
  test case
sql/item_cmpfunc.h:
  -added Arg_comparator::cleanup() method which frees
   'comparators' array.
  -added Item_bool_func2::cleanup() method which calls 
   Arg_comparator::cleanup() method
2010-04-16 16:42:34 +05:00
Georgi Kodinov
16fadb10b5 Bug #52629: memory leak from sys_var_thd_dbug in binlog.binlog_write_error
When re-setting (SET GLOBAL debug='') the GLOBAL debug settings the 
server was not freeing the data elements from the top (initial) frame 
before setting them to 0 without freeing the underlying memory. As these 
are global settings there's a chance that something is there already.
Fixed by :
1. making sure the allocated data are cleaned up before re-setting them
while parsing a debug string
2. making sure the stuff allocated in the global settings is freed on 
shutdown.
2010-04-16 10:30:53 +03:00
Luis Soares
8fa9a5861b automerge: merged bug clone into latest mysql-5.1-bugteam. 2010-04-16 01:59:21 +01:00
Vasil Dimov
9a7da960f8 Fix path to have_innodb_plugin.inc 2010-04-12 17:26:20 +03:00
Vasil Dimov
84c41ecbff Remove unused file 2010-04-12 17:23:00 +03:00
Vasil Dimov
0ee2f371f5 Fix path to innodb-index.inc 2010-04-12 16:58:47 +03:00