1. 19 May, 2011 3 commits
  2. 18 May, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #784281. · 78794f32
      Igor Babaev authored
      When a view is merged into a select all the depended_from fields
      pointing to the select of the view should have been corrected to
      point to the select where the view is used. It was not done yet.
      This could lead to wrong results returned by queries such as
      one from the test case for bug 33389.
      Correction of outer references required walking through all items
      of the proccesed qurery. To avoid this the following solution was
      implemented.
      Each select now contains a pointer to the select it is merged into
      (if there is any). Such pointers allow to get the corrected value
      of depended_from on the fly. The function Item_ident::get_depended_from
      was introduced for this purpose.
      78794f32
  3. 17 May, 2011 1 commit
    • Igor Babaev's avatar
      Merged the code of MWL#106 into 5.3 · c8611b6e
      Igor Babaev authored
      Resolved all conflicts, bad merges and fixed a few minor bugs in the code.
      Commented out the queries from multi_update, view, subselect_sj, func_str,
      derived_view, view_grant that failed either with crashes in ps-protocol or
      with wrong results.
      The failures are clear indications of some bugs in the code and these bugs
      are to be fixed.
      c8611b6e
  4. 04 May, 2011 4 commits
    • Oleksandr Byelkin's avatar
      Moving max/min optimization from prepare to optimization phase. MWL#148 · 18698229
      Oleksandr Byelkin authored
      mysql-test/r/explain.result:
        fixed results (new item)
      mysql-test/r/subselect.result:
        fixed results (new item)
      mysql-test/r/subselect_no_mat.result:
        fixed results (new item)
      mysql-test/r/subselect_no_opts.result:
        fixed results (new item)
      mysql-test/r/subselect_no_semijoin.result:
        Fixed results (new item)
      mysql-test/suite/pbxt/r/subselect.result:
        Fixed results (new item)
      mysql-test/t/explain.test:
        Fixed results (correct behaviour)
      sql/item_cmpfunc.cc:
        Pass through  for max/min
      sql/item_subselect.cc:
        moving max/min
      sql/item_subselect.h:
        moving max/min
      sql/mysql_priv.h:
        new uncacheble flags added
      sql/opt_subselect.cc:
        maxmin moved.
      sql/opt_subselect.h:
        New function for maxmin.
      sql/sql_class.h:
        debug code
      sql/sql_lex.cc:
        Fixed flags.
        Limit setting fixed.
      sql/sql_lex.h:
        2 new flags.
      sql/sql_select.cc:
        Prepare divided on 2 function to be able recollect some info after transformation.
      sql/sql_select.h:
        Prepare divided on 2 functions.
      18698229
    • unknown's avatar
      LP BUG#715759 · a3a72db7
      unknown authored
      Pushing test case only. The bug itself was fixed by the
      combined patches for LP BUG#717577 and LP BUG#776274.
      a3a72db7
    • unknown's avatar
      Automatic merge with 5.3 · a6817e80
      unknown authored
      a6817e80
    • Igor Babaev's avatar
      Fixed LP bug #776274, · 93058ecc
      Igor Babaev authored
      The bug was introduced by the patch that fixed bug 717577.
      93058ecc
  5. 02 May, 2011 3 commits
  6. 30 Apr, 2011 1 commit
  7. 28 Apr, 2011 3 commits
    • Michael Widenius's avatar
      Added ALTER ONLINE TABLE, which will give an error if the change can't be done... · e89705ca
      Michael Widenius authored
      Added ALTER ONLINE TABLE, which will give an error if the change can't be done 'instantly' (without a table copy)
      
      
      mysql-test/r/alter_table_online.result:
        Test new feature
      mysql-test/t/alter_table_online.test:
        Test new feature
      sql/handler.cc:
        Added comment
      sql/lex.h:
        Added ONLINE keyword
      sql/mysql_priv.h:
        Added option to alter table to require online operation
      sql/share/errmsg.txt:
        Added error message if ONLINE can't be done
      sql/sql_lex.h:
        Added online option
      sql/sql_parse.cc:
        Added online option to mysql_alter_table()
      sql/sql_table.cc:
        Added test that gives error if table can't be done instantly when requsted to be online.
        Fixed wrong test if table includes a VARCHAR
        Fixed wrong (but unlikely) handling of error conditions in ALTER table
      sql/sql_yacc.yy:
        Added ALTER ONLINE TABLE syntax
      storage/maria/ha_maria.cc:
        Fixed bug where 'start_bulk_insert' used too small buffer if used with unknown number of rows
      e89705ca
    • Michael Widenius's avatar
      Added option "AND DISABLE CHECKPOINT" to "FLUSH TABLES WITH READ LOCK" · 138cbb87
      Michael Widenius authored
      This makes it possible to do safe multi volume snapshots as long as one snapshots the volume with the transaction logs last.
      
      
      include/mysql_com.h:
        Added REFRESH_CHECKPOINT
      mysql-test/r/flush.result:
        Added test of new FLUSH TABLES syntax + calls to checkpoint_status handler calls
      mysql-test/t/flush.test:
        Added test of new FLUSH TABLES syntax + calls to checkpoint_status handler calls
      sql/handler.cc:
        Added code to call checkpoint_state for all handlertons that supports it
      sql/handler.h:
        Added new checkpoint_state() handlerton call to temporarly disable checkpoints.
      sql/lex.h:
        Added CHECKPOINT keyword
      sql/sql_yacc.yy:
        Added support for FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT
      storage/maria/ha_maria.cc:
        Added handlerton call to disable checkpoints.
      storage/maria/ma_checkpoint.c:
        Don't do checkpoint if checkpoints are disabled.
      storage/maria/ma_static.c:
        Added maria_checkpoint_disabled
      storage/maria/maria_def.h:
        Added maria_checkpoint_disabled
      storage/xtradb/handler/ha_innodb.cc:
        Added handlerton call to disable checkpoints.
      storage/xtradb/include/log0log.h:
        Added option to log_checkpoint() to allow one to ignore not critical checkpoints during the time checkpoints are disabled.
      storage/xtradb/log/log0log.c:
        Added code to allow one to disable checkpoints during a FLUSH TABLES ... DISABLE CHECKPOINT
        This was done by adding a new argument to log_checkpoint() which tells us when the checkpoint is called by srv_master_thread (which are safe to ignore)
      storage/xtradb/srv/srv0srv.c:
        Tell log_checkpoint() that checkpoints from srv_master_thread() are safe to ignore (will just delay recovery time a bit).
      138cbb87
    • unknown's avatar
      Fix LP BUG#718593 · 32bfdefe
      unknown authored
      Analysis:
      Build_equal_items_for_cond() rewrites the WHERE clause in such a way,
      that it may merge the list join->cond_equal->current_level with the
      list of child Items in an AND condition of the WHERE clause.
      
      The place where this is done is:
      static COND *build_equal_items_for_cond(THD *thd, COND *cond,
                                              COND_EQUAL *inherited)
      {
        ...
            if (and_level)
          {
            args->concat(&eq_list);
            args->concat((List<Item> *)&cond_equal.current_level);
          }
        ...
      }
      
      As a result, later transformations on the WHERE clause may change the
      structure of the list join->cond_equal->current_level without knowing this.
      
      Specifically in this bug, Item_in_subselect::inject_in_to_exists_cond
      creates a new AND of the old WHERE clause and the IN->EXISTS conditions.
      It then calls fix_fields() for the new AND. Among other things, fix_fields
      flattens all nested ANDs into one by merging the AND argument lists.
      
      When there is a cond_equal for the JOIN, its list of Item_equal objects
      is attached to the end of the original AND. When a lower-level AND is
      merged into the top-level one, the argument list of the lower-level AND
      is concatenated to the list of multiple equalities in the upper-level AND.
      
      As a result, when substitute_for_best_equal_field processes the 
      multiple equalities, it turns out that the multiple equality list contains
      the Items from the lower-level AND which were concatenated to the end of
      the join->cond_equal->current_level list. This results in a crash because
      this list must not contain any other Items except for the previously found
      Item_equal ones.
      
      Solution:
      When performing IN->EXIST predicate injection, and the where clause is an
      AND, detach the list of Item_equal objects before calling fix_fields on
      the injected where clause.
      
      After fix_fields is done, reattach back the multiple equalities list to
      the end of the argument list of the new AND.
      32bfdefe
  8. 27 Apr, 2011 3 commits
    • Igor Babaev's avatar
      Fixed LP bug #754521. · ad250abc
      Igor Babaev authored
      The function test_quick_select by mistake did not update the value
      of table->quick_condition_rows for index intersection scans though
      the specification explicitly required to do so from any table access
      plan once the plan provided a better upper bound for the number of
      rows selected from the table. It resulted in a bogus, usually very
      big number saved as the cost of the table access. This, in its turn,
      in many cases forced the optimizer to make a bad choice of the
      execution plan for join queries.
      ad250abc
    • Igor Babaev's avatar
      Merge · 5c078ceb
      Igor Babaev authored
      5c078ceb
    • Igor Babaev's avatar
      Fixed LP bugs #717577, #724942. · 1a18998c
      Igor Babaev authored
      Both these two bugs happened due to the following problem.
      When a view column is referenced in the query an Item_direct_view_ref
      object is created that is refers to the Item_field for the column.
      All references to the same view column refer to the same Item_field.
      Different references can belong to different AND/OR levels and,
      as a result, can be included in different Item_equal object.
      These Item_equal objects may include different constant objects.
      If these constant objects are substituted for the Item_field created
      for a view column we have a conflict situation when the second
      substitution annuls the first substitution. This leads to
      wrong result sets returned by the query. Bug #724942 demonstrates
      such an erroneous behaviour.
      Test case of the bug #717577 produces wrong result sets because best
      equal fields of the multiple equalities built for different OR levels
      of the WHERE condition differs. The subsitution for the best equal field
      in the second OR branch overwrites the the substitution made for the
      first branch.
      
      To avoid such conflicts we have to substitute for the references
      to the view columns rather than for the underlying field items.
      To make such substitutions possible we have to include into
      multiple equalities references to view columns rather than 
      field items created for such columns.
      
      This patch modifies the Item_equal class to include references
      to view columns into multiple equality objects. It also performs
      a clean up of the class methods and adds more comments. The methods
      of the Item_direct_view_ref class that assist substitutions for
      references to view columns has been also added by this patch.
      1a18998c
  9. 20 Apr, 2011 3 commits
    • Igor Babaev's avatar
      Fixed LP bug #752353. · 1474a17f
      Igor Babaev authored
      In some cases the field max_part_no of the SEL_ARG structure
      was not initialized. That triggered a Valgrind complain.
      1474a17f
    • unknown's avatar
      Fix LP BUG#715069 · c27c6d0b
      unknown authored
      Corrected PBXT test results (explains).
      c27c6d0b
    • unknown's avatar
      Fix LP BUG#715069 · 4f3bffa1
      unknown authored
      Analysis:
      The wrong result is a consquence of sorting the subquery
      result and then selecting only the first row due to the
      artificial LIMIT 1 introduced by the fix_fields phase.
      Normally, if there is an ORDER BY in a subquery, the ORDER
      is removed (Item_in_subselect::select_in_like_transformer),
      however if a GROUP BY is transformed into ORDER, this happens
      later, after the removal of the ORDER clause of subqueries, so
      we end up with a subquery with an ORDER clause, and an artificially
      added LIMIT 1.
      
      The reason why the same works in the main 5.3 without MWL#89, is
      that the 5.3 performs all subquery transformations, including
      IN->EXISTS before JOIN::optimize(). The beginning of JOIN::optimize
      does:
        if (having || (select_options & OPTION_FOUND_ROWS))
          select_limit= HA_POS_ERROR;
      which sets the limit back to infinity, thus 5.3 sorts the whole
      subquery result, and IN performs the lookup into all subquery result
      rows.
      
      Solution:
      Sorting of subqueries without LIMIT is meaningless. Since LIMIT in
      subqueries is not supported, the patch removes sorting by setting
        join->skip_sort_order= true
      for each subquery JOIN object. This improves a number of execution
      plans to not perform unnecessary sorting at all.
      4f3bffa1
  10. 19 Apr, 2011 1 commit
    • Sergei Golubchik's avatar
      lp:730035 Handlersocket does not load · ee4f28b0
      Sergei Golubchik authored
      -fimplicit-termplates must be in CXXFLAGS not in handlersocket_la_CXXFLAGS.
      otehrwise automake puts it in the command line too early to override
      global -fno-implicit-templates
      ee4f28b0
  11. 14 Apr, 2011 2 commits
  12. 12 Apr, 2011 1 commit
  13. 11 Apr, 2011 2 commits
  14. 08 Apr, 2011 5 commits
  15. 07 Apr, 2011 6 commits
  16. 04 Apr, 2011 1 commit