1. 21 Feb, 2013 2 commits
    • Igor Babaev's avatar
      Merge. · 6537b551
      Igor Babaev authored
      6537b551
    • Igor Babaev's avatar
      Fixed bug mdev-3913. · c9b63e6a
      Igor Babaev authored
      The wrong result set returned by the left join query  from
      the bug test case happened due to several inconsistencies 
      and bugs of the legacy mysql code.
      
      The bug test case uses an execution plan that employs a scan
      of a materialized IN subquery from the WHERE condition.
      When materializing such an IN- subquery the optimizer injects
      additional equalities  into the WHERE clause. These equalities
      express the constraints imposed by the subquery predicate.
      The injected equality of the query in the  test case happens
      to belong to the same equality class, and a new equality 
      imposing a condition on the rows of the materialized subquery
      is inferred from this class. Simultaneously the multiple
      equality is added to the ON expression of the LEFT JOIN
      used in the main query.
        
      The inferred equality of the form f1=f2 is taken into account
      when optimizing the scan of  the rows the temporary table 
      that is the result of the subquery materialization: only the 
      values of the field f1 are read from the table into the record 
      buffer. Meanwhile the inferred equality is removed from the
      WHERE conditions altogether as a constraint on the fields
      of the temporary table that has been used when filling this table. 
      This equality is supposed to be removed from the ON expression
      when the multiple equalities of the ON expression are converted
      into an optimal set of equality predicates. It supposed to be
      removed from the ON expression as an equality inferred from only
      equalities of the WHERE condition. Yet, it did not happened
      due to the following bug in the code.
      
      Erroneously the code tried to build multiple equality for ON
      expression twice: the first time, when it called optimize_cond()
      for the WHERE condition, the second time, when it called
      this function for the HAVING condition. When executing
      optimize_con() for the WHERE condition  a reference
      to the multiple equality of the WHERE condition is set
      in the multiple equality of the  ON expression. This reference
      would allow later to convert multiple equalities of the
      ON expression into equality predicates. However the 
      the second call of build_equal_items() for the ON expression
      that happened when optimize_cond() was called for the
      HAVING condition reset this reference to NULL.
      
      This bug fix blocks calling build_equal_items() for ON
      expressions for the second time. In general, it will be
      beneficial for many queries as it removes from ON 
      expressions any equalities that are to be checked for the
      WHERE condition.
      The patch also fixes two bugs in the list manipulation
      operations and a bug in the function  
      substitute_for_best_equal_field() that resulted
      in passing wrong reference to the multiple equalities
      of where conditions when processing multiple
      equalities  of ON expressions.
      
      The code of substitute_for_best_equal_field() and
      the code the helper function eliminate_item_equal()
      were also streamlined and cleaned up.
      Now the conversion of the multiple equalities into
      an optimal set of equality predicates first produces
      the sequence of the all equalities processing multiple
      equalities one by one, and, only after this, it inserts
      the equalities at the beginning of the other conditions.
      
      The multiple changes in the output of EXPLAIN
      EXTENDED are mainly the result of this streamlining,
      but in some cases is the result of the removal of
      unneeded equalities from ON expressions. In
      some test cases this removal were reflected in the
      output of EXPLAIN resulted in disappearance of 
      “Using where” in some rows of the execution plans.
      c9b63e6a
  2. 13 Feb, 2013 1 commit
    • unknown's avatar
      Fix for MDEV-4140 · d4b1e8f3
      unknown authored
      Analysis:
      Range analysis detects that the subquery is expensive and doesn't
      build a range access method. Later, the applicability test for loose
      scan doesn't take that into account, and builds a loose scan method
      without a range scan on the min/max column. As a result loose scan
      fetches the first key in each group, rather than the first key that
      satisfies the condition on the min/max column.
      
      Solution:
      Since there is no SEL_ARG tree to be used for the min/max column,
      it is not possible to use loose scan if the min/max column is compared
      with an expensive scalar subquery. Make the test for loose scan
      applicability to be in sync with the range analysis code by testing if
      the min/max argument is compared with an expensive predicate.
      d4b1e8f3
  3. 12 Feb, 2013 1 commit
  4. 11 Feb, 2013 1 commit
    • unknown's avatar
      MDEV-4123 fix. · 3f36dfe3
      unknown authored
      Missed update_used_tables() call for multi-update values.
      3f36dfe3
  5. 08 Feb, 2013 1 commit
    • Igor Babaev's avatar
      Fixed bug mdev-3995. · 48aee459
      Igor Babaev authored
      This bug happened because the executor tried to use a wrong
      TABLE REF object when building access keys. It constructed
      keys from fields of a materialized table from a ref object
      created to construct keys from the fields of the underlying
      base table. This could happen only when materialized table
      was created for a non-correlated IN subquery and only
      when the materialized table used for lookups.
      In this case we are guaranteed to be able to construct the
      keys from the fields of tables that would be outer tables
      for the tables of the IN subquery.
      The patch makes sure that no ref objects constructed from
      fields of materialized lookup tables are to be used.
      48aee459
  6. 04 Feb, 2013 1 commit
    • unknown's avatar
      Fix for bug MDEV-765 (LP:825075) · 0b2dc3fc
      unknown authored
      Analys:
      The cause for the wrong result was that the optimizer
      incorrectly chose min/max loose scan when it is not
      applicable. The applicability test missed the case when
      a condition on the MIN/MAX argument was OR-ed with a
      condition on some other field. In this case, the MIN/MAX
      condition cannot be used for loose scan.
      
      Solution:
      Extend the test check_group_min_max_predicates() to check
      that the WHERE clause is of the form: "cond1 AND cond2"
      where 
        cond1 - does not use min_max_column at all.
        cond2 - is an AND/OR tree with leaves in form "min_max_column $CMP$ const"
                or $CMP$ is one of the functions between, is [not] null
      
      0b2dc3fc
  7. 28 Jan, 2013 2 commits
  8. 26 Jan, 2013 1 commit
  9. 25 Jan, 2013 7 commits
  10. 24 Jan, 2013 2 commits
  11. 22 Jan, 2013 1 commit
  12. 21 Jan, 2013 4 commits
    • Igor Babaev's avatar
      Merge 5.1->5.2 · 8127e631
      Igor Babaev authored
      8127e631
    • Igor Babaev's avatar
      Merge. · 82fe8a4e
      Igor Babaev authored
      82fe8a4e
    • Igor Babaev's avatar
      Fixed bug mdev-4063 (bug #56927). · fade3647
      Igor Babaev authored
      This bug could result in returning 0 for the expressions of the form 
      <aggregate_function>(distinct field) when the system variable  
      max_heap_table_size was set to a small enough number.
      It happened because the method Unique::walk() did not support
      the case when more than one pass was needed to merge the trees
      of distinct values saved in an external file.
      
      Backported a fix in grant_lowercase.test from mariadb 5.5.
      fade3647
    • Sergei Golubchik's avatar
      MDEV-4029 SELECT on information_schema using a subquery locks up the... · 43c6953f
      Sergei Golubchik authored
      MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling
        
      Early evaluation of subqueries in the WHERE conditions on I_S.*_STATUS tables,
      otherwise the subquery on this same table will try to acquire LOCK_status twice.
      43c6953f
  13. 20 Jan, 2013 1 commit
  14. 16 Jan, 2013 2 commits
    • Igor Babaev's avatar
      Corrected the fix for bug mdev-3938. · 63afbba4
      Igor Babaev authored
      63afbba4
    • unknown's avatar
      MDEV-4056 fix. · 2255132f
      unknown authored
      The problem was that maybe_null of Item_row and its componetes was unsynced after update_used_tables() (and so pushed_cond_guards was not initialized but then requested).
      
      Fix  updates Item_row::maybe_null on update_used_tables().
      2255132f
  15. 17 Jan, 2013 2 commits
    • unknown's avatar
      MDEV-3900 Optimizer difference between MySQL and MariaDB with stored functions... · d51f96b1
      unknown authored
      MDEV-3900 Optimizer difference between MySQL and MariaDB with stored functions in WHERE clause of UPDATE or DELETE statements
      
      Analysis
      The reason for the less efficient plan was result of a prior design decision -
      to limit the eveluation of constant expressions during optimization to only
      non-expensive ones. With this approach all stored procedures were considered
      expensive, and were not evaluated during optimization. As a result, SPs didn't
      participate in range optimization, which resulted in a plan with table scan
      rather than index range scan.
      
      Solution
      Instead of considering all SPs expensive, consider expensive only those SPs
      that are non-deterministic. If an SP is deterministic, the optimizer will
      checj if it is constant, and may eventually evaluate it during optimization.
      
      d51f96b1
    • unknown's avatar
      backport of: · 8a296e6c
      unknown authored
      Don't reset maybe_null in update_used_tables(); This breaks ROLLUP
      This fixed failing test in group_by.test
      8a296e6c
  16. 16 Jan, 2013 2 commits
    • unknown's avatar
      MDEV-3988 fix. · a716b061
      unknown authored
      Subquery turned into constant too late to be excluded from grouping list so test for constant added to the create_temp_table().
      a716b061
    • Igor Babaev's avatar
      Fixed bug mdev-3938. · f8f90aa7
      Igor Babaev authored
      The original patch with the implementation of virtual columns
      did not support INSERT DELAYED into tables with virtual columns.
      This patch fixes the problem.
      f8f90aa7
  17. 12 Jan, 2013 1 commit
    • Igor Babaev's avatar
      Fixed bug mdev-4025. · 12bf6fe8
      Igor Babaev authored
      The bug could lead to a wrong estimate of the number of expected rows
      in the output of the EXPLAIN commands for queries with GROUP BY.
      This could be observed in the test case for LP bug 934348.
      12bf6fe8
  18. 11 Jan, 2013 1 commit
    • Vladislav Vaintroub's avatar
      MDEV-4020 : Make sure strmov symbol is exported by client library on Linux... · d8acafcb
      Vladislav Vaintroub authored
      MDEV-4020 : Make sure strmov symbol is exported by client library  on Linux (even if the server and libraries itself use stpcpy instead of it)
      
      It is a workaround that allows myodbc built by certain distributions' (CentOS,Fedora) to peacefully coexist with mariadb client libraries.
      The problem is that MyODBC in these distros needs strmov() to be exported by mysql client shared library, or else myodbc fails to load.
      d8acafcb
  19. 10 Jan, 2013 2 commits
  20. 09 Jan, 2013 1 commit
  21. 08 Jan, 2013 1 commit
  22. 28 Dec, 2012 1 commit
    • unknown's avatar
      MDEV-3873 & MDEV-3876 & MDEV-3912 : Wrong result (extra rows) with ALL subquery · 6f26aac9
      unknown authored
      from a MERGE view.
      
      The problem was in the lost ability to be null for the table of a left join if it
      is a view/derived table.
      
      It hapenned because setup_table_map(), was called earlier then we merged
      the view or derived.
      
      Fixed by propagating new maybe_null flag during Item::update_used_tables().
      
      Change in join_outer.test and join_outer_jcl6.test appeared because
      IS NULL reported no used tables (i.e. constant) for argument which could not be
      NULL and new maybe_null flag was propagated for IS NULL argument (Item_field)
      because table the Item_field belonged to changed its maybe_null status.
      6f26aac9
  23. 21 Dec, 2012 2 commits