1. 01 Mar, 2011 1 commit
    • unknown's avatar
      MWL#89 · ba7de885
      unknown authored
      Merge MWL#89 with 5.3.
      
      ba7de885
  2. 23 Feb, 2011 1 commit
    • Michael Widenius's avatar
      Fixed compiler warnings and some test failures found by buildbot · e4a65e43
      Michael Widenius authored
      
      dbug/dbug.c:
        Fixed compiler warnings on windows
      mysql-test/r/index_intersect_innodb.result:
        Don't print number of rows as this varies
      mysql-test/suite/funcs_1/r/processlist_val_no_prot.result:
        Update to use new State
      mysql-test/suite/handler/heap.result:
        Update results
      mysql-test/suite/handler/heap.test:
        Changed key used in test as the key 'b' will not guarantee order of the two last elements (as the key value is the same)
      mysql-test/suite/pbxt/r/lock_multi.result:
        Update to use new State
      mysql-test/t/index_intersect.test:
        Don't print number of rows as this varies
      mysql-test/valgrind.supp:
        Added suppression for linux
      mysys/hash.c:
        Fixed compiler warnings on windows
      plugin/handler_socket/handlersocket/database.cpp:
        Fixed compiler warnings
      sql-common/client_plugin.c:
        Changed variable to define to avoid compiler warnings when variable is not used
      sql-common/my_time.c:
        Initialize all my_time elements to avoid compiler warnings
      storage/oqgraph/ha_oqgraph.cc:
        Use right function (to avoid compiler warning)
      storage/pbxt/src/table_xt.cc:
        Initialize variables (to avoid compiler warnings)
      e4a65e43
  3. 22 Feb, 2011 3 commits
  4. 21 Feb, 2011 2 commits
  5. 20 Feb, 2011 1 commit
    • Michael Widenius's avatar
      Added HandlerSocket plugin · 50d1833c
      Michael Widenius authored
      - Fixed compiler errors
      - Modified Makefiles to be part of plugin directory
      - Some minor changes in database.cpp to use the new MariaDB handler interface
      50d1833c
  6. 19 Feb, 2011 4 commits
  7. 18 Feb, 2011 4 commits
    • Vladislav Vaintroub's avatar
    • Vladislav Vaintroub's avatar
      Linker error, missing extern "C" for mi_killed. · 9ba92060
      Vladislav Vaintroub authored
      Fix is to move extern "C" at the start of header file.
      9ba92060
    • Michael Widenius's avatar
      Merge with bugfix · 003f8da2
      Michael Widenius authored
      sql/multi_range_read.cc:
        Added printing of error if something goes wrong in get_next()
        (Not critical for this bug fix, but this was something that I noticed while testing and found missing)
      storage/myisam/mi_rkey.c:
        Fixed wrong error number in mi_yield_and_check_if_killed()
      003f8da2
    • Michael Widenius's avatar
      Fix for lp:711565 "Index Condition Pushdown can make a thread hold MyISAM... · f09388fa
      Michael Widenius authored
      Fix for lp:711565 "Index Condition Pushdown can make a thread hold MyISAM locks as well as be unKILLable for long time"
      - In Maria/MyISAM: Release/re-acquire locks to give queries that wait on them a chance to make progress
      - In Maria/MyISAM: Change from numeric constants to ICP_RES values.
      - In Maria: Do check index condition in maria_rprev() (was lost in the merge/backport?)
      - In Maria/MyISAM/XtraDB: Check if the query was killed, and return immediately if it was.
      
      Added new storage engine error: HA_ERR_ABORTED_BY_USER, for handler to signal that it detected a kill of the query and aborted
      
      Authors: Sergey Petrunia & Monty
      
      include/my_base.h:
        Added HA_ERR_ABORTED_BY_USER, for handler to signal that it detected a kill of the query and aborted
      include/my_handler.h:
        Added comment
      mysql-test/r/myisam_icp.result:
        Updated test
      mysql-test/t/myisam_icp.test:
        Drop used tables at start of test
        Added test case that can help with manual testing of killing index condition pushdown query.
      mysys/my_handler_errors.h:
        Text for new storage engine error
      sql/handler.cc:
        If engine got HA_ERR_ABORTED_BY_USER, send kill message.
      sql/multi_range_read.cc:
        Return error code
      storage/maria/ha_maria.cc:
        Added ma_killed_in_mariadb() to detect kill.
        Ensure that file->external_ref points to TABLE object.
      storage/maria/ma_extra.c:
        Dummy test-if-killed for standalone
      storage/maria/ma_key.c:
        If ma_check_index_cond() fails, set my_errno and info->cur_row.lastpos
      storage/maria/ma_rkey.c:
        Release/re-acquire locks to give queries that wait on them a chance to make progress
        Check if the query was killed, and return immediately if it was
      storage/maria/ma_rnext.c:
        Check if the query was killed, and return immediately if it was
        Added missing fast_ma_writeinfo(info)
      storage/maria/ma_rnext_same.c:
        Check if the query was killed, and return immediately if it was
        Added missing fast_ma_writeinfo(info)
      storage/maria/ma_rprev.c:
        Check if the query was killed, and return immediately if it was
        Added missing fast_ma_writeinfo(info) and ma_check_index_cond()
      storage/maria/ma_search.c:
        Give error message if we find a wrong key
      storage/maria/ma_static.c:
        Added pointer to test-if-killed function
      storage/maria/maria_def.h:
        New prototypes
      storage/myisam/ha_myisam.cc:
        Added mi_killed_in_mariadb()
        Ensure that file->external_ref points to TABLE object.
      storage/myisam/mi_extra.c:
        Dummy test-if-killed for standalone
      storage/myisam/mi_key.c:
        If ma_check_index_cond() fails, set my_errno and info->lastpos
      storage/myisam/mi_rkey.c:
        Ensure that info->lastpos= HA_OFFSET_ERROR in case of error
        Release/re-acquire locks to give queries that wait on them a chance to make progress
        Check if the query was killed, and return immediately if it was
        Reorder code to do less things in case of error.
        Added missing fast_mi_writeinfo()
      storage/myisam/mi_rnext.c:
        Check if the query was killed, and return immediately if it was
        Simplify old ICP code
        Added missing fast_ma_writeinfo(info)
      storage/myisam/mi_rnext_same.c:
        Check if the query was killed, and return immediately if it was
        Added missing fast_mi_writeinfo(info)
      storage/myisam/mi_rprev.c:
        Check if the query was killed, and return immediately if it was
        Simplify error handling of ICP
        Added missing fast_mi_writeinfo(info)
      storage/myisam/mi_search.c:
        Give error message if we find a wrong key
      storage/myisam/mi_static.c:
        Added pointer to test-if-killed function
      storage/myisam/myisamdef.h:
        New prototypes
      storage/xtradb/handler/ha_innodb.cc:
        Added DB_SEARCH_ABORTED_BY_USER and ha_innobase::is_thd_killed()
        Check if the query was killed, and return immediately if it was
      storage/xtradb/handler/ha_innodb.h:
        Added prototype
      storage/xtradb/include/db0err.h:
        Added DB_SEARCH_ABORTED_BY_USER
      storage/xtradb/include/row0mysql.h:
        Added possible ICP errors
      storage/xtradb/row/row0sel.c:
        Use ICP errors instead of constants.
        Detect if killed and return B_SEARCH_ABORTED_BY_USER
      f09388fa
  8. 15 Feb, 2011 1 commit
    • unknown's avatar
      Fix for LP BUG#714808 and LP BUG#719280. · 880301c0
      unknown authored
      The patch also adjusts several instable test results
      to order the result.
      
      Analysis:
      
      The function prev_record_reads() may skip (jump over)
      some query plan nodes where record_count < 1. At the
      same time, even though get_partial_join_cost() uses
      all first N plan nodes after the last constant table,
      it may produce a smaller record_count than
      prev_record_reads(), because the record count for
      some plan nodes may be < 1, and these nodes may not
      participate in prev_record_reads.
      
      Solution:
      The current solution is to treat the result of
      get_partial_join_cost() as the upper bound for the
      total number of unique lookup keys.
      880301c0
  9. 14 Feb, 2011 3 commits
    • unknown's avatar
      Fix LP BUG#718578 · 88ccb087
      unknown authored
      This bug extends the fix for LP BUG#715027 to cover one
      more case of an Item being transformed, and its property
      Item::with_subselect not being updated because
      quick_fix_fields doesn't recalculate any properties.
      88ccb087
    • unknown's avatar
      MWL#89 · 85ed2a1d
      unknown authored
      Adjusted test results.
      85ed2a1d
    • unknown's avatar
      LP BUG#715027 · 9102d5db
      unknown authored
      Adjusted test results of EXPLAIN EXTENDED where complex
      and conditions are flattened as a result of calling
      fix_fields instead of quick_fix_field.
      9102d5db
  10. 13 Feb, 2011 1 commit
    • unknown's avatar
      Fix LP BUG#715027 · efeebcc5
      unknown authored
      Analysis:
      Before calling:
        write_record= (select->skip_record(thd) > 0);
      the function find_all_keys needs to restore the original read/write
      sets of the table that is sorted if the condition select->cond
      contains a subquery.
      
      This didn't happen in this test case because the flag "with_subselect"
      was not set properly for select->cond.
      
      The reason for the flag not being set properly, was that this condition
      was rewritten by add_cond_and_fix() inside make_join_select() by:
      
            /* Add conditions added by add_not_null_conds(). */
            if (tab->select_cond)
              add_cond_and_fix(thd, &tmp, tab->select_cond);
      
      However, the function add_cond_and_fix() called the shortcut method
      Item::quick_fix_field() that didn't update the "with_subselect"
      property.
      
      Solution:
      Call the complete Item::fix_fields() to update all Item properties,
      including "with_subselect".
      efeebcc5
  11. 12 Feb, 2011 4 commits
  12. 11 Feb, 2011 2 commits
    • unknown's avatar
      Fix LP BUG#715034 · ef70debb
      unknown authored
      Analysis:
      The failed assert is a result of calling Item_sum_distinct::clear()
      on an incomplete object for which Item_sum_distinct::setup() was
      not yet called.
      
      The reason is that JOIN::exec for the outer query calls JOIN::reinit()
      for all its subqueries, which in turn calls clear() for all aggregate
      functions of the subqueries. The call stack is:
      mysql_explain_union -> mysql_select -> JOIN::exec -> select_desribe ->
      mysql_explain_union -> mysql_select -> JOIN::reinit
      
      This assert doesn't fail in the main 5.3 because constant subqueries
      are being executed during the optimize phase of the outer query,
      thus the Unique object is created before calling JOIN::exec for the
      outer query, and Item_sum_distinct::clear() actually cleans the
      Unique object.
      
      Solution:
      The best solution is the obvious one - substitute the assert with
      a test whether Item_sum_distinct::tree is NULL.
      ef70debb
    • Sergey Petrunya's avatar
      Merge: BUG#716293: "Range checked for each record" is not used if condition... · 3fa4121c
      Sergey Petrunya authored
      Merge: BUG#716293: "Range checked for each record" is not used if condition refers to outside of subquery
      
      3fa4121c
  13. 10 Feb, 2011 4 commits
    • unknown's avatar
      Fix LP BUG#714999 · bb39eb0e
      unknown authored
      Analysis:
      The crash in EXPLAIN resulted from an attempt to print the
      name of the internal temporary table created to compute
      distinct for the innermost subquery of the test case.
      Such tables do not have a corresponding TABLE_LIST (table
      reference), hence the crash. The reason for this was that
      the subquery was executed as part of constant condition
      evaluation before EXPLAIN attempts to print the table name.
      During the subquery execution, the subquery JOIN_TAB and
      its table are substituted by a temporary table in
      make_simple_join.
      
      Solution:
      Similar to the analogous case for other Items than the
      IS NULL function, do not evaluate expensive constant
      conditions.
      bb39eb0e
    • unknown's avatar
      MWL#89 · 15da3d8b
      unknown authored
      Fixed LP BUG#714808 Assertion `outer_lookup_keys <= outer_record_count'
      
      Analysis:
      
      The function best_access_path() computes the number or records as
      follows:
      
      ...
            if (rec < MATCHING_ROWS_IN_OTHER_TABLE)
              rec= MATCHING_ROWS_IN_OTHER_TABLE; // Fix for small tables
      ...
                    if (table->quick_keys.is_set(key))
                      records= (double) table->quick_rows[key];
                    else
                    {
                      /* quick_range couldn't use key! */
                      records= (double) s->records/rec;
                    }
      
      Above MATCHING_ROWS_IN_OTHER_TABLE == 10, and s->records == 1,
      thus we get an estimated 0.1 records. As a result JOIN::get_partial_join_cost()
      for the outer query computes outer_record_count == 0.1 records, which is
      meaningless in this context.
      
      Solution:
      Round row count estimates that are < 1 to 1.
      15da3d8b
    • unknown's avatar
      MWL#89 · ccd69427
      unknown authored
      Fixed a memory leak found by valgrind. The memory leak was
      a result of JOINs corresponding to subselects in a global
      ORDER BY of a UNION not being cleaned up because the
      fake_select of the UNION didn't point down to the subquery
      select.
      ccd69427
    • Sergey Petrunya's avatar
      BUG#716293: "Range checked for each record" is not used if condition refers to outside of subquery · 5991ca2a
      Sergey Petrunya authored
      - Assume that outside subquery references are known when doing "Range-checked-for-each-record" check.
      5991ca2a
  14. 09 Feb, 2011 2 commits
  15. 07 Feb, 2011 1 commit
  16. 06 Feb, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #702403 that caused a crash on the tree for mwl#128 · 847114a2
      Igor Babaev authored
      with the test case added by this patch.
      The bug cannot be reproduced with the same test case for the main
      5.3 tree because the backported fix for bug 59696 masks the 
      problem that causes the crash in the mentioned test case. It's not
      clear weather this fix masks this problem in all possible cases. 
      
      Anyway the patch for bug 698882 introduced some inconsistent data
      structures that could contain indirect references to deleted object.
      It happened when two Item_equal objects were merged and the Item_field
      list of the second object was joined to such list of the first object.
      This operation required adjustment of the backward pointers in 
      Item fields from the joined list. However the adjustment was missing 
      and this caused crashes in the tree for mwl#128.
      
      Now the backward pointers are set only when Item_equal items are
      completely built and are not changed anymore.
       
      847114a2
  17. 05 Feb, 2011 1 commit
    • Igor Babaev's avatar
      Introduced optimizer switch flag 'optimize_join_buffer_size'. · 7208fe97
      Igor Babaev authored
      When this flag is 'off' the size of the used join buffer 
      is taken directly from the system variable 'join_buffer_size'.
      When this flag is 'on' then the size of the buffer depends
      on the estimated number of rows in the partial join whose
      records are to be stored in the buffer.
      By default this flag is set 'on'.
      7208fe97
  18. 03 Feb, 2011 1 commit
    • unknown's avatar
      MWL#89 · 090b4a10
      unknown authored
      Adjusted test cases in accordance with the implementation.
      090b4a10
  19. 01 Feb, 2011 2 commits
    • Vladislav Vaintroub's avatar
      Fix compile errors: · 116ff420
      Vladislav Vaintroub authored
      * declaration in the middle of the block in C file.
      * round() is only available in C99.
      116ff420
    • Igor Babaev's avatar
      Back-ported the patch for bug #59696 from mysql-5.6 code line. · 6867e1b0
      Igor Babaev authored
      The patch fixed the following optimizer defect: when performing
      substitution for best equal fields into where conditions to be
      able to do their evaluations as soon as possible the optimizer 
      skipped conditions over views. That could lead to suboptimal 
      execution of queries that used views.  
      Slightly changed the test case to demonstrate the performance
      improvements if this fix.
      6867e1b0
  20. 29 Jan, 2011 1 commit