1. 08 Mar, 2011 2 commits
    • Michael Widenius's avatar
    • unknown's avatar
      Fix LP BUG#719198 · 546a166b
      unknown authored
      Analysis:
      The assert failed because the execution code for
      partial matching is designed with the assumption that
      NULLs on the left side are detected as early as possible,
      and a NULL result is returned before any lookups are
      performed at all.
      
      However, in the case of an Item_cache object on the left
      side, null was not detected properly, because detection
      was done via Item::is_null(), which is not implemented at
      all for Item_cache, and resolved to the default Item::is_null()
      which always returns FALSE.
      
      Solution:
      Use the property Item::null_value instead of is_null(), which
      is properly updated for Item_cache objects as well.
      546a166b
  2. 04 Mar, 2011 3 commits
  3. 03 Mar, 2011 4 commits
    • Sergey Petrunya's avatar
      Merge fix for BUG#693747 · cdd214de
      Sergey Petrunya authored
      cdd214de
    • Sergey Petrunya's avatar
      Merge BUG#707925. · 0e090eaa
      Sergey Petrunya authored
      0e090eaa
    • Sergey Petrunya's avatar
      BUG#707925: Wrong result with join_cache_level=6 optimizer_use_mrr = force (incremental, BKA join) · 8ef094fe
      Sergey Petrunya authored
      - The problem was that Mrr_ordered_index_reader's interrupt_read() and resume_read() would 
        save and restore 1) index tuple  2) the rowid (as bytes returned by handler->position()).  Clustered 
        primary key columns were not saved/restored. 
        They are not explicitly present in the index tuple (i.e. table->key_info[secondary_key].key_parts 
        doesn't list them), but they are actually there, in particular 
        table->field[clustered_primary_key_member].part_of_key(secondary_key) == 1. Index condition pushdown
        code [correctly] uses the latter as inidication that pushed index condition can refer to clustered PK
        members. 
      
        The fix was to make interrupt_read()/resume_read() to save/restore clustered primary key members as well,
        so that we get correct values for them when evaluating pushed index condition.
      [3rd attempt: remove the debugging aids, fix comments in testcase]
      8ef094fe
    • unknown's avatar
      Fix LP BUG#718763 · adce16f9
      unknown authored
      Analysis:
      The reason for the crash was that the inner subquery was executed
      via a scan on a final temporary table applied after all other
      operations. This final operation is implemented by changing the
      contents of the JOIN object of the subquery to represent a table
      scan over the temp table. At the same time query optimization of
      the outer subquery required evaluation of the inner subquery, which
      happened before the actual EXPLAIN. The evaluation left the JOIN
      object of the inner subquery in the changed state, where it represented
      a table scan over a temp table, and EXPLAIN crashed because the temp
      table is not associated with any table reference (TABLE_LIST object).
      The reason the JOIN was not restored was because its saving/restoration
      was controlled by the join->select_lex->uncacheable flag, which was
      not set in the case of materialization.
      
      Solution:
      In the methods Item_in_subselect::[single | row]_value_transformer() set:
          select_lex->uncacheable|= UNCACHEABLE_EXPLAIN;
      In addition, for symmetry, change:
          master_unit->uncacheable|= UNCACHEABLE_EXPLAIN;
      instead of UNCACHEABLE_DEPENDENT because if a subquery was not
      dependent initially, the changed methods do not change this
      fact. The subquery may later become correlated if it is transformed
      to an EXISTS query, but it may stay uncorrelated if executed via
      materialization.
      adce16f9
  4. 02 Mar, 2011 1 commit
    • Sergey Petrunya's avatar
      BUG#693747: Assertion multi_range_read.cc:908: int DsMrr_impl::dsmrr_init · 9faf5452
      Sergey Petrunya authored
      - Make DsMrr_impl::dsmrr_init() handle the case of 
         1. 1st MRR scan using DS-MRR strategy (i.e. doing key sorting and rowid sorting)
         2. 2nd MRR scan getting a buffer that's too small to fit one key element 
            and one rowid element, and so falling back to default MRR implementation
        In this case, dsmrr_init() is invoked with {primary_handler, secondary_handler}
        initialized for DS-MRR scan and have to reset them to be initialized for the
        default MRR scan.
      (attempt 2, with simplified testcase)
      9faf5452
  5. 01 Mar, 2011 2 commits
  6. 28 Feb, 2011 2 commits
    • Sergey Petrunya's avatar
      BUG#724275: Crash in JOIN::optimize in maria-5.3 · 10b8119a
      Sergey Petrunya authored
      - Make equality-substitution-for-ref-access code in JOIN::optimize() treat join_tab->ref.key_copy correctly
        (in the way create_ref_for_key() has filled it).
      10b8119a
    • Igor Babaev's avatar
      Fixed LP bug #725050. · 0f0360e2
      Igor Babaev authored
      The bug in the function print_keyuse() caused crashes if
      hash join could be used. It happened because the function
      ignored the fact that KEYUSE structures could be created
      for hash joins as well. 
      0f0360e2
  7. 27 Feb, 2011 3 commits
    • Igor Babaev's avatar
      Merge. · 1b03a028
      Igor Babaev authored
      1b03a028
    • Igor Babaev's avatar
      Minor corrections. · ed3524c2
      Igor Babaev authored
      sql/mysqld.cc:
        Fixed: optimize_join_buffer_size was missing in the description of possible
        options for the optimizer switch.
      sql/sql_select.cc:
        Fixed: initialization for the field ref_table_rows of the KEYUSE structure was 
        missing (as a result of a lame merge).
      ed3524c2
    • Igor Babaev's avatar
      Merge · d57b1be9
      Igor Babaev authored
      d57b1be9
  8. 26 Feb, 2011 1 commit
  9. 25 Feb, 2011 4 commits
    • Sergey Petrunya's avatar
      Merge of fix for BUG#723822 · 71371a9d
      Sergey Petrunya authored
      71371a9d
    • Sergey Petrunya's avatar
      BUG#723822: Crash in get_constant_key_infix with EXISTS ( SELECT .. DISTINCT ) · 0f265b82
      Sergey Petrunya authored
      - Make get_constant_key_infix() take into account that there may be SEL_TREEs with
        type=SEL_ARG::MAYBE_KEY, which it cannot process, because they are not real ranges
        but rather indications that we might have been able to construct a range if we had
        values for some other tables' fields. 
        (check_quick_select() already has such check)
      0f265b82
    • Michael Widenius's avatar
      automatic merge · 227f1103
      Michael Widenius authored
      227f1103
    • Michael Widenius's avatar
      Fixed compiler warnings · 52b64be3
      Michael Widenius authored
      client/readline.cc:
        Initialize not used variable (to kill wrong compiler warning)
      mysql-test/suite/handler/aria.result:
        Updated test result
      mysql-test/suite/handler/handler.inc:
        Changed index to ensure rows are in a fixed order
      mysql-test/suite/handler/heap.result:
        Updated test result
      mysql-test/suite/handler/innodb.result:
        Updated test result
      mysql-test/suite/handler/myisam.result:
        Updated test result
      plugin/handler_socket/handlersocket/Makefile.am:
        Use CXX flags to compile
      sql/filesort.cc:
        Initialize variable that may be used
      sql/log.cc:
        Initialize not used variable (to kill wrong compiler warning)
      sql/opt_range_mrr.cc:
        Fixed cast to avoid compiler warning
      storage/xtradb/fil/fil0fil.c:
        Added cast to avoid compiler warning
      52b64be3
  10. 24 Feb, 2011 3 commits
    • Sergey Petrunya's avatar
      BUG#724537: innodb_mysql.test fails with --embedded-server · 22e1ee5f
      Sergey Petrunya authored
      - Don't access THD::killed directly from ha_innodb.cc. This is forbidden because 
        THD has different membership (and so, different member offsets) in regular and embedded server.
        Access must be done through thd_killed() function.
      
      - if we're interrupted by the user while in XtraDB, return the proper code.
      
      22e1ee5f
    • Igor Babaev's avatar
      8f4bcdac
    • Igor Babaev's avatar
      BNLH algorithm always used a full table scan over the joined table · 272e5e62
      Igor Babaev authored
      even in the cases when there existed range/index-merge scans that
      were cheaper than the full table scan.
      This was a defect/bug of the implementation of mwl #128. 
      Now hash join can work not only with full table scan of the joined
      table, but also with full index scan, range and index-merge scans.
      Accordingly, in the cases when hash join is used the column 'type'
      in the EXPLAINs can contain now 'hash_ALL', 'hash_index', 'hash_range'
      and 'hash_index_merge'. If hash join is coupled with a range/index_merge
      scan then the columns 'key' and 'key_len' contain info not only on
      the used hash index, but also on the indexes used for the scan.   
      272e5e62
  11. 23 Feb, 2011 2 commits
    • Michael Widenius's avatar
      Fixed build issues · 6c610ed9
      Michael Widenius authored
      - Linking now with g++ instead of gcc with 'compile-dist' to solve problems with handlersocket/client
      - Fixed bug in heap tables when doing handler read next-prev over last row
      
      
      BUILD/compile-dist:
        - Linking now with g++ instead of gcc with 'compile-dist' to solve problems with handlersocket/client
      cmd-line-utils/libedit/vi.c:
        Fixed compiler warning about not checking return value for write
      mysql-test/r/index_intersect.result:
        Updated results (missed this file in my last push)
      mysql-test/suite/handler/aria.result:
        Updated test results
      mysql-test/suite/handler/handler.inc:
        Changed test to use read next/read prev on key where there are duplicates that can come in different order depending on system
        Added testing of read next-prev over last row and read prev-next around first row
      mysql-test/suite/handler/heap.result:
        Updated test results
      mysql-test/suite/handler/init.inc:
        More rows to test
      mysql-test/suite/handler/innodb.result:
        Updated test results
      mysql-test/suite/handler/interface.result:
        Updated test results
      mysql-test/suite/handler/myisam.result:
        Updated test results
      mysql-test/t/variables-big.test:
        Fixed test to not fail on windows
      mysql-test/valgrind.supp:
        Removed not matching fun: to get rid of valgrind warning
      storage/heap/hp_rfirst.c:
        Added state so that we know if we have an active position in the index.
      storage/heap/hp_rkey.c:
        Added state so that we know if we have an active position in the index.
      storage/heap/hp_rnext.c:
        Handle reading several next after finding the last row (this caused a crash before)
      storage/heap/hp_rprev.c:
        Handle reading several prev after finding the first row (this caused a crash before)
      storage/xtradb/buf/buf0buf.c:
        Fixed compiler warning about uninitialized value
      6c610ed9
    • Michael Widenius's avatar
      Fixed compiler warnings and some test failures found by buildbot · 39616eb9
      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)
      39616eb9
  12. 22 Feb, 2011 2 commits
  13. 21 Feb, 2011 2 commits
  14. 20 Feb, 2011 1 commit
    • Michael Widenius's avatar
      Added HandlerSocket plugin · 2c7d6f12
      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
      2c7d6f12
  15. 19 Feb, 2011 4 commits
  16. 18 Feb, 2011 4 commits
    • Vladislav Vaintroub's avatar
    • Vladislav Vaintroub's avatar
      Linker error, missing extern "C" for mi_killed. · e906ffcf
      Vladislav Vaintroub authored
      Fix is to move extern "C" at the start of header file.
      e906ffcf
    • Michael Widenius's avatar
      Merge with bugfix · 2813f568
      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()
      2813f568
    • Michael Widenius's avatar
      Fix for lp:711565 "Index Condition Pushdown can make a thread hold MyISAM... · b12e3796
      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
      b12e3796