1. 30 Mar, 2011 2 commits
    • Marko Mäkelä's avatar
      e2f14878
    • Marko Mäkelä's avatar
      Bug#11877216 InnoDB too eager to commit suicide on a busy server · ddec6ecd
      Marko Mäkelä authored
      sync_array_print_long_waits(): Return the longest waiting thread ID
      and the longest waited-for lock. Only if those remain unchanged
      between calls in srv_error_monitor_thread(), increment
      fatal_cnt. Otherwise, reset fatal_cnt.
      
      Background: There is a built-in watchdog in InnoDB whose purpose is to
      kill the server when some thread is stuck waiting for a mutex or
      rw-lock. Before this fix, the logic was flawed.
      
      The function sync_array_print_long_waits() returns TRUE if it finds a
      lock wait that exceeds 10 minutes (srv_fatal_semaphore_wait_threshold).
      The function srv_error_monitor_thread() will kill the server if this
      happens 10 times in a row (fatal_cnt reaches 10), checked every 30
      seconds. This is wrong, because this situation does not mean that the
      server is hung. If the server is very busy for a little over 15
      minutes, it will be killed.
      
      Consider this example. Thread T1 is waiting for mutex M. Some time
      later, threads T2..Tn start waiting for the same mutex M. If T1 keeps
      waiting for 600 seconds, fatal_cnt will be incremented to 1. So far,
      so good. Now, if M is granted to T1, the server was obviously not
      stuck. But, T2..Tn keeps waiting, and their wait time will be longer
      than 600 seconds. If 5 minutes later, some Tn has still been waiting
      for more than 10 minutes for the mutex M, the server can be killed,
      even though it is not stuck.
      
      rb:622 approved by Jimmy Yang
      ddec6ecd
  2. 28 Mar, 2011 2 commits
    • Vasil Dimov's avatar
      Merge mysql-5.1-innodb -> mysql-5.5-innodb · f2b0b245
      Vasil Dimov authored
      f2b0b245
    • Vasil Dimov's avatar
      Store the '\0'-terminated query in row->trx_query · 08d598fb
      Vasil Dimov authored
      This problem was introduced in
      marko.makela@oracle.com-20100514130815-ym7j7cfu88ro6km4
      and is probably the reason for the following valgrind warning:
      
      from http://bugs.mysql.com/52691 , http://bugs.mysql.com/file.php?id=16880 :
      
      Version: '5.6.3-m5-valgrind-max-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
      ==14947== Thread 18:
      ==14947== Conditional jump or move depends on uninitialised value(s)
      ==14947==    at 0x4A06318: __GI_strlen (mc_replace_strmem.c:284)
      ==14947==    by 0x9F3D7A: fill_innodb_trx_from_cache(trx_i_s_cache_struct*, THD*, TABLE*) (i_s.cc:591)
      ==14947==    by 0x9F4D7D: trx_i_s_common_fill_table(THD*, TABLE_LIST*, Item*) (i_s.cc:1238)
      ==14947==    by 0x7689F3: get_schema_tables_result(JOIN*, enum_schema_table_state) (sql_show.cc:6745)
      ==14947==    by 0x715A75: JOIN::exec() (sql_select.cc:2861)
      ==14947==    by 0x7185BD: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:3609)
      ==14947==    by 0x70E823: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:319)
      ==14947==    by 0x6F2305: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4557)
      ==14947==    by 0x6EAED4: mysql_execute_command(THD*) (sql_parse.cc:2135)
      ==14947==    by 0x6F44C9: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:5597)
      ==14947==    by 0x6E864B: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1093)
      ==14947==    by 0x6E785E: do_command(THD*) (sql_parse.cc:815)
      ==14947==    by 0x6C18DD: do_handle_one_connection(THD*) (sql_connect.cc:771)
      ==14947==    by 0x6C146E: handle_one_connection (sql_connect.cc:707)
      ==14947==    by 0x30E1807760: start_thread (pthread_create.c:301)
      ==14947==    by 0x35EA670F: ???
      ==14947==  Uninitialised value was created by a heap allocation
      ==14947==    at 0x4A0515D: malloc (vg_replace_malloc.c:195)
      ==14947==    by 0xB4B948: mem_area_alloc (mem0pool.c:385)
      ==14947==    by 0xB4A27C: mem_heap_create_block (mem0mem.c:333)
      ==14947==    by 0xB4A530: mem_heap_add_block (mem0mem.c:446)
      ==14947==    by 0xB0D2A4: mem_heap_alloc (mem0mem.ic:186)
      ==14947==    by 0xB0D9C2: ha_storage_put_memlim (ha0storage.c:118)
      ==14947==    by 0xA479D8: fill_trx_row (trx0i_s.c:521)
      ==14947==    by 0xA490E9: fetch_data_into_cache (trx0i_s.c:1319)
      ==14947==    by 0xA491BA: trx_i_s_possibly_fetch_data_into_cache (trx0i_s.c:1352)
      ==14947==    by 0x9F4CE7: trx_i_s_common_fill_table(THD*, TABLE_LIST*, Item*) (i_s.cc:1221)
      ==14947==    by 0x7689F3: get_schema_tables_result(JOIN*, enum_schema_table_state) (sql_show.cc:6745)
      ==14947==    by 0x715A75: JOIN::exec() (sql_select.cc:2861)
      ==14947==    by 0x7185BD: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:3609)
      ==14947==    by 0x70E823: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:319)
      ==14947==    by 0x6F2305: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4557)
      ==14947==    by 0x6EAED4: mysql_execute_command(THD*) (sql_parse.cc:2135)
      ==14947==    by 0x6F44C9: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:5597)
      ==14947==    by 0x6E864B: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1093)
      ==14947==    by 0x6E785E: do_command(THD*) (sql_parse.cc:815)
      ==14947==    by 0x6C18DD: do_handle_one_connection(THD*) (sql_connect.cc:771)
      ==14947==    by 0x6C146E: handle_one_connection (sql_connect.cc:707)
      ==14947==    by 0x30E1807760: start_thread (pthread_create.c:301)
      ==14947==    by 0x35EA670F: ???
      
      
      (gdb) bt
      #0  0x0000000004a06318 in _vgrZU_libcZdsoZa___GI_strlen (str=0x3026bfa0 "insert into `blobtest` set `data`='pkefxxpkalpabzgrczlxefkreqljeqbvzrcnhvhsjsfnvxzjsltfuincffigdkmhvvcmnseluzgbtedrfmxvnrdmzesbinjgwvharkpgjplrlnqudfidbqwgbykupycxzyikzqincnsjrxgncqzlgyqwjdbjulztgsffxpjgymsnntdibvklwqylmwhsmdskmllxuwafabdjnwlyofknwuixiyrgnplmerfdewgizkdhznitesfqepsqbbwkdepkmjoseyxjofmmjaqdipwopfrwidmhqbtovdslvayxcnpewzhppeetblccppniamezibuoinvlxkafpcmozawtplfpepxwlwhymsuraezcwvjqzwogsozodlsfzjiyrcaljjhqwdrcjawvelhefzzaexvcbyorlcyupqwgjuamiqpiputtndjwcsuyzdfhuxswuowhrzdvriwrxqmcqthvzzzvivbabbnhdbtcfdtgssvmirrcddnytnctcvqplwytxxzxelldhwahalzxvgynaiwjyezhxqhlsqudngekocfvlbqprxqhyhwbaomgqiwkpfguohuvlnhtrsszgacxhhzeppyqwfwabiqzgyzkperiidyunrykopysvlcxwhrcboetjltawdjergalsfvaxncmzoznryumrjmncvhvxqvqhhbznnifkguuiffmlrbmgwtzvnuwlaguixqadkupfhasbbxnwkrvsfhrqanfmvjtzfqodtutkjlxfcogtsjywrdgmzgszjtsmimaelsveayqrwviqwwefeziuaqsqpauxpnzhaxjtkdfvvodniwezskbxfxszyniyzkzxngcfwgjlyrlskmrzxqnptwlilsxybuguafxxkvryyjrnkhhcmxuusitaflaiuxjhyfnzkahlgmaszujqmfdhyppdnpweqanmvzgjfyzjolbmprhnuuxextcaxzicfvsuochprmlf"...) at mc_replace_strmem.c:284
      #1  0x00000000009f3d7b in fill_innodb_trx_from_cache (cache=0x1462440, thd=0x2a495000, table=0x2a422500) at /home/sbester/build/bzr/mysql-trunk/storage/innobase/handler/i_s.cc:591
      #2  0x00000000009f4d7e in trx_i_s_common_fill_table (thd=0x2a495000, tables=0x2a4c3ec0) at /home/sbester/build/bzr/mysql-trunk/storage/innobase/handler/i_s.cc:1238
      #3  0x00000000007689f4 in get_schema_tables_result (join=0x30f90c40, executed_place=PROCESSED_BY_JOIN_EXEC) at /home/sbester/build/bzr/mysql-trunk/sql/sql_show.cc:6745
      #4  0x0000000000715a76 in JOIN::exec (this=0x30f90c40) at /home/sbester/build/bzr/mysql-trunk/sql/sql_select.cc:2861
      #5  0x00000000007185be in mysql_select (thd=0x2a495000, rref_pointer_array=0x2a497590, tables=0x2a4c3ec0, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2684619520, result=0x30319720, unit=0x2a496d28, select_lex=0x2a497378) at /home/sbester/build/bzr/mysql-trunk/sql/sql_select.cc:3609
      #6  0x000000000070e824 in handle_select (thd=0x2a495000, lex=0x2a496c78, result=0x30319720, setup_tables_done_option=0) at /home/sbester/build/bzr/mysql-trunk/sql/sql_select.cc:319
      #7  0x00000000006f2306 in execute_sqlcom_select (thd=0x2a495000, all_tables=0x2a4c3ec0) at /home/sbester/build/bzr/mysql-trunk/sql/sql_parse.cc:4557
      #8  0x00000000006eaed5 in mysql_execute_command (thd=0x2a495000) at /home/sbester/build/bzr/mysql-trunk/sql/sql_parse.cc:2135
      #9  0x00000000006f44ca in mysql_parse (thd=0x2a495000, rawbuf=0x30d80060 "select * from innodb_trx", length=24, parser_state=0x35ea5540) at /home/sbester/build/bzr/mysql-trunk/sql/sql_parse.cc:5597
      #10 0x00000000006e864c in dispatch_command (command=COM_QUERY, thd=0x2a495000, packet=0x30bb4e31 "select * from innodb_trx", packet_length=24) at /home/sbester/build/bzr/mysql-trunk/sql/sql_parse.cc:1093
      #11 0x00000000006e785f in do_command (thd=0x2a495000) at /home/sbester/build/bzr/mysql-trunk/sql/sql_parse.cc:815
      #12 0x00000000006c18de in do_handle_one_connection (thd_arg=0x2a495000) at /home/sbester/build/bzr/mysql-trunk/sql/sql_connect.cc:771
      #13 0x00000000006c146f in handle_one_connection (arg=0x2a495000) at /home/sbester/build/bzr/mysql-trunk/sql/sql_connect.cc:707
      #14 0x00000030e1807761 in start_thread (arg=0x35ea6710) at pthread_create.c:301
      #15 0x00000030e14e14ed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
      (gdb) frame 1
      #1  0x00000000009f3d7b in fill_innodb_trx_from_cache (cache=0x1462440, thd=0x2a495000, table=0x2a422500) at /home/sbester/build/bzr/mysql-trunk/storage/innobase/handler/i_s.cc:591
      591                                     row->trx_query_cs);
      (gdb) list
      586                     if (row->trx_query) {
      587                             /* store will do appropriate character set
      588                             conversion check */
      589                             fields[IDX_TRX_QUERY]->store(
      590                                     row->trx_query, strlen(row->trx_query),
      591                                     row->trx_query_cs);
      592                             fields[IDX_TRX_QUERY]->set_notnull();
      593                     } else {
      594                             fields[IDX_TRX_QUERY]->set_null();
      595                     }
      08d598fb
  3. 24 Mar, 2011 1 commit
    • Marko Mäkelä's avatar
      Bug#11766305 - 59392: Remove thr0loc.c and ibuf_inside() [part 4 of 4] · 85dbe88d
      Marko Mäkelä authored
      ibuf_inside(), ibuf_enter(), ibuf_exit(): Add the parameter mtr. The
      flag is no longer kept in the thread-local storage but in the
      mini-transaction (mtr->inside_ibuf).
      
      mtr_start(): Clean up the comment and remove the unused return value.
      mtr_commit(): Assert !ibuf_inside(mtr) in debug builds.
      
      ibuf_mtr_start(): Like mtr_start(), but sets the flag.
      ibuf_mtr_commit(), ibuf_btr_pcur_commit_specify_mtr(): Wrappers that
      assert ibuf_inside().
      
      buf_page_get_zip(), buf_page_init_for_read(),
      buf_read_ibuf_merge_pages(), fil_io(), ibuf_free_excess_pages(),
      ibuf_contract_ext(): Remove assertions on ibuf_inside(), because a
      mini-transaction is not available.
      
      buf_read_ahead_linear(): Add the parameter inside_ibuf.
      
      ibuf_restore_pos(): When this function returns FALSE, it commits mtr
      and must therefore do ibuf_exit(mtr).
      
      ibuf_delete_rec(): This function commits mtr and must therefore do
      ibuf_exit(mtr).
      
      ibuf_rec_get_page_no(), ibuf_rec_get_space(), ibuf_rec_get_info(),
      ibuf_rec_get_op_type(), ibuf_build_entry_from_ibuf_rec(),
      ibuf_rec_get_volume(), ibuf_get_merge_page_nos(),
      ibuf_get_volume_buffered_count(), ibuf_get_entry_counter_low(): Add
      the parameter mtr in debug builds, for asserting ibuf_inside(mtr).
      
      rb:585 approved by Sunny Bains
      85dbe88d
  4. 22 Mar, 2011 1 commit
    • Marko Mäkelä's avatar
      Bug#11766305 - 59392: Remove thr0loc.c and ibuf_inside() [part 3] · a4d2a3a3
      Marko Mäkelä authored
      Remove the slot_no member of struct thr_local_struct.
      
      enum srv_thread_type: Remove unused thread types.
      srv_get_thread_type(): Unused function, remove.
      
      thr_local_get_slot_no(), thr_local_set_slot_no(): Remove.
      
      srv_thread_type_validate(), srv_slot_get_type(): New functions, for debugging.
      
      srv_table_reserve_slot(): Return the srv_slot_t* directly. Do not create
      thread-local storage.
      
      srv_suspend_thread(): Get the srv_slot_t* as parameter. Return void;
      the caller knows slot->event already.
      
      srv_thread_has_reserved_slot(), srv_release_threads(): Assert
      srv_thread_type_validate(type).
      
      srv_init(): Use mem_zalloc() instead of mem_alloc(). Replace
      srv_table_get_nth_slot(), because it now asserts that the kernel_mutex
      is being held.
      
      srv_master_thread(), srv_purge_thread(): Remember the slot from
      srv_table_reserve_slot().
      
      rb:629 approved by Inaam Rana
      a4d2a3a3
  5. 21 Mar, 2011 2 commits
    • Marko Mäkelä's avatar
      Bug#11766305 - 59392: Remove thr0loc.c and ibuf_inside() [part 2] · 0cedc709
      Marko Mäkelä authored
      Add some const qualifiers to accessor and validator functions.
      
      btr_pcur_get_up_match(), btr_pcur_get_low_match(): Add const qualifiers.
      
      btr_pcur_get_page(), btr_pcur_get_block(), btr_pcur_get_rec(),
      rec_get_start(), rec_get_end(): Define as constness-preserving macros.
      In debug builds, discard the const qualifier.
      
      page_rec_validate(), page_simple_validate_old(), page_simple_validate_new(),
      page_dir_slot_check(), page_validate(): Add const qualifiers.
      
      rb:626 approved by Sunny Bains
      0cedc709
    • Marko Mäkelä's avatar
      Bug#11766305 - 59392: Remove thr0loc.c and ibuf_inside() [part 1] · 0dc3b272
      Marko Mäkelä authored
      Remove unused member mtr from btr_pcur_struct.
      
      rb:624 approved by Sunny Bains
      0dc3b272
  6. 15 Mar, 2011 3 commits
  7. 09 Mar, 2011 1 commit
    • unknown's avatar
      Bug#60196 / Bug#11831040 · 64e19595
      unknown authored
      Test case cannot run on embedded server.
      No need for precautionary cleanup of unique names.
      64e19595
  8. 08 Mar, 2011 1 commit
  9. 07 Mar, 2011 1 commit
    • unknown's avatar
      Bug#60196 / Bug#11831040 · 08f128f6
      unknown authored
      Setting lowercase_table_names to 2 on Windows causing Foreign Key problems
      
      This problem was exposed by the fix for Bug#55222.  There was a codepath in dict0load.c,
      dict_load_foreigns() that made sure the table name matched case sensitive in order to
      load a referenced table into the dictionary as needed.  If an engine is rebooted which
      accesses a table with foreign keys, and lower_case_table_names=2, then the table with
      foreign keys will get an error when it is changed (insert/updated/delete).
      Once the referenced tables are loaded into the dictionary cache by a select statement
      on those tables, the same change would succeed because the affected code path would
      not get followed.
      08f128f6
  10. 02 Mar, 2011 3 commits
  11. 01 Mar, 2011 8 commits
    • Vinay Fisrekar's avatar
      merge from mysql-5.1 -> mysql-5.5 · be386ebb
      Vinay Fisrekar authored
      be386ebb
    • Vinay Fisrekar's avatar
      Bug#11766165 - 59211: SELECT RETURNS DIFFERENT VALUE FOR MIN(YEAR) FUNCTION · 845e36e1
      Vinay Fisrekar authored
      Result File Correction For Bug Fix
      845e36e1
    • Alexander Barkov's avatar
      Merging from mysql-5.1 · 561738dc
      Alexander Barkov authored
      561738dc
    • Magne Mahre's avatar
      Post-push cleanup, for Bug#11763065 et al. · a4481d32
      Magne Mahre authored
      a4481d32
    • Alexander Barkov's avatar
      Bug#11766725 (Bug#59901) EXTRACTVALUE STILL BROKEN AFTER FIX FOR BUG #44332 · fd1e3b03
      Alexander Barkov authored
      Problem: a byte behind the end of input string was read
      in case of a broken XML not having a quote or doublequote
      character closing a string value.
      
      Fix: changing condition not to read behind the end of input string
      
        @ mysql-test/r/xml.result
        @ mysql-test/t/xml.test
        Adding tests
      
        @ strings/xml.c
        When checking if the closing quote/doublequote was found,
        using p->cur[0] us unsafe, as p->cur can point to the byte after the value.
        Comparing p->cur to p->beg instead.
      fd1e3b03
    • Alexander Barkov's avatar
      Bug#11753363 (bug#44793) CHARACTER SETS: CASE CLAUSE, UCS2 OR UTF32, FAILURE · 14263b22
      Alexander Barkov authored
      Problem: in case of string CASE/WHEN arguments with different
      character sets, Item_func_case::find_item() called comparator
      cmp_items[x] on mixed character set Items, so a 8-bit value could
      be errouneously referenced to as being utf16/utf32 value,
      which led to crash on DBUG_ASSERT() because of wrong value length.
      This was wrong, as string comparator expects arguments in the same
      character set.
      
      Fix: modify Item_func_case's argument list after calling
      agg_arg_charsets_for_comparison() - put the Items in "agg" array
      back to "args", because some of the Items in the "agg" array might
      have been changed to character set converters:
      - to Item_func_conv_charset for non-constant items
      - to Item_string for constant items
      
      In other words, perform the same substitution which is done in
      all other operations string comparison or string result operations:
      
      Replace
        CASE         latin1_item              WHEN utf16_item THEN ... END
      to
        CASE CONVERT(latin1_item USING utf16) WHEN utf16_item THEN ... END
      
      Replace
        CASE utf16_item WHEN         latin1_item              THEN ... END
      to
        CASE utf16_item WHEN CONVERT(latin1_item USING utf16) THEN ... END
      
      
        @ mysql-test/r/ctype_utf16.result
        @ mysql-test/r/ctype_utf32.result
        @ mysql-test/t/ctype_utf16.test
        @ mysql-test/t/ctype_utf32.test
        Adding tests
      
        @ sql/item_cmpfunc.cc
        Put "agg" back to "args".
      
        @ sql/sql_string.cc
        Backporting a fix for String::set_or_copy_aligned() from 5.6,
        for better test coverage:
        "SELECT _utf16 0x61" should expand the string to 0x0061 rather
        than to 0x000061.
        This fix was made in 5.6 under terms of "WL#4616 Implement UTF16-LE".
      14263b22
    • Magne Mahre's avatar
      Bug#11765237 - 58179: CANNOT START MYSQLD WITH APP VERIFIER · c4715a80
      Magne Mahre authored
      Bug#11763065 - 55730: KILL_SERVER() CALLS SETEVENT ON A NULL 
                     HANDLE, SMEM_EVENT_CONNECT_REQUEST
            
      Application Verifier is a Microsoft tool used for
      detecting certain classes of programming errors.
      In particular, MS Windows OS resource usage is
      monitored for wrong usage (handles, thread local
      storage, critical sections, ...)
            
      In MySQL 5.5.x, an error was introduced where an
      object on thread local storage was used before the
      TLS and the object was created.
            
      The fix has been to move the mysys initialization
      to an earlier stage in the boot process when built for
      Windows.  For non-win builds, the init already happens
      early.
      
      Some un-tangling of calls to my_init(), my_basic_init()
      and my_thread_global_init() was done.  There is no
      longer a need to do init in steps, so the full my_init()
      is called instead of my_init_basic().
            
      In addition,  Bug#11763065 was fixed.  The event handle
      'smem_event_connect_request' is only created if
      'opt_enable_shared_memory' is set.  When killing the
      server, an event was flagged on the handle
      unconditionally.  Added a test, so it will only be
      flagged if created.
      
      
      include/my_pthread.h:
        my_thread_basic_global_init is no longer
        necessary, and the my_thread_basic_global_reinit 
        function is renamed to reflect that it now
        reinits mutexes and condvars originating from
        my_thread_global_init
      mysys/my_thr_init.c:
        Reorganized code.
      c4715a80
    • Dmitry Lenev's avatar
      Fix for bug #11765505 - "58480: LARGE_TESTS.LOCK_TABLES_BIG · 901226b6
      Dmitry Lenev authored
      IS FAILING".
      
      The problem was that large_tests.lock_tables_big test was
      failing due to exceeding open files limit on platforms where
      this limit was set too low (this test simultaneously opens
      approx. 6000 files).
      
      This patch solves this issue by ensuring that this test is
      skipped on such platforms.
      901226b6
  12. 28 Feb, 2011 5 commits
  13. 27 Feb, 2011 1 commit
  14. 25 Feb, 2011 4 commits
  15. 24 Feb, 2011 1 commit
  16. 23 Feb, 2011 4 commits