1. 11 Sep, 2009 1 commit
    • Vladislav Vaintroub's avatar
      This is the downport of · 716099e0
      Vladislav Vaintroub authored
      Bug#24509 - 2048 file descriptor limit on windows needs increasing, also 
      WL#3049 - improved Windows I/O
                              
      The patch replaces the use of the POSIX I/O interfaces in mysys on Windows with 
      the Win32 API calls (CreateFile, WriteFile, etc). The Windows HANDLE for the open 
      file is stored in the my_file_info struct, along with a flag for append mode 
      because the Windows API does not support opening files in append mode in all cases)
      The default max open files has been increased to 16384 and can be increased further
      by setting --max-open-files=<value> during the server start.
                                    
      Another major change in this patch that almost all Windows specific file IO code
      has been moved to a new file my_winfile.c, greatly reducing the amount of code 
      in #ifdef blocks within mysys, thus improving readability.
                                     
                                          
      Minor enhancements:
      - my_(f)stat() is changed to use __stati64 structure with  64 file size
      and timestamps. It will return correct file size now (C runtime implementation
      used to report outdated information)
      - my_lock on Windows is prepared to handle additional timeout parameter
      - after review : changed __WIN__ to _WIN32 in the new and changed code.
      
      client/mysqlbinlog.cc:
        fileno -> my_fileno
      client/readline.cc:
        fileno -> my_fileno
      include/config-win.h:
        Increase OS_FILE_LIMIT for Windows.
        Remove O_SHARE - Windows does not support it. Its definition conflicts with
        O_SHORT_LIVED, that has different semantics.
      include/my_dir.h:
        Use stat64 for stat() family of functions on Windows, because of 64 bit file size.
      include/my_global.h:
        Increased default value for open file limit to 16K
      include/my_sys.h:
        - my_file_info got new structure members - file handle and open flags
        - 2 new Windows-only mysys functions : my_get_osfhandle and my_osmaperr,
          modelled after Windows C runtime functions _get_osfhandle and _dosmaperr
      libmysql/CMakeLists.txt:
        new files my_winfile.c and my_winerr.c
      mysql-test/suite/large_tests/r/lock_tables_big.result:
        test for more then 2048 open file descriptors on Windows
      mysql-test/suite/large_tests/t/lock_tables_big.test:
        test for more then 2048 open file descriptors on Windows
      mysys/CMakeLists.txt:
        new files my_winfile.c and my_winerr.c
      mysys/Makefile.am:
        new files my_winfile.c and my_winerr.c
      mysys/default_modify.c:
        fileno -> my_fileno
      mysys/my_chsize.c:
        implementation of chsize on Windows now moved to my_winfile.c
      mysys/my_create.c:
        - my_sopen->my_win_open
        - close open file before removing (won't generally work on Windows otherwise)
      mysys/my_file.c:
        On Windows, files returned by my_open will not start with 0, but 2048 
        (making it simple to detect incompatible mix of CRT and mysys  io functions)
      mysys/my_fopen.c:
        fileno->my_win_fileno , fclose->my_win_fclose, fdopen->my_win_fdopen
        Check for legal filename is done by my_win_[f]open functions
      mysys/my_fstream.c:
        fileno->my_fileno
      mysys/my_lib.c:
        Windows stat() functions are moved to my_winfile.c
      mysys/my_lock.c:
        Move Windows code under #ifdef to a separate function win_lock().
        Add a parameter for lock wait timeout
      mysys/my_mmap.c:
         _get_osfhandle->my_get_osfhandle
      mysys/my_open.c:
        my_sopen->my_win_open (simpler interface)
      mysys/my_pread.c:
        moved most windows specific code to my_win_file.c
        Use my_win_pread
      mysys/my_quick.c:
        Use my_win_read/my_win_write
      mysys/my_read.c:
        Moved most of windows specific code to my_win_file.c
        Use my_win_read()
      mysys/my_seek.c:
        On Windows, use my_win_lseek() in my_seek()/my_tell()
        Removed dead code (synchronization of lseeks)
        Improved DBUG tracing (file position is ulonglong, not ulong)
      mysys/my_static.c:
        Removed array initialization. my_file_info_default is global variable
        thus it is initialized with all zeros anyway
      mysys/my_sync.c:
        _commit->my_win_fsync
      mysys/my_winerr.c:
        New file my_winerr.c
        Exports my_osmaperr modelled after undocumented C runtime
        function _dosmaperr(). The problem with _dosmaperr() used previously is that 
        1) it is nowhere documented and thus code relying on it is not guaranteed to work
           in subsequent releases on the C runtime
        2) it is present only in static C runtime (mysqld does not link if compiled with
          /MD)
      mysys/my_winfile.c:
        New file my_winfile.c
        Implements ANSI/Posix file IO routines, when possible using native Windows IO, without
        C runtime (C runtime dropped because of the 2048 file descriptor limit).
      mysys/my_write.c:
        write->my_win_write
      mysys/mysys_priv.h:
        Declaration of Windows Posix functions (private to mysys, shall not be visible
        outside)
      storage/innobase/handler/ha_innodb.cc:
        mysys native Windows IO : correct innodb tmp file handling
        mysql_tmpfile does not return valid CRT file descriptor, thus
        it is not possible to dup() it. Instead, the native file handle has 
        to be duplicated and then converted to CRT descriptor.
      storage/myisam/mi_locking.c:
        _commit->my_sync
      716099e0
  2. 29 Aug, 2009 1 commit
  3. 27 Aug, 2009 3 commits
  4. 26 Aug, 2009 3 commits
  5. 25 Aug, 2009 2 commits
  6. 24 Aug, 2009 6 commits
    • Joerg Bruehe's avatar
      Automerge "trunk" -> "trunk-build". · 03c3e515
      Joerg Bruehe authored
      03c3e515
    • Davi Arnaut's avatar
      Bug#45261: Crash, stored procedure + decimal · fc394595
      Davi Arnaut authored
      The problem was that creating a DECIMAL column from a decimal
      value could lead to a failed assertion as decimal values can
      have a higher precision than those attached to a table. The
      assert could be triggered by creating a table from a decimal
      with a large (> 30) scale. Also, there was a problem in
      calculating the number of digits in the integral and fractional
      parts if both exceeded the maximum number of digits permitted
      by the new decimal type.
      
      The solution is to ensure that truncation procedure is executed
      when deducing a DECIMAL column from a decimal value of higher
      precision. If the integer part is equal to or bigger than the
      maximum precision for the DECIMAL type (65), the integer part
      is truncated to fit and the fractional becomes zero. Otherwise,
      the fractional part is truncated to fit into the space left
      after the integer part is copied.
      
      This patch borrows code and ideas from Martin Hansson's patch.
      
      mysql-test/r/type_newdecimal.result:
        Add test case result for Bug#45261. Also, update test case to
        reflect that an additive operation increases the precision of
        the resulting type by 1.
      mysql-test/t/type_newdecimal.test:
        Add test case for Bug#45261
      sql/field.cc:
        Added DBUG_ASSERT to ensure object's invariant is maintained.
        Implement method to create a field to hold a decimal value
        from an item.
      sql/field.h:
        Explain member variable. Add method to create a new decimal field.
      sql/item.cc:
        The precision should only be capped when storing the value
        on a table. Also, this makes it impossible to calculate the
        integer part if Item::decimals (the scale) is larger than the
        precision.
      sql/item.h:
        Simplify calculation of integer part.
      sql/item_cmpfunc.cc:
        Do not limit the precision. It will be capped later.
      sql/item_func.cc:
        Use new method for allocating a new decimal field.
        Add a specialized method for retrieving the precision
        of a user variable item.
      sql/item_func.h:
        Add method to return the precision of a user variable.
      sql/item_sum.cc:
        Use new method for allocating a new decimal field.
      sql/my_decimal.h:
        The integer part could be improperly calculated for a decimal
        with 31 digits in the fractional part.
      sql/sql_select.cc:
        Use new method which truncates the integer or decimal parts
        as needed.
      fc394595
    • Alfranio Correia's avatar
    • Alfranio Correia's avatar
    • Jonathan Perkin's avatar
      Apply changes from mysql-5.1.38-release clone: · 8a2454f8
      Jonathan Perkin authored
       - Add conditionals for bundled zlib and innodb plugin.
       - Apply patch from bug#46834 to install the test suite in RPMs.
       - Add plugins to RPMs.  Disable example plugins.
      8a2454f8
    • Alexander Nozdrin's avatar
      Backporting patch for Bug#46650 (Innodb assertion autoinc_lock == lock · 8b72c02a
      Alexander Nozdrin authored
      in lock_table_remove_low on INSERT SELECT) to mysql-trunk.
      8b72c02a
  7. 21 Aug, 2009 9 commits
    • Mattias Jonsson's avatar
      merge · 8b0ec014
      Mattias Jonsson authored
      8b0ec014
    • Mattias Jonsson's avatar
      Bug#46639: 1030 (HY000): Got error 124 from storage engine on · a4e832d6
      Mattias Jonsson authored
      INSERT ... SELECT ...
      
      Problem was that when bulk insert is used on an empty
      table/partition, it disables the indexes for better
      performance, but in this specific case it also tries
      to read from that partition using an index, which is
      not possible since it has been disabled.
      
      Solution was to allow index reads on disabled indexes
      if there are no records.
      
      Also reverted the patch for bug#38005, since that was a workaround
      in the partitioning engine instead of a fix in myisam.
      
      mysql-test/r/partition.result:
        Bug#46639: 1030 (HY000): Got error 124 from storage engine on
        INSERT ... SELECT ...
        
        updated result file
      mysql-test/t/partition.test:
        Bug#46639: 1030 (HY000): Got error 124 from storage engine on
        INSERT ... SELECT ...
        
        Added testcase
      sql/ha_partition.cc:
        Bug#46639: 1030 (HY000): Got error 124 from storage engine on
        INSERT ... SELECT ...
        
        reverted the patch for bug#38005, since that was a workaround
        around this problem, not needed after fixing it in myisam.
      storage/myisam/mi_search.c:
        Bug#46639: 1030 (HY000): Got error 124 from storage engine on
        INSERT ... SELECT ...
        
        Return HA_ERR_END_OF_FILE instead of HA_ERR_WRONG_INDEX
        when there are no rows.
      a4e832d6
    • Georgi Kodinov's avatar
      787a4940
    • Georgi Kodinov's avatar
      automerge · 8723e9d2
      Georgi Kodinov authored
      8723e9d2
    • Georgi Kodinov's avatar
      Revert of the fix for bug #46019. · 66ce3dee
      Georgi Kodinov authored
      66ce3dee
    • Martin Hansson's avatar
      Merge. · 8f75260b
      Martin Hansson authored
      8f75260b
    • Martin Hansson's avatar
      Merge. · b011f1ea
      Martin Hansson authored
      b011f1ea
    • Joerg Bruehe's avatar
    • Ramil Kalimullin's avatar
      Fix for bug #46456 [Ver->Prg]: HANDLER OPEN + TRUNCATE + DROP · fb9ba373
      Ramil Kalimullin authored
      (temporary) TABLE, crash
      
      Problem: if one has an open "HANDLER t1", further "TRUNCATE t1" 
      doesn't close the handler and leaves handler table hash in an 
      inconsistent state, that may lead to a server crash.
      
      Fix: TRUNCATE should implicitly close all open handlers.
      
      Doc. request: the fact should be described in the manual accordingly.
      
      
      mysql-test/r/handler_myisam.result:
        Fix for bug #46456 [Ver->Prg]: HANDLER OPEN + TRUNCATE + DROP
        (temporary) TABLE, crash
          - test result.
      mysql-test/t/handler_myisam.test:
        Fix for bug #46456 [Ver->Prg]: HANDLER OPEN + TRUNCATE + DROP
        (temporary) TABLE, crash
          - test case.
      sql/sql_delete.cc:
        Fix for bug #46456 [Ver->Prg]: HANDLER OPEN + TRUNCATE + DROP
         (temporary) TABLE, crash
          - remove all truncated tables from the HANDLER's hash.
      fb9ba373
  8. 20 Aug, 2009 8 commits
  9. 19 Aug, 2009 4 commits
    • Alfranio Correia's avatar
      BUG#45694 Deadlock in replicated statement is not retried · 40b9df39
      Alfranio Correia authored
      If the SQL Thread fails to execute an event due to a temporary error (e.g.
      ER_LOCK_DEADLOCK) and the option "--slave_transaction_retries" is set the SQL
      Thread should not be aborted and the transaction should be restarted from the
      beginning and re-executed.
      
      Unfortunately, a wrong interpretation of the THD::is_fatal_error was preventing
      this behavior. In a nutshell, "this variable is set to TRUE if an execution of a
      compound statement cannot continue. In particular, it is used to disable access
      to the CONTINUE or EXIT handlers of stored routines. So even temporary errors
      may have this variable set.
      
      To fix the bug, we have done what follows:
      
         DBUG_ENTER("has_temporary_error");
      
      -  if (thd->is_fatal_error)
      -    DBUG_RETURN(0);
      -
         DBUG_EXECUTE_IF("all_errors_are_temporary_errors",
                         if (thd->main_da.is_error())
                         {
      40b9df39
    • Alexander Nozdrin's avatar
      Fix default.conf · ed1976f1
      Alexander Nozdrin authored
      ed1976f1
    • Georgi Kodinov's avatar
      Bug #46019: ERROR 1356 When selecting from within another · 06655369
      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).
      06655369
    • Georgi Kodinov's avatar
      40defb1d
  10. 17 Aug, 2009 3 commits