1. 30 Jul, 2009 1 commit
    • V Narayanan's avatar
      Bug#45800 crash when replacing into a merge table and there is a duplicate · 0d61bd9d
      V Narayanan authored
            
      A REPLACE in the MERGE engine is actually a REPLACE
      into one (FIRST or LAST) of the underlying MyISAM
      tables. So in effect the server works on the meta
      data of the MERGE table, while the real insert happens
      in the MyISAM table.
      
      The MERGE table has no index, while MyISAM has a
      unique index. When a REPLACE into a MERGE table (
      and the REPLACE conflicts with a duplicate in a
      child table) is done, we try to access the duplicate
      key information for the MERGE table. This information
      actually does not exist, hence this results in a crash.
      
      The problem can be resolved by modifying the MERGE
      engine to provide us the duplicate key information
      directly, instead of just returning the MyISAM index
      number as the error key. Then the SQL layer (or "the
      server") does not try to access the key_info of the
      MERGE table, which does not exist.
      
      The current patch modifies the MERGE engine to provide
      the position for a record where a unique key violation
      occurs.
      
      include/myisammrg.h:
        Bug#45800 crash when replacing into a merge table and there is a duplicate
        
        Add a member to the st_mymerge_info structure that will
        store the duplicate key offset in the MERGE table. This
        offset will be the sum of the record offset of the MyISAM
        table within the MERGE table and the offset of the record
        within the MyISAM table.
      mysql-test/r/merge.result:
        Bug#45800 crash when replacing into a merge table and there is a duplicate
        
        Result file for the test case.
      mysql-test/t/merge.test:
        Bug#45800 crash when replacing into a merge table and there is a duplicate
        
        Added test case for both REPLACE and INSERT...ON DUPLICATE UPDATE.
      storage/myisammrg/ha_myisammrg.cc:
        Bug#45800 crash when replacing into a merge table and there is a duplicate
        
        The info method now will process the HA_STATUS_ERRKEY flag
        and will return the index and the offset of the duplicate
        key.
      storage/myisammrg/ha_myisammrg.h:
        Bug#45800 crash when replacing into a merge table and there is a duplicate
        
        Set the HA_DUPLICATE_POS flag to indicate that the duplicate
        key information is now available in the MERGE storage engine.
      storage/myisammrg/myrg_info.c:
        Bug#45800 crash when replacing into a merge table and there is a duplicate
        
        We modify the myrg_status function to return the position of the
        duplicate key. The duplicate key position in the MERGE table will
        be the MyISAM file_offset and the offset within the MyISAM table
        of the start position of the records.
      0d61bd9d
  2. 29 Jul, 2009 7 commits
    • Kristofer Pettersson's avatar
      Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al. · 846f0913
      Kristofer Pettersson authored
      Fixed wrong prototype declaration which cased build failure on solaris.
      846f0913
    • Kristofer Pettersson's avatar
      auto-merge · 0497f0c2
      Kristofer Pettersson authored
      0497f0c2
    • Kristofer Pettersson's avatar
      Bug#44521 Executing a stored procedure as a prepared statement can sometimes cause · fc1acef6
      Kristofer Pettersson authored
                an assertion in a debug build.
      
      The reason is that the C API doesn't support multiple result sets for prepared
      statements and attempting to execute a stored routine which returns multiple result
      sets sometimes lead to a network error. The network error sets the diagnostic area
      prematurely which later leads to the assert when an attempt is made to set a second
      server state.
      
      This patch fixes the issue by changing the scope of the error code returned by
      sp_instr_stmt::execute() to include any error which happened during the execution.
      To assure that Diagnostic_area::is_sent really mean that the message was sent all
      network related functions are checked for return status.
      
      libmysqld/lib_sql.cc:
        * Changed prototype to return success/failure status on net_send_error_packet(),
          net_send_ok(), net_send_eof(), write_eof_packet().
      mysql-test/r/sp_notembedded.result:
        * Added test case for bug 44521
      mysql-test/t/sp_notembedded.test:
        * Added test case for bug 44521
      sql/protocol.cc:
        * Changed prototype to return success/failure status on net_send_error_packet(),
          net_send_ok(), net_send_eof(), write_eof_packet().
      sql/protocol.h:
        * Changed prototype to return success/failure status on net_send_error_packet(),
          net_send_ok(), net_send_eof(), write_eof_packet().
      sql/sp_head.cc:
        * Changed prototype to return success/failure status on net_send_error_packet(),
          net_send_ok(), net_send_eof(), write_eof_packet().
      fc1acef6
    • Mikael Ronstrom's avatar
      2c38ed0d
    • Mikael Ronstrom's avatar
      Bug#46354, when defining partitions without subpartition definition after... · a8e7535e
      Mikael Ronstrom authored
      Bug#46354, when defining partitions without subpartition definition after defining it with the first partition and using list partition caused crash, fixed by more error checks in parser
      a8e7535e
    • Guilhem Bichot's avatar
      removing unused array (compiler warning) · 79283b61
      Guilhem Bichot authored
      79283b61
    • Guilhem Bichot's avatar
      Bug#45829 "CREATE TABLE TRANSACTIONAL PAGE_CHECKSUM ROW_FORMAT=PAGE accepted, does nothing": · a58b887c
      Guilhem Bichot authored
      those keywords do nothing in 5.1 (they are meant for future versions, for example featuring the Maria engine)
      so they are here removed from the syntax. Adding those keywords to future versions when needed is:
      - WL#5034 "Add TRANSACTIONA=0|1 and PAGE_CHECKSUM=0|1 clauses to CREATE TABLE"
      - WL#5037 "New ROW_FORMAT value for CREATE TABLE: PAGE"
      
      mysql-test/r/create.result:
        test that syntax is not accepted
      mysql-test/t/create.test:
        test that syntax is not accepted
      sql/handler.cc:
        remove ROW_FORMAT=PAGE
      sql/handler.h:
        Mark unused objects, but I don't remove them by fear of breaking any plugin which includes this file
        (see also table.h)
      sql/lex.h:
        removing syntax
      sql/sql_show.cc:
        removing output of noise keywords in SHOW CREATE TABLE and INFORMATION_SCHEMA.TABLES
      sql/sql_table.cc:
        removing TRANSACTIONAL
      sql/sql_yacc.yy:
        removing syntax
      sql/table.cc:
        removing TRANSACTIONAL, PAGE_CHECKSUM. Their place in the frm file is not reclaimed,
        for compatibility with older 5.1.
      sql/table.h:
        Mark unused objects, but I don't remove them by fear of breaking any plugin which includes this file
        (and there are several engines which use the content TABLE_SHARE and thus rely on a certain binary
        layout of this structure).
      a58b887c
  3. 28 Jul, 2009 8 commits
    • Alfranio Correia's avatar
    • Davi Arnaut's avatar
      If running the mysql_upgrade test case with Valgrind, the resource · 1df8ad6c
      Davi Arnaut authored
      consumption (CPU) for upgrading a large log table can be intense.
      Therefore, truncate the general_log table beforehand if running
      mysql_upgrade test with Valgrind.
      
      mysql-test/t/mysql_upgrade.test:
        Truncate log table if running with Valgrind.
      1df8ad6c
    • Alexey Kopytov's avatar
      Automerge. · 879162d3
      Alexey Kopytov authored
      879162d3
    • Alexey Kopytov's avatar
      Automerge. · fd3b0066
      Alexey Kopytov authored
      fd3b0066
    • Alexey Kopytov's avatar
      Automerge. · bac18522
      Alexey Kopytov authored
      bac18522
    • Alexey Kopytov's avatar
      Manual merge. · f9437bd7
      Alexey Kopytov authored
      f9437bd7
    • Alexey Kopytov's avatar
      Bug #45031: invalid memory reads in my_real_read using protocol · baefaa1e
      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.
      baefaa1e
    • Alfranio Correia's avatar
      BUG#41166 stored function requires "deterministic" if binlog_format is "statement" · 043e09b5
      Alfranio Correia authored
      If the log_bin_trust_function_creators option is not defined, creating a stored
      function requires either one of the modifiers DETERMINISTIC, NO SQL, or READS
      SQL DATA. Executing a stored function should also follows the same rules if in
      STATEMENT mode. However, this was not happening and a wrong error was being
      printed out: ER_BINLOG_ROW_RBR_TO_SBR.
      
      The patch makes the creation and execution compatible and prints out the correct
      error ER_BINLOG_UNSAFE_ROUTINE when a stored function without one of the modifiers
      above is executed in STATEMENT mode.
      043e09b5
  4. 27 Jul, 2009 7 commits
  5. 26 Jul, 2009 1 commit
    • Luis Soares's avatar
      BUG#43046: mixed mode switch to row format with temp table lead · cf505e44
      Luis Soares authored
                 to wrong result
            
      When using MIXED mode and issuing 'CREATE TEMPORARY TABLE t_tmp',
      the statement is logged if the current binlogging mode is
      STATEMENT. This causes the slave to replay the instruction and
      create the temporary table as well. If there is no switch to ROW
      mode, and later on a 'DROP TEMPORARY TABLE t_tmp' is issued, then
      this statement will also be logged and the slave will
      remove/close the temporary table.
            
      However, if there is a switch to ROW mode between the CREATE and
      DROP TEMPORARY table, the DROP statement will not be logged,
      leaving the slave with a dangling temporary table.
            
      This patch addresses this, by always logging a DROP TEMPORARY
      TABLE IF EXISTS when in mixed mode and a drop statement is issued
      for temporary table(s).
      
      mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result:
        Updated result file.
      mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test:
        Added test case.
      sql/sql_table.cc:
        When dropping table(s) in mixed mode and current statement 
        logging is ROW, builds an extra DROP TEMPORARY TABLE IF 
        EXISTS for temporary tables that are being dropped. Later, 
        it logs the extra drop statement.
      cf505e44
  6. 24 Jul, 2009 16 commits
    • Davi Arnaut's avatar
      Bug#43587: Putting event_scheduler=1 in init SQL file crashes · 8ec2f3d0
      Davi Arnaut authored
      mysqld
      
      The problem was that enabling the event scheduler inside a init
      file caused the server to crash upon start-up. The crash occurred
      because the event scheduler wasn't being initialized before the
      commands in the init-file are processed.
      
      The solution is to initialize the event scheduler before the init
      file is read. The patch also disables the event scheduler during
      bootstrap and makes the bootstrap operation robust in the
      presence of background threads.
      
      mysql-test/std_data/init_file.dat:
        Add test case for Bug#43587
      sql/event_scheduler.cc:
        Signal that the thread_count has been decremented.
      sql/events.cc:
        Disable the event scheduler during bootstrap.
      sql/mysql_priv.h:
        Export variable.
      sql/mysqld.cc:
        Initialize the event scheduler before commands are executed.
      sql/sql_parse.cc:
        Signal that the bootstrap thread is done.
      8ec2f3d0
    • Konstantin Osipov's avatar
    • Gleb Shchepa's avatar
      Merge from 5.0 · 2bc6b6a8
      Gleb Shchepa authored
      ******
      manual merge 5.0-bugteam --> 5.1-bugteam (bug 38816)
      2bc6b6a8
    • Gleb Shchepa's avatar
      Bug #38816: kill + flush tables with read lock + stored · dc0a87fd
      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.
      dc0a87fd
    • Alexey Kopytov's avatar
      Automerge. · c24cccab
      Alexey Kopytov authored
      c24cccab
    • Alexey Kopytov's avatar
      Automerge. · 8b435278
      Alexey Kopytov authored
      8b435278
    • Alexey Kopytov's avatar
      Automerge. · 85c97e6c
      Alexey Kopytov authored
      85c97e6c
    • Alexey Kopytov's avatar
      Manual merge. · 498dc4d3
      Alexey Kopytov authored
      498dc4d3
    • Alexey Kopytov's avatar
      Bug #46075: Assertion failed: 0, file .\protocol.cc, line 416 · 885292e4
      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.
      885292e4
    • Anurag Shekhar's avatar
      merging with local branch. · 21c2e21d
      Anurag Shekhar authored
      21c2e21d
    • Anurag Shekhar's avatar
      Bug#30102: Rename table does corrupt tables with partition files on failure · 0498988b
      Anurag Shekhar authored
      Problem was that a failing rename just left the partitions at the state
      it was at the failure.
      
      Solution was to try to revert the started rename if a failure occured.
      
      mysql-test/r/partition_not_embedded.result:
        Bug#30102: Rename table does corrupt tables with partition files on failure
        
        New result file
      mysql-test/t/partition_not_embedded.test:
        Bug#30102: Rename table does corrupt tables with partition files on failure
        
        New test file
        (list_files does not report the files in embedded)
      sql/ha_partition.cc:
        Bug#30102: Rename table does corrupt tables with partition files on failure
        
        Better error handling for rename partitions (reverting the started rename
        operation)
        
        Different order of files for delete.
      sql/handler.cc:
        Bug#30102: Rename table does corrupt tables with partition files on failure
        
        Tries to remove as many table files as possible
        if the first delete succeeds.
      0498988b
    • V Narayanan's avatar
      merging with mysql-5.1-bugteam · 3669be61
      V Narayanan authored
      3669be61
    • V Narayanan's avatar
      merging with mysql-5.0-bugteam · 74d4c331
      V Narayanan authored
      74d4c331
    • Satya B's avatar
      merge 5.0-bugteam to 5.1-bugteam · 30441aea
      Satya B authored
      30441aea
    • Alexander Barkov's avatar
      Backporting "WL#3332 Korean Enhancements" and · c6771e7b
      Alexander Barkov authored
      "WL#4584 New euckr characters" from 5.4.
      (as agreed on ServerPT meeting on July 8).
      c6771e7b
    • Satya B's avatar
      merge to mysql-5.0-bugteam · 559e2f1c
      Satya B authored
      559e2f1c