1. 12 Jan, 2009 1 commit
  2. 09 Jan, 2009 2 commits
    • Michael Widenius's avatar
      Code cleanup: · 7eda7f13
      Michael Widenius authored
      - Removed not needed casts
      - Indentation fixes
      - Changed some buffer variables to uchar, to be able to remove casts
      
      
      storage/maria/ma_bitmap.c:
        Removed not needed casts
      storage/maria/ma_blockrec.c:
        Removed not needed casts
      storage/maria/ma_check.c:
        Removed not needed casts.
        Changed type of buffers to be able to remove casts
      storage/maria/ma_create.c:
        Removed not needed casts
      storage/maria/ma_delete.c:
        Removed not needed casts
      storage/maria/ma_dynrec.c:
        Removed not needed casts
      storage/maria/ma_extra.c:
        Removed not needed casts
      storage/maria/ma_ft_boolean_search.c:
        Removed not needed casts
      storage/maria/ma_ft_nlq_search.c:
        Removed not needed casts
      storage/maria/ma_ft_parser.c:
        Removed not needed casts
      storage/maria/ma_loghandler.c:
        Removed not needed casts
      storage/maria/ma_open.c:
        Removed not needed casts
      storage/maria/ma_packrec.c:
        Removed not needed casts
      storage/maria/ma_pagecache.c:
        Removed not needed casts
      storage/maria/ma_preload.c:
        Removed not needed casts
        Removed not needed initialization
      storage/maria/ma_rnext_same.c:
        Removed not needed casts
      storage/maria/ma_rt_index.c:
        Removed not needed casts
      storage/maria/ma_search.c:
        Removed not needed casts
      storage/maria/ma_sort.c:
        Removed not needed casts
        Removed not needed if
        Fixed indentation
      storage/maria/ma_statrec.c:
        Removed not needed casts
      storage/maria/ma_test2.c:
        Removed not needed casts
      storage/maria/ma_write.c:
        Removed not needed casts
        Indentation fixes
      storage/maria/maria_chk.c:
        Removed not needed casts
      storage/maria/maria_pack.c:
        Removed not needed casts
      7eda7f13
    • Michael Widenius's avatar
      Fixed bugs from my latest patch found by pushbuild: · 7dc83c50
      Michael Widenius authored
      Bug #41962 Maria: view-related test failures (insert, view, maria, trigger tests)
      Added error handling for wrong update of view.
      See Bug #41760 Inserting into multiple-table views is not working
      
      mysql-test/r/delayed.result:
        Fixed test as we are now testing values before fields.
        Added new tests to test all error combinations
      mysql-test/suite/maria/r/maria.result:
        Added error handling for not supported update of view.
      mysql-test/suite/maria/t/maria.test:
        Added error handling for not supported update of view.
      mysql-test/t/delayed.test:
        Fixed test as we are now testing values before fields.
        Added new tests to test all error combinations
      sql/sql_base.cc:
        Fixed warning from valgrind
      sql/sql_insert.cc:
        Don't test from which table values are in case of INSERT ... SELECT
        Run fix_fields() in values before we do it on fields.
        This is needed becasue check_view_single_update() are accessing values.
      storage/maria/ma_blockrec.c:
        Don't call pagecache_delete_pages() if no pages to delete.
        This fixes a DBUG_ASSERT() error in maria_test_recovery
      7dc83c50
  3. 07 Jan, 2009 1 commit
  4. 05 Jan, 2009 1 commit
  5. 29 Dec, 2008 1 commit
    • unknown's avatar
      Fixed mutex taking order on recovery of bulk insert. · 4da218f0
      unknown authored
      storage/maria/ma_key_recover.c:
        Takes intern_lock before writing CLR_END of bulk insert.
        Added debug info about writing trigger.
        Check of mutex taken in _ma_state_info_write() where we need it.
      4da218f0
  6. 27 Dec, 2008 1 commit
    • Michael Widenius's avatar
      Fixed bugs found by pushbuild · 910284e6
      Michael Widenius authored
      Added code to detect and give error when doing an insert into a view where we accessed fields in a not yet read table
      Disabled test in subselect.test as the CHECK_OPTION for views doesn't work for insert.
      This needs to be fixed properly later.
      
      The problem with views are described in Bug #41760 Inserting into multiple-table views is not working
      
      mysql-test/r/insert.result:
        Fixed wrong usage of insert into view.
      mysql-test/r/subselect.result:
        Disabled wrong test (temporary)
      mysql-test/suite/maria/r/maria.result:
        Added test of size of table
      mysql-test/suite/maria/t/maria.test:
        Added test of size of table
      mysql-test/t/insert.test:
        Fixed wrong usage of insert into view
        The bug is that during insert/update we currently don't read any of the referenced tables of the view.
        This means that we can't get a value from another table to use as part of the update.
      mysql-test/t/subselect.test:
        Disabled not working test until someone has time to fix insert into view properly
        Here we where refering to last used value in t2, which is wrong.
      sql/sql_insert.cc:
        Detect if we are trying to update one table in a view based on value in another, not yet read, table.
        This fixes the problem discovered in insert.test
      storage/maria/ma_blockrec.c:
        Don't ignore not critical changes to the last page in the table.
        We need to write the last page as otherwise we can during aborting of a row with a duplicate key get
        state.data_file_length and the real length of file out of sync
      storage/maria/ma_check.c:
        Flush the page cache even if we got an error during zerofill.
        (This fixes a call to assert() in case of a too short data file)
      storage/maria/ma_pagecache.c:
        Mark page as read when we do a write of a full page.
        This fixes a bug when we got an error during read and then used direct write to page to update it
      storage/maria/ma_state.c:
        Restore info->lock.type after call to maria_versioning.
        Fixed crash in maria_recover.test
      storage/maria/maria_read_log.c:
        Don't write thread id in debug log. (Not needed as maria_read_log is a single treaded program)
      910284e6
  7. 23 Dec, 2008 1 commit
  8. 22 Dec, 2008 3 commits
    • Michael Widenius's avatar
      3ef5b1fd
    • Michael Widenius's avatar
      3ecbee7c
    • Michael Widenius's avatar
      Fix for Bug#40311 Assert in MARIA_RECORD_POS during pushbuild 2 test: · 86fcfb15
      Michael Widenius authored
      Fixed bug when removing a newly inserted record (in case of duplicate key).
      The bug caused a crash for rows with several blobs and the first blob was small enough to fit into the head page.
      Don't change state_history if nothing changed (speed optimization that also simplifies logic).
      Reset state_history if we added/deleted or updated rows without versioning.
      Fixed wrong test in trnman_exists_active_transactions() if state is visible or not.
      
      Other bugs fixed:
      Fixed wrong argument to (lock->get_status) when we had to wait for TL_WRITE_CONCURRENT_INSERT.
      Item_equal::update_used_tables() didn't calculate const_item_cache properly.
      Added assert's to detect if join_read_const_table() was called under wrong assumptions..
      Fixed that _ma_setup_live_state() is called from thr_lock() instead of handler::external_lock().
      This was needed to get versioning information to be setup correctly.
      Fixed error in debug binaries during a call to _ma_check_table_is_closed() when another thread was opening/closing a table.
      Fixed wrong test when finding right history_state to use.
      
      mysql-test/suite/maria/r/maria.result:
        Added test for Bug#40311 Assert in MARIA_RECORD_POS during pushbuild 2 test
      mysql-test/suite/maria/t/maria.test:
        Added test for Bug#40311 Assert in MARIA_RECORD_POS during pushbuild 2 test
      mysys/thr_lock.c:
        Fixed wrong argument to (lock->get_status) when we had to wait for TL_WRITE_CONCURRENT_INSERT
      sql/item_cmpfunc.cc:
        Item_equal::update_used_tables() didn't calculate const_item_cache properly, which later caused a wrong result for item->const_item()
      sql/sql_base.cc:
        In debug mode, Initilize record buffer with unexpected data to catch usage of uninitialized memory
      sql/sql_select.cc:
        Fixed indentation
        Added assert's to detect if join_read_const_table() was called under wrong assumptions.
        One assert() is disabled for now as Item_equal() doesn't behave as expected.
      storage/maria/ha_maria.cc:
        Move calling to _ma_setup_live_state() to ma_state.c::_ma_block_get_status()
        This was needed as _ma_setup_live_state() needed to know if the table will be used concurrently or not
      storage/maria/ma_blockrec.c:
        Fixed bug when removing a newly inserted record (in case of duplicate key).
        The bug caused a crash for rows with several blobs and the first blob was small enough to fit into the head page.
      storage/maria/ma_dbug.c:
        Added mutex to protect the open table list during _ma_check_table_is_closed().
        Without the protection we could get a error in debug binaries during a call to _ma_check_table_is_closed()
      storage/maria/ma_delete_table.c:
        Removed not used code
      storage/maria/ma_rename.c:
        Removed not used code
      storage/maria/ma_state.c:
        Fixed wrong test when finding right history_state to use
        Mark in tables->state_current.no_transid if we are using transid's or not.
        Don't change state_history if nothing changed (speed optimization that also simplifies logic)
        Reset state_history if we added/deleted or updated rows without versioning.
        More DBUG_ASSERT's and more DBUG
        Updated maria_versioning() to initialize environment before calling _ma_blok_get_status(). This was needed because of the new logic in _ma_block_get_status()
      storage/maria/ma_state.h:
        Added flags to detect if table changed and/or if we changed table without versioning
      storage/maria/ma_write.c:
        Simple cleanups (No logic changes)
      storage/maria/trnman.c:
        Fixed wrong test in trnman_exists_active_transactions() if state is visible or not.
      86fcfb15
  9. 15 Dec, 2008 1 commit
  10. 10 Dec, 2008 3 commits
  11. 09 Dec, 2008 3 commits
    • Michael Widenius's avatar
      Merge with main Maria tree · 7f91cf08
      Michael Widenius authored
      7f91cf08
    • Michael Widenius's avatar
      Merge with base Maria tree · 9948682b
      Michael Widenius authored
      Remove warnings from test logs about depricated options
      
      mysql-test/t/events_logs_tests-master.opt:
        Remove warnings from test logs about depricated options
      mysql-test/t/log_tables-big-master.opt:
        Remove warnings from test logs about depricated options
      mysql-test/t/log_tables-master.opt:
        Remove warnings from test logs about depricated options
      mysql-test/t/multi_statement-master.opt:
        Remove warnings from test logs about depricated options
      mysql-test/t/ps-master.opt:
        Remove warnings from test logs about depricated options
      mysql-test/t/show_check-master.opt:
        Remove warnings from test logs about depricated options
      mysql-test/t/slow_query_log_file_basic-master.opt:
        Remove warnings from test logs about depricated options
      mysql-test/t/slow_query_log_file_func-master.opt:
        Remove warnings from test logs about depricated options
      mysql-test/t/union-master.opt:
        Remove warnings from test logs about depricated options
      sql/mysqld.cc:
        Don't give warnings for empty log file names
      9948682b
    • Guilhem Bichot's avatar
      Fix for BUG#41159 "Maria: deadlock between checkpoint and maria_write() when extending data file". · c9a29373
      Guilhem Bichot authored
      No testcase (concurrency, tested by pushbuild2).
      
      storage/maria/ha_maria.cc:
        a comment about what Sanja had discovered a while ago
      storage/maria/ma_bitmap.c:
        guard against concurrent flush of bitmap by checkpoint: we must have close_lock here
      storage/maria/ma_blockrec.c:
        comment fixed for new behaviour
      storage/maria/ma_checkpoint.c:
        Release intern_lock before flushing bitmap, or it deadlocks with allocate_and_write_block_record()
        when that function needs to increase the data file's length (that function makes bitmap non flushable,
        then wants intern_lock to increase data_file_length).
        The checkpoint section which looks at the share's content (bitmap, state) needs to be protected from the possible
        my_free-ing done by a concurrent maria_close(); intern_lock is not enough as
        both maria_close() and checkpoint now have to release it in the middle.
        So the protection is done with close_lock. in_checkpoint is now protected by close_lock
        in places where it was protected by intern_lock.
      storage/maria/ma_close.c:
        hold close_lock in maria_close() from start to end, to guard against checkpoint trying to flush
        bitmap while we have my_free'd its structures, for example. intern_lock was not enough as
        both maria_close() and checkpoint have to release it in the middle, to avoid deadlocks.
      storage/maria/ma_open.c:
        initialize new mutex
      storage/maria/ma_recovery.c:
        a comment about what Sanja had discovered a while ago
      storage/maria/maria_def.h:
        comment.
        new mutex protecting the close of a MARIA_SHARE, from _start_ to _end_ of it.
      c9a29373
  12. 08 Dec, 2008 6 commits
    • unknown's avatar
      merge · 131a6a57
      unknown authored
      131a6a57
    • unknown's avatar
      Fixed mutexes lock order in maria_close(): LOCK_trn_list ->... · c9b0c5a1
      unknown authored
      Fixed mutexes lock order in maria_close(): LOCK_trn_list -> MARIA_SHARE::intern_lock (then will be WL to revert the order).
      (BUG#40981 Maria: deadlock between checkpoint and maria_close() when freeing state info)
      
      storage/maria/ma_checkpoint.c:
        The argument added to the function to use it in maria_close().
      storage/maria/ma_close.c:
        Locking/unlocking MARIA_SHARE::intern_lock added to use correct order of the mutexes taking.
      storage/maria/ma_state.c:
        Removed assert becase now we have externally locked mutex in maria_close().
        The argument added to the _ma_remove_not_visible_states_with_lock() to use it in maria_close().
        _ma_remove_not_visible_states_with_lock() fixed tio be usable from maria_chk where transaction manager is not initialized.
      storage/maria/ma_state.h:
        The argument added to the function to use it in maria_close().
      storage/maria/maria_def.h:
        Fixed comment to the variable.
      storage/maria/trnman.c:
        The debugging assert added.
        New function to detect transaction manager initialization added (maria_chk do not initialize it).
      storage/maria/trnman_public.h:
        New function to detect transaction manager initialization added (maria_chk do not initialize it).
      c9b0c5a1
    • Michael Widenius's avatar
      Fixed problem with crash in Maria _ma_setup_live_state() where history link... · d0fb8270
      Michael Widenius authored
      Fixed problem with crash in Maria _ma_setup_live_state() where history link didn't include needed state
      
      mysql-test/mysql-test-run.pl:
        Remove warnings in log about depricated mysqld options
      storage/maria/ma_state.c:
        More DBUG_PRINT
      storage/maria/trnman.c:
        Fixed wrong test if commit_trid is visible
      d0fb8270
    • unknown's avatar
      merge · 7f3631c2
      unknown authored
      7f3631c2
    • Georgi Kodinov's avatar
      merged 5.0-main -> 5.1-main · ba816c14
      Georgi Kodinov authored
      ba816c14
    • unknown's avatar
      False alarm about incorrect mutex taking removed. · e1ee25e4
      unknown authored
      storage/maria/ma_loghandler.c:
        Number of the buffer now passed to buffer initialization function to assign buffer number and break false alarm "chain" by switching off deadlock detection for one buffer.
      e1ee25e4
  13. 05 Dec, 2008 9 commits
    • Guilhem Bichot's avatar
      merge with latest 5.1-maria · ccfb9c32
      Guilhem Bichot authored
      ccfb9c32
    • Guilhem Bichot's avatar
      Fix for BUG#41037 "Maria: recovery failure (pushbuild2)" (checkpoint bug). · 91bc9cc9
      Guilhem Bichot authored
      mysql-test/suite/maria/r/maria-recovery3.result:
        result.
      mysql-test/suite/maria/t/maria-recovery3-master.opt:
        usual recovery test options
      mysql-test/suite/maria/t/maria-recovery3.test:
        Test for BUG#41037. Without the bugfix, the test would hang because Recovery would fail with "undo_key_insert got error 126": Recovery would believe INSERT of 2 is uncommitted, try to execute its UNDO_KEY_INSERT, fail to find the key to delete because DELETE deleted it. That failure of _ma_ck_real_delete() would mark table as corrupted (see
        in d_search()) which is error 126 (HA_ERR_CRASHED).
      storage/maria/ma_blockrec.c:
        set trn->rec_lsn to LSN of commit record, when writing it.
      storage/maria/ma_blockrec.h:
        new function
      storage/maria/ma_commit.c:
        when committing or rolling back, rec_lsn should be LSN_IMPOSSIBLE: assertion is moved here
        from trnman_end_trn(), because now ma_commit() can set rec_lsn and so when we reach trnman_end_trn()
        it's not LSN_IMPOSSIBLE anymore.
        Adding debug possibility to pause between COMMIT record write and trnman_commit_trn(), to be
        able to fire checkpoint in between.
      storage/maria/ma_loghandler.c:
        in-write hook for COMMIT records
      storage/maria/ma_recovery.c:
        More debugging info in maria_recovery.trace, to see how the starting point of REDO phase is determined
      storage/maria/trnman.c:
        assertion cannot be here anymore see ma_commit.c
      91bc9cc9
    • Sergei Golubchik's avatar
      compilation warnings · 633eabc6
      Sergei Golubchik authored
      633eabc6
    • Guilhem Bichot's avatar
      Fix for BUG#41102 "Maria: maria-no-logging.test fails randomly on Win64" · 44d3917f
      Guilhem Bichot authored
      mysql-test/include/maria_empty_logs.inc:
        move mysqladmin call to include file for reusal (so that others don't have to hit the same bug in their tests);
        this include file additionally waits for disconnection. Reasons for BUG#41102:
        - in maria-no-logging.test, we shut down mysqld in maria_empty_logs.inc, remove logs, tell mtr that it can
        restart mysqld, then wait for being connected (wait_until_connected_again.inc), then send commands to new mysqld.
        - but under Windows "mysqladmin shutdown" does not wait for mysqld to be down, so we accidentally removed logs
        while it was shutting down, wait_until_connected_again found that we were connected (because it was shutting
        down slowly, connections were not yet broken), sent new commands, and one of them failed because mysqld finally
        closed connections.
        - the fix is to just wait for disconnection after shutdown.
        - in a sense, the catch is the "again" in wait_until_connected_again.inc...
      mysql-test/include/mysqladmin_shutdown.inc:
        shutdown with mysqladmin AND waiting for shutdown to complete (needed on Windows)
      mysql-test/include/wait_until_connected_again.inc:
        comment
      mysql-test/include/wait_until_disconnected.inc:
        script which waits until connection is lost
      44d3917f
    • Sergei Golubchik's avatar
      merged · d00d63dd
      Sergei Golubchik authored
      d00d63dd
    • Georgi Kodinov's avatar
      1bb6a0ba
    • Sergei Golubchik's avatar
      bug#41024 maria: Server crashes in sysbench OLTP_RW test at lf_hash.c:94 · c151d0cc
      Sergei Golubchik authored
      bug#41023 maria: Server asserts in sysbench OLTP_RO test 
      bug#40888 maria: Server crashes in sysbench OLTP_RW test at lf_alloc-pin.c:513
      bug#40892 maria: Livelock in sysbench OLTP_RW test 
      bug#40895 maria: Server crashes in sysbench OLTP_RO test at lf_alloc-pin.c:367
      bug#40890 maria: Server crashes in sysbench OLTP_RW test at ctype-bin.c:8
      
      Yet another strict aliasing issue
      c151d0cc
    • Sergei Golubchik's avatar
      bug#40416 - Maria: Memory allocated at trnman.c:129 was underrun. · f82866f5
      Sergei Golubchik authored
      we cannot access a trn after we put it in the pool
      f82866f5
    • Guilhem Bichot's avatar
      Fix for pushbuild failure (test which can't run in embedded mode) and compiler warning · 45521d97
      Guilhem Bichot authored
      mysql-test/suite/maria/t/maria_showlog_error.test:
        test which can't run in embedded mode
      storage/innobase/handler/ha_innodb.cc:
        compiler warning
      45521d97
  14. 04 Dec, 2008 3 commits
    • Guilhem Bichot's avatar
      Fixing Valgrind error: deadlock detector was set to random; seen in many... · fb945ef2
      Guilhem Bichot authored
      Fixing Valgrind error: deadlock detector was set to random; seen in many InnoDB tests like innodb-replace.test
      
      storage/innobase/handler/ha_innodb.cc:
        Fixing Valgrind error: deadlock detector was set to random. Making the recently added lines closer
        to the InnoDB style (tabs not spaces)
      fb945ef2
    • Vladislav Vaintroub's avatar
      Bug#38522: 5 seconds delay when closing application using embedded server · 8f500c52
      Vladislav Vaintroub authored
                        
      The problem here is that embedded server starts handle_thread manager 
      thread  on mysql_library_init() does not stop it on mysql_library_end().
      At shutdown, my_thread_global_end() waits for thread count to become 0,
      but since we did not stop the thread it will give up after 5 seconds.
                   
      Solution is to move shutdown for handle_manager thread from kill_server()
      (mysqld specific) to clean_up() that is used by both embedded and mysqld.
                  
      This patch also contains some refactorings - to avoid duplicate code,
      start_handle_manager() and stop_handle_manager() functions are introduced.
      Unused variables are eliminated. handle_manager does not rely on global
      variable abort_loop anymore to stop (abort_loop is not set for embedded).
                  
      Note: Specifically on Windows and when using DBUG version of libmysqld, 
      the complete solution requires removing obsolete code my_thread_init() 
      from my_thread_var(). This has a side effect that a DBUG statement 
      after my_thread_end() can cause thread counter to be incremented, and 
      embedded will hang for some seconds. Or worse, my_thread_init() will 
      crash if critical sections have been deleted by the global cleanup 
      routine that runs in a different thread. 
      
      This patch also fixes and revert prior changes for Bug#38293 
      "Libmysqld crash in mysql_library_init if language file missing".
      
      Root cause of the crash observed in Bug#38293  was bug in my_thread_init() 
      described above
      
      
      
      
      client/mysql.cc:
        sql_protocol_typelib is not exported from libmysqld
        (does not make sense either)
        thus excluded from embedded client
      dbug/dbug.c:
        revert changes for Bug#38293
      include/my_dbug.h:
        revert changes for Bug#38293
      libmysql/libmysql.c:
        Removed DBUG_POP call, because when called after my_end(), will access
        THR_key_mysys that is already deleted. The result of pthread_get_specific
        is not predictable in this case and hence DBUG_POP can crash.
      libmysqld/examples/CMakeLists.txt:
        Revert changes for Bug#38293.
      libmysqld/lib_sql.cc:
        code to start handle manager is factored out into 
        start_handle_manager() function
      libmysqld/libmysqld.def:
        Revert changes for Bug #38293
        Remove excessive exports from libmysqld, export what API documents.
      mysys/my_thr_init.c:
        Remove windows-DLL-specific workaround for something (old code, no documentation for
        what specifically). The problem is that even after my_thread_end() is finished, 
        DBUG statement can initiate my_thread_init(). This does not happen anywhere else and 
        should not happen on  Windows either.
      sql/mysql_priv.h:
        - new functions start_handle_manager() and stop_handle_manager()
        - move manager_thread_in_use  variable to sql_manager.cc and made
        it static
        - remove manager_status, as it is unused
      sql/mysqld.cc:
        Code to start/stop handle_manager thread is factored out into start_handle_manager()
      8f500c52
    • Michael Widenius's avatar
      Fixed warnings and errors discovered by pushbuild2 · d83f6470
      Michael Widenius authored
      mysys/my_init.c:
        Fixed link error when compiling without thread support
      sql/item_create.cc:
        Fixed compiler warning
      sql/mysqld.cc:
        Fixed compile error on windows
      sql/protocol.cc:
        Fixed compiler warning
      sql/sql_class.cc:
        Fixed compiler warning
      sql/sql_class.h:
        Fixed compiler warning
      storage/myisam/mi_open.c:
        Fixed compiler warning
      storage/myisammrg/ha_myisammrg.cc:
        Fixed compiler warning (shadow variable)
      d83f6470
  15. 03 Dec, 2008 2 commits
  16. 02 Dec, 2008 2 commits
    • Michael Widenius's avatar
    • Michael Widenius's avatar
      WL#3262 add mutex lock order checking to safemutex (also called safe_mutex_deadlock_detector) · 32f81bab
      Michael Widenius authored
      This writes a warning on stderr if one uses mutex in different order,
      like if one in one case would lock mutex in the order A,B and in another case
      would lock mutex in the order B,A
      This is inspired by and loosely based on the LOCKDEP patch by Jonas
      Wrong mutex order is either fixed or mutex are marked with MYF_NO_DEADLOCK_DETECTION
      if used inconsistently (need to be fixed by server team)
      
      KNOWN_BUGS.txt:
        Added information that one need to dump and restore Maria tables
      include/hash.h:
        Added prototype function for walking over all elements in a hash
      include/my_pthread.h:
        Added my_pthread_mutex_init() and my_pthread_mutex_lock(); These should be used if one wants to disable mutex order checking.
        Changed names of the nonposix mutex_init functions to not conflict with my_phread_mutex_init()
        Added and extended structures for mutex deadlock detection.
        New arguments to sage_mutex_init() and safe_mutex_lock() to allow one to disable mutex order checking.
        Added variable 'safe_mutex_deadlock_detector' to enable/disable deadlock detection for all pthread_mutex_init()
      mysys/Makefile.am:
        Added cleaning of test files
        Added test_thr_mutex
      mysys/hash.c:
        Added hash_iterate() to iterate over all elements in a hash
        More comments
      mysys/my_init.c:
        Added calls to destory all mutex uses by mysys()
        Added waiting for threads to end before calling TERMINATE() to list not freed memory
      mysys/my_pthread.c:
        Changed names to free my_pthread_mutex_init() for mutex-lock-order-checking
      mysys/my_sleep.c:
        Fixed too long wait if using 1000000L as argument
      mysys/my_thr_init.c:
        Mark THR_LOCK_threads and THR_LOCK_malloc to not have mutex deadlock detection.
        (We can't have it enabled for this as these are internal mutex used by the detector  
        Call my_thread_init() early as we need thread specific variables enabled for the following pthread_mutex_init()
        Move code to wait for threads to end to my_wait_for_other_threads_to_die()
        Don't destroy mutex and conditions unless all threads have died
        Added my_thread_destroy_mutex() to destroy all mutex used by the mysys thread system
        Name the thread specific mutex as "mysys_var->mutex"
        Added my_thread_var_mutex_in_use() to return pointer to mutex in use or 0 if thread variables are not initialized
      mysys/mysys_priv.h:
        Added prototypes for functions used internally with mutex-wrong-usage detection
      mysys/thr_mutex.c:
        Added runtime detection of mutex used in conflicting order
        See WL#3262 or test_thr_mutex.c for examples
        The base idea is for each mutex have two hashes:
        - mutex->locked_mutex points to all mutex used after this one
        - mutex->used_mutex points to all mutex which has this mutex in it's mutex->locked_mutex
        There is a wrong mutex order if any mutex currently locked before this mutex is in the mutex->locked_mutex hash
      sql/event_queue.cc:
        Mark mutex used inconsistently (need to be fixed by server team)
      sql/event_scheduler.cc:
        Declare the right order to take the mutex
      sql/events.cc:
        Mark mutex used inconsistently (need to be fixed by server team)
      sql/ha_ndbcluster_binlog.cc:
        Mark mutex used inconsistently (need to be fixed by server team)
      sql/log.cc:
        Mark mutex used inconsistently (need to be fixed by server team)
      sql/mysqld.cc:
        Use pthread_mutex_trylock instead of pthread_mutex_unlock() when sending kill signal to thread
        This is needed to avoid wrong mutex order as normally one takes 'current_mutex' before mysys_var->mutex.
        Added call to free sp cache.
        Add destruction of LOCK_server_started and COND_server_started.
        Added register_mutex_order() function to register in which order mutex should be taken
        (to initiailize mutex_deadlock_detector).
        Added option to turn off safe_mutex_deadlock_detector
      sql/protocol.cc:
        Fixed wrong argument to DBUG_PRINT (found by valgrind)
      sql/rpl_mi.cc:
        Mark mutex used inconsistently (need to be fixed by server team)
      sql/set_var.cc:
        Remove wrong locking of LOCK_global_system_variables when reading and setting log variables
        (would cause inconsistent mutex order).
        Update global variables outside of logger.unlock() as LOCK_global_system_variables has to be taken before logger locks
        Reviewed by gluh
      sql/sp_cache.cc:
        Added function to destroy mutex used by sp cache
      sql/sp_cache.h:
        Added function to destroy mutex used by sp cache
      sql/sql_class.cc:
        Use pthread_mutex_trylock instead of pthread_mutex_unlock() when sending kill signal to thread
        This is needed to avoid wrong mutex order as normally one takes 'current_mutex' before mysys_var->mutex.
        Register order in which LOCK_delete and mysys_var->mutex is taken
      sql/sql_insert.cc:
        Give a name for Delayed_insert::mutex
        Mark mutex used inconsistently (need to be fixed by server team)
        Move closing of tables outside of di->mutex (to avoid wrong mutex order)
      sql/sql_show.cc:
        Don't keep LOCK_global_system_variables locked over value->show_type() as this leads to wrong mutex order
      storage/innobase/handler/ha_innodb.cc:
        Disable safe_muted_deadlock_detector for innobase intern mutex (to speed up page cache initialization)
      storage/maria/ha_maria.cc:
        Added flag to ha_maria::info() to signal if we need to lock table share or not.
        This is needed to avoid locking mutex in wrong order
      storage/maria/ha_maria.h:
        Added flag to ha_maria::info() to signal if we need to lock table share or not.
      storage/maria/ma_close.c:
        Destroy key_del_lock
        Simplify freeing ftparser_param
      storage/maria/ma_key.c:
        Better comment
      storage/maria/ma_loghandler.c:
        Mark mutex used inconsistently (need to be fixed by sanja)
      storage/maria/ma_state.c:
        More comments
      storage/maria/ma_test1.c:
        Ensure that safe_mutex_deadlock_detector is always on (should be, this is just for safety)
      storage/maria/ma_test2.c:
        Ensure that safe_mutex_deadlock_detector is always on (should be, this is just for safety)
      32f81bab