An error occurred fetching the project authors.
  1. 05 Aug, 2013 1 commit
  2. 31 Jul, 2013 1 commit
  3. 17 Jul, 2013 1 commit
    • unknown's avatar
      Fix for MDEV-4219 A simple select query returns random data (upstream bug#68473) · 7f87e0c8
      unknown authored
        
      In the case of loose scan used as input for order by, end_send()
      didn't detect correctly that a loose scan was used, and didn't copy
      the non-aggregated fields from the temp table used for ORDER BY.
        
      The fix uses the fact that the quick select used for sorting is
      attached to JOIN::pre_sort_join_tab instead of JOIN::join_tab.
      7f87e0c8
  4. 11 Jul, 2013 1 commit
  5. 10 Jul, 2013 1 commit
    • Alexander Barkov's avatar
      Adding support for MySQL-5.6 temporal column types: · fcccbc1e
      Alexander Barkov authored
        TIME, DATETIME, TIMESTAMP
      
      
      added:
        mysql-test/r/type_temporal_mysql56.result
        mysql-test/std_data/mysql56datetime.MYD
        mysql-test/std_data/mysql56datetime.MYI
        mysql-test/std_data/mysql56datetime.frm
        mysql-test/std_data/mysql56time.MYD
        mysql-test/std_data/mysql56time.MYI
        mysql-test/std_data/mysql56time.frm
        mysql-test/std_data/mysql56timestamp.MYD
        mysql-test/std_data/mysql56timestamp.MYI
        mysql-test/std_data/mysql56timestamp.frm
        mysql-test/suite/rpl/r/rpl_temporal_mysql56.result
        mysql-test/suite/rpl/t/rpl_temporal_mysql56.test
        mysql-test/t/type_temporal_mysql56.test
        sql/compat56.cc
        sql/compat56.h
      modified:
        client/mysqlbinlog.cc
        include/my_time.h
        include/mysql.h.pp
        include/mysql_com.h
        mysql-test/r/statistics.result
        mysql-test/r/strict.result
        mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
        mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
        sql-common/my_time.c
        sql/CMakeLists.txt
        sql/field.cc
        sql/field.h
        sql/item.cc
        sql/item_strfunc.cc
        sql/item_sum.cc
        sql/item_timefunc.cc
        sql/log_event.cc
        sql/opt_range.cc
        sql/opt_table_elimination.cc
        sql/protocol.cc
        sql/rpl_utility.cc
        sql/rpl_utility.h
        sql/sql_partition.cc
        sql/sql_prepare.cc
        sql/sql_select.cc
        sql/sql_table.cc
        sql/table.cc
        storage/perfschema/pfs_engine_table.cc
      fcccbc1e
  6. 15 Jun, 2013 2 commits
  7. 05 Jun, 2013 1 commit
    • Michael Widenius's avatar
      -Run test suite with smaller aria keybuffer size (to make it possible to run... · bd4395c0
      Michael Widenius authored
      -Run test suite with smaller aria keybuffer size (to make it possible to run more tests in parallel)
      -Added test and extra code to ensure we don't leave keyread on for a handler table.
      -Create on disk temporary files always with long data pointers if SQL_SMALL_RESULT is not used. This ensures that we can handle temporary files bigger than 4G.
      
      mysql-test/include/default_mysqld.cnf:
        Run test suite with smaller aria keybuffer size
      mysql-test/suite/maria/maria3.result:
        Run test suite with smaller aria keybuffer size
      mysql-test/suite/sys_vars/r/aria_pagecache_buffer_size_basic.result:
        Run test suite with smaller aria keybuffer size
      sql/handler.cc:
        Disable key read (extra safety if something went wrong)
      sql/multi_range_read.cc:
        Ensure we have don't leave keyread on for secondary_file
      sql/opt_range.cc:
        Simplify code with mark_columns_used_by_index_no_reset()
        Ensure that read_keys_and_merge() disableds keyread if it enables it
      sql/opt_subselect.cc:
        Remove not anymore used argument for create_internal_tmp_table()
      sql/sql_derived.cc:
        Remove not anymore used argument for create_internal_tmp_table()
      sql/sql_select.cc:
        Use 'enable_keyread()' instead of calling HA_EXTRA_RESET. (Makes debugging easier)
        Create on disk temporary files always with long data pointers if SQL_SMALL_RESULT is not used. This ensures that we can handle temporary files bigger than 4G.
        Remove not anymore used argument for create_internal_tmp_table()
        More DBUG
      sql/sql_select.h:
        Remove not anymore used argument for create_internal_tmp_table()
      bd4395c0
  8. 21 May, 2013 1 commit
  9. 14 May, 2013 1 commit
    • Alexey Botchkov's avatar
      MDEV-4521 MBRContains, MBRWithin no longer work with geometries of different type. · 01943901
      Alexey Botchkov authored
              get_mm_leaf function can store all sorts of spatial features in
              one type of field it receives from an Item_field.
              So we just allow that by setting the type of this field to GEOMETRY.
      
      per-file comments:
        mysql-test/r/gis-rtree.result
              result updated
        mysql-test/t/gis-rtree.test
              test case added.
        sql/opt_range.cc
              set geom_type=GEOMETRY if we got Field_geom.
      01943901
  10. 05 May, 2013 1 commit
    • Michael Widenius's avatar
      Fixed errors and compiler warnings found by buildbot · 9c7fc884
      Michael Widenius authored
      Solaris fixes:
      - Fixed that wait_timeout_func and wait_timeout tests works on solaris
      - We have to compile without NO_ALARM on Solaris as Solaris doesn't support timeouts on sockets with setsockopt(.. SO_RCVTIMEO).
      - Fixed that compile-solaris-amd64-debug works (before that we got a wrong ELF class: ELFCLASS64 on linkage)
      - Added missing sync_with_master
      Other bug fixes:
      - Free memory for rpl_global_gtid_binlog_state before exit() to avoid 'accessing uninitalized mutex' error.
      
      
      
      BUILD/FINISH.sh:
        Fixed issues on Solaris with ksh
      BUILD/compile-solaris-amd64-debug:
        Added missing -m64 flag
      configure.cmake:
        We have to compile without NO_ALARM on Solaris as Solaris doesn't support timeouts on sockets with setsockopt(.. SO_RCVTIMEO)
      mysql-test/suite/rpl/t/rpl_gtid_mdev4473.test:
        - Added missing sync_with_master (fix by knielsen)
      sql-common/client.c:
        Added () to get rid of compiler warning
      sql/item_strfunc.cc:
        Fixed compiler warning
      sql/log.cc:
        Free memory for static variable rpl_global_gtid_binlog_state before exit()
        - If we are compiling with safemalloc, we would try to call sf_free() for some members after sf_terminate() was called, which would result of trying to access the uninitalized mutex 'sf_mutex'
      sql/multi_range_read.cc:
        Fixed compiler warnings of converting double to ulong.
      sql/opt_range.cc:
        Fixed compiler warnings of converting double to ulong or uint
        - Better to have all variables that can be number of rows as 'ha_rows'
      sql/rpl_gtid.cc:
        Added rpl_binlog_state::free() to be able to free memory for static objects before exit()
      sql/rpl_gtid.h:
        Added rpl_binlog_state::free() to be able to free memory for static objects before exit()
      sql/set_var.cc:
        Fixed compiler warning
      sql/sql_join_cache.cc:
        Fixed compiler warnings of converting double to uint
      sql/sql_show.cc:
        Added cast to get rid of compiler warning
      sql/sql_statistics.cc:
        Remove code that didn't do anything.
        (store_record() with record[0] is a no-op)
      storage/xtradb/os/os0file.c:
        Added  __attribute__ ((unused))
      support-files/compiler_warnings.supp:
        Ignore warnings from atomic_add_64_nv
        (was not able to fix this with a cast as the macro is a bit different between systems)
      vio/viosocket.c:
        Added more DBUG_PRINT
      9c7fc884
  11. 30 Apr, 2013 1 commit
    • Neeraj Bisht's avatar
      BUG#16222245 - CRASH WITH EXPLAIN FOR A QUERY WITH LOOSE SCAN FOR · 7c63bb21
      Neeraj Bisht authored
      GROUP BY, MYISAM 
      
      Problem:-
      In a query, where we are using loose index scan optimization and 
      we have MIN() causes segmentation fault(where table row length 
      is less then key_length).
      
      Analysis:
      
      While using loose index scan for MIN(), we call key_copy(), to copy 
      the key data from record.
      This function is using temporary record buffer to store key data 
      from the record buffer.But in case where the key length is greater 
      then the buffer length, this will cause a segmentation fault.
      
      
      Solution:
      Give a proper buffer to store a key record.
      
      
      sql/opt_range.cc:
        We can't use record buffer to store key data.So, give a proper buffer to store a key record.
      7c63bb21
  12. 18 Apr, 2013 1 commit
    • unknown's avatar
      MDEV-4345 · 906bcd98
      unknown authored
      Sampling of selectivity of LIKE predicate.
      906bcd98
  13. 16 Apr, 2013 1 commit
    • Igor Babaev's avatar
      Added comments. · 95bdd00c
      Igor Babaev authored
      Renamed the virtual method middle_point_pos for the class Field to
      pos_in_interval.
      95bdd00c
  14. 12 Apr, 2013 1 commit
    • Jorgen Loland's avatar
      Bug#16540042: WRONG QUERY RESULT WHEN USING RANGE OVER · d052f069
      Jorgen Loland authored
                    PARTIAL INDEX
      
      Consider the following table definition:
      
      CREATE TABLE t (
        my_col CHAR(10),
        ...
        INDEX my_idx (my_col(1))
      )
      
      The my_idx index is not able to distinguish between rows with
      equal first-character my_col-values (e.g. "f", "foo", "fee").
      
      Prior to this CS, the range optimizer would translate
      
      "WHERE my_col NOT IN ('f', 'h')" into (optimizer trace syntax)
      
      "ranges": [
        "NULL < my_col < f",
        "f < my_col"
      ]
      
      But this was not correct because the rows with values "foo" 
      and "fee" would not belong to any of those ranges. However, the
      predicate "my_col != 'f' AND my_col != 'h'" would translate
      to 
      
      "ranges": [
        "NULL < my_col"
      ]
      
      because get_mm_leaf() changes from "<" to "<=" for partial
      keyparts. This CS changes the range optimizer implementation 
      for NOT IN to behave like a conjunction of NOT EQUAL: it 
      replaces "<" with "<=" for all but the first range when the
      keypart is partial.
      d052f069
  15. 07 Apr, 2013 1 commit
    • Igor Babaev's avatar
      Fixed bug mdev-4363. · abaca98f
      Igor Babaev authored
      When calculating the selectivity of a range in the function
      get_column_range_cardinality a check whether NULL values are
      included into into the range must be done.
      abaca98f
  16. 06 Apr, 2013 2 commits
  17. 08 Apr, 2013 1 commit
    • unknown's avatar
      If a range tree has a branch that is an expensive constant, · 2c892440
      unknown authored
      currently get_mm_tree skipped the evaluation of this constant
      and icorrectly proceeded. The correct behavior is to return a
      NULL subtree, according to the IF branch being fixed - when it
      evaluates the constant it returns a value, and doesn't continue
      further.
      2c892440
  18. 04 Apr, 2013 2 commits
    • Igor Babaev's avatar
      Fixed bug mdev-4366. · 88dbe1f9
      Igor Babaev authored
      When performing the range analysis for a conjunction the function
      calculate_cond_selectivity_for_table should take in to account that
      the analysis of some conjuncts may return SEL_ARG::IMPOSSIBLE.
      88dbe1f9
    • Igor Babaev's avatar
      Fixed bug mdev-4367. · 3a9667ea
      Igor Babaev authored
      When calculating selectivity of conditions one should take into account
      the cases when some tables to be joined are empty.
      3a9667ea
  19. 03 Apr, 2013 1 commit
    • Igor Babaev's avatar
      Fixed bug mdev-4349. · 14157ad0
      Igor Babaev authored
      Range analysis of the condition for a non-indexed column may
      return an impossible range. This must be taken into account.
      14157ad0
  20. 01 Apr, 2013 1 commit
  21. 31 Mar, 2013 1 commit
  22. 26 Mar, 2013 1 commit
  23. 25 Mar, 2013 1 commit
  24. 20 Mar, 2013 1 commit
  25. 19 Mar, 2013 2 commits
  26. 11 Mar, 2013 1 commit
  27. 25 Feb, 2013 1 commit
  28. 13 Feb, 2013 1 commit
    • unknown's avatar
      Fix for MDEV-4140 · 076507cc
      unknown authored
      Analysis:
      Range analysis detects that the subquery is expensive and doesn't
      build a range access method. Later, the applicability test for loose
      scan doesn't take that into account, and builds a loose scan method
      without a range scan on the min/max column. As a result loose scan
      fetches the first key in each group, rather than the first key that
      satisfies the condition on the min/max column.
      
      Solution:
      Since there is no SEL_ARG tree to be used for the min/max column,
      it is not possible to use loose scan if the min/max column is compared
      with an expensive scalar subquery. Make the test for loose scan
      applicability to be in sync with the range analysis code by testing if
      the min/max argument is compared with an expensive predicate.
      076507cc
  29. 04 Feb, 2013 1 commit
    • unknown's avatar
      Fix for bug MDEV-765 (LP:825075) · 12bd3ddf
      unknown authored
      Analys:
      The cause for the wrong result was that the optimizer
      incorrectly chose min/max loose scan when it is not
      applicable. The applicability test missed the case when
      a condition on the MIN/MAX argument was OR-ed with a
      condition on some other field. In this case, the MIN/MAX
      condition cannot be used for loose scan.
      
      Solution:
      Extend the test check_group_min_max_predicates() to check
      that the WHERE clause is of the form: "cond1 AND cond2"
      where 
        cond1 - does not use min_max_column at all.
        cond2 - is an AND/OR tree with leaves in form "min_max_column $CMP$ const"
                or $CMP$ is one of the functions between, is [not] null
      
      12bd3ddf
  30. 31 Jan, 2013 1 commit
    • unknown's avatar
      Fix bug MDEV-641 · 5bf6f6dd
      unknown authored
      Analysis:
      Range analysis discoveres that the query can be executed via loose index scan for GROUP BY.
      Later, GROUP BY analysis fails to confirm that the GROUP operation can be computed via an
      index because there is no logic to handle duplicate field references in the GROUP clause.
      As a result the optimizer produces an inconsistent plan. It constructs a temporary table,
      but on the other hand the group fields are not set to point there.
          
      Solution:
      Make loose scan analysis work in sync with order by analysis. In the case of duplicate
      columns loose scan will not be applicable. This limitation will be lifted in 10.0 by
      removing duplicate columns.
      5bf6f6dd
  31. 29 Jan, 2013 1 commit
  32. 28 Jan, 2013 1 commit
    • unknown's avatar
      Fix for MDEV-3948, and backport of the following collection of fixes and backports · a056d4f2
      unknown authored
      from MariaDB 10.0.
        
      The bug in mdev-3948 was an instance of the problem fixed by Sergey's patch
      in 10.0 - namely that the range optimizer could change table->[read | write]_set,
      and not restore it.
        
      revno: 3471
      committer: Sergey Petrunya <psergey@askmonty.org>
      branch nick: 10.0-serg-fix-imerge
      timestamp: Sat 2012-11-03 12:24:36 +0400
      message:
        # MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions
        Reconcile the fixes from:
        #
        # guilhem.bichot@oracle.com-20110805143029-ywrzuz15uzgontr0
        # Fix for BUG#12698916 - "JOIN QUERY GIVES WRONG RESULT AT 2ND EXEC. OR
        # AFTER FLUSH TABLES [-INT VS NULL]"
        #
        # guilhem.bichot@oracle.com-20111209150650-tzx3ldzxe1yfwji6
        # Fix for BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET == SAVE_READ_SET
        # and
        #
        and related fixes from: BUG#1006164, MDEV-376:
        
        Now, ROR-merged QUICK_RANGE_SELECT objects make no assumptions about the values
        of table->read_set and table->write_set.
        Each QUICK_ROR_SELECT has (and had before) its own column bitmap, but now, all 
        QUICK_ROR_SELECT's functions that care: reset(), init_ror_merged_scan(), and 
        get_next()  will set table->read_set when invoked and restore it back to what 
        it was before the call before they return.
      
        This allows to avoid the mess when somebody else modifies table->read_set for 
        some reason.
      a056d4f2
  33. 25 Jan, 2013 1 commit
  34. 23 Jan, 2013 1 commit
    • Michael Widenius's avatar
      MDEV-4011 Added per thread memory counting and usage · df7e1237
      Michael Widenius authored
      Base code and idea from a patch from by plinux at Taobao.
      
      The idea is that we mark all memory that are thread specific with MY_THREAD_SPECIFIC.
      Memory counting is done per thread in the my_malloc_size_cb_func callback function from my_malloc().
      There are plenty of new asserts to ensure that for a debug server the counting is correct.
      
      Information_schema.processlist gets two new columns: MEMORY_USED and EXAMINED_ROWS.
      - The later is there mainly to show how query is progressing.
      
      The following changes in interfaces was needed to get this to work:
      - init_alloc_root() amd init_sql_alloc() has extra option so that one can mark memory with MY_THREAD_SPECIFIC
      - One now have to use alloc_root_set_min_malloc() to set min memory to be allocated by alloc_root()
      - my_init_dynamic_array()  has extra option so that one can mark memory with MY_THREAD_SPECIFIC
      - my_net_init() has extra option so that one can mark memory with MY_THREAD_SPECIFIC
      - Added flag for hash_init() so that one can mark hash table to be thread specific.
      - Added flags to init_tree() so that one can mark tree to be thread specific.
      - Removed with_delete option to init_tree(). Now one should instead use MY_TREE_WITH_DELETE_FLAG.
      - Added flag to Warning_info::Warning_info() if the structure should be fully initialized.
      - String elements can now be marked as thread specific.
      - Internal HEAP tables are now marking it's memory as MY_THREAD_SPECIFIC.
      - Changed type of myf from int to ulong, as this is always a set of bit flags.
      
      Other things:
      - Removed calls to net_end() and thd->cleanup() as these are now done in ~THD()
      - We now also show EXAMINED_ROWS in SHOW PROCESSLIST
      - Added new variable 'memory_used'
      - Fixed bug where kill_threads_for_user() was using the wrong mem_root to allocate memory.
      - Removed calls to the obsoleted function init_dynamic_array()
      - Use set_current_thd() instead of my_pthread_setspecific_ptr(THR_THD,...)
      
      
      client/completion_hash.cc:
        Updated call to init_alloc_root()
      client/mysql.cc:
        Updated call to init_alloc_root()
      client/mysqlbinlog.cc:
        init_dynamic_array() -> my_init_dynamic_array()
        Updated call to init_alloc_root()
      client/mysqlcheck.c:
        Updated call to my_init_dynamic_array()
      client/mysqldump.c:
        Updated call to init_alloc_root()
      client/mysqltest.cc:
        Updated call to init_alloc_root()
        Updated call to my_init_dynamic_array()
        Fixed compiler warnings
      extra/comp_err.c:
        Updated call to my_init_dynamic_array()
      extra/resolve_stack_dump.c:
        Updated call to my_init_dynamic_array()
      include/hash.h:
        Added HASH_THREAD_SPECIFIC
      include/heap.h:
        Added flag is internal temporary table.
      include/my_dir.h:
        Safety fix: Ensure that MY_DONT_SORT and MY_WANT_STAT don't interfer with other mysys flags
      include/my_global.h:
        Changed type of myf from int to ulong, as this is always a set of bit flags.
      include/my_sys.h:
        Added MY_THREAD_SPECIFIC and MY_THREAD_MOVE
        Added malloc_flags to DYNAMIC_ARRAY
        Added extra mysys flag argument to my_init_dynamic_array()
        Removed deprecated functions init_dynamic_array() and my_init_dynamic_array.._ci
        Updated paramaters for init_alloc_root()
      include/my_tree.h:
        Added my_flags to allow one to use MY_THREAD_SPECIFIC with hash tables.
        Removed with_delete. One should now instead use MY_TREE_WITH_DELETE_FLAG
        Updated parameters to init_tree()
      include/myisamchk.h:
        Added malloc_flags to allow one to use MY_THREAD_SPECIFIC for checks.
      include/mysql.h:
        Added MYSQL_THREAD_SPECIFIC_MALLOC
        Used 'unused1' to mark memory as thread specific.
      include/mysql.h.pp:
        Updated file
      include/mysql_com.h:
        Used 'unused1' to mark memory as thread specific.
        Updated parameters for my_net_init()
      libmysql/libmysql.c:
        Updated call to init_alloc_root() to mark memory thread specific.
      libmysqld/emb_qcache.cc:
        Updated call to init_alloc_root()
      libmysqld/lib_sql.cc:
        Updated call to init_alloc_root()
      mysql-test/r/create.result:
        Updated results
      mysql-test/r/user_var.result:
        Updated results
      mysql-test/suite/funcs_1/datadict/processlist_priv.inc:
        Update to handle new format of SHOW PROCESSLIST
      mysql-test/suite/funcs_1/datadict/processlist_val.inc:
        Update to handle new format of SHOW PROCESSLIST
      mysql-test/suite/funcs_1/r/is_columns_is.result:
        Update to handle new format of SHOW PROCESSLIST
      mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result:
        Updated results
      mysql-test/suite/funcs_1/r/processlist_val_no_prot.result:
        Updated results
      mysql-test/t/show_explain.test:
        Fixed usage of debug variable so that one can run test with --debug
      mysql-test/t/user_var.test:
        Added test of memory_usage variable.
      mysys/array.c:
        Added extra my_flags option to init_dynamic_array() and init_dynamic_array2() so that one can mark memory with MY_THREAD_SPECIFIC
        All allocated memory is marked with the given my_flags.
        Removed obsolete function init_dynamic_array()
      mysys/default.c:
        Updated call to init_alloc_root()
        Updated call to my_init_dynamic_array()
      mysys/hash.c:
        Updated call to my_init_dynamic_array_ci().
        Allocated memory is marked with MY_THREAD_SPECIFIC if HASH_THREAD_SPECIFIC is used.
      mysys/ma_dyncol.c:
        init_dynamic_array() -> my_init_dynamic_array()
        Added #if to get rid of compiler warnings
      mysys/mf_tempdir.c:
        Updated call to my_init_dynamic_array()
      mysys/my_alloc.c:
        Added extra parameter to init_alloc_root() so that one can mark memory with MY_THREAD_SPECIFIC
        Extend MEM_ROOT with a flag if memory is thread specific.
        This is stored in block_size, to keep the size of the MEM_ROOT object identical as before.
        Allocated memory is marked with MY_THREAD_SPECIFIC if used with init_alloc_root()
      mysys/my_chmod.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_chsize.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_copy.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_create.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_delete.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_error.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_fopen.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_fstream.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_getwd.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_lib.c:
        Updated call to init_alloc_root()
        Updated call to my_init_dynamic_array()
        Updated DBUG_PRINT because of change of myf type
      mysys/my_lock.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_malloc.c:
        Store at start of each allocated memory block the size of the block and if the block is thread specific.
        Call malloc_size_cb_func, if set, with the memory allocated/freed.
        Updated DBUG_PRINT because of change of myf type
      mysys/my_open.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_pread.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_read.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_redel.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_rename.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_seek.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_sync.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/my_thr_init.c:
        Ensure that one can call my_thread_dbug_id() even if thread is not properly initialized.
      mysys/my_write.c:
        Updated DBUG_PRINT because of change of myf type
      mysys/mysys_priv.h:
        Updated parameters to sf_malloc and sf_realloc()
      mysys/safemalloc.c:
        Added checking that for memory marked with MY_THREAD_SPECIFIC that it's the same thread that is allocation and freeing the memory.
        Added sf_malloc_dbug_id() to allow MariaDB to specify which THD is handling the memory.
        Added my_flags arguments to sf_malloc() and sf_realloc() to be able to mark memory with MY_THREAD_SPECIFIC.
        Added sf_report_leaked_memory() to get list of memory not freed by a thread.
      mysys/tree.c:
        Added flags to init_tree() so that one can mark tree to be thread specific.
        Removed with_delete option to init_tree(). Now one should instead use MY_TREE_WITH_DELETE_FLAG.
        Updated call to init_alloc_root()
        All allocated memory is marked with the given malloc flags
      mysys/waiting_threads.c:
        Updated call to my_init_dynamic_array()
      sql-common/client.c:
        Updated call to init_alloc_root() and my_net_init() to mark memory thread specific.
        Updated call to my_init_dynamic_array().
        Added MYSQL_THREAD_SPECIFIC_MALLOC so that client can mark memory as MY_THREAD_SPECIFIC.
      sql-common/client_plugin.c:
        Updated call to init_alloc_root()
      sql/debug_sync.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      sql/event_scheduler.cc:
        Removed calls to net_end() as this is now done in ~THD()
        Call set_current_thd() to ensure that memory is assigned to right thread.
      sql/events.cc:
        my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
      sql/filesort.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      sql/filesort_utils.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      sql/ha_ndbcluster.cc:
        Updated call to init_alloc_root()
        Updated call to my_net_init()
        Removed calls to net_end() and thd->cleanup() as these are now done in ~THD()
      sql/ha_ndbcluster_binlog.cc:
        Updated call to my_net_init()
        Updated call to init_sql_alloc()
        Removed calls to net_end() and thd->cleanup() as these are now done in ~THD()
      sql/ha_partition.cc:
        Updated call to init_alloc_root()
      sql/handler.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
        Added missing call to my_dir_end()
      sql/item_func.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      sql/item_subselect.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      sql/item_sum.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      sql/log.cc:
        More DBUG
        Updated call to init_alloc_root()
      sql/mdl.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      sql/mysqld.cc:
        Added total_memory_used
        Updated call to init_alloc_root()
        Move mysql_cond_broadcast() before my_thread_end()
        Added mariadb_dbug_id() to count memory per THD instead of per thread.
        Added my_malloc_size_cb_func() callback function for my_malloc() to count memory.
        Move initialization of mysqld_server_started and mysqld_server_initialized earlier.
        Updated call to my_init_dynamic_array().
        Updated call to my_net_init().
        Call my_pthread_setspecific_ptr(THR_THD,...) to ensure that memory is assigned to right thread.
        Added status variable 'memory_used'.
        Updated call to init_alloc_root()
        my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
      sql/mysqld.h:
        Added set_current_thd()
      sql/net_serv.cc:
        Added new parameter to my_net_init() so that one can mark memory with MY_THREAD_SPECIFIC.
        Store in net->thread_specific_malloc if memory is thread specific.
        Mark memory to be thread specific if requested.
      sql/opt_range.cc:
        Updated call to my_init_dynamic_array()
        Updated call to init_sql_alloc()
        Added MY_THREAD_SPECIFIC to allocated memory.
      sql/opt_subselect.cc:
        Updated call to init_sql_alloc() to mark memory thread specific.
      sql/protocol.cc:
        Fixed compiler warning
      sql/records.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      sql/rpl_filter.cc:
        Updated call to my_init_dynamic_array()
      sql/rpl_handler.cc:
        Updated call to my_init_dynamic_array2()
      sql/rpl_handler.h:
        Updated call to init_sql_alloc()
      sql/rpl_mi.cc:
        Updated call to my_init_dynamic_array()
      sql/rpl_tblmap.cc:
        Updated call to init_alloc_root()
      sql/rpl_utility.cc:
        Updated call to my_init_dynamic_array()
      sql/slave.cc:
        Initialize things properly before calling functions that allocate memory.
        Removed calls to net_end() as this is now done in ~THD()
      sql/sp_head.cc:
        Updated call to init_sql_alloc()
        Updated call to my_init_dynamic_array()
        Added parameter to warning_info() that it should be fully initialized.
      sql/sp_pcontext.cc:
        Updated call to my_init_dynamic_array()
      sql/sql_acl.cc:
        Updated call to init_sql_alloc()
        Updated call to my_init_dynamic_array()
        my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
      sql/sql_admin.cc:
        Added parameter to warning_info() that it should be fully initialized.
      sql/sql_analyse.h:
        Updated call to init_tree() to mark memory thread specific.
      sql/sql_array.h:
        Updated call to my_init_dynamic_array() to mark memory thread specific.
      sql/sql_audit.cc:
        Updated call to my_init_dynamic_array()
      sql/sql_base.cc:
        Updated call to init_sql_alloc()
        my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
      sql/sql_cache.cc:
        Updated comment
      sql/sql_class.cc:
        Added parameter to warning_info() that not initialize it until THD is fully created.
        Updated call to init_sql_alloc()
        Mark THD::user_vars has to be thread specific.
        Updated call to my_init_dynamic_array()
        Ensure that memory allocated by THD is assigned to the THD.
        More DBUG
        Always acll net_end() in ~THD()
        Assert that all memory signed to this THD is really deleted at ~THD.
        Fixed set_status_var_init() to not reset memory_used.
        my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
      sql/sql_class.h:
        Added MY_THREAD_SPECIFIC to allocated memory.
        Added malloc_size to THD to record allocated memory per THD.
      sql/sql_delete.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      sql/sql_error.cc:
        Added 'initialize' parameter to Warning_info() to say if should allocate memory for it's structures.
        This is used by THD::THD() to not allocate memory until THD is ready.
        Added Warning_info::free_memory()
      sql/sql_error.h:
        Updated Warning_info() class.
      sql/sql_handler.cc:
        Updated call to init_alloc_root() to mark memory thread specific.
      sql/sql_insert.cc:
        More DBUG
      sql/sql_join_cache.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      sql/sql_lex.cc:
        Updated call to my_init_dynamic_array()
      sql/sql_lex.h:
        Updated call to my_init_dynamic_array()
      sql/sql_load.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      sql/sql_parse.cc:
        Removed calls to net_end() and thd->cleanup() as these are now done in ~THD()
        Ensure that examined_row_count() is reset before query.
        Fixed bug where kill_threads_for_user() was using the wrong mem_root to allocate memory.
        my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
        Don't restore thd->status_var.memory_used when restoring thd->status_var
      sql/sql_plugin.cc:
        Updated call to init_alloc_root()
        Updated call to my_init_dynamic_array()
        Don't allocate THD on the stack, as this causes problems with valgrind when doing thd memory counting.
        my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
      sql/sql_prepare.cc:
        Added parameter to warning_info() that it should be fully initialized.
        Updated call to init_sql_alloc() to mark memory thread specific.
      sql/sql_reload.cc:
        my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
      sql/sql_select.cc:
        Updated call to my_init_dynamic_array() and init_sql_alloc() to mark memory thread specific.
        Added MY_THREAD_SPECIFIC to allocated memory.
        More DBUG
      sql/sql_servers.cc:
        Updated call to init_sql_alloc() to mark memory some memory thread specific.
        my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
      sql/sql_show.cc:
        Updated call to my_init_dynamic_array()
        Mark my_dir() memory thread specific.
        Use my_pthread_setspecific_ptr(THR_THD,...) to mark that allocated memory should be allocated to calling thread.
        More DBUG.
        Added malloc_size and examined_row_count to SHOW PROCESSLIST.
        Added MY_THREAD_SPECIFIC to allocated memory.
        Updated call to init_sql_alloc()
        Added parameter to warning_info() that it should be fully initialized.
      sql/sql_statistics.cc:
        Fixed compiler warning
      sql/sql_string.cc:
        String elements can now be marked as thread specific.
      sql/sql_string.h:
        String elements can now be marked as thread specific.
      sql/sql_table.cc:
        Updated call to init_sql_alloc() and my_malloc() to mark memory thread specific
        my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
        Fixed compiler warning
      sql/sql_test.cc:
        Updated call to my_init_dynamic_array() to mark memory thread specific.
      sql/sql_trigger.cc:
        Updated call to init_sql_alloc()
      sql/sql_udf.cc:
        Updated call to init_sql_alloc()
        my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
      sql/sql_update.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      sql/table.cc:
        Updated call to init_sql_alloc().
        Mark memory used by temporary tables, that are not for slave threads, as MY_THREAD_SPECIFIC
        Updated call to init_sql_alloc()
      sql/thr_malloc.cc:
        Added my_flags argument to init_sql_alloc() to be able to mark memory as MY_THREAD_SPECIFIC.
      sql/thr_malloc.h:
        Updated prototype for init_sql_alloc()
      sql/tztime.cc:
        Updated call to init_sql_alloc()
        Updated call to init_alloc_root() to mark memory thread specific.
        my_pthread_setspecific_ptr(THR_THD,...) -> set_current_thd()
      sql/uniques.cc:
        Updated calls to init_tree(), my_init_dynamic_array() and my_malloc() to mark memory thread specific.
      sql/unireg.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      storage/csv/ha_tina.cc:
        Updated call to init_alloc_root()
      storage/federated/ha_federated.cc:
        Updated call to init_alloc_root()
        Updated call to my_init_dynamic_array()
        Ensure that memory allocated by fedarated is registered for the system, not for the thread.
      storage/federatedx/federatedx_io_mysql.cc:
        Updated call to my_init_dynamic_array()
      storage/federatedx/ha_federatedx.cc:
        Updated call to init_alloc_root()
        Updated call to my_init_dynamic_array()
      storage/heap/ha_heap.cc:
        Added MY_THREAD_SPECIFIC to allocated memory.
      storage/heap/heapdef.h:
        Added parameter to hp_get_new_block() to be able to do thread specific memory tagging.
      storage/heap/hp_block.c:
        Added parameter to hp_get_new_block() to be able to do thread specific memory tagging.
      storage/heap/hp_create.c:
        - Internal HEAP tables are now marking it's memory as MY_THREAD_SPECIFIC.
        - Use MY_TREE_WITH_DELETE instead of removed option 'with_delete'.
      storage/heap/hp_open.c:
        Internal HEAP tables are now marking it's memory as MY_THREAD_SPECIFIC.
      storage/heap/hp_write.c:
        Added new parameter to hp_get_new_block()
      storage/maria/ma_bitmap.c:
        Updated call to my_init_dynamic_array()
      storage/maria/ma_blockrec.c:
        Updated call to my_init_dynamic_array()
      storage/maria/ma_check.c:
        Updated call to init_alloc_root()
      storage/maria/ma_ft_boolean_search.c:
        Updated calls to init_tree() and init_alloc_root()
      storage/maria/ma_ft_nlq_search.c:
        Updated call to init_tree()
      storage/maria/ma_ft_parser.c:
        Updated call to init_tree()
        Updated call to init_alloc_root()
      storage/maria/ma_loghandler.c:
        Updated call to my_init_dynamic_array()
      storage/maria/ma_open.c:
        Updated call to my_init_dynamic_array()
      storage/maria/ma_sort.c:
        Updated call to my_init_dynamic_array()
      storage/maria/ma_write.c:
        Updated calls to my_init_dynamic_array() and init_tree()
      storage/maria/maria_pack.c:
        Updated call to init_tree()
      storage/maria/unittest/sequence_storage.c:
        Updated call to my_init_dynamic_array()
      storage/myisam/ft_boolean_search.c:
        Updated call to init_tree()
        Updated call to init_alloc_root()
      storage/myisam/ft_nlq_search.c:
        Updated call to init_tree()
      storage/myisam/ft_parser.c:
        Updated call to init_tree()
        Updated call to init_alloc_root()
      storage/myisam/ft_stopwords.c:
        Updated call to init_tree()
      storage/myisam/mi_check.c:
        Updated call to init_alloc_root()
      storage/myisam/mi_write.c:
        Updated call to my_init_dynamic_array()
        Updated call to init_tree()
      storage/myisam/myisamlog.c:
        Updated call to init_tree()
      storage/myisam/myisampack.c:
        Updated call to init_tree()
      storage/myisam/sort.c:
        Updated call to my_init_dynamic_array()
      storage/myisammrg/ha_myisammrg.cc:
        Updated call to init_sql_alloc()
      storage/perfschema/pfs_check.cc:
        Rest current_thd
      storage/perfschema/pfs_instr.cc:
        Removed DBUG_ENTER/DBUG_VOID_RETURN as at this point my_thread_var is not allocated anymore, which can cause problems.
      support-files/compiler_warnings.supp:
        Disable compiler warning from offsetof macro.
      df7e1237
  35. 16 Jan, 2013 1 commit
    • Neeraj Bisht's avatar
      Bug#11751794 MYSQL GIVES THE WRONG RESULT WITH SOME SPECIAL USAGE · a981b545
      Neeraj Bisht authored
      Consider the following query:
      
      SELECT f_1,..,f_m, AGGREGATE_FN(C)
      FROM t1
      WHERE ...
      GROUP BY ...
      
      Loose index scan ("Using index for group-by") can be used for
      this query if there is an index 'i' covering all fields in the
      select list, and the GROUP BY clause makes up a prefix f1,...,fn
      of 'i'. Furthermore, according to rule NGA2 of
      get_best_group_min_max(), the WHERE clause must contain a
      conjunction of equality predicates for all fields fn+1,...,fm.
      
      The problem in this bug was that a query with WHERE clause that
      broke NGA2 was not detected and therefore used loose index scan.
      This lead to wrong result. The query had an index
      covering (c1,c2) and had:
        "WHERE (c1 = 1 AND c2 = 'a') OR (c1 = 2 AND c2 = 'b')
         GROUP BY c1"
      or 
        "WHERE (c1 = 1 ) OR (c1 = 2 AND c2 = 'b')
         GROUP BY c1"
      
      
      This WHERE clause cannot be transformed to a conjunction of
      equality predicates.
      
      The solution is to introduce another rule, NGA3, that complements
      NGA2. NGA3 says that if a gap field (field between those
      listed in GROUP BY and C in the index) has a predicate, then
      there can only be one range in the query. This requirement is
      more strict than it has to be in theory. BUG 15947433 will deal
      with that.
      
      
      sql/opt_range.cc:
        check for the repetition of non group field.
      a981b545
  36. 10 Jan, 2013 1 commit
    • Annamalai Gurusami's avatar
      Bug #16004999 ASSERT STATE == TRX_STATE_NOT_STARTED, UNLOCK_ROW() · 5dcb701d
      Annamalai Gurusami authored
      Problem:
      
      During the index intersect access method, the SQL layer will access one row,
      that satisfies a set of conditions, using an index i1.  And then it will try to
      access the same row, with other set of conditions using the next index i2.  If
      the fetch from i2 fails (we are talking about an error situation here and not
      simply an unmatched row situation), then it will unlock the row accessed via
      i1.  This will work in all situations except deadlock error.
      
      When a deadlock happens, InnoDB will rollback the transaction.  InnoDB intimates
      the SQL layer about this through the THD::transaction_rollback_request member.
      But this is not currently used by the SQL layer.
      
      Solution:
      
      When an error happens, the SQL layer must check the 
      THD::transaction_rollback_request member, before calling handler::unlock_row().
      We have also added a debug assert in ha_innobase::unlock_row() checking that
      it must be called only when the transaction is in active state.
      
      rb#1773 approved by Marko and Sunny.
      5dcb701d