1. 08 Jul, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #806510. · 55b0a184
      Igor Babaev authored
      The bug was caused by an incorrect code of the function
      Item_direct_view_ref::replace_equal_field introduced in the
      patch for bugs 717577, 724942. The function erroneously
      returned the wrapped field instead of the Item_direct_view_ref
      object itself in the cases when no replacement happened.
      
      The bug masked two other minor bugs that could result in not
      quite correct output of the EXPLAIN command for some queries.
      They were fixed in the patch as well.
       
      55b0a184
  2. 07 Jul, 2011 5 commits
    • Igor Babaev's avatar
      Merge. · ace927a3
      Igor Babaev authored
      ace927a3
    • Igor Babaev's avatar
      Fixed LP bug #806477. · fc88a8a5
      Igor Babaev authored
      The offending query returns a wrong result set because the optimizer
      erroneously eliminated the where condition evaluated it to TRUE.
      The cause of this wrong transformation was that the flag maybe_null
      for an inner table of the outer join was not set to TRUE after the 
      table had replaced the wrapping view.
      Now the function SELECT_LEX::update_used_tables resets the value
      of the maybe_null flag for each leaf table of the query after all
      merges of views have been done.
      
       
      fc88a8a5
    • unknown's avatar
      Fix bug lp:806943 · 1921ec69
      unknown authored
      Analysis:
      This bug is yet another incarnation of the generic problem
      where optimization of the outer query triggers evaluation
      of a subquery, and this evaluation performs a destructive
      change to the subquery plan. Specifically a temp table is
      created for the DISTINCT operation that replaces the
      original subquery table. Later, select_describe() attempts
      to print the table name, however, there is no corresponding
      TABLE_LIST object to the internal temp table, so we get a
      crash. Execution works fine because it is not interested in
      the corresponding TABLE_LIST object (or its name).
      
      Solution:
      Similar to other such bugs, block the evaluation of expensive
      Items in convert_const_to_int().
      1921ec69
    • Igor Babaev's avatar
      Merge. · e6942033
      Igor Babaev authored
      e6942033
    • Igor Babaev's avatar
      Fixed LP bug #806431. · 44ca8be7
      Igor Babaev authored
      The function generate_derived_keys_for_table incorrectly handled
      the cases when a materialized view or derived table could be accessed
      by different keys on the same fields if these keys depended on the
      same tables.
        
      44ca8be7
  3. 06 Jul, 2011 4 commits
  4. 05 Jul, 2011 6 commits
  5. 04 Jul, 2011 5 commits
    • Sergey Petrunya's avatar
      Change the default @@optimizer_switch setting from · 592cc990
      Sergey Petrunya authored
        semijoin=on,firstmatch=on,loosescan=on
      to
        semijoin=off,firstmatch=off,loosescan=off
      Adjust the testcases:
      - Modify subselect*.test and join_cache.test so that all tests
        use the same execution paths as before (i.e. optimizations that
        are being tested are enabled)
      - Let all other test files run with the new default settings (i.e.
        with new optimizations disabled)
      - Copy subquery testcases from these files into t/subselect_extra.test
        which will run them with new optimizations enabled.
      592cc990
    • Igor Babaev's avatar
      Merge. · 8ba213c1
      Igor Babaev authored
      8ba213c1
    • Michael Widenius's avatar
      Automatic merge · b5e3d8b8
      Michael Widenius authored
      b5e3d8b8
    • unknown's avatar
      Fix LP bug lp:802979 · 764e8018
      unknown authored
      Analysis:
      This bug consists of two related problems that are
      result of too early evaluation of single-row subqueries
      during the optimization phase of the outer query.
      
      Several optimizer code paths try to evaluate single-row
      subqueries in order to produce a constant and use that
      constant for further optimzation.
      
      When the execution of the subquery peforms destructive
      changes to the representation of the subquery, and these
      changes are not anticipated by the subsequent optimization
      phases of the outer query, we tipically get a crash or
      failed assert.
      
      Specifically, in this bug the inner-most suqbuery with
      DISTINCT triggers a substitution of the original JOIN
      object by a single-table JOIN object with a temp table
      needed to perform the DISTINCT operation (created by
      JOIN::make_simple_join).
      
      This substitution breaks EXPLAIN because:
      a) in the first example JOIN::cleanup no longer can
      reach the original table of the innermost subquery, and
      close all indexes, and
      b) in this second test query, EXPLAIN attempts to print
      the name of the internal temp table, and crashes because
      the temp table has no name (NULL pointer instead).
      
      Solution:
      a) fully disable subquery evaluation during optimization
      in all cases - both for constant propagation and range
      optimization, and
      b) change JOIN::join_free() to perform cleanup irrespective
      of EXPLAIN or not.
      764e8018
    • Michael Widenius's avatar
      Aria fixes: · 3293a51b
      Michael Widenius authored
      - Fixed multi-user problem with one thread doing inserts and another doing scans that gave error 175
      - Fixed bug that caused assert in move_to_next_bitmap() & _ma_read_bitmap_page()
      - Much more DBUG_ASSERT(!maria_assert_if_crashed_table) to detect errors early
      - EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere
      
      storage/maria/ma_bitmap.c:
        More secure handling of first_bitmap_with_space (now we also take care of wrong values)
        Don't set page to -1; This fixed unlikely bug that caused assert in move_to_next_bitmap() & _ma_read_bitmap_page()
      storage/maria/ma_blockrec.c:
        More DBUG_ASSERT()'s
        Fixed multi-user problem with one thread doing inserts and another doing scans that gave error 175
        (We should use data_file_length from start of scan, not new value as new bitmap page may not yet be in page cache)
      storage/maria/ma_check.c:
        EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere)
      storage/maria/ma_checkpoint.c:
        Made maria_checkpoint_min_activity static so that one can change it in debugger while testing.
        Fixed long standing performance problem that caused write of state info at checkpoint for any file that was ever changed since open.
      storage/maria/ma_create.c:
        EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere
      storage/maria/ma_dynrec.c:
        Added missing MARIA_EXTERNAL_LOCKING (minor performance improvement)
      storage/maria/ma_locking.c:
        EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere
      storage/maria/ma_open.c:
        EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere
      storage/maria/ma_pagecache.c:
        Added assert to detect reads outside of data file
      storage/maria/maria_def.h:
        Added checkpoint_state to cache state writes in checkpoint
      3293a51b
  6. 03 Jul, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #804686. · 0d4d97b6
      Igor Babaev authored
      The assert conditions in the functions Item_direct_ref_to_ident::transform
      and Item_direct_ref_to_ident::compile could be not valid after constant
      propagation when fields and field references may be substituted for constants.
      Not only these invalid asserts have been removed, but the functions containing
      them have been removed as well because now Item_ref::transform and 
      Item_ref::compile can be used instead of them.
      0d4d97b6
  7. 02 Jul, 2011 2 commits
  8. 01 Jul, 2011 9 commits
    • Michael Widenius's avatar
      Automatic merge · 4a30fd7b
      Michael Widenius authored
      4a30fd7b
    • Michael Widenius's avatar
      Merge with 5.2 · 7d92cfbc
      Michael Widenius authored
      7d92cfbc
    • Michael Widenius's avatar
      Added progress reporting for alter table, LOAD DATA INFILE and for aria... · 16ee2074
      Michael Widenius authored
      Added progress reporting for alter table, LOAD DATA INFILE and for aria tables: check table, repair table, analyze table.
      - The client gets a progress report message that triggers a callback function if requested with mysql_options(MYSQL_PROGRESS_CALLBACK, function)
      - Added Progress field last to 'show processlist'
      - Stage, Max_stage and Progress field added to information_schema.progresslist
      - The 'mysql' client by defaults enables progress reports when the output is a tty.
      - Added progress_report_time time variable to configure how often progress reports is sent to client
      Added read only system variable 'in_transaction' which is 1 if we have executed a BEGIN statement.
      
      
      client/client_priv.h:
        Added OPT_REPORT_PROGRESS
      client/mysql.cc:
        Added option --progress-reports (on by default if not batch mode)
        Progress reports is written to stdout for long running commands
      include/Makefile.am:
        Added mysql/service_progress_report.h
      include/myisamchk.h:
        Added variables to be able to do progress reporting in Aria and later in MyISAM
      include/mysql.h:
        Added new mysql_options() parameter: MYSQL_PROGRESS_CALLBACK
      include/mysql.h.pp:
        Added new mysql_options() parameter: MYSQL_PROGRESS_CALLBACK
      include/mysql/plugin.h:
        Added functions for reporting progress.
      include/mysql/plugin_auth.h.pp:
        Added functions for reporting progress.
      include/mysql_com.h:
        Added CLIENT_PROGRESS mysql_real_connect() flag.
      include/sql_common.h:
        Added callback function for reporting progress
      mysql-test/r/old-mode.result:
        Ensure that SHOW PROGRESSLIST doesn't have the Progress column in old mode.
      mysql-test/suite/funcs_1/datadict/datadict_priv.inc:
        Added new column
      mysql-test/suite/funcs_1/datadict/processlist_priv.inc:
        Test all new PROCESSLIST columns
      mysql-test/suite/funcs_1/r/is_columns_is.result:
        Updated results
      mysql-test/suite/funcs_1/r/is_columns_is_embedded.result:
        Updated results
      mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result:
        Updated results
      mysql-test/suite/funcs_1/r/is_tables_is_embedded.result:
        Updated results
      mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result:
        Updated results
      mysql-test/suite/funcs_1/r/processlist_priv_ps.result:
        Updated results
      mysql-test/suite/funcs_1/r/processlist_val_no_prot.result:
        Updated results
      mysql-test/suite/funcs_1/r/processlist_val_ps.result:
        Updated results
      mysql-test/suite/pbxt/r/pbxt_locking.result:
        Updated results
      mysql-test/suite/pbxt/r/skip_name_resolve.result:
        Updated results
      mysql-test/t/old-mode.test:
        Ensure that SHOW PROGRESSLIST doesn't have the Progress column in old mode.
      plugin/handler_socket/handlersocket/Makefile.am:
        Added -lmysqlservices
      scripts/mytop.sh:
        Made 'State' field width dynamic.
        Added 'Progress' to process list display.
      sql-common/client.c:
        Added handling of progress messages.
        Removed check_license() function.
      sql/mysql_priv.h:
        Added opt_progress_report_time
      sql/mysqld.cc:
        Added progress_report_time time variable to configure how often progress reports is sent to client
      sql/protocol.cc:
        Added net_send_progress_packet()
      sql/protocol.h:
        New prototypes
      sql/set_var.cc:
        Added variables progress_report_time and in_transaction
      sql/sql_acl.cc:
        Safety fix: Made client_capabilities ulonglong
      sql/sql_class.cc:
        Added interface functions for progress reporting
      sql/sql_class.h:
        Added varibles in THD for progress reporting.
        Added CF_REPORT_PROGRESS
      sql/sql_load.cc:
        Added progress reporting for LOAD DATA INFILE
      sql/sql_parse.cc:
        Added CF_REPORT_PROGRESS for top level commands for which it's safe to send progress reports to client
      sql/sql_show.cc:
        Added Progress field last to 'show processlist'
        Stage, Max_stage and Progress field added to information_schema.progresslist
      sql/sql_table.cc:
        Added progress reporting for ALTER TABLE
        Added THD as argument to copy_data_between_tables()
      storage/maria/ha_maria.cc:
        Added progress reporting for check table, repair table, analyze table
        Fixed a bug in start_bulk_insert() that caused alter table to always run with all keys enabled.
      storage/maria/ma_check.c:
        Added progress reporting
        Remember old state before starting repair. This removes some warnings from optimize_table if create-with-sort fails.
      storage/maria/ma_check_standalone.h:
        Added dummy reporting function for standalone Aria programs.
      storage/maria/ma_sort.c:
        Added progress reporting
      storage/maria/maria_chk.c:
        Updated version
      storage/maria/maria_def.h:
        Added new prototypes
      tests/mysql_client_test.c:
        Added test case for progress reporting
      16ee2074
    • Michael Widenius's avatar
      Updated result · a332ea4a
      Michael Widenius authored
      mysql-test/suite/pbxt/r/status.result:
        Updated result file from change in old commit
      a332ea4a
    • Sergey Petrunya's avatar
      Buildbot run fixes: · ceaa3ea0
      Sergey Petrunya authored
      - update suite/pbxt/r/status.result with changes that arise from addition of Handler_tmp_% status variables.
      ceaa3ea0
    • Sergey Petrunya's avatar
      9345318f
    • Sergei Golubchik's avatar
      Added read only system variable 'in_transaction' which tells if there's · a1757e16
      Sergei Golubchik authored
      an active transaction.
      
      fixed a bug - not clearing "in transaction" status on set @@autocommit=1
      a1757e16
    • Sergei Golubchik's avatar
      Removed check_license() function · 67539d85
      Sergei Golubchik authored
      67539d85
    • Igor Babaev's avatar
      Fixed LP bug #803851. · 99aff33d
      Igor Babaev authored
      The function generate_derived_keys_for_table should set the value of
      the number of keys for the derived table to 0 before it starts 
      generating key definitions for the table. It's important as the
      function can be called twice by the optimizer for a derived table
      if the query contains a subquery to which the IN-EXIST transformation
      is applicable.
      
      Fixed a valgrind complain.
      99aff33d
  9. 30 Jun, 2011 2 commits
    • Sergey Petrunya's avatar
      Fix buildbot failures: · 91e5eb19
      Sergey Petrunya authored
      - JOIN::prepare would have set JOIN::table_count to incorrect value (bad merge of MWL 106)
      - optimize_keyuse() would use table-bit as table number
        (the change in optimize_keyuse is also the reason for query plan changes. Not 
         expected to have much effect because only handles cases of no index statistics)
      - st_select_lex::register_dependency_item() ignored the fact that some of the 
        selects on the dependency paths could have been merged to their parents (because they 
        were mergeable VIEWs)
      - Undo the incorrect fix in Item_subselect::recalc_used_tables(): do not call 
        fix_after_pullout() for Item_subselect::Ref_to_outside members. 
      91e5eb19
    • Igor Babaev's avatar
      Fixed LP bug #802845. · d4e9da31
      Igor Babaev authored
      If the expression for a derived table contained a clause LIMIT 0
      SELECT from such derived table incorrectly returned a non-empty set.
      
      Fixed by ensuring JOIN::do_send_rows to be updated after the call
      of st_select_lex_unit::set_limit that sets the value of 
      JOIN::unit->select_limit_cnt.
      d4e9da31
  10. 29 Jun, 2011 5 commits
    • Igor Babaev's avatar
      Fixed LP bug #803410. · 3d002a70
      Igor Babaev authored
      Due to this bug in the function generate_derived_keys_for_table some
      key definitions to access materialized derived tables or materialized
      views were constructed with invalid info for their key parts.
      This could make the server crash when it optimized queries using 
      materialized derived tables or materialized views. 
      3d002a70
    • Michael Widenius's avatar
      Aria bug fixes and improvements: · 8f938e07
      Michael Widenius authored
      - Fixed performance bug in alter table with Aria; Aria didn't use disable keys + enable keys
      - Fixed wrong warning about 'Wrong CRC on datapage' from REPAIR TABLE with aria block tables.
      - Fixed bug in aria_chk that disabled performance counters.
      - Added --translog_buffer_size to maria_read_log.
      
      storage/maria/ha_maria.cc:
        Fixed performance bug in alter table with Aria; Aria didn't use disable keys + enable keys
      storage/maria/ma_bitmap.c:
        Added some DBUG_ASSERT()'s and made code more uniform
      storage/maria/ma_check.c:
        Fixed wrong warning about 'Wrong CRC on datapage' from REPAIR TABLE with aria block tables.
      storage/maria/ma_pagecache.c:
        Copy read pages to buffer even if there was an error (to be able to detect zero filled pages)
      storage/maria/maria_chk.c:
        Fixed bug in aria_chk that disabled performance counters.
      storage/maria/maria_read_log.c:
        Added option to set translog_buffer_size
      8f938e07
    • Sergey Petrunya's avatar
      lp:802965: Crash in do_copy_not_null with semijoin=on in maria-5.3 · 4a634961
      Sergey Petrunya authored
      - The crash was because a NOT NULL table column inside the subquery was considered NULLable
        because the code thought it was on the inner side of an outer join nest.
      - Fixed by making correct distinction between tables inside outer join nests and inside semi-join nests.
      4a634961
    • Sergey Petrunya's avatar
      Merge · ccb2d772
      Sergey Petrunya authored
      ccb2d772
    • Igor Babaev's avatar
      Merge. · 85d1aea2
      Igor Babaev authored
      85d1aea2