An error occurred fetching the project authors.
  1. 27 Jun, 2013 1 commit
  2. 26 Jun, 2013 1 commit
  3. 19 Jun, 2013 2 commits
  4. 17 Jun, 2013 1 commit
  5. 16 Jun, 2013 1 commit
    • Michael Widenius's avatar
      More merge fixes: · 8075b05b
      Michael Widenius authored
      - mdl.cc and mdl.h merged completely
      - mysql_system_tables*.sql merged completely
      - Fixed wrong merge of lock_tables
      - Added some missing functions:
       - bool THD::notify_shared_lock()
       - Dynamic_array::pop, Dynamic_array::del
      - Added MDL_context_owner to THD
      - Added metadata_locks_hash_instances
      8075b05b
  6. 15 Jun, 2013 1 commit
  7. 25 Mar, 2013 1 commit
  8. 24 Jan, 2013 1 commit
  9. 23 Jan, 2013 3 commits
    • Sergei Golubchik's avatar
      cleanup: · c71fad99
      Sergei Golubchik authored
      * don't use 'myf flags', when 'my_bool is_thread_specific' is meant
      * call set_malloc_size_cb() for embedded too
      * warn in safemalloc if the memory is freed by a wrong thread
      
      sql/mysqld.cc:
        move set_malloc_size_cb() to a function that is also called for embedded
      sql/mysqld.h:
        gdb-friendly, one can put breakpoint on a function, but not on a macro
      sql/sql_class.cc:
        initialize thread_id earlier
      c71fad99
    • Sergei Golubchik's avatar
      cleanup: use MYF() for mysys flags · 682da0aa
      Sergei Golubchik authored
      682da0aa
    • Michael Widenius's avatar
      MDEV-4011 Added per thread memory counting and usage · a260b155
      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.
      a260b155
  10. 18 Jan, 2013 2 commits
  11. 15 Jan, 2013 1 commit
    • Sergei Golubchik's avatar
      remove thd_mark_as_hard_kill() · 750b9147
      Sergei Golubchik authored
      (because it's conceptually wrong. only the user can decide whether the kill is
      allowed to leave tables in the inconsistent state, storage engine has no say in that)
      750b9147
  12. 10 Jan, 2013 2 commits
    • Michael Widenius's avatar
      Fixed some race conditons and bugs related to killed queries · 6e9a48b6
      Michael Widenius authored
      KILL now breaks locks inside InnoDB
      Fixed possible deadlock when running INNODB STATUS
      Added ha_kill_query() and kill_query() to send kill signal to all storage engines
      Added reset_killed() to ensure we don't reset killed state while awake() is getting called
      
      
      include/mysql/plugin.h:
        Added thd_mark_as_hard_kill()
      include/mysql/plugin_audit.h.pp:
        Added thd_mark_as_hard_kill()
      include/mysql/plugin_auth.h.pp:
        Added thd_mark_as_hard_kill()
      include/mysql/plugin_ftparser.h.pp:
        Added thd_mark_as_hard_kill()
      sql/handler.cc:
        Added ha_kill_query() to send kill signal to all storage engines
      sql/handler.h:
        Added ha_kill_query() and kill_query() to send kill signal to all storage engines
      sql/log_event.cc:
        Use reset_killed()
      sql/mdl.cc:
        use thd->killed instead of thd_killed() to abort on soft kill
      sql/sp_rcontext.cc:
        Use reset_killed()
      sql/sql_class.cc:
        Fixed possible deadlock in INNODB STATUS by not getting thd->LOCK_thd_data if it's locked.
        Use reset_killed()
        Tell storge engines that KILL has been sent
      sql/sql_class.h:
        Added reset_killed() to ensure we don't reset killed state while awake() is getting called.
        Added mark_as_hard_kill()
      sql/sql_insert.cc:
        Use reset_killed()
      sql/sql_parse.cc:
        Simplify detection of killed queries.
        Use reset_killed()
      sql/sql_select.cc:
        Use reset_killed()
      sql/sql_union.cc:
        Use reset_killed()
      storage/innobase/handler/ha_innodb.cc:
        Added innobase_kill_query()
        Fixed error reporting for interrupted queries.
      storage/xtradb/handler/ha_innodb.cc:
        Added innobase_kill_query()
        Fixed error reporting for interrupted queries.
      6e9a48b6
    • Sergey Petrunya's avatar
      MDEV-3982: show_explain.test fails, times out or crashes · 7b81b641
      Sergey Petrunya authored
      Backport the fix from 10.0 tree
      
      - The problem was that thd_killed() may be called by innodb from 
        an internal innodb thread.
      - Fixed by not processing APC requests when we're not in the thread
        that owns the APC target.
      7b81b641
  13. 17 Dec, 2012 1 commit
  14. 20 Dec, 2012 1 commit
    • Vladislav Vaintroub's avatar
      MDEV-3945 - do not hold LOCK_thread_count when freeing THD. · 21b4fda3
      Vladislav Vaintroub authored
        
      The patch decreases the duration of LOCK_thread_count, so it is not hold during THD destructor and freeing memory.
      This mutex  now only protects the integrity of threads list, when removing THD from it,  and thread_count variable.
        
      The add_to_status() function that updates global status during client disconnect,  is now correctly protected by the LOCK_status mutex.
      
      Benchmark : in a  "non-persistent" sysbench test (oltp_ro with reconnect after each query),  ~ 25% more connects/disconnects were measured
      21b4fda3
  15. 01 Oct, 2012 1 commit
    • Sergei Golubchik's avatar
      more fixes for test cases · 416d0aeb
      Sergei Golubchik authored
      mysql-test/suite/innodb/include/restart_and_reinit.inc:
        drop and recreate mysql.innodb* tables when deleting innodb table spaces
      mysql-test/t/ssl_8k_key-master.opt:
        with loose- prefix ssl errors are ignored
      sql-common/client.c:
        compiler warnings
      sql/field.cc:
        use the new function
      sql/item.cc:
        don't convert time to double or decimal via longlong,
        this loses sub-second part.
        Use dedicated functions.
      sql/item.h:
        incorrect cast_to_int type for params
      sql/item_strfunc.cc:
        use the new function
      sql/lex.h:
        unused
      sql/my_decimal.h:
        helper macro
      sql/sql_plugin.cc:
        workaround for a compiler warning
      sql/sql_yacc.yy:
        unused
      sql/transaction.cc:
        fix the merge for SERVER_STATUS_IN_TRANS_READONLY protocol flag
      storage/sphinx/CMakeLists.txt:
        compiler warnings
      416d0aeb
  16. 27 Sep, 2012 2 commits
    • Michael Widenius's avatar
      Implementation of Multi-source replication (MDEV:253) · 1864d959
      Michael Widenius authored
      Documentation of the feature can be found at: http://kb.askmonty.org/en/multi-source-replication/
      This code is based on code from Taobao, developed by Plinux
      
      BUILD/SETUP.sh:
        Added -Wno-invalid-offsetof to get rid of warning of offsetof() on C++ class (safe in the contex we use it)
      client/mysqltest.cc:
        Added support for error names starting with 'W'
        Added connection_name support to --sync_with_master
      cmake/maintainer.cmake:
        Added -Wno-invalid-offsetof to get rid of warning of offsetof() on C++ class (safe in the contex we use it)
      mysql-test/r/mysqltest.result:
        Updated results
      mysql-test/r/parser.result:
        Updated results
      mysql-test/suite/multi_source/my.cnf:
        Setup of multi-master tests
      mysql-test/suite/multi_source/simple.result:
        Simple basic test of multi-source functionality
      mysql-test/suite/multi_source/simple.test:
        Simple basic test of multi-source functionality
      mysql-test/suite/multi_source/syntax.result:
        Test of multi-source syntax
      mysql-test/suite/multi_source/syntax.test:
        Test of multi-source syntax
      mysql-test/suite/rpl/r/rpl_rotate_logs.result:
        Updated results because of new error messages
      mysql-test/t/parser.test:
        Updated test as master_pos_wait() now takes more arguments than before
      sql/event_scheduler.cc:
        No reason to initialize slave_thread (it's guaranteed to be zero here)
      sql/item_create.cc:
        Added connection_name argument to master_pos_wait()
        Simplified code
      sql/item_func.cc:
        Added connection_name argument to master_pos_wait()
      sql/item_func.h:
        Added connection_name argument to master_pos_wait()
      sql/log.cc:
        Added tag "Master 'connection_name'" to slave errors that has a connection name.
      sql/mysqld.cc:
        Added variable mysqld_server_initialized so that other functions can test if server is fully initialized.
        Free all slave data in one place (fewer ifdef's)
        Removed not needed call to close_active_mi()
        Initialize slaves() later in startup to ensure that everthing is really initialized when slaves start.
        Made status variable slave_running multi-source safe
      sql/mysqld.h:
        Added mysqld_server_initialized
      sql/rpl_mi.cc:
        Store connection name and cmp_connection_name (only used for show full slave status) in Master_info
        Added code for Master_info_index, which handles storage of multi-master information
        Don't write the empty "" connection_name to multi-master.info file. This is handled by the original code.
      sql/rpl_mi.h:
        Added connection_name and Master_info_index
      sql/rpl_rli.cc:
        Added connection_name to relay log files.
      sql/rpl_rli.h:
        Fixed type of slave_skip_counter as we now access it directly in sys_vars.cc, so it must be uint
      sql/share/errmsg-utf8.txt:
        Added new error messages needed for multi-source
        Added multi-source name to error ER_MASTER_INFO and WARN_NO_MASTER_INFO
      sql/slave.cc:
        Moved things a bit around to make it easier to handle error conditions.
        Create a global master_info_index and add the "" connection to it
        Ensure that new Master_info doesn't fail.
        Don't call terminate_slave_threads(active_mi..) on end_slave() as this is now done automaticly when deleting master_info_index.
        Delete not needed function close_active_mi(). One can achive same thing by calling end_slave().
        Added support for SHOW FULL SLAVE STATUS (show status for all master connections with connection_name as first column)
      sql/slave.h:
        Added new prototypes
      sql/sql_base.cc:
        More DBUG_PRINT
      sql/sql_class.cc:
        Reset thd->connection_name and thd-->default_master_connection
      sql/sql_class.h:
        Added thd->connection_name and thd-->default_master_connection
        Added slave_skip_count to variables to make changing the @@sql_slave_skip_count variable thread safe
      sql/sql_const.h:
        Added MAX_CONNECTION_NAME
      sql/sql_lex.cc:
        Reset 'lex->verbose' (to simplify some sql_yacc.yy code)
      sql/sql_lex.h:
        Added connection_name
      sql/sql_parse.cc:
        Added support for connection_name to all SLAVE commands.
        - Instead of using active_mi, we now get the current Master_info from master_info_index.
        - Create new replication threads with CHANGE MASTER
        - Added support for show_all_master_info()
      sql/sql_reload.cc:
        Made reset/full slave use master_info_index->get_master_info() instead of active_mi.
        If one uses 'RESET SLAVE "connection_name" all' the connection is removed from master_info_index.
      sql/sql_repl.cc:
        sql_slave_skip_counter is moved to thd->variables to make it thread safe and fix some bugs with it
        Add connection name to relay log files.
        Added connection name to errors.
        Added some logging for multi-master if log_warnings > 1
        stop_slave():
        - Don't check if thd is set. It's guaranteed to always be set.
        change_master():
        - Check for duplicate connection names in change_master()
        - Check for wrong arguments first in file (to simplify error handling)
        - Register new connections in master_info_index
      sql/sql_yacc.yy:
        Added optional connection_name to a all relevant master/slave commands
      sql/strfunc.cc:
        my_global.h shoud always be included first.
      sql/sys_vars.cc:
        Added variable default_master_connection
        Made variable sql_slave_skip_counter multi-source safe
      sql/sys_vars.h:
        Added Sys_var_session_lexstring (needed for default_master_connection)
        Added Sys_var_multi_source_uint (needed for sql_slave_skip_counter).
      1864d959
    • Sergei Golubchik's avatar
      fixes for test failures · 474fe6d9
      Sergei Golubchik authored
      and small collateral changes
      
      mysql-test/lib/My/Test.pm:
        somehow with "print" we get truncated writes sometimes
      mysql-test/suite/perfschema/r/digest_table_full.result:
        md5 hashes of statement digests differ, because yacc token codes are different in mariadb
      mysql-test/suite/perfschema/r/dml_handler.result:
        host table is not ported over yet
      mysql-test/suite/perfschema/r/information_schema.result:
        host table is not ported over yet
      mysql-test/suite/perfschema/r/nesting.result:
        this differs, because we don't rewrite general log queries, and multi-statement
        packets are logged as a one entry. this result file is identical to what mysql-5.6.5
        produces with the --log-raw option.
      mysql-test/suite/perfschema/r/relaylog.result:
        MariaDB modifies the binlog index file directly, while MySQL 5.6 has a feature "crash-safe binlog index" and modifies a special "crash-safe" shadow copy of the index file and then moves it over. That's why this test shows "NONE" index file writes in MySQL and "MANY" in MariaDB.
      mysql-test/suite/perfschema/r/server_init.result:
        MariaDB initializes the "manager" resources from the "manager" thread, and starts this thread only when --flush-time is not 0. MySQL 5.6 initializes "manager" resources unconditionally on server startup.
      mysql-test/suite/perfschema/r/stage_mdl_global.result:
        this differs, because MariaDB disables query cache when query_cache_size=0. MySQL does not
        do that, and this causes useless mutex locks and waits.
      mysql-test/suite/perfschema/r/statement_digest.result:
        md5 hashes of statement digests differ, because yacc token codes are different in mariadb
      mysql-test/suite/perfschema/r/statement_digest_consumers.result:
        md5 hashes of statement digests differ, because yacc token codes are different in mariadb
      mysql-test/suite/perfschema/r/statement_digest_long_query.result:
        md5 hashes of statement digests differ, because yacc token codes are different in mariadb
      mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result:
        will be updated to match 5.6 when alfranio.correia@oracle.com-20110512172919-c1b5kmum4h52g0ni and anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y are merged
      mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result:
        will be updated to match 5.6 when anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y is merged
      474fe6d9
  17. 14 Aug, 2012 1 commit
  18. 07 Aug, 2012 1 commit
  19. 25 Jul, 2012 1 commit
    • Thayumanavar's avatar
      Bug#13699303 - THREAD POOL PLUGIN IGNORES TIMEOUT. · fa0d2df5
      Thayumanavar authored
      PROBLEM: 
      mysql provides a feature where in a session which is 
      idle for a period specified by the wait_timeout variable
      (whose value is in seconds), the session is closed
      This feature is not present when we use thread pool.
      FIX:
      This patch implements the interface functions which is 
      required to implement the wait_timeout functionality
      in the thread pool plugin.
      fa0d2df5
  20. 17 Jul, 2012 1 commit
  21. 11 Jul, 2012 1 commit
  22. 10 Jul, 2012 3 commits
    • Sergey Petrunya's avatar
      MWL#182: Explain running statements: address review feedback · 725d76e1
      Sergey Petrunya authored
      - switch SHOW EXPLAIN to using an INFORMATION_SCHEMA table.
      725d76e1
    • Rohit Kalhans's avatar
      bug#11759333: · 6fe6288d
      Rohit Kalhans authored
      follow-up patch for the failure on pb2 windows build
      6fe6288d
    • Rohit Kalhans's avatar
      BUG#11759333: SBR LOGGING WARNING MESSAGES FOR PRIMARY · 6da51d17
      Rohit Kalhans authored
      KEY UPDATES WITH A LIMIT OF 1
      
      Problem: The unsafety warning for statements such as
      update...limit1 where pk=1 are thrown when binlog-format
      = STATEMENT,despite of the fact that such statements are
      actually safe. this leads to filling up of the disk space 
      with false warnings.
       
      Solution: This is not a complete fix for the problem, but
      prevents the disks from getting filled up. This should
      therefore be regarded as a workaround. In the future this
      should be overriden by server general suppress/filtering
      framework. It should also be noted that another worklog is
      supposed to defeat this case's artificial unsafety.
      
      We use a warning suppression mechanism to detect warning flood,
      enable the suppression, and disable this when the average
      warnings/second has reduced to acceptable limits.
       
        Activation: The supression for LIMIT unsafe statements are
        activated when the last 50 warnings were logged in less 
        than 50 seconds. 
       
        Supression: Once activated this supression will prevent the
        individual warnings to be logged in the error log, but print
        the warning for every 50 warnings with the note:
        "The last warning was repeated N times in last S seconds"  
        Noteworthy is the fact that this supression works only on the
        error logs and the warnings seen by the clients will remain as
        it is (i.e. one warning/ unsafe statement)
       
        Deactivation: The supression will be deactivated once the
        average # of warnings/sec have gone down to the acceptable limits.
      
      
      
      sql/sql_class.cc:
        Added code to supress warning while logging them to error-log.
      6da51d17
  23. 28 Jun, 2012 1 commit
  24. 25 Jun, 2012 1 commit
  25. 19 Jun, 2012 1 commit
  26. 07 Jun, 2012 3 commits
  27. 28 May, 2012 1 commit
    • Praveenkumar Hulakund's avatar
      Bug#14003080:65104: MAX_USER_CONNECTIONS WITH PROCESSLIST EMPTY · b2c3acc9
      Praveenkumar Hulakund authored
      Analysis:
      -------------
      If server is started with limit of MAX_CONNECTIONS and 
      MAX_USER_CONNECTIONS then only MAX_USER_CONNECTIONS of any particular
      users can be connected to server and total MAX_CONNECTIONS of client can
      be connected to server.
      
      Server maintains a counter for total CONNECTIONS and total CONNECTIONS 
      from particular user.
      
      Here, MAX_CONNECTIONS of connections are created to server. Out of this
      MAX_CONNECTIONS, connections from particular user (say USER1) are
      also created. The connections from USER1 is lesser than 
      MAX_USER_CONNECTIONS. After that there was one more connection request from
      USER1. Since USER1 can still create connections as he havent reached
      MAX_USER_CONNECTIONS, server increments counter of CONNECTIONS per user.
      As server already has MAX_CONNECTIONS of connections, next check to total
      CONNECTION count fails. In this case control is returned WITHOUT 
      decrementing the CONNECTIONS per user. So the counter per user CONNECTIONS goes
      on incrementing for each attempt until current connections are closed. 
      And because of this counter per CONNECTIONS reached MAX_USER_CONNECTIONS. 
      So, next connections form USER1 user always returns with MAX_USER_CONNECTION 
      limit error, even when total connection to sever are less than MAX_CONNECTIONS.
      
      Fix:
      -------------
      This issue is occurred because of not handling counters properly in the
      server. Changed the code to handle per user connection counters properly.
      b2c3acc9
  28. 17 May, 2012 1 commit
    • Gopal Shankar's avatar
      Bug#12636001 : deadlock from thd_security_context · 21faded5
      Gopal Shankar authored
      PROBLEM:
      Threads end-up in deadlock due to locks acquired as described
      below,
      
      con1: Run Query on a table. 
        It is important that this SELECT must back-off while
        trying to open the t1 and enter into wait_for_condition().
        The SELECT then is blocked trying to lock mysys_var->mutex
        which is held by con3. The very significant fact here is
        that mysys_var->current_mutex will still point to LOCK_open,
        even if LOCK_open is no longer held by con1 at this point.
      
      con2: Try dropping table used in con1 or query some table.
        It will hold LOCK_open and be blocked trying to lock
        kernel_mutex held by con4.
      
      con3: Try killing the query run by con1.
        It will hold THD::LOCK_thd_data belonging to con1 while
        trying to lock mysys_var->current_mutex belonging to con1.
        But current_mutex will point to LOCK_open which is held
        by con2.
      
      con4: Get innodb engine status
        It will hold kernel_mutex, trying to lock THD::LOCK_thd_data
        belonging to con1 which is held by con3.
      
      So while technically only con2, con3 and con4 participate in the
      deadlock, con1's mysys_var->current_mutex pointing to LOCK_open
      is a vital component of the deadlock.
      
      CYCLE = (THD::LOCK_thd_data -> LOCK_open ->
               kernel_mutex -> THD::LOCK_thd_data)
      
      FIX:
      LOCK_thd_data has responsibility of protecting,
      1) thd->query, thd->query_length
      2) VIO
      3) thd->mysys_var (used by KILL statement and shutdown)
      4) THD during thread delete.
      
      Among above responsibilities, 1), 2)and (3,4) seems to be three
      independent group of responsibility. If there is different LOCK
      owning responsibility of (3,4), the above mentioned deadlock cycle
      can be avoid. This fix introduces LOCK_thd_kill to handle
      responsibility (3,4), which eliminates the deadlock issue.
      
      Note: The problem is not found in 5.5. Introduction MDL subsystem 
      caused metadata locking responsibility to be moved from TDC/TC to
      MDL subsystem. Due to this, responsibility of LOCK_open is reduced. 
      As the use of LOCK_open is removed in open_table() and 
      mysql_rm_table() the above mentioned CYCLE does not form.
      Revision ID for changes,
      open_table() = dlenev@mysql.com-20100727133458-m3ua9oslnx8fbbvz
      mysql_rm_table() = jon.hauglid@oracle.com-20101116100012-kxep9txz2fxy3nmw
      
      21faded5
  29. 10 May, 2012 1 commit
  30. 26 Apr, 2012 1 commit