1. 23 Jul, 2010 1 commit
    • Alexey Kopytov's avatar
      Bug #54476: crash when group_concat and 'with rollup' in · 116931c1
      Alexey Kopytov authored
                           prepared statements
      
      Using GROUP_CONCAT() together with the WITH ROLLUP modifier
      could crash the server.
      
      The reason was a combination of several facts:
      
      1. The Item_func_group_concat class stores pointers to ORDER
      objects representing the columns in the ORDER BY clause of
      GROUP_CONCAT().
      
      2. find_order_in_list() called from
      Item_func_group_concat::setup() modifies the ORDER objects so
      that their 'item' member points to the arguments list
      allocated in the Item_func_group_concat constructor.
      
      3. In some cases (e.g. in JOIN::rollup_make_fields) a copy of
      the original Item_func_group_concat object could be created by
      using the Item_func_group_concat::Item_func_group_concat(THD
      *thd, Item_func_group_concat *item) copy constructor. The
      latter essentially creates a shallow copy of the source
      object. Memory for the arguments array is allocated on
      thd->mem_root, but the pointers for arguments and ORDER are
      copied verbatim.
      
      What happens in the test case is that when executing the query
      for the first time, after a copy of the original
      Item_func_group_concat object has been created by
      JOIN::rollup_make_fields(), find_order_in_list() is called for
      this new object. It then resolves ORDER BY by modifying the
      ORDER objects so that they point to elements of the arguments
      array which is local to the cloned object. When thd->mem_root
      is freed upon completing the execution, pointers in the ORDER
      objects become invalid. Those ORDER objects, however, are also
      shared with the original Item_func_group_concat object which is
      preserved between executions of a prepared statement. So the
      first call to find_order_in_list() for the original object on
      the second execution tries to dereference an invalid pointer.
      
      The solution is to create copies of the ORDER objects when
      copying Item_func_group_concat to not leave any stale pointers
      in other instances with different lifecycles.
      
      
      
      mysql-test/r/func_gconcat.result:
        Test case for bug #54476.
      mysql-test/t/func_gconcat.test:
        Test case for bug #54476.
      sql/item_sum.cc:
        Copy the ORDER objects pointed to by the elements of the 
        'order' array in the copy constructor of 
        Item_func_group_concat.
      sql/table.h:
        Removed the unused 'item_copy' member of the ORDER class.
      116931c1
  2. 21 Jul, 2010 10 commits
  3. 20 Jul, 2010 3 commits
    • Davi Arnaut's avatar
      Bug#45288: pb2 returns a lot of compilation warnings on linux · 450d34b7
      Davi Arnaut authored
      Fix warnings flagged by the new warning option -Wunused-but-set-variable
      that was added to GCC 4.6 and that is enabled by -Wunused and -Wall. The
      option causes a warning whenever a local variable is assigned to but is
      later unused. It also warns about meaningless pointer dereferences.
      
      client/mysql.cc:
        Meaningless pointer dereferences.
      client/mysql_upgrade.c:
        Check whether reading from the file succeeded.
      extra/comp_err.c:
        Unused.
      extra/yassl/src/yassl_imp.cpp:
        Skip instead of reading data that is discarded.
      include/my_pthread.h:
        Variable is only used in debug builds.
      include/mysys_err.h:
        Add new error messages.
      mysys/errors.c:
        Add new error message for permission related functions.
      mysys/mf_iocache.c:
        Variable is only checked under THREAD.
      mysys/my_copy.c:
        Raise a error if chmod or chown fails.
      mysys/my_redel.c:
        Raise a error if chmod or chown fails.
      regex/engine.c:
        Use a equivalent variable for the assert.
      server-tools/instance-manager/instance_options.cc:
        Unused.
      sql/field.cc:
        Unused.
      sql/item.cc:
        Unused.
      sql/log.cc:
        Do not ignore the return value of freopen: only set buffer if
        reopening succeeds.
        
        Adjust doxygen comment to the right function.
        
        Pass message lenght to log function.
      sql/mysqld.cc:
        Do not ignore the return value of freopen: only set buffer if
        reopening succeeds.
      sql/partition_info.cc:
        Unused.
      sql/slave.cc:
        No need to set pointer to the address of '\0'.
      sql/spatial.cc:
        Unused. Left for historical purposes.
      sql/sql_acl.cc:
        Unused.
      sql/sql_base.cc:
        Pointers are always set to the same variables.
      sql/sql_parse.cc:
        End statement if reading fails.
        
        Store the buffer after it has actually been updated.
      sql/sql_repl.cc:
        No need to set pointer to the address of '\0'.
      sql/sql_show.cc:
        Put variable under the same ifdef block.
      sql/udf_example.c:
        Set null pointer flag appropriately.
      storage/csv/ha_tina.cc:
        Meaningless dereferences.
      storage/example/ha_example.cc:
        Return the error since it's available.
      storage/myisam/mi_locking.c:
        Remove unused and dead code.
      450d34b7
    • Davi Arnaut's avatar
      Bug#52514: mysql 5.1 do_abi_check does not compile w/ gcc4.5 · d42b1ce3
      Davi Arnaut authored
                 due to GCC preprocessor change
            
      The problem is that newer GCC versions treats missing headers
      as fatal errors. The solution is to use a guard macro to prevent
      the inclusion of system headers when checking the ABI with the
      C Preprocessor.
      
      Reference: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15638
                 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44836
      
      Makefile.am:
        Define guard macro.
      configure.in:
        Remove workaround.
      include/mysql.h:
        Guard the header inclusion.
      include/mysql.h.pp:
        Header is not included anymore.
      d42b1ce3
    • Davi Arnaut's avatar
      Bug#54453: Failing assertion: trx->active_trans when renaming a · 6c79155d
      Davi Arnaut authored
                 table with active trx
      
      Essentially, the problem is that InnoDB does a implicit commit
      when a cursor (table handler) is unlocked/closed, creating
      a dissonance between the transaction state within the server
      layer and the storage engine layer. Theoretically, a statement
      transaction can encompass several table instances in a similar
      manner to a multiple statement transaction, hence it does not
      make sense to limit a statement transaction to the lifetime of
      the table instances (cursors) used within it.
      
      Since this particular instance of the problem is only triggerable
      on 5.1 and is masked on 5.5 due 2PC being skipped (assertion is in
      the prepare phase of a 2PC), the solution (which is less risky) is
      to explicitly end the transaction before the cached table is unlock
      on rename table.
      
      The patch is to be null merged into trunk.
      
      mysql-test/include/commit.inc:
        Fix counters, the binlog engine does not get involved anymore.
      mysql-test/suite/innodb_plugin/r/innodb_bug54453.result:
        Add test case result for Bug#54453
      mysql-test/suite/innodb_plugin/t/innodb_bug54453.test:
        Add test case for Bug#54453
      sql/sql_table.cc:
        End transaction as otherwise InnoDB will end it behind our backs.
      6c79155d
  4. 19 Jul, 2010 4 commits
  5. 16 Jul, 2010 3 commits
    • Davi Arnaut's avatar
      Bug#48327: Some crashes specific to FreeBSD ("embedded") · fdbb37d4
      Davi Arnaut authored
      Bug#47139: Test "merge" crashes in "embedded" run
      
      Backport patch for Bug#47139
      fdbb37d4
    • Georgi Kodinov's avatar
      d32efc12
    • Ramil Kalimullin's avatar
      Fix for bug #50667: The InnoDB plugin prevents initialization · c20f5f4c
      Ramil Kalimullin authored
      of the "embedded" server
      
      Problem: mysqltest_embedded failed to load ha_innodb_plugin library
      on some platforms (due to some unresolved references).
      
      Fix: on FreeBSD use -export-dynamic flag building mysqltest_embedded.
      That allows to use its global symbols to resolve references in the
      dynamically loaded plugin library.
      
      
      libmysqld/examples/Makefile.am:
        Fix for bug #50667: The InnoDB plugin prevents initialization
        of the "embedded" server
          - use -export-dynamic (on FreeBSD/DragonFly) building
        mysqltest_embedded to allow using its global symbols 
        to resolve references in the dynamically loaded plugin libraries.
      c20f5f4c
  6. 15 Jul, 2010 1 commit
    • Alexey Kopytov's avatar
      Backport of the fix for bug#25421 to 5.0. · ce3d6c97
      Alexey Kopytov authored
      Calculating the estimated number of records for a range scan
      may take a significant time, and it was impossible for a user
      to interrupt that process by killing the connection or the
      query.
      
      Fixed by checking the thread's 'killed' status in
      check_quick_keys() and interrupting the calculation process if
      it is set to a non-zero value.
      ce3d6c97
  7. 12 Jul, 2010 1 commit
    • Alexey Kopytov's avatar
      Bug#55061: Build failing on sol 8 x86 - assembler code vs · 5a0f3168
      Alexey Kopytov authored
                 compiler problem
      
      GCC-style inline assembly is not supported by the Sun Studio
      compilers prior to version 12.
      
      Added a check for the Sun Studio version to avoid using 
      _FPU_GETCW() / _FPU_SETCW() when inline assembly is
       unsupported. This can lead to some differences in floating
      point calculations on Solaris 8/x86 which, however, is not worth
      bothering with Sun-style assembly .il templates.
      5a0f3168
  8. 09 Jul, 2010 10 commits
    • Mattias Jonsson's avatar
      merge · f2e56a42
      Mattias Jonsson authored
      f2e56a42
    • Mattias Jonsson's avatar
      merge · ffc229ee
      Mattias Jonsson authored
      ffc229ee
    • Davi Arnaut's avatar
      Remove AC_LANG_WERROR, it causes trouble earlier versions · a34de807
      Davi Arnaut authored
      of autoconf and is not strictly needed for now.
      a34de807
    • unknown's avatar
      60c8958c
    • Georgi Kodinov's avatar
    • Davi Arnaut's avatar
      Bug#45288: pb2 returns a lot of compilation warnings on linux · dd12c004
      Davi Arnaut authored
      Although the C standard mandates that sprintf return the number
      of bytes written, some very ancient systems (i.e. SunOS 4)
      returned a pointer to the buffer instead. Since these systems
      are not supported anymore and are hopefully long dead by now,
      simply remove the portability wrapper that dealt with this
      discrepancy. The autoconf check was causing trouble with GCC.
      dd12c004
    • Davi Arnaut's avatar
      Bug#53445: Build with -Wall and fix warnings that it generates · f7166f46
      Davi Arnaut authored
      Introduce a MySQL maintainer/developer mode that enables
      a set of warning options for the C/C++ compiler. This mode
      is intended to help improve the overall quality of the code.
      
      The warning options are:
      
      C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Werror"
      CXX_WARNINGS="$C_WARNINGS -Wno-unused-parameter"
      
      Since -Wall is essentially a moving target, autoconf checks
      are not run with warning options enabled, in particualr -Werror.
      This decision might be revisited in the future. The patch also
      fixes a mistake in the makefiles, where automake CXXFLAGS would
      be set to CFLAGS.
      
      config/ac-macros/maintainer.m4:
        Add a set of default compiler flags used when in maintainer mode.
      configure.in:
        Hook into the maintainer mode. Disabled by default.
      f7166f46
    • Mattias Jonsson's avatar
      Bug#52517: Regression in ROW level replication performance with partitions · 08ae89c6
      Mattias Jonsson authored
      In bug-28430 HA_PRIMARY_KEY_REQUIRED_FOR_POSITION
      was disabled in the partitioning engine in the first patch,
      That bug was later fixed a second time, but that flag
      was not removed.
      
      No need to disable this flag, as it leads to bad
      choise in row replication.
      
      sql/ha_partition.h:
        Not disabling HA_PRIMARY_KEY_REQUIRED_FOR_POSITION flag.
        Updated comment (has nothing to do with hidden key.
      sql/handler.h:
        Updated comments to about HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
      08ae89c6
    • Sergey Glukhov's avatar
      Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set · 652456f6
      Sergey Glukhov authored
      The problem there is that HAVING condition evaluates const
      parts of condition despite the condition has references
      on aggregate functions. Table t1 became const tables
      after make_join_statistics and table1.pk = 1, HAVING is
      transformed into MAX(1) < 7 and taken away from HAVING.
      The fix is to skip evaluation of HAVING conts parts if
      HAVING condition has references on aggregate functions.
      
      
      mysql-test/r/having.result:
        test case
      mysql-test/t/having.test:
        test case
      sql/sql_select.cc:
        skip evaluation of HAVING conts parts if
        HAVING condition has references on aggregate functions.
      652456f6
    • Jimmy Yang's avatar
      Fix bug #55039 Failing assertion: space_id > 0 in fil0fil.c. · d44003e8
      Jimmy Yang authored
      rb://396, approved by Sunny Bains.
      d44003e8
  9. 08 Jul, 2010 3 commits
  10. 07 Jul, 2010 4 commits
    • sunanda's avatar
      rko Mdkeld change, revision 3351.14.134 add innodb_plugin to mysql-test-run default suites · bba86e6c
      sunanda authored
      was not complete. Bootstrap failed to pick up necessary files needed by test and hence
      all tests failed.
      bba86e6c
    • Vasil Dimov's avatar
      Merge the fix for Bug#49238 from SVN · 2dc8e3da
      Vasil Dimov authored
      (without the unrelated whitespace changes):
      
        ------------------------------------------------------------------------
        r7009 | jyang | 2010-04-29 20:44:56 +0300 (Thu, 29 Apr 2010) | 6 lines
        
        branches/5.0: Port fix for bug #49238 (Creating/Dropping a temporary
        table while at 1023 transactions will cause assert) from 5.1 to
        branches/5.1. Separate action for return value DB_TOO_MANY_CONCURRENT_TRXS
        from that of DB_MUST_GET_MORE_FILE_SPACE in row_drop_table_for_mysql().
        
        
        ------------------------------------------------------------------------
      2dc8e3da
    • Jon Olav Hauglid's avatar
      Bug #54117 crash in thr_multi_unlock, temporary table · 425a1a6d
      Jon Olav Hauglid authored
      This crash occured after ALTER TABLE was used on a temporary
      transactional table locked by LOCK TABLES. Any later attempts to
      execute LOCK/UNLOCK TABLES, caused the server to crash.
      
      The reason for the crash was the list of locked tables would
      end up having a pointer to a free'd table instance. This happened
      because ALTER TABLE deleted the table without also removing the
      table reference from the locked tables list.
      
      This patch fixes the problem by making sure ALTER TABLE also
      removes the table from the locked tables list.
      
      Test case added to innodb_mysql.test.
      425a1a6d
    • Georgi Kodinov's avatar
      Addendum to the fix for bug #53095 (failing information_schema.test on windows) · 7bd0c00c
      Georgi Kodinov authored
      Since the original fix for this bug lowercases the search pattern it's not a 
      good idea to copy the search pattern to the output instead of the real table 
      name found (since, depending on the case mode these two names may differ in 
      case).
      Fixed the infrmation_schema.test failure by making sure the actual table 
      name of an inoformation schema table is passed instead of the lookup pattern
      even when the pattern doesn't contain wildcards.
      7bd0c00c