1. 02 Jul, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #804515. · 006dedf5
      Igor Babaev authored
      If no index is used to access a materialized derived table or view
      then the value of TABLE_REF::key for this table must be (-1).
      006dedf5
  2. 01 Jul, 2011 9 commits
    • Michael Widenius's avatar
      Automatic merge · 8318ef14
      Michael Widenius authored
      8318ef14
    • Michael Widenius's avatar
      Merge with 5.2 · e063e3fd
      Michael Widenius authored
      e063e3fd
    • Michael Widenius's avatar
      Added progress reporting for alter table, LOAD DATA INFILE and for aria... · 3c78bfe7
      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
      3c78bfe7
    • Michael Widenius's avatar
      Updated result · 62e47b44
      Michael Widenius authored
      mysql-test/suite/pbxt/r/status.result:
        Updated result file from change in old commit
      62e47b44
    • Sergey Petrunya's avatar
      Buildbot run fixes: · 85fb8bb4
      Sergey Petrunya authored
      - update suite/pbxt/r/status.result with changes that arise from addition of Handler_tmp_% status variables.
      85fb8bb4
    • Sergey Petrunya's avatar
      1ecfc955
    • Sergei Golubchik's avatar
      Added read only system variable 'in_transaction' which tells if there's · 5a9ba869
      Sergei Golubchik authored
      an active transaction.
      
      fixed a bug - not clearing "in transaction" status on set @@autocommit=1
      5a9ba869
    • Sergei Golubchik's avatar
      Removed check_license() function · e696da7b
      Sergei Golubchik authored
      e696da7b
    • Igor Babaev's avatar
      Fixed LP bug #803851. · 584954ab
      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.
      584954ab
  3. 30 Jun, 2011 2 commits
    • Sergey Petrunya's avatar
      Fix buildbot failures: · e2eafc3b
      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. 
      e2eafc3b
    • Igor Babaev's avatar
      Fixed LP bug #802845. · 55165f51
      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.
      55165f51
  4. 29 Jun, 2011 6 commits
    • Igor Babaev's avatar
      Fixed LP bug #803410. · bd62c823
      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. 
      bd62c823
    • Michael Widenius's avatar
      Aria bug fixes and improvements: · 5e876bd3
      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
      5e876bd3
    • Sergey Petrunya's avatar
      lp:802965: Crash in do_copy_not_null with semijoin=on in maria-5.3 · f30b4a0d
      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.
      f30b4a0d
    • Sergey Petrunya's avatar
      Merge · 1aede4d1
      Sergey Petrunya authored
      1aede4d1
    • Igor Babaev's avatar
      Merge. · a853c7dd
      Igor Babaev authored
      a853c7dd
    • Igor Babaev's avatar
      Fixed LP bug #802860. · 31edda66
      Igor Babaev authored
      This crashing bug could manifest itself at execution of join queries
      over materialized derived tables with IN subquery predicates in the
      where clause. If for such a query the optimizer chose to use duplicate
      weed-out with duplicates in a materialized derived table and chose to
      employ join cache the the execution could cause a crash of the server.
      It happened because the JOIN_CACHE::init method assumed  that the value
      of TABLE::file::ref is set at the moment when the method was called 
      for the employed join cache. It's true for regular tables, but it's 
      not true for materialized derived tables that are filled now at the
      first access to them, i.e. after the JOIN_CACHE::init has done its job.
      
      To fix this problem for any ROWID field of materialized derived table
      the procedure that copies fields from record buffers into the employed
      join buffer first checks whether the value of TABLE::file::ref has 
      been set for the table, and if it's not so the procedure sets this value.
      31edda66
  5. 28 Jun, 2011 6 commits
    • Sergey Petrunya's avatar
      Remove garbage comment · ff960f43
      Sergey Petrunya authored
      ff960f43
    • Sergey Petrunya's avatar
      Followup to previous commit: · 44931971
      Sergey Petrunya authored
      - Update test results
      - Fix a problem with PS: 
         = convert_subq_to_sj() should not save where to prep_where or on_expr to prep_on_expr.
         = After an unmerged subquery predicate has been pulled, it should call fix_after_pullout() for 
           outer_refs.
      44931971
    • unknown's avatar
      Fixed bug lp:800679 · 78fa331e
      unknown authored
        
      Analysis:
        The failed assert ensured that the choice of subquery strategy
        is performed only for queries with at least one table. If there
        is a LIMIT 0 clause all tables are removed, and the subquery is
        neither optimized, nor executed during actual optimization. However,
        if the query is EXPLAIN-ed, the EXPLAIN execution path doesn't remove
        the query tables if there is a LIMIT 0 clause. As a result, the
        subquery optimization code is called, which violates the ASSERT
        condition.
        
      Solution:
        Transform the assert into a condition, and if the outer query
        has no tables assume that there will be at most one subquery
        execution.
        
        There is potentially a better solution by reengineering the
        EXPLAIN/optimize code, so that subquery optimization is not
        done if not needed. Such a solution would be a lot bigger and
        more complex than a bug fix.
      78fa331e
    • Sergey Petrunya's avatar
      BUG#751484: Valgrind warning / sporadic crash in evaluate_join_record... · 95cba104
      Sergey Petrunya authored
      BUG#751484: Valgrind warning / sporadic crash in evaluate_join_record sql_select.cc:14099 with semijoin
      - Added testcase. The bug is most likely fixed by MWL#90 code.
      95cba104
    • Igor Babaev's avatar
      Merge · 5ce5e8db
      Igor Babaev authored
      5ce5e8db
    • Igor Babaev's avatar
      Fixed LP bug #800535. · 9c4a3ced
      Igor Babaev authored
      The function create_view_field in some cases incorrectly set the maybe_null
      flag for the returned items.
      9c4a3ced
  6. 27 Jun, 2011 12 commits
    • Michael Widenius's avatar
      Automatic merge · 32b3272b
      Michael Widenius authored
      32b3272b
    • Michael Widenius's avatar
      Automatic merge · c7525961
      Michael Widenius authored
      c7525961
    • Sergey Petrunya's avatar
      Test: enable semi-join processing for cases of semi-joins and outer joins,... · 04326c52
      Sergey Petrunya authored
      Test: enable semi-join processing for cases of semi-joins and outer joins, except for the case when the 
      subquery is in the ON clause.
      04326c52
    • Sergey Petrunya's avatar
      a28c8a3c
    • Sergey Petrunya's avatar
      Added TODO comments · 44806426
      Sergey Petrunya authored
      44806426
    • Michael Widenius's avatar
      Added mytop to distribution (with some small trivial changes to make it workg... · c785ed70
      Michael Widenius authored
      Added mytop to distribution (with some small trivial changes to make it workg good also for MariaDB)
      
      scripts/CMakeLists.txt:
        Added mytop
      scripts/Makefile.am:
        Added mytop
      scripts/make_binary_distribution.sh:
        Added mytop
      scripts/make_win_bin_dist:
        Added mytop
      scripts/mytop.sh:
        Added mytop (with some small trivial changes to make it workg good also for MariaDB)
      support-files/mysql.spec.sh:
        Added mytop
      c785ed70
    • Michael Widenius's avatar
      New status variables: Rows_tmp_read, Handler_tmp_update and Handler_tmp_write · ba9a890f
      Michael Widenius authored
      Split status variable Rows_read to Rows_read and Rows_tmp_read so that one can see how much real data is read.
      Same was done with with Handler_update and Handler_write.
      Fixed bug in MEMORY tables where some variables was counted twice.
      Added new internal handler call 'ha_close()' to have one place to gather statistics.
      Fixed bug where thd->open_options was set to wrong value when doing admin_recreate_table()
      
      
      mysql-test/r/status.result:
        Updated test results and added new tests
      mysql-test/r/status_user.result:
        Udated test results
      mysql-test/t/status.test:
        Added new test for temporary table status variables
      sql/ha_partition.cc:
        Changed to call ha_close() instead of close()
      sql/handler.cc:
        Added internal_tmp_table variable for easy checking of temporary tables.
        Added new internal handler call 'ha_close()' to have one place to gather statistics.
        Gather statistics for internal temporary tables.
      sql/handler.h:
        Added handler variables internal_tmp_table, rows_tmp_read.
        Split function update_index_statistics() to two.
        Added ha_update_tmp_row() for faster tmp table handling with more statistics.
      sql/item_sum.cc:
        ha_write_row() -> ha_write_tmp_row()
      sql/multi_range_read.cc:
        close() -> ha_close()
      sql/mysqld.cc:
        New status variables: Rows_tmp_read, Handler_tmp_update and Handler_tmp_write
      sql/opt_range.cc:
        close() -> ha_close()
      sql/sql_base.cc:
        close() -> ha_close()
      sql/sql_class.cc:
        Added handling of rows_tmp_read
      sql/sql_class.h:
        Added new satistics variables.
        rows_read++  ->  update_rows_read() to be able to correctly count reads to internal temp tables.
        Added handler::ha_update_tmp_row()
      sql/sql_connect.cc:
        Added comment
      sql/sql_expression_cache.cc:
        ha_write_row() -> ha_write_tmp_row()
      sql/sql_select.cc:
        close() -> ha_close()
        ha_update_row() -> ha_update_tmp_row()
      sql/sql_show.cc:
        ha_write_row() -> ha_write_tmp_row()
      sql/sql_table.cc:
        Fixed bug where thd->open_options was set to wrong value when doing admin_recreate_table()
      sql/sql_union.cc:
        ha_write_row() -> ha_write_tmp_row()
      sql/sql_update.cc:
        ha_write_row() -> ha_write_tmp_row()
      sql/table.cc:
        close() -> ha_close()
      storage/heap/ha_heap.cc:
        Removed double counting of statistic variables.
        close -> ha_close() to get tmp table statistics.
      storage/maria/ha_maria.cc:
        close -> ha_close() to get tmp table statistics.
      ba9a890f
    • Sergey Petrunya's avatar
      More semi-join + outer-join testcases. · c25728cd
      Sergey Petrunya authored
      c25728cd
    • Michael Widenius's avatar
      Updated version tag to beta · a6542a13
      Michael Widenius authored
      a6542a13
    • Michael Widenius's avatar
      Automatic merge · 2cfbfbac
      Michael Widenius authored
      2cfbfbac
    • Michael Widenius's avatar
      6b2438c0
    • Igor Babaev's avatar
      Fixed LP bug #801536. · cb164640
      Igor Babaev authored
      Ensured valid calculations of the estimates stored in JOIN_TAB::used_fieldlength.
      
      cb164640
  7. 25 Jun, 2011 3 commits
    • Igor Babaev's avatar
      Fixed LP bug #802023. · 77f8874c
      Igor Babaev authored
      Made mergeable views and mergeable derived tables transparent for
      the MIN/MAX optimization.
      77f8874c
    • Igor Babaev's avatar
      Added test cases for LP bug #798625 and LP bug #800085 · c6802021
      Igor Babaev authored
      fixed by the patch for LP bug 798621.
      c6802021
    • Igor Babaev's avatar
      Fixed LP bug #799499. · 37bac085
      Igor Babaev authored
      The following were missing in the patch for mwl106:
      - KEY_PART_INFO::fieldnr were not set for generated keys to access
        tmp tables storing the rows of materialized derived tables/views
      - TABLE_SHARE::column_bitmap_size was not set for tmp tables storing
        the rows of materialized derived tables/views.
      These could cause crashes or memory overwrite.
      
      37bac085
  8. 24 Jun, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #798576. · fb22eb13
      Igor Babaev authored
      If a view/derived table is non-mergeable then the definition of the tmp table
      to store the rows for it is created at the prepare stage. In this case if the
      view definition uses outer joins and a view column belongs to an inner table
      of one of them then the column should be considered as nullable independently
      on nullability of the underlying column. If the underlying column happens to be
      defined as non-nullable then the function create_tmp_field_from_item rather 
      than the function create_tmp_field_from_field should be employed to create
      the definition of the interesting column in the tmp table.
       
      fb22eb13