An error occurred fetching the project authors.
  1. 25 Mar, 2013 1 commit
    • Michael Widenius's avatar
      Speed up connection time: · d8986fd6
      Michael Widenius authored
      -Change my_rnd() slightly to make it safer if two threads use it at the same time.
      -Avoid some sprintf and strmov in vio.
      -Changed thread_count to be automaticly incremented (instead of under LOCK_thread_count).
      -Thread cache now uses LOCK_thread_cache instead of LOCK_thread_count.
      -Moved delete thd out from LOCK_thread_count.
      -Save some mysql_cond_broadcast(&COND_thread_count) calls.
      -Removed call to getsockname() during connect.
      -Initialize random generator without locks.
      
      Other things:
      -Fixed test cases that depends on changes for LOCK_grant
      -Added thread_safe_decrement32() and thread_safe_increment32()
      -Removed sql_rnd_with_mutex() and get_thread_running()
      -In check_table_access() don't lock LOCK_grant if we can resolve the grant with user or db level grants (the normal case).
      -Don't use a lock for setting THD->query_id.
      -Fixed bug where thd->set_query_id() could be set to same value by multiple threads.
      
      Thanks to Yoshinori Matsunobu for the benchmark of connection speed and to
      Domas Mituzas for the inspiration for many of the fixes.
      
      
      include/violite.h:
        Change desc to a string pointer
      mysql-test/suite/perfschema/r/all_instances.result:
        Added new mutex
      mysql-test/suite/perfschema/t/func_mutex.test:
        Test for LOCK_system_variables_hash instead of LOCK_grant, as LOCK_grant is not anymore always taken for SELECT's.
      mysys/my_gethwaddr.c:
        More DBUG
      mysys/my_rnd.c:
        Change my_rnd() slightly to make it safer if two threads use it at the same time.
      sql/event_scheduler.cc:
        Changed thread_count to be automically incremented
        Moved some safe things out from LOCK_thread_count.
        Simplify deleting of THD for running thread.
      sql/mysqld.cc:
        Changed thread_count to be automically incremented
        Thread cache now uses LOCK_thread_cache instead of LOCK_thread_count
        Added delete_running_thd()
        Moved delete thd out from LOCK_thread_count
        More DBUG
        Only call  mysql_cond_broadcast(&COND_thread_count) if thread_count is 0
        Removed call to getsockname() (old not anymore needed check)
      sql/mysqld.h:
        Removed sql_rnd_with_mutex() (not needed anymore)
        Removed not used function get_thread_running()
        Added thread_safe_decrement32() and thread_safe_increment32()
        Simplified dec_thread_running() and inc_thread_running()
        next_query_id() should return the original value for global_query_id, not the next one.
        (Bug introduced with MySQL 5.5 merge).
      sql/sql_acl.cc:
        In check_table_access() don't lock LOCK_grant if we can resolve the grant with user or db level grants (the normal case).
      sql/sql_class.cc:
        Removed thd_lock_thread_count() and thd_unlock_thread_count()
        Initialize random generator without locks
        Don't use a lock for setting THD->query_id.
        (This is only accessed by thread owning the THD)
      sql/sql_class.h:
        Don't use a lock for setting THD->query_id.
      sql/sql_insert.cc:
        Changed thread_count to be automically incremented
      sql/sql_parse.cc:
        Changed thread_count to be automically incremented
        Fixed bug where thd->set_query_id() could be set to same value by multiple threads.
      vio/vio.c:
        Don't generate 'desc' with sprintf/strmov. Assign a pointer instead.
        (Good enough as this is just for debugging)
      d8986fd6
  2. 19 Mar, 2013 1 commit
    • Michael Widenius's avatar
      Speed up connection time: · 615d51b6
      Michael Widenius authored
      -Change my_rnd() slightly to make it safer if two threads use it at the same time.
      -Avoid some sprintf and strmov in vio.
      -Changed thread_count to be automically incremented (instead of under LOCK_thread_count).
      -Thread cache now uses LOCK_thread_cache instead of LOCK_thread_count.
      -Moved delete thd out from LOCK_thread_count.
      -Save some mysql_cond_broadcast(&COND_thread_count) calls.
      -Removed call to getsockname() during connect.
      -Initialize random generator without locks.
      
      Other things:
      -Added thread_safe_decrement32() and thread_safe_increment32()
      -Removed sql_rnd_with_mutex() and get_thread_running()
      
      Thanks to Yoshinori Matsunobu for the benchmark of connection speed and to
      Domas Mituzas for the inspiration for many of the fixes.
       
      
      include/violite.h:
        Change desc to a string pointer
      mysql-test/suite/perfschema/r/all_instances.result:
        Added new mutex
      mysys/my_rnd.c:
        Change my_rnd() slightly to make it safer if two threads use it at the same time.
      sql/event_scheduler.cc:
        Changed thread_count to be automically incremented
        Moved some safe things out from LOCK_thread_count.
        Simplify deleting of THD for running thread.
      sql/mysqld.cc:
        Changed thread_count to be automically incremented
        Thread cache now uses LOCK_thread_cache instead of LOCK_thread_count
        Added delete_running_thd()
        Moved delete thd out from LOCK_thread_count
        More DBUG_ENTER
        Only call  mysql_cond_broadcast(&COND_thread_count) if thread_count is 0
        Removed call to getsockname() (old not anymore needed check)
      sql/mysqld.h:
        Removed sql_rnd_with_mutex() (not needed anymore)
        Removed not used function get_thread_running()
        Added thread_safe_decrement32() and thread_safe_increment32()
        Simplified dec_thread_running() and inc_thread_running()
      sql/sql_class.cc:
        Removed thd_lock_thread_count() and thd_unlock_thread_count()
        Initialize random generator without locks
      sql/sql_insert.cc:
        Changed thread_count to be automically incremented
      sql/sql_parse.cc:
        Changed thread_count to be automically incremented
      vio/vio.c:
        Don't generate 'desc' with sprintf/strmov. Assign a pointer instead.
        (Good enough as this is just for debugging)
      615d51b6
  3. 30 Jan, 2013 1 commit
  4. 24 Jan, 2013 1 commit
  5. 23 Jan, 2013 1 commit
    • 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
  6. 10 Jan, 2013 1 commit
    • 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
  7. 17 Dec, 2012 2 commits
    • Sergei Golubchik's avatar
      MDEV-438 Microseconds: Precision is ignored in CURRENT_TIMESTAMP(N) when it is... · 1d2b11b2
      Sergei Golubchik authored
      MDEV-438 Microseconds: Precision is ignored in CURRENT_TIMESTAMP(N) when it is given as a default column value
      
      For MySQL 5.6 compatibility, support precision specification in CURRENT_TIMESTAMP in
      a default clause, when it's not less than the column's precision.
      1d2b11b2
    • Michael Widenius's avatar
      Fixed the CREATE TABLE IF EXIST generates warnings instead of errors · 2dbce3d0
      Michael Widenius authored
      mysql-test/r/create.result:
        Updated test results
      mysql-test/t/create.test:
        Updated test
      sql/sql_base.cc:
        Use push_internal_handler/pop_internal_handler to avoid errors & warnings instead of clear_error
        Give a warnings instead of an error for CREATE TABLE IF EXISTS
      sql/sql_parse.cc:
        Check if we failed because of table exists (can only happen from create)
      sql/sql_table.cc:
        Check if we failed because of table exists (can only happen from create)
      2dbce3d0
  8. 05 Dec, 2012 1 commit
    • Gleb Shchepa's avatar
      Bug #15948123: SERVER WORKS INCORRECT WITH LONG TABLE ALIASES · d538d394
      Gleb Shchepa authored
      Code in MDL subsystem assumes that identifiers of objects can't
      be longer than NAME_LEN characters. This assumption was broken
      when one tried to construct MDL_key based on table alias, which
      can have arbitrary length. Since MDL_key's (and MDL locks) are
      not really used for table aliases this patch changes code to
      not initialize MDL_key object for table list element representing
      aliases.
      d538d394
  9. 27 Nov, 2012 2 commits
  10. 26 Nov, 2012 1 commit
  11. 17 Oct, 2012 1 commit
    • unknown's avatar
      MDEV-452 Add full support for auto-initialized/updated timestamp and datetime · bc4a4567
      unknown authored
      Generalized support for auto-updated and/or auto-initialized timestamp
      and datetime columns. This patch is a reimplementation of MySQL's
      "WL#5874: CURRENT_TIMESTAMP as DEFAULT for DATETIME columns". In order to
      ease future merges, this implementation reused few function and variable
      names from MySQL's patch, however the implementation is quite different.
      
      TODO:
      The only unresolved problem in this patch is the semantics of LOAD DATA for
      TIMESTAMP and DATETIME columns in the cases when there are missing or NULL
      columns. I couldn't fully comprehend the logic behind MySQL's behavior and
      its relationship with their own documentation, so I left the results to be
      more consistent with all other LOAD cases.
      
      The problematic test cases can be seen by running the test file function_defaults,
      and observing the test case differences. Those were left on purpose for discussion.
      bc4a4567
  12. 06 Oct, 2012 1 commit
  13. 02 Oct, 2012 1 commit
    • Michael Widenius's avatar
      Changed SHOW_FUNC variabels that don't return SHOW_ARRAY to SHOW_SIMPLE_FUNC. · 572560f3
      Michael Widenius authored
      This allows us to avoid calculating variables (including those involving mutex) that doesn't match the given
      wildcard in SHOW STATUS LIKE '...'
      Removed all references to active_mi that could cause problems for multi-source replication.
      
      Added START|STOP ALL SLAVES
      Added SHOW ALL SLAVES STATUS
      
      
      include/mysql/plugin.h:
        Added SHOW_SIMPLE_FUNC
      include/mysql/plugin_audit.h.pp:
        Updated .pp file
      include/mysql/plugin_auth.h.pp:
        Updated .pp file
      include/mysql/plugin_ftparser.h.pp:
        Updated .pp file
      mysql-test/suite/multi_source/info_logs.result:
        New columns in SHOW ALL SLAVES STATUS
      mysql-test/suite/multi_source/info_logs.test:
        Test new syntax
      mysql-test/suite/multi_source/simple.result:
        New columns in SHOW ALL SLAVES STATUS
      mysql-test/suite/multi_source/simple.test:
        test new syntax
      mysql-test/suite/multi_source/syntax.result:
        Updated result
      mysql-test/suite/multi_source/syntax.test:
        Test new syntax
      mysql-test/suite/rpl/r/rpl_skip_replication.result:
        Updated result
      plugin/semisync/semisync_master_plugin.cc:
        SHOW_FUNC -> SHOW_SIMPLE_FUNC
      sql/item_create.cc:
        Simplify code
      sql/lex.h:
        Added SLAVES keyword
      sql/log.cc:
        Constant -> define
      sql/log_event.cc:
        Added comment
      sql/mysqld.cc:
        SHOW_FUNC -> SHOW_SIMPLE_FUNC
        Made slave_retried_trans, slave_received_heartbeats and heartbeat_period multi-source safe
        Clear variable denied_connections and slave_retried_transactions on startup
      sql/mysqld.h:
        Added slave_retried_transactions
      sql/rpl_mi.cc:
        create_signed_file_name -> create_logfile_name_with_suffix
        Added start_all_slaves() and stop_all_slaves()
      sql/rpl_mi.h:
        Added prototypes
      sql/rpl_rli.cc:
        create_signed_file_name -> create_logfile_name_with_suffix
        added executed_entries
      sql/rpl_rli.h:
        Added executed_entries
      sql/share/errmsg-utf8.txt:
        More and better error messages
      sql/slave.cc:
        Added more fields to SHOW ALL SLAVES STATUS
        Added slave_retried_transactions
        Changed constants -> defines
      sql/sql_class.h:
        Added comment
      sql/sql_insert.cc:
        active_mi.rli -> thd->rli_slave
      sql/sql_lex.h:
        Added SQLCOM_SLAVE_ALL_START & SQLCOM_SLAVE_ALL_STOP
      sql/sql_load.cc:
        active_mi.rli -> thd->rli_slave
      sql/sql_parse.cc:
        Added START|STOP ALL SLAVES
      sql/sql_prepare.cc:
        Added SQLCOM_SLAVE_ALL_START & SQLCOM_SLAVE_ALL_STOP
      sql/sql_reload.cc:
        Made REFRESH RELAY LOG multi-source safe
      sql/sql_repl.cc:
        create_signed_file_name -> create_logfile_name_with_suffix
        Don't send my_ok() from start_slave() or stop_slave() so that we can call it for all master connections
      sql/sql_show.cc:
        Compare wild cards early for all variables
      sql/sql_yacc.yy:
        Added START|STOP ALL SLAVES
        Added SHOW ALL SLAVES STATUS
      sql/sys_vars.cc:
        Made replicate_events_marked_for_skip,slave_net_timeout and rpl_filter multi-source safe.
      sql/sys_vars.h:
        Simplify Sys_var_rpl_filter
      572560f3
  14. 28 Sep, 2012 1 commit
    • Michael Widenius's avatar
      Fixed issues found by QA (Elena) · 5a4b5869
      Michael Widenius authored
      - Added parameter to reset_logs() so that one can specify if new logs should be created.
      
      mysql-test/include/setup_fake_relay_log.inc:
        There is no orphan relay log files anymore
      mysql-test/mysql-test-run.pl:
        Added multi_source to test suite
      mysql-test/suite/multi_source/info_logs.result:
        New test
      mysql-test/suite/multi_source/info_logs.test:
        New test
      mysql-test/suite/multi_source/my.cnf:
        Added log-warnings to get more information to the log files
      mysql-test/suite/multi_source/relaylog_events.result:
        Added cleanup
      mysql-test/suite/multi_source/relaylog_events.test:
        Added cleanup
      mysql-test/suite/multi_source/reset_slave.result:
        Updated results after improved RESET SLAVE
      mysql-test/suite/multi_source/simple.result:
        Updated results after improved RESET SLAVE
      mysql-test/suite/multi_source/simple.test:
        Syncronize positions before show full slave status
      mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result:
        Updated results after improved RESET SLAVE (we now use less relay log files)
      mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result:
        Updated results after improved RESET SLAVE (we now use less relay log files)
      sql/log.cc:
        Added parameter to reset_logs() so that one can specify if new logs should be created.
      sql/log.h:
        Added parameter to reset_logs()
      sql/rpl_mi.cc:
        Create Master_info_index::index_file_names once at init
        More DBUG_PRINT
        Give error if Master_info_index::check_duplicate_master_info fails
      sql/rpl_rli.cc:
        If we do a full reset, don't create any new relay log files.
      sql/share/errmsg-utf8.txt:
        Improved error message if connection exists
      sql/sql_parse.cc:
        Fixed memory leak
      sql/sql_repl.cc:
        check_duplicate_master_info() now generates an error
        Added parameter to reset_logs()
      5a4b5869
  15. 27 Sep, 2012 1 commit
    • 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
  16. 18 Sep, 2012 1 commit
    • Michael Widenius's avatar
      This fix+comments was originally made by Alexey Kopytov · af4eeaf5
      Michael Widenius authored
      LP bug #1035225 / MySQL bug #66301: INSERT ... ON DUPLICATE KEY UPDATE +
      innodb_autoinc_lock_mode=1 is broken
      
      The problem was that when certain INSERT ... ON DUPLICATE KEY UPDATE
      were executed concurrently on a table containing an AUTO_INCREMENT
      column as a primary key, InnoDB would correctly reserve non-overlapping
      AUTO_INCREMENT intervals for each statement, but when the server
      encountered the first duplicate key error on the secondary key in one of
      the statements and performed an UPDATE, it also updated the internal
      AUTO_INCREMENT value to the one from the existing row that caused a
      duplicate key error, even though the AUTO_INCREMENT value was not
      specified explicitly in the UPDATE clause. It would then proceed with
      using AUTO_INCREMENT values the range reserved previously by another
      statement, causing duplicate key errors on the AUTO_INCREMENT column.
      
      Fixed by changing write_record() to ensure that in case of a duplicate
      key error the internal AUTO_INCREMENT counter is only updated when the
      AUTO_INCREMENT value was explicitly updated by the UPDATE
      clause. Otherwise it is restored to what it was before the duplicate key
      error, as that value is unused and can be reused for subsequent
      successfully inserted rows.
      
      sql/sql_insert.cc:
        Don't update next_insert_id to the value of a row found during ON DUPLICATE KEY UPDATE.
      sql/sql_parse.cc:
        Added DBUG_SYNC
      sql/table.h:
        Added next_number_field_updated flag to detect changing of auto increment fields.
        Moved fields a bit to get bool fields after each other (better alignment)
      af4eeaf5
  17. 13 Sep, 2012 1 commit
    • Michael Widenius's avatar
      Added THD::utime_after_query to avoid calling current_utime() twice for every end-of-query · 32e4c7e1
      Michael Widenius authored
      Increment long_query_count also if thd->variables.log_slow_rate_limit is used
      Added new state "Writing to binlog"
      
      
      sql/sql_class.h:
        Added THD::utime_after_query to avoid calling current_utime() twice for every end-of-query
      sql/sql_parse.cc:
        Increment long_query_count also if thd->variables.log_slow_rate_limit is used
        Removed extra calls to thd_proc_info(thd, "logging slow query") and thd->current_utime();
      sql/sql_table.cc:
        Added new state "Writing to binlog"
      32e4c7e1
  18. 08 Sep, 2012 1 commit
    • Michael Widenius's avatar
      Added new status variables: · 3a793b9d
      Michael Widenius authored
      feature_dynamic_columns,feature_fulltext,feature_gis,feature_locale,feature_subquery,feature_timezone,feature_trigger,feature_xml
      Opened_views, Executed_triggers, Executed_events
      Added new process status 'updating status' as part of 'freeing items'
      
      mysql-test/r/features.result:
        Test of feature_xxx status variables
      mysql-test/r/mysqld--help.result:
        Removed duplicated 'language' variable.
      mysql-test/r/view.result:
        Test of opened_views
      mysql-test/suite/rpl/t/rpl_start_stop_slave.test:
        Write more information on failure
      mysql-test/t/features.test:
        Test of feature_xxx status variables
      mysql-test/t/view.test:
        Test of opened_views
      sql/event_scheduler.cc:
        Increment executed_events status variable
      sql/field.cc:
        Increment status variable
      sql/item_func.cc:
        Increment status variable
      sql/item_strfunc.cc:
        Increment status variable
      sql/item_subselect.cc:
        Increment status variable
      sql/item_xmlfunc.cc:
        Increment status variable
      sql/mysqld.cc:
        Add new status variables to 'show status'
      sql/mysqld.h:
        Added executed_events
      sql/sql_base.cc:
        Increment status variable
      sql/sql_class.h:
        Add new status variables
      sql/sql_parse.cc:
        Added new process status 'updating status' as part of 'freeing items'
      sql/sql_trigger.cc:
        Increment status variable
      sql/sys_vars.cc:
        Increment status variable
      sql/tztime.cc:
        Increment status variable
      3a793b9d
  19. 04 Sep, 2012 1 commit
    • Michael Widenius's avatar
      Switch automaticly to statement based replication for statements that can't... · 51392386
      Michael Widenius authored
      Switch automaticly to statement based replication for statements that can't generate row based events. This is needed to avoid getting
      updates to system, statistics and admin tables logged to binary log.
      - Removed special code used to temporarily change to statement based replication.
      - Changed to a faster and smaller interface for temporarily switching to statement based replication.
      
      sql/event_db_repository.cc:
        Change to new interface to not use row based replication for system table changes.
      sql/events.cc:
        Change to new interface to not use row based replication for system table changes.
      sql/sp.cc:
        Removed temporarily switching to statement based replication (this is now done automaticly in mysql_execute_command())
      sql/sql_acl.cc:
        Change to new interface to not use row based replication for system table changes.
        Removed temporarily switching to statement based replication (this is now done automaticly in mysql_execute_command())
      sql/sql_class.h:
        Added new interface for temporarily switching to statement based replication.
      sql/sql_parse.cc:
        Mark commands that needs original replication mode with CF_FORCE_ORIGINAL_BINLOG_FORMAT.
        Switch automaticly to statement based replication for statements that can't generate row based events (and can't change replication mode)
      sql/sql_udf.cc:
        Removed temporarily switching to statement based replication (this is now done automaticly in mysql_execute_command())
      51392386
  20. 14 Aug, 2012 1 commit
    • Michael Widenius's avatar
      Fixed compiler errors · b886cac7
      Michael Widenius authored
      Updated test to also work on 32 bit
      
      mysql-test/suite/heap/heap.test:
        Updated test to also work on 32 bit
      b886cac7
  21. 08 Aug, 2012 1 commit
  22. 17 Jul, 2012 1 commit
  23. 10 Jul, 2012 1 commit
  24. 29 Jun, 2012 1 commit
  25. 09 Jun, 2012 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #1010729. · 10f42e2c
      Igor Babaev authored
      The bug prevented acceptance of UNION queries whose non-first select 
      clauses contained join expressions with degenerated single-table nests
      as valid queries.
      The bug was introduced into mysql-5.5 code line by the patch for
      bug 33204.
      10f42e2c
  26. 05 Jun, 2012 1 commit
    • Michael Widenius's avatar
      Fixed build failures found by buildbot · 56ea8e9c
      Michael Widenius authored
      - Added suppression of warnings
      - Fixed some test cases
      
      
      BUILD/FINISH.sh:
        Added AM_EXTRA_MAKEFLAGS
      BUILD/SETUP.sh:
        Added option --extra-makeflags
      client/mysqldump.c:
        Added suppression
      mysql-test/r/mysql.result:
        Updated results
      mysql-test/r/mysql_upgrade.result:
        Updated results
      mysql-test/r/partition_innodb_plugin.result:
        Updated results
      mysql-test/r/partition_open_files_limit.result:
        Updated results
      mysql-test/r/symlink.result:
        Updated results
      mysql-test/suite/innodb/r/innodb-create-options.result:
        Updated results
      mysql-test/suite/innodb/t/innodb-create-options.test:
        Don't print error message (as it's varies on different system)
      mysql-test/t/mysql.test:
        Don't print error message (as it's varies on different system)
      mysql-test/t/mysql_upgrade.test:
        Fixed checking of error number
      mysql-test/t/partition_innodb_plugin.test:
        Don't print error message (as it's varies on different system)
      plugin/semisync/semisync_master.cc:
        Added suppression
      sql/ha_partition.cc:
        Added suppression
      sql/item_subselect.cc:
        Added suppression
      sql/multi_range_read.cc:
        Added suppression
      sql/sql_parse.cc:
        Added suppression
      sql/sql_select.cc:
        Added suppression
      storage/innobase/handler/ha_innodb.cc:
        Removed not used variable
      storage/maria/ma_delete.c:
        Added suppression
      storage/maria/ma_key_recover.c:
        Added suppression
      storage/maria/ma_write.c:
        Added suppression
      strings/ctype-ucs2.c:
        Added suppression
      support-files/compiler_warnings.supp:
        Added suppressions
      unittest/mysys/my_vsnprintf-t.c:
        Fixed test case with %M to also work on Solaris
      56ea8e9c
  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. 20 Apr, 2012 1 commit
    • Andrei Elkin's avatar
      BUG#11754117 incorrect logging of INSERT into auto-increment · 49e484c8
      Andrei Elkin authored
      BUG#11761686 insert_id event is not filtered.
        
      Two issues are covered.
        
      INSERT into autoincrement field which is not the first part in the composed primary key 
      is unsafe by autoincrement logging design. The case is specific to MyISAM engine
      because Innodb does not allow such table definition.
        
      However no warnings and row-format logging in the MIXED mode was done, and
      that is fixed.
        
      Int-, Rand-, User-var log-events were not filtered along with their parent
      query that made possible them to screw up execution context of the following
      query.
        
      Fixed with deferring their execution until the parent query.
      
      ******
      Bug#11754117 
      
      Post review fixes.
      
      mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result:
        a new result file is added.
      mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result:
        results updated.
      mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test:
        regression test for BUG#11754117-45670 is added.
      mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test:
        regression test for filtering issue of BUG#11754117 - 45670 is added.
      sql/log_event.cc:
        Logics are added for deferring and executing events associated 
        with the Query event.
      sql/log_event.h:
        Interface to deferred events batch execution is added.
      sql/rpl_rli.cc:
        initialization for new RLI members is added.
      sql/rpl_rli.h:
        New members to RLI are added to facilitate deferred events gathering
        and execution control;
        two general character RLI cleanup methods are constructed.
      sql/rpl_utility.cc:
        Deferred_log_events methods are difined.
      sql/rpl_utility.h:
        A new class Deferred_log_events is defined to implement
        IRU events gathering, execution and cleanup.
      sql/slave.cc:
        Necessary changes to initialize `rli->deferred_events' and prevent
        deferred event deletion in the main read-exec branch.
      sql/sql_base.cc:
        A new safe-check function for multi-part pk with auto-increment is defined
        and deployed in lock_tables().
      sql/sql_class.cc:
        Initialization for a new member and replication cleanups are added
        to THD class.
      sql/sql_class.h:
        THD class receives a new member to hold a specific execution
        context for slave applier.
      sql/sql_parse.cc:
        Execution of the deferred event in started prior to its parent query.
      49e484c8
  30. 18 Apr, 2012 1 commit
    • Nuno Carvalho's avatar
      WL#6236: Allow SHOW MASTER LOGS and SHOW BINARY LOGS with REPLICATION CLIENT · 448c3d62
      Nuno Carvalho authored
      Currently SHOW MASTER LOGS and SHOW BINARY LOGS require the SUPER
      privilege. Monitoring tools (such as MEM) often want to check this 
      output - for instance MEM generates the SUM of the sizes of the logs 
      reported here, and puts that in the Replication overview within the MEM
      Dashboard.
      However, because of the SUPER requirement, these tools often have an 
      account that holds open the connection whilst monitoring, and can lock
      out administrators when the server gets overloaded and reaches
      max_connections - there is already another SUPER privileged account
      connected, the "monitor". 
      
      As SHOW MASTER STATUS, and all other replication related statements,
      return with either REPLICATION CLIENT or SUPER privileges, this worklog 
      is to make SHOW MASTER LOGS and SHOW BINARY LOGS be consistent with this
      as well, and allow both of these commands with either SUPER or 
      REPLICATION CLIENT. 
      This allows monitoring tools to not require a SUPER privilege any more,
      so is safer in overloaded situations, as well as being more secure, as 
      lighter privileges can be given to users of such tools or scripts.
      448c3d62
  31. 28 Mar, 2012 1 commit
  32. 11 Mar, 2012 1 commit
  33. 05 Mar, 2012 1 commit
  34. 28 Feb, 2012 1 commit
  35. 19 Feb, 2012 1 commit
    • Tatjana Azundris Nuernberg's avatar
      BUG 13454045 - 63524: BUG #35396 "ABNORMAL/IMPOSSIBLE/LARGE QUERY_TIME AND LOCK_TIME" HAPPENS A · ede9f4fa
      Tatjana Azundris Nuernberg authored
      If a query's end time is before before its start time, the system clock has been turn back
      (daylight savings time etc.). When the system clock is changed, we can't tell for certain a
      given query was actually slow. We did not protect against logging such a query with a bogus
      execution time (resulting from end_time - start_time being negative), and possibly logging it
      even though it did not really take long to run.
      
      We now have a sanity check in place.
      
      sql/sql_parse.cc:
        Make sure end time is not before start time - otherwise, we can be SURE the system clock
        was changed in between, but not by how much. In other words, when the clock is changed,
        we don't know how long a query ran, and whether it was slow.
      ede9f4fa
  36. 10 Feb, 2012 1 commit
    • unknown's avatar
      lp:910817: Race condition in kill_threads_for_user() · 3d61c139
      unknown authored
      The code was accessing a pointer in a mem_root that might be freed by
      another concurrent thread. Fix by moving the access to be done while the
      LOCK_thd_data is held, preventing the memory from being freed too early.
      3d61c139
  37. 08 Feb, 2012 1 commit
  38. 07 Feb, 2012 1 commit
    • Rohit Kalhans's avatar
      BUG#11758263 50440: MARK UNORDERED UPDATE WITH AUTOINC UNSAFE · de85a600
      Rohit Kalhans authored
            
            Problem: Statements that write to tables with auto_increment columns
            based on the selection from another table, may lead to master
            and slave going out of sync, as the order in which the rows
            are retrived from the table may differ on master and slave.
            
            Solution: We mark writing to a table with auto_increment table
            as unsafe. This will cause the execution of such statements to
            throw a warning and forces the statement to be logged in ROW if
            the logging format is mixed. 
            
            Changes: 
            1. All the statements that writes to a table with auto_increment 
            column(s) based on the rows fetched from another table, will now
            be unsafe.
            2. CREATE TABLE with SELECT will now be unsafe.
      
      
      sql/share/errmsg-utf8.txt:
        Added new Warning messages
      sql/sql_base.cc:
        created a new function that checks for select + write on a autoinc table
        made all such statements to be unsafe.
      sql/sql_parse.cc:
        made create autoincremnet tabble + select unsafe
      de85a600