1. 24 Aug, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #37044: Read overflow in opt_range.cc found during "make test" · 31abbbb0
      Georgi Kodinov authored
      The code was using a special global buffer for the value of IS NULL ranges.
      This was not always long enough to be copied by a regular memcpy. As a 
      result read buffer overflows may occur.
      Fixed by setting the null byte to 1 and setting the rest of the field disk image
      to NULL with a bzero (instead of relying on the buffer and memcpy()).
      31abbbb0
  2. 19 Aug, 2009 1 commit
  3. 21 Aug, 2009 3 commits
  4. 20 Aug, 2009 1 commit
    • Martin Hansson's avatar
      Bug#46616: Assertion `!table->auto_increment_field_not_null' on · fa0f3de5
      Martin Hansson authored
      view manipulations
            
      The bespoke flag was not properly reset after last call to 
      fill_record. Fixed by resetting in caller mysql_update.
      
      mysql-test/r/auto_increment.result:
        Bug#46616: Test result.
      mysql-test/t/auto_increment.test:
        Bug#46616: Test case.
      sql/sql_update.cc:
        Bug#46616: Fix.
      fa0f3de5
  5. 19 Aug, 2009 2 commits
    • Georgi Kodinov's avatar
      Bug #46019: ERROR 1356 When selecting from within another · da0e1c9b
      Georgi Kodinov authored
      view that has Group By
            
      Table access rights checking function check_grant() assumed
      that no view is opened when it's called.
      This is not true with nested views where the inner view
      needs materialization. In this case the view is already 
      materialized when check_grant() is called for it.
      This caused check_grant() to not look for table level
      grants on the materialized view table.
      Fixed by checking if a view is already materialized and if 
      it is check table level grants using the original table name
      (not the ones of the materialized temp table).
      da0e1c9b
    • Georgi Kodinov's avatar
      a92daba8
  6. 17 Aug, 2009 1 commit
  7. 13 Aug, 2009 1 commit
    • Davi Arnaut's avatar
      Bug#46013: rpl_extraColmaster_myisam fails on pb2 · a825d8c0
      Davi Arnaut authored
      Bug#45243: crash on win in sql thread clear_tables_to_lock() -> free()
      Bug#45242: crash on win in mysql_close() -> free()
      Bug#45238: rpl_slave_skip, rpl_change_master failed (lost connection) for STOP SLAVE
      Bug#46030: rpl_truncate_3innodb causes server crash on windows
      Bug#46014: rpl_stm_reset_slave crashes the server sporadically in pb2
      
      When killing a user session on the server, it's necessary to
      interrupt (notify) the thread associated with the session that
      the connection is being killed so that the thread is woken up
      if waiting for I/O. On a few platforms (Mac, Windows and HP-UX)
      where the SIGNAL_WITH_VIO_CLOSE flag is defined, this interruption
      procedure is to asynchronously close the underlying socket of
      the connection.
      
      In order to enable this schema, each connection serving thread
      registers its VIO (I/O interface) so that other threads can
      access it and close the connection. But only the owner thread of
      the VIO might delete it as to guarantee that other threads won't
      see freed memory (the thread unregisters the VIO before deleting
      it). A side note: closing the socket introduces a harmless race
      that might cause a thread attempt to read from a closed socket,
      but this is deemed acceptable.
      
      The problem is that this infrastructure was meant to only be used
      by server threads, but the slave I/O thread was registering the
      VIO of a mysql handle (a client API structure that represents a
      connection to another server instance) as a active connection of
      the thread. But under some circumstances such as network failures,
      the client API might destroy the VIO associated with a handle at
      will, yet the VIO wouldn't be properly unregistered. This could
      lead to accesses to freed data if a thread attempted to kill a
      slave I/O thread whose connection was already broken.
      
      There was a attempt to work around this by checking whether
      the socket was being interrupted, but this hack didn't work as
      intended due to the aforementioned race -- attempting to read
      from the socket would yield a "bad file descriptor" error.
      
      The solution is to add a hook to the client API that is called
      from the client code before the VIO of a handle is deleted.
      This hook allows the slave I/O thread to detach the active vio
      so it does not point to freed memory.
      
      server-tools/instance-manager/mysql_connection.cc:
        Add stub method required for linking.
      sql-common/client.c:
        Invoke hook.
      sql/client_settings.h:
        Export hook.
      sql/slave.cc:
        Introduce hook that clears the active VIO before it is freed
        by the client API.
      a825d8c0
  8. 12 Aug, 2009 1 commit
    • unknown's avatar
      BUG#45516 SQL thread does not use database charset properly · 6b1580c8
      unknown authored
              
      Replication SQL thread does not set database default charset to 
      thd->variables.collation_database properly, when executing LOAD DATA binlog.
      This bug can be repeated by using "LOAD DATA" command in STATEMENT mode.
              
      This patch adds code to find the default character set of the current database 
      then assign it to thd->db_charset when slave server begins to execute a relay log.
      The test of this bug is added into rpl_loaddata_charset.test 
      6b1580c8
  9. 11 Aug, 2009 4 commits
  10. 10 Aug, 2009 2 commits
  11. 08 Aug, 2009 1 commit
    • Davi Arnaut's avatar
      Bug#45010: invalid memory reads during parsing some strange statements · 357430de
      Davi Arnaut authored
      The problem is that the lexer could inadvertently skip over the
      end of a query being parsed if it encountered a malformed multibyte
      character. A specially crated query string could cause the lexer
      to jump up to six bytes past the end of the query buffer. Another
      problem was that the laxer could use unfiltered user input as
      a signed array index for the parser maps (having upper and lower
      bounds 0 and 256 respectively).
      
      The solution is to ensure that the lexer only skips over well-formed
      multibyte characters and that the index value of the parser maps
      is always a unsigned value.
      
      mysql-test/r/ctype_recoding.result:
        Update test case result: ending backtick is not skipped over anymore.
      sql/sql_lex.cc:
        Characters being analyzed must be unsigned as they can be
        used as indexes for the parser maps. Only skip over if the
        string is a valid multi-byte sequence.
      tests/mysql_client_test.c:
        Add test case for Bug#45010
      357430de
  12. 06 Aug, 2009 1 commit
  13. 04 Aug, 2009 2 commits
  14. 03 Aug, 2009 2 commits
  15. 02 Aug, 2009 1 commit
    • Alfranio Correia's avatar
      BUG#43264 Test rpl_trigger is failing randomly w/ use of copy_file in 5.0 · f8d7a710
      Alfranio Correia authored
      The test case fails sporadically on Windows while trying to overwrite an unused
      binary log. The problem stems from the fact that MySQL on Windows does not
      immediately unlock/release a file while the process that opened and closed it is
      still running. In BUG 38603, this issue was circumvented by stopping the MySQL
      process, copying the file and then restarting the MySQL process. 
      
      Unfortunately, such facilities are not available in the 5.0.  Other approaches
      such as stopping the slave and issuing change master do not work because the relay
      log file and index are not closed when a slave is stopped. So to fix the problem,
      we simply don't run on windows the part of the test that was failing.
      f8d7a710
  16. 31 Jul, 2009 1 commit
  17. 30 Jul, 2009 4 commits
    • Matthias Leich's avatar
      8e410185
    • Joerg Bruehe's avatar
      Merge the fix for bug#42213 into 5.0-build. · bdf6ecc4
      Joerg Bruehe authored
      bdf6ecc4
    • Matthias Leich's avatar
      Merge of fix for bug 44493 into GCA tree · a800612b
      Matthias Leich authored
      a800612b
    • Joerg Bruehe's avatar
      Our autoconf function "MYSQL_STACK_DIRECTION" will not work · 53b114c2
      Joerg Bruehe authored
      correctly if the compiler optimizes too clever.
      
      This has happaned on HP-UX 11.23 (IA64) at optimization
      level "+O2", causing bug#42213:
         Check for "stack overrun" doesn't work, server crashes
      
      Fix it by adding a pragma that prevents this optimization.
      As a result, it should be safe to use "+O2" on this platform
      (unless there is some other, optimizer-related, bug which
      is just currently masked because we use resudec optimization).
      
      
      config/ac-macros/misc.m4:
        Our autoconf function "MYSQL_STACK_DIRECTION" is meant to
        determine whether the stack grows towards higher or towards
        lower addresses.
        It does this by comparing the addresses of a variable
        (which is local to a recursive function) on different
        nesting levels.
        
        This approach requires that the function is really
        implemented as a recursive function, with each nested call
        allocating a new stack frame containing the local variable.
        If, however, the compiler is optimizing so clever that the
        recursive function is implemented by a loop, then this
        test will not produce correct results.
        
        This has happened on HP-UX 11.23 (IA64) when HP's compiler
        was called with optimization "+O2" (not with "+O1"),
        reported as bug#42213.
        
        Rather than starting a race with the compiler and making
        the function so complicated that this optimization does
        not happen, the idea is to prevent the optimization
        by adding a pragma. For HP, this is "#pragma noinline".
        
        If we encounter other compilers which also optimize
        too clever, we may add their pragmas here.
        
        It is a debatable issue whether such pragmas should be
        guarded by conditional compiling or not, the reviewers
        voted to do it.
        It seems HP has different compilers, "ANSI C" and "aCC",
        on the affected platform "__HP_cc" ("ANSI C") is predefined.
        To be on the safe side, the pragma will also take effect
        if HP's "aCC" compiler is used, or any other compiler on HP-UX.
      53b114c2
  18. 28 Jul, 2009 2 commits
    • Alexey Kopytov's avatar
      Automerge. · 6084ee27
      Alexey Kopytov authored
      6084ee27
    • Alexey Kopytov's avatar
      Bug #45031: invalid memory reads in my_real_read using protocol · 3e2d8d93
      Alexey Kopytov authored
                  compression 
       
      Since uint3korr() may read 4 bytes depending on build flags and 
      platform, allocate 1 extra "safety" byte in the network buffer 
      for cases when uint3korr() in my_real_read() is called to read
      last 3 bytes in the buffer. 
       
      It is practically hard to construct a reliable and reasonably 
      small test case for this bug as that would require constructing 
      input stream such that a certain sequence of bytes in a 
      compressed packet happens to be the last 3 bytes of the network 
      buffer. 
      
      
      sql/net_serv.cc:
        Allocate 1 extra "safety" byte in the network buffer for cases 
        when uint3korr() is used to read last 3 bytes in the buffer.
      3e2d8d93
  19. 27 Jul, 2009 3 commits
    • Davi Arnaut's avatar
      Bug#46385: [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted t · f9551a9c
      Davi Arnaut authored
      The maximum value of the max_join_size variable is set by converting
      a signed type (long int) with negative value (-1) to a wider unsigned
      type (unsigned long long), which yields the largest possible value of
      the wider unsigned type -- as per the language conversion rules. But,
      depending on build options, the type of the max_join_size might be a
      shorter type (ha_rows - unsigned long) which causes the warning to be
      thrown once the large value is truncated to fit.
      
      The solution is to ensure that the maximum value of the variable is
      always set to the maximum value of integer type of max_join_size.
      
      Furthermore, it would be interesting to always have a fixed type for
      this variable, but this would incur in a change of behavior which is
      not acceptable for a GA version. See Bug#35346.
      
      sql/mysqld.cc:
        Set max value for type.
      f9551a9c
    • Davi Arnaut's avatar
      Bug#20023: mysql_change_user() resets the value of SQL_BIG_SELECTS · f1133179
      Davi Arnaut authored
      Post-merge fix: test case could fail due to a conversion of the
      max_join_size value to a integer. Fixed by preserving the value
      as a string for comparison purposes.
      
      tests/mysql_client_test.c:
        Preserve max_join_size value as a string instead of converting
        it to a integer -- value can be larger then the type used.
      f1133179
    • Satya B's avatar
      merging with mysql-5.0-bugteam · c36c4e49
      Satya B authored
      c36c4e49
  20. 24 Jul, 2009 5 commits
    • Gleb Shchepa's avatar
      Bug #38816: kill + flush tables with read lock + stored · 065732ee
      Gleb Shchepa authored
                  procedures causes crashes!
      
      The problem of that bugreport was mostly fixed by the
      patch for bug 38691.
      However, attached test case focused on another crash or
      valgrind warning problem: SHOW PROCESSLIST query accesses
      freed memory of SP instruction that run in a parallel
      connection.
      
      Changes of thd->query/thd->query_length in dangerous
      places have been guarded with the per-thread
      LOCK_thd_data mutex (the THD::LOCK_delete mutex has been
      renamed to THD::LOCK_thd_data).
      
      
      sql/ha_myisam.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Modification of THD::query/query_length has been guarded
        with the a THD::set_query() method call/LOCK_thd_data
        mutex.
        Unnecessary locking with the global LOCK_thread_count
        mutex has been removed.
      sql/log_event.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Modification of THD::query/query_length has been guarded
        with the THD::set_query()) method call/LOCK_thd_data
        mutex.
      sql/slave.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Modification of THD::query/query_length has been guarded
        with the THD::set_query() method call/LOCK_thd_data mutex.
        
        The THD::LOCK_delete mutex has been renamed to
        THD::LOCK_thd_data.
      sql/sp_head.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Modification of THD::query/query_length has been guarded
        with the a THD::set_query() method call/LOCK_thd_data
        mutex.
      sql/sql_class.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        The new THD::LOCK_thd_data mutex and THD::set_query()
        method has been added to guard modifications of THD::query/
        THD::query_length fields, also the Statement::set_statement()
        method has been overloaded in the THD class.
        
        The THD::LOCK_delete mutex has been renamed to
        THD::LOCK_thd_data.
      sql/sql_class.h:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        The new THD::LOCK_thd_data mutex and THD::set_query()
        method has been added to guard modifications of THD::query/
        THD::query_length fields, also the Statement::set_statement()
        method has been overloaded in the THD class.
        
        The THD::LOCK_delete mutex has been renamed to
        THD::LOCK_thd_data.
      sql/sql_insert.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Modification of THD::query/query_length has been guarded
        with the a THD::set_query() method call/LOCK_thd_data
        mutex.
      sql/sql_parse.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Modification of THD::query/query_length has been guarded
        with the a THD::set_query() method call/LOCK_thd_data mutex.
      sql/sql_repl.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        The THD::LOCK_delete mutex has been renamed to
        THD::LOCK_thd_data.
      sql/sql_show.cc:
        Bug #38816: kill + flush tables with read lock + stored
                    procedures causes crashes!
        
        Inter-thread read of THD::query/query_length field has
        been protected with a new per-thread LOCK_thd_data
        mutex in the mysqld_list_processes function.
      065732ee
    • Alexey Kopytov's avatar
      Automerge. · 05e6e0aa
      Alexey Kopytov authored
      05e6e0aa
    • Alexey Kopytov's avatar
      Bug #46075: Assertion failed: 0, file .\protocol.cc, line 416 · df9eac9e
      Alexey Kopytov authored
      In create_myisam_from_heap() mark all errors as fatal except 
      HA_ERR_RECORD_FILE_FULL for a HEAP table.
      
      Not doing so could lead to problems, e.g. in a case when a
      temporary MyISAM table gets overrun due to its MAX_ROWS limit
      while executing INSERT/REPLACE IGNORE ... SELECT. 
      The SELECT execution was aborted, but the error was 
      converted to a warning due to IGNORE clause, so neither 'ok' 
      nor 'error' packet could be sent back to the client. This 
      condition led to hanging client when using 5.0 server, or 
      assertion failure in 5.1.
      
      
      mysql-test/r/insert_select.result:
        Added a test case for bug #46075.
      mysql-test/t/insert_select.test:
        Added a test case for bug #46075.
      sql/sql_select.cc:
        In create_myisam_from_heap() mark all errors as fatal except 
        HA_ERR_RECORD_FILE_FULL for a HEAP table.
      df9eac9e
    • V Narayanan's avatar
      merging with mysql-5.0-bugteam · feec1106
      V Narayanan authored
      feec1106
    • Satya B's avatar
      merge to mysql-5.0-bugteam · 7fd6a2e6
      Satya B authored
      7fd6a2e6
  21. 23 Jul, 2009 1 commit
    • Staale Smedseng's avatar
      Bug #45770 errors reading server SSL files are printed, but · 94db736d
      Staale Smedseng authored
      not logged
              
      Errors encountered during initialization of the SSL subsystem
      are printed to stderr, rather than to the error log.
              
      This patch adds a parameter to several SSL init functions to
      report the error (if any) out to the caller. The function
      init_ssl() in mysqld.cc is moved after the initialization of
      the log subsystem, so that any error messages can be logged to
      the error log. Printing of messages to stderr has been 
      retained to get diagnostic output in a client context.
      
      
      include/violite.h:
        Adding an enumeration for the various errors that can
        occur during initialization of the SSL module.
      sql/mysqld.cc:
        Adding more logging of SSL init errors, and moving
        init_ssl() till after initialization of logging 
        subsystem.
      vio/viosslfactories.c:
        Define error strings, provide an access method for these
        strings, and maintain an error parameter in several funcs
        to return the error (if any) to the caller.
      94db736d