1. 31 May, 2010 4 commits
    • Gleb Shchepa's avatar
      Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY · fefbd756
      Gleb Shchepa authored
                  when it should use index
      
      Sometimes the LEFT/RIGHT JOIN with an empty table caused an
      unnecessary filesort.
      
      Sample query, where t1.i1 is indexed and t3 is empty:
      
        SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2
                             LEFT JOIN t3 ON t2.i2 = t3.i3
          ORDER BY t1.i1 LIMIT 5;
      
      The server erroneously used an item of empty outer-joined
      table as a common constant of a Item_equal (multi-equivalence
      expression).
      By the fix for the bug 16590 the constant status of such
      an item has been propagated to st_table::const_key_parts
      map bits related to other Item_equal argument-related
      key parts (those are obviously not constant in our case).
      As far as test_if_skip_sort_order function skips constant
      prefixes of testing keys, this caused an ignorance of
      available indices, since some prefixes were marked as
      constant by mistake.
      
      
      mysql-test/r/order_by.result:
        Test case for bug #38745.
      mysql-test/t/order_by.test:
        Test case for bug #38745.
      sql/item.h:
        Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY
                    when it should use index
        
        Item::is_outer_field() has been added and overloaded for
        Item_field and Item_ref classes.
      sql/item_cmpfunc.cc:
        Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY
                    when it should use index
        
        Item_equal::update_const() and Item_equal::update_used_tables()
        have been updated to not take into account the constantness
        of outer-joined table items.
      fefbd756
    • Davi Arnaut's avatar
      77e744f8
    • Tor Didriksen's avatar
      Bug #49829 Many "hides virtual function" warnings with SunStudio · 8231f082
      Tor Didriksen authored
      Backport from mysql-pe (of those parts which have not been upmerged from 5.1)
      
      
      
      sql/field.cc:
        Local scope variable or method argument same as class attribute.
      sql/item.cc:
        Rename auto variable to avoid name clash.
      sql/item.h:
        Item_ref::basic_const_item had wrong signature (missing const)
        and was thus never called.
      sql/partition_info.cc:
        Rename, to avoid name clashes.
      sql/sql_load.cc:
        Rename, to avoid name clashes.
      8231f082
    • Sergey Glukhov's avatar
      test case fix · 07f07ffe
      Sergey Glukhov authored
      07f07ffe
  2. 28 May, 2010 9 commits
    • Davi Arnaut's avatar
      Backport: remove dead code. · a1b8e4dc
      Davi Arnaut authored
      Reorganize function to reflect that it does not actually uses curses
      and that there is no curses variant.
      a1b8e4dc
    • Davi Arnaut's avatar
      Backport: Remove unused and ancient files, functions, and facilities. · 11648411
      Davi Arnaut authored
      client/mysql.cc:
        Remove unused functions.
      client/sql_string.cc:
        Remove unused functions.
      include/my_pthread.h:
        Remove unused prototype.
      mysys/my_pthread.c:
        Remove unused function.
      sql/lock.cc:
        Remove unused function.
      sql/lock.h:
        Remove unused and duplicated prototypes.
      sql/sql_class.h:
        Removed unused variables.
      sql/sql_const.h:
        Remove unused defines.
      sql/sql_priv.h:
        Remove unused defines.
      sql/sql_string.cc:
        Remove unused prototype.
      sql/thr_malloc.cc:
        Remove unused function.
      sql/thr_malloc.h:
        Remove unused prototype.
      storage/myisam/CMakeLists.txt:
        Remove obsolete fulltext file.
      storage/myisam/Makefile.am:
        Remove obsolete files (were already commented out).
      storage/myisam/ft_eval.c:
        Remove obsolete fulltext file.
      storage/myisam/ft_eval.h:
        Remove obsolete fulltext file.
      storage/myisam/ft_stem.c:
        Remove obsolete fulltext file.
      storage/myisam/ft_test1.c:
        Remove obsolete fulltext file.
      storage/myisam/ft_test1.h:
        Remove obsolete fulltext file.
      11648411
    • Davi Arnaut's avatar
    • Davi Arnaut's avatar
      0ef35548
    • Davi Arnaut's avatar
      Backport a old cleanup patch. · ba485814
      Davi Arnaut authored
      Formatting cleanup: removing tabs and trailing spaces
      to conform to MySQL Internals Coding Guidelines.
      ba485814
    • unknown's avatar
      Bug#52168 decimal casting catastrophes: crashes and valgrind errors on simple casts · 229cc4e1
      unknown authored
      The problem is that if a NULL is stored in an Item_cache_decimal object,
      the associated my_decimal object is not initialized.  However, it is still
      accessed when val_int() is called. The fix is to check for null_value
      within val_int(), and return without accessing the my_decimal object when
      the cached value is NULL.
      
      Bug#52122 reports the same issue for val_real(), and this patch also includes
      fixes for val_real() and val_str() and corresponding test cases from that
      bug report.  
      
      Also, NULL is returned from val_decimal() when value is null. This will
      avoid that callers access an uninitialized my_decimal object.
      
      Made similar changes to all other Item_cache classes.  Now all val_*
      methods should return a well defined value when actual value is NULL.
      
      mysql-test/r/type_decimal.result:
        Updated result file with test cases for Bug#52168 and Bug#52122.
      mysql-test/t/type_decimal.test:
        Added test cases for Bug#52168 and Bug#52122.
      sql/item.cc:
        In Item_cache_*::val_* methods, return a well defined value
        when actual value is NULL.
        
        This is especially important for Item_cache_decimal since
        otherwise one risk accessing an uninitialized my_decimal object.
      sql/item.h:
        Added method Item_cache::has_value() which returns TRUE if cache 
        object contains a non-null value.
      229cc4e1
    • Jonathan Perkin's avatar
    • Jonathan Perkin's avatar
      Merge · f02c9f13
      Jonathan Perkin authored
      f02c9f13
    • Alexander Nozdrin's avatar
      Auto-merge from mysql-trunk. · 59a99129
      Alexander Nozdrin authored
      59a99129
  3. 27 May, 2010 5 commits
    • Joerg Bruehe's avatar
      Get rid of the "net retry count" difference which · 7758bdc8
      Joerg Bruehe authored
      is not needed any more with current versions of FreeBSD.
      (Entries 52410 and 52412 in the Bug DB)
      
      That change is based on Dan Nelson replying on the
      FreeBSD mailing list, freebsd-questions@freebsd.org
      in a thread running from 2010-Apr-29 to 2010-May-1 titled
           "Need info about FreeBSD and interrupted system
            calls for MySQL code"
      
      Also, ensure the cmake settings correspond to the autotools
      ones: Add "HAVE_BROKEN_REALPATH" to cmake.
      
      
      cmake/os/FreeBSD.cmake:
        With current versions of FreeBSD, threading is not done on
        the user-level any more, so the huge "net retry count"
        is not needed any more.
        However, it is still being kept as a comment for now,
        so that it can be re-activated should the need arise.
        
        In addition, set "HAVE_BROKEN_REALPATH" to completely
        mirror the autotools path.
      configure.in:
        With current versions of FreeBSD, threading is not done on
        the user-level any more, so the huge "net retry count"
        is not needed any more.
        This definitely holds for FreeBSD version 6 and up.
        
        Adapt the informational messages to the path taken.
      7758bdc8
    • Sergey Glukhov's avatar
      Bug#52430 Incorrect key in the error message for duplicate key error involving BINARY type · f1e1d1bd
      Sergey Glukhov authored
      For BINARY(N) strip trailing zeroes to make the error message nice-looking
      
      
      mysql-test/r/errors.result:
        test case
      mysql-test/r/type_binary.result:
        result fix
      mysql-test/t/errors.test:
        test case
      sql/key.cc:
        For BINARY(N) strip trailing zeroes to make the error message nice-looking
      f1e1d1bd
    • Sergey Glukhov's avatar
      Bug#52856 concurrent show columns or show full columns causes a crash!!!1 · 8fa381fd
      Sergey Glukhov authored
      We should avoid any SHARE fields assignments as
      this is shared structure and assignments may
      affect other therads. To avoid this
      copy of SHARE struct is created and
      stored into TABLE struct which is
      used in get_schema_coulumns_record later.
      
      
      
      mysql-test/r/mdl_sync.result:
        test case
      mysql-test/t/mdl_sync.test:
        test case
      sql/sql_show.cc:
        We should avoid any SHARE fields assignments as
        this is shared structure and assignments may
        affect other therads. To avoid this
        copy of SHARE struct is created and
        stored into TABLE struct which is
        used in get_schema_coulumns_record later.
      8fa381fd
    • Jonathan Perkin's avatar
    • Tor Didriksen's avatar
      Bug #53445 Build with -Wall and fix warnings that it generates · bac571e1
      Tor Didriksen authored
      Post-push fix: -Wall implies -Wunused on some platforms,
      which will generate thousands of warnings about unused parameters.
      
      
      configure.cmake:
        Do not warn about unused parameters in C++
      bac571e1
  4. 26 May, 2010 4 commits
    • Tor Didriksen's avatar
      Bug #53445 Build with -Wall and fix warnings that it generates · 85da8956
      Tor Didriksen authored
      Add -Wall to gcc/g++
      Fix most warnings reported in dbg and opt mode.
      
      
      cmd-line-utils/libedit/filecomplete.c:
        Remove unused auto variables.
      configure.cmake:
        Add -Wall to gcc.
      extra/comp_err.c:
        Cast to correct type.
      extra/perror.c:
        Fix segfault (but warnings about deprecated features remain)
      extra/yassl/taocrypt/include/runtime.hpp:
        Comparing two literals was reported as undefined behaviour.
      include/my_global.h:
        Add a template for aligning character buffers.
      mysys/lf_alloc-pin.c:
        Initialize pointer.
      sql/mysqld.cc:
        Use UNINIT_VAR rather than LINT_INIT.
      sql/partition_info.cc:
        Use UNINIT_VAR rather than LINT_INIT.
      sql/rpl_handler.cc:
        Use char[] rather than unsigned long[] array for placement buffer.
      sql/spatial.cc:
        Use char[] rather than unsigned void*[] array for placement buffer.
      sql/spatial.h:
        Use char[] rather than unsigned void*[] array for placement buffer.
      sql/sql_partition.cc:
        Initialize auto variable.
      sql/sql_table.cc:
        Initialize auto variables.
        Add parens around assignment within if()
      sql/sys_vars.cc:
        Use UNINIT_VAR.
      storage/innobase/os/os0file.c:
        Init first slot in auto variable.
      storage/myisam/mi_create.c:
        Use UNINIT_VAR rather than LINT_INIT.
      storage/myisam/mi_open.c:
        Remove (wrong) casting.
      storage/myisam/mi_page.c:
        Remove (wrong) casting.
      storage/myisam/mi_search.c:
        Cast to uchar* rather than char*.
      strings/ctype-ucs2.c:
        Use UNINIT_VAR rather than LINT_INIT.
        Add (uchar*) casting.
      85da8956
    • Alexander Nozdrin's avatar
    • Alexander Nozdrin's avatar
      de0f63c1
    • Mattias Jonsson's avatar
      pre push fix of test results · 3fb49262
      Mattias Jonsson authored
      3fb49262
  5. 25 May, 2010 5 commits
  6. 24 May, 2010 4 commits
  7. 23 May, 2010 1 commit
    • Alexey Kopytov's avatar
      Manual merge of mysql-5.1-bugteam to mysql-trunk-merge. · 598cf5ae
      Alexey Kopytov authored
      Conflicts:
      
         conflict      Makefile.am
         conflict      mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
         conflict      mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
         conflict      sql/opt_sum.cc
         conflict      sql/set_var.cc
         conflict      sql/sql_base.cc
         conflict      sql/sql_priv.h
         conflict      sql/sql_show.cc
      598cf5ae
  8. 21 May, 2010 5 commits
    • Gleb Shchepa's avatar
      Bug #53804: serious flaws in the alter database .. upgrade · d72a4710
      Gleb Shchepa authored
                  data directory name command
      
      The check_db_name function has been modified to validate tails of
      #mysql50#-prefixed database names for compliance with MySQL 5.0
      database name encoding rules (the check_table_name function call
      has been reused).
      
      
      mysql-test/r/renamedb.result:
        Updated test case.
      mysql-test/r/upgrade.result:
        Test case for bug #53804.
      mysql-test/t/renamedb.test:
        Updated test case.
      mysql-test/t/upgrade.test:
        Test case for bug #53804.
      sql/mysql_priv.h:
        Bug #53804: serious flaws in the alter database .. upgrade
                    data directory name command
        
        The check_mysql50_prefix has been added.
      sql/sql_table.cc:
        Bug #53804: serious flaws in the alter database .. upgrade
                    data directory name command
        
        - The check_mysql50_prefix has been added.
        - The check_n_cut_mysql50_prefix function has been refactored
        to share code with new check_mysql50_prefix function.
      sql/table.cc:
        Bug #53804: serious flaws in the alter database .. upgrade
                    data directory name command
        
        The check_db_name function has been modified to validate tails of
        #mysql50#-prefixed database names for compliance with MySQL 5.0
        database name encoding rules.
      d72a4710
    • Jon Olav Hauglid's avatar
      merge from mysql-trunk-runtime · 923da1e8
      Jon Olav Hauglid authored
      923da1e8
    • Alexander Nozdrin's avatar
      Backporting a test case for Bug#30036 (SHOW TABLE TYPES causes the debug client · 5e4a4020
      Alexander Nozdrin authored
      to crash) from mysql-6.0-codebase.
      5e4a4020
    • Alexander Nozdrin's avatar
      Fix for Bug#52923 (Inadequate documentation of "Can't get hostname for your address" error). · 9003fb7c
      Alexander Nozdrin authored
      The thing is that on some platforms (e.g. Mac OS X) sockaddr_in / sockaddr_in6
      contain a non-standard field (sin_len / sin6_len), that must be set.
      
      The problem was that only standard fields were set, thus getnameinfo() returned
      EAI_SYSTEM instead of EAI_NONAME.
      
      The fix is to introduce configure-time checks (for GNU auto-tools and CMake) for
      those additional fields and to set them if they are available.
      9003fb7c
    • Dmitry Lenev's avatar
      Follow-up for the fix for bug #46947 "Embedded SELECT without · 705b98df
      Dmitry Lenev authored
      FOR UPDATE is causing a lock".
       
      This patch tries to address problems which were exposed 
      during backporting of original patch to 5.1 tree.
       
      - It ensures that we don't change locking behavior of simple
        SELECT statements on InnoDB tables when they are executed
        under LOCK TABLES ... READ and with @@innodb_table_locks=0.
        Also we no longer pass TL_READ_DEFAULT/TL_WRITE_DEFAULT 
        lock types, which are supposed to be parser-only, to 
        handler::start_stmt() method.
      - It makes check_/no_concurrent_insert.inc auxiliary scripts 
        more robust against changes in test cases that use them
        and also ensures that they don't unnecessarily change 
        environment of caller.
      
      mysql-test/include/check_concurrent_insert.inc:
        Reset DEBUG_SYNC facility before and after using it in
        auxiliary script. This makes this script more robust against
        changes in test cases calling it. It also ensures that script
        does not unnecessarily change environment of caller.
      mysql-test/include/check_no_concurrent_insert.inc:
        Reset DEBUG_SYNC facility before and after using it in
        auxiliary script. This makes this script more robust against
        changes in test cases calling it. It also ensures that script
        does not unnecessarily change environment of caller.
      mysql-test/r/innodb-lock.result:
        Added coverage for LOCK TABLES ... READ behavior in
        @@innodb_table_locks = 0 mode. This test also checks
        that an appropriate type of lock is passed to
        handler::start_stmt() method.
      mysql-test/t/innodb-lock.test:
        Added coverage for LOCK TABLES ... READ behavior in
        @@innodb_table_locks = 0 mode. This test also checks
        that an appropriate type of lock is passed to
        handler::start_stmt() method.
      sql/sql_base.cc:
        Since we no longer set TL_READ as lock type for tables used  
        in simple SELECT right in the parser, in order to preserve  
        behavior for such statements on InnoDB tables when in  
        LOCK TABLES mode with @innodb_table_locks = 0,  
        check_lock_and_start_stmt() had to be changed to convert  
        TL_READ_DEFAULT to an appropriate type of read lock before  
        passing it to handler::start_stmt() method.  
        We do similar thing for TL_WRITE_DEFAULT as this lock type  
        is also supposed to be parser-only type.  
        As consequence read_lock_type_for_table() had to be  
        adjusted to behave properly when it is called from  
        check_lock_and_start_stmt() in prelocked mode.
      705b98df
  9. 20 May, 2010 3 commits
    • Sven Sandberg's avatar
      BUG#52987: mysqldump fails if umask=0077 · 37b02cd7
      Sven Sandberg authored
      Problem: The test case mysqldump reads a file that must
      be world-readable. The test did not force the file to be
      world-readable, so if the tree was branched with a umask
      of 0077, the test would fail.
      Fix: chmod the file.
      
      
      mysql-test/t/mysqldump.test:
        Added chmod so that the file is guaranteed to be world-readable.
      37b02cd7
    • Alexander Nozdrin's avatar
      Manual merge from mysql-trunk. · dabd4a1c
      Alexander Nozdrin authored
      Conflicts:
        - mysql-test/r/partition.result
        - mysql-test/r/variables_debug.result
        - mysql-test/t/partition.test
        - mysql-test/t/variables_debug.test
      dabd4a1c
    • Alexander Nozdrin's avatar
      Empty merge from mysql-trunk. · 44486663
      Alexander Nozdrin authored
      44486663