Commit graph

76 commits

Author SHA1 Message Date
Sergey Petrunya
908fa69da9 Bug #13571700 TINYBLOB NOT NULL, CRASH IN PROTOCOL::NET_STORE_DATA
- Backport testcase from mysql-5.6
2014-03-07 13:21:16 +01:00
Sergey Petrunya
5ba109c4f6 Bug#45227: Lost HAVING clause led to a wrong result.
- Backport testcase from mysql-5.6
2014-03-07 13:14:58 +01:00
Sergei Golubchik
0dc23679c8 10.0-base merge 2014-02-26 15:28:07 +01:00
Sergei Golubchik
0b9a0a3517 5.5 merge 2014-02-25 16:04:35 +01:00
Sergei Golubchik
ff2e82f4a1 5.3 merge 2014-02-22 22:51:20 +01:00
Igor Babaev
3e03c9eae9 After constant row substitution the optimizer should call the method
update_used_tables for the the where condition to update cached
indicators of constant subexpressions. It should be done before further
possible simplification of the where condition.

This change caused simplification of the executed where conditions 
in many test cases.
2014-02-20 21:27:33 -08:00
Sergei Golubchik
d28d3ba40d 10.0-base merge 2013-12-16 13:02:21 +01:00
Sergei Golubchik
c6d30805db 5.5 merge 2013-11-23 00:50:54 +01:00
Igor Babaev
d34e46795e Merge 5.3->5.5 2013-11-21 21:40:43 -08:00
Igor Babaev
c0f31dc9f3 Another attempt to fix bug mdev-5103.
The earlier pushed fix for the bug was incomplete. It did not remove
the main cause of the problem: the function remove_eq_conds()
removed always true multiple equalities from any conjunct, but did not
adjust the list of them stored in Item_cond_and::cond_equal.current_level.

Simplified the test case for the bug and moved it to another test file.

The fix triggered changes in EXPLAIN EXTENDED for some queries.
2013-11-21 15:19:25 -08:00
Sergei Golubchik
9af177042e 10.0-base merge.
Partitioning/InnoDB changes are *not* merged (they'll come from 5.6)
TokuDB does not compile (not updated to 10.0 SE API)
2013-09-21 10:14:42 +02:00
Sergei Golubchik
4ec2e9d7ed 5.5 merge and fixes for compiler/test errors 2013-09-18 13:07:31 +02:00
Igor Babaev
880e166483 Merge 5.3->5.5 2013-08-31 08:18:25 -07:00
Igor Babaev
576a2b1533 Fixed bug mdev-4971.
The function propagate_new_equalities() did not updated properly
the references to inherited multiple equalities.
2013-08-29 21:02:42 -07:00
Igor Babaev
901737c978 Fixed bug mdev-4944.
The patch to fix mdev-4418 turned out to be incorrect.
At the substitution of single row tables in make_join_statistics()
the used multiple equalities may change and references to the new multiple
equalities must be updated. The function remove_eq_conds() takes care of it and
it should be called right after the substitution of single row tables.
Calling it after the call of make_join_statistics was a mistake.
2013-08-26 12:55:58 -07:00
Igor Babaev
34aa69564d Merge 5.3->5.5 2013-08-27 22:19:14 -07:00
unknown
35b2883643 merge 5.5 -> 10.0-base 2013-08-20 14:48:29 +03:00
Igor Babaev
4eddb2c221 Merge 5.3->5.5.
In particular:
Merged the patch for bug mdev-4418 from 5.3 into 5.5.
Fixed a bug in the patch that should be backported to 5.3.
2013-08-18 19:58:51 -07:00
Igor Babaev
25c152018d Fixed bug mdev-4418.
After single row substitutions there might appear new equalities.
They should be properly propagated to all AND/OR levels the WHERE
condition. It's done now with an additional call of remove_eq_conds().
2013-08-16 22:01:47 -07:00
Igor Babaev
fa7f677218 Fixed bug mdev-4355.
This patch almost totally revised the patch for bug mdev-4177.
The latter had too many defects. In particular, it did not
propagate multiple equalities formed when merging a degenerate
disjunct into underlying AND formula.
2013-08-15 14:16:16 -07:00
Sergei Golubchik
fcf87600a2 MDEV-4865 Change related to --log option/variable was merged partially
Complete the merge of magne.mahre@oracle.com-20101102115354-vxcaxminmzglzalk
(WL#5185 Remove deprecated 5.1 features)
2013-08-13 13:35:36 +02:00
Sergei Golubchik
b7b5f6f1ab 10.0-monty merge
includes:
* remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING"
* introduce LOCK_share, now LOCK_ha_data is strictly for engines
* rea_create_table() always creates .par file (even in "frm-only" mode)
* fix a 5.6 bug, temp file leak on dummy ALTER TABLE
2013-07-21 16:39:19 +02:00
Sergei Golubchik
4d57bfdd48 temporal-related changes. don't apply sql_mode flags on the lower level (str_to_datetime),
do it on the upper level, in items that return temporal values.

update tests results to match 5.6 better and to fix old bugs.
2013-07-11 23:16:33 +02:00
Sergei Golubchik
3ab7052d79 fix cast.test, select.test, select_jcl6.test: update results after strict_date_checking=1 2013-07-10 21:19:11 +02:00
Alexander Barkov
e013bf9f0e The bug
MDEV-4489 "Replication of big5, cp932, gbk, sjis strings makes wrong values on slave"
has been fixed.

Problem:
String constants of some Asian charsets (big5,cp932,gbk,sjis)
can have backslash '\' (0x5C) in the second byte of multi-byte characters.
Replicating of such constants using the standard '\'-escaping is dangerous.
Therefore, constants of these charsets are replicated using hex notation:
INSERT INTO t1 (a) VALUES (0x815C);

However, 0xHHHH constants do not work well in some cases,
because they can behave as strings and as numbers, depending on context
(for example, depending on the data type of the column in an INSERT statement).

This SQL script was not replicated correctly with statement-based replication:

SET NAMES gbk;
PREPARE STMT FROM 'INSERT INTO t1 (a) VALUES (?)';
SET @a = '1';
EXECUTE STMT USING @a;

The INSERT statement was replicated as:
INSERT INTO t1 (a) VALUES (0x31);

'1' was correctly converted to the number 1 on master.
But the 0x31 constant was treated as number 49 on slave.

Fix:

1. Binary log now uses X'HHHH' instead of 0xHHHH constants.
2. The X'HHHH' constants now work always as strings, in all contexts.
This is the SQL standard compliant behaviour.

After the fix, the above statement is replicated as:
INSERT INTO t1 (a) VALUES (X'31');
X'31' is treated as string '1' on slave, and is correctly converted to 1.


modified:
  @ mysql-test/r/ctype_cp932_binlog_stm.result
  @ mysql-test/r/select.result
  @ mysql-test/r/select_jcl6.result
  @ mysql-test/r/select_pkeycache.result
  @ mysql-test/r/user_var-binlog.result
  @ mysql-test/r/varbinary.result
  @ mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
  @ mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
  @ mysql-test/suite/rpl/r/rpl_charset_sjis.result
  @ mysql-test/suite/rpl/r/rpl_mdev382.result
  @ mysql-test/suite/rpl/t/rpl_charset_sjis.test
  @ mysql-test/t/ctype_cp932_binlog_stm.test
  @ mysql-test/t/select.test
  @ mysql-test/t/varbinary.test
    Adding and updating tests

  @ sql/item.cc
  @ sql/item.h
  @ sql/sql_yacc.yy
  @ sql/sql_lex.cc
    Splitting the implementations of X'HH' and 0xHH constants into two
    separate classes. Fixing the parser to distinguish the two syntaxes.

  @ sql/log_event.cc
    Using X'HH' instead of 0xHH for binary logging for string constants
    of the "dangerous" charsets.

  @ sql/sql_string.h
    Adding a helped method String::append_hex().
2013-05-08 13:36:17 +04:00
Igor Babaev
75befe7526 Merge 5.3->5.5 2013-05-04 21:56:45 -07:00
Igor Babaev
86f43c3077 Fixed bug mdev-4274.
This bug was the result of incompleteness of the patch for bug mdev-4177.
When an OR condition is simplified to a single conjunct it is merged
into the embedding AND condition. Multiple equalities are also merged,
and any field item involved in those equality should acquire a pointer
to a the multiple equality formed by this merge.
2013-04-29 20:31:40 -07:00
Igor Babaev
926b0f54c9 Fixed bug mdev-4250.
This is a bug in the legacy code. It did not manifest itself because
it was masked by other bugs that were fixed by the patches for
mdev-4172 and mdev-4177.
2013-03-08 00:25:26 -08:00
Sergei Golubchik
8dad7dfa6a 5.3->5.5 merge 2013-03-10 12:46:56 +01:00
Sergei Golubchik
68baf07dcd 5.3 merge 2012-10-18 23:33:06 +02:00
Igor Babaev
66bd2b56fc Fixed LP bug #1058071 (mdev-564).
In some rare cases when the value of the system variable join_buffer_size
was set to a number less than 256 the function JOIN_CACHE::set_constants 
determined the size of an offset in the join buffer equal to 1 though
the minimal join buffer required more than 256 bytes. This could cause
a crash of the server when records from the join buffer were read.
2012-09-29 22:44:13 -07:00
Sergei Golubchik
1185420da0 5.3 merge 2012-05-21 20:54:41 +02:00
unknown
ea8314fdd5 LP bug#994275 fix.
In 5.3 we substitute constants in ref access values it can't be null so we do not need add NOT NULL for early NULL filtering.
2012-05-07 21:14:37 +03:00
Igor Babaev
8b469eb515 Merge 5.3->5.5. 2012-03-01 14:22:22 -08:00
Sergey Petrunya
2256ecdd7c Merge 5.2->5.3 2012-02-24 20:07:12 +04:00
Sergei Golubchik
25609313ff 5.3.4 merge 2012-02-15 18:08:08 +01:00
Igor Babaev
7b79d8a33f Merge 5.2->5.3 in preparation for the release of mariadb-5.3.4-rc. 2012-02-01 15:48:02 -08:00
unknown
69327e2987 Adjust test results after Monty's push of the new
handler counter Handler_read_rnd_deleted.
2012-01-18 12:53:50 +02:00
Sergei Golubchik
38e3ae155d mysql-5.5 merge 2012-01-16 20:16:35 +01:00
Sergei Golubchik
4f435bddfd 5.3 merge 2012-01-13 15:50:02 +01:00
Sergei Golubchik
8c2bcdf85f MDEV-76 5.5 memory overrun on main.select_jcl6.
geometry fields are blobs too.
2012-01-07 20:01:55 +01:00
Igor Babaev
2b1f0b8757 Back-ported the patch of the mysql-5.6 code line that
fixed several defects in the greedy optimization:

1) The greedy optimizer calculated the 'compare-cost' (CPU-cost)
   for iterating over the partial plan result at each level in
   the query plan as 'record_count / (double) TIME_FOR_COMPARE'

   This cost was only used locally for 'best' calculation at each
   level, and *not* accumulated into the total cost for the query plan.

   This fix added the 'CPU-cost' of processing 'current_record_count'
   records at each level to 'current_read_time' *before* it is used as
   'accumulated cost' argument to recursive 
   best_extension_by_limited_search() calls. This ensured that the
   cost of a huge join-fanout early in the QEP was correctly
   reflected in the cost of the final QEP.

   To get identical cost for a 'best' optimized query and a
   straight_join with the same join order, the same change was also
   applied to optimize_straight_join() and get_partial_join_cost()

2) Furthermore to get equal cost for 'best' optimized query and a
   straight_join the new code substrcated the same '0.001' in
   optimize_straight_join() as it had been already done in
   best_extension_by_limited_search()

3) When best_extension_by_limited_search() aggregated the 'best' plan a
   plan was 'best' by the check :

   'if ((search_depth == 1) || (current_read_time < join->best_read))'

   The term '(search_depth == 1' incorrectly caused a new best plan to be
   collected whenever the specified 'search_depth' was reached - even if
   this partial query plan was more expensive than what we had already
   found.
2011-12-24 08:55:10 -08:00
Igor Babaev
a910e8ef5b Made join_cache_level == 2 by default. 2011-12-15 14:26:59 -08:00
Igor Babaev
f5dac20f38 Made the optimizer switch flags 'outer_join_with_cache', 'semijoin_with_cache'
set to 'on' by default.
2011-12-15 00:21:15 -08:00
Sergei Golubchik
2ccf247e93 after merge changes:
* rename all debugging related command-line options
  and variables to start from "debug-", and made them all
  OFF by default.
* replace "MySQL" with "MariaDB" in error messages
* "Cast ... converted ... integer to it's ... complement"
  is now a note, not a warning
* @@query_cache_strip_comments now has a session scope,
  not global.
2011-12-12 23:58:40 +01:00
Michael Widenius
6d4224a31c Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
2011-12-11 11:34:44 +02:00
Sergei Golubchik
d2755a2c9c 5.3->5.5 merge 2011-11-22 18:04:38 +01:00
Igor Babaev
e0c1b3f242 Fixed LP bug #886145.
The bug happened because in some cases the function JOIN::exec
did not save the value of TABLE::pre_idx_push_select_cond in
TABLE::select->pre_idx_push_select_cond for the sort table.

Noticed and fixed a bug in the function make_cond_remainder
that builds the remainder condition after extraction of an index
pushdown condition from the where condition. The code
erroneously assumed that the function make_cond_for_table left
the value of ICP_COND_USES_INDEX_ONLY in sub-condition markers.
Adjusted many result files from the regression test suite
after this fix .
2011-11-06 01:23:03 -07:00
Sergei Golubchik
76f0b94bb0 merge with 5.3
sql/sql_insert.cc:
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
  ******
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
  small cleanup
  ******
  small cleanup
2011-10-19 21:45:18 +02:00
Igor Babaev
715dc5f99d Fixed a cost estimation bug introduced into in the function best_access_path
of the 5.3 code line after a merge with 5.2 on 2010-10-28
in order not to allow the cost to access a joined table to be equal
to 0 ever.

Expanded data sets for many test cases to get the same execution plans
as before.
2011-09-30 18:55:02 -07:00