1. 25 May, 2010 2 commits
    • Davi Arnaut's avatar
      Bug#42643: InnoDB does not support replication of TRUNCATE TABLE · 3c279d9a
      Davi Arnaut authored
      The problem was that TRUNCATE TABLE didn't take a exclusive
      lock on a table if it resorted to truncating via delete of
      all rows in the table. Specifically for InnoDB tables, this
      could break proper isolation as InnoDB ends up aborting some
      granted locks when truncating a table.
      
      The solution is to take a exclusive metadata lock before
      TRUNCATE TABLE can proceed. This guarantees that no other
      transaction is using the table.
      
      Incompatible change: Truncate via delete no longer fails
      if sql_safe_updates is activated (this was a undocumented
      side effect).
      3c279d9a
    • Dmitry Lenev's avatar
      Pre-requisite patch for bug #51263 "Deadlock between · a3c080be
      Dmitry Lenev authored
      transactional SELECT and ALTER TABLE ... REBUILD PARTITION".
      
      The goal of this patch is to decouple type of metadata
      lock acquired for table by open_tables() from type of
      table-level lock to be acquired on it.
      
      To achieve this we change approach to how we determine what
      type of metadata lock should be acquired on table to be open.
      Now instead of inferring it at open_tables() time from flags
      and type of table-level lock we rely on that type of metadata
      lock is properly set at parsing time and is not changed
      further.
      a3c080be
  2. 21 May, 2010 1 commit
    • Dmitry Lenev's avatar
      Follow-up for the fix for bug #46947 "Embedded SELECT without · 6ceacd4f
      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.
      6ceacd4f
  3. 19 May, 2010 1 commit
    • Jon Olav Hauglid's avatar
      Bug #53798 OPTIMIZE TABLE breaks repeatable read · c09eb2af
      Jon Olav Hauglid authored
      The problem was that OPTMIZE TABLE was allowed to run on a table
      in use by a transaction in a different connection. This caused
      repeatable read to break.
      
      This bug was fixed by the introduction of metadata locking, WL#4284.
      OPTIMIZE TABLE will now be blocked until the transaction using the
      table, has ended.
      
      This patch contains a regression test added to innodb_mysql_lock.test
      and no code changes.
      c09eb2af
  4. 18 May, 2010 3 commits
  5. 17 May, 2010 2 commits
  6. 16 May, 2010 2 commits
  7. 14 May, 2010 3 commits
    • Alexander Nozdrin's avatar
      Patch for Bug#27863 (excessive memory usage for many small queries in a · 5c4333bc
      Alexander Nozdrin authored
      multiquery packet).
      
      Background:
      
        - a query can contain multiple SQL statements;
      
        - the server frees resources allocated to process a query when the
          whole query is handled. In other words, resources allocated to process
          one SQL statement from a multi-statement query are freed when all SQL
          statements are handled.
      
      The problem was that the parser allocated a buffer of size of the whole
      query for each SQL statement in a multi-statement query. Thus, if a query
      had many SQL-statements (so, the query was long), but each SQL statement
      was short, ther parser tried to allocate huge amount of memory (number of
      small SQL statements * length of the whole query).
      
      The memory was allocated for a so-called "cpp buffer", which is intended to
      store pre-processed SQL statement -- SQL text without version specific
      comments.
      
      The fix is to allocate memory for the "cpp buffer" once for all SQL
      statements (once for a query).
      5c4333bc
    • Konstantin Osipov's avatar
      Committing on behalf of Valdislav Vaintroub (reviewed and · d63caa0c
      Konstantin Osipov authored
      approved):
      
      3161 Vladislav Vaintroub       2010-04-29                 
       Bug#53196 : CMake builds don't support 'make tags' and 
      'make ctags' targets.  
         - Added tags and ctags targets
      d63caa0c
    • Alexander Nozdrin's avatar
      Patch for Bug#21818 (Return value of ROW_COUNT() is incorrect · 7752ccec
      Alexander Nozdrin authored
      for ALTER TABLE, LOAD DATA).
      
      ROW_COUNT is now assigned according to the following rules:
      
        - In my_ok():
          - for DML statements: to the number of affected rows;
          - for DDL statements: to 0.
      
        - In my_eof(): to -1 to indicate that there was a result set.
      
          We derive this semantics from the JDBC specification, where int
          java.sql.Statement.getUpdateCount() is defined to (sic) "return the
          current result as an update count; if the result is a ResultSet
          object or there are no more results, -1 is returned".
      
        - In my_error(): to -1 to be compatible with the MySQL C API and
          MySQL ODBC driver.
      
        - For SIGNAL statements: to 0 per WL#2110 specification. Zero is used
          since that's the "default" value of ROW_COUNT in the diagnostics area.
      7752ccec
  8. 13 May, 2010 3 commits
  9. 12 May, 2010 4 commits
    • Jonathan Perkin's avatar
    • Jonathan Perkin's avatar
      Remove comments. · 9d33e954
      Jonathan Perkin authored
      9d33e954
    • Jonathan Perkin's avatar
      Changes to build using CMake according to existing release packages: · 5b85121c
      Jonathan Perkin authored
       - Update/fix file layouts for each package type, add new types for
         native package formats including deb, rpm and svr4.
      
       - Build all plugins, including debug versions
      
       - Update compiler flags to match current release
      
       - Add missing @VAR@ expansions
      
       - Install correct mysqclient library symlinks
      
       - Fix icc/ia64 builds
      
       - Fix install of libmysqld-debug
      
       - Don't include mysql_embedded
      
       - Remove unpackaged manual pages to avoid missing files warnings
      
       - Don't install mtr's test suite
      5b85121c
    • Jonathan Perkin's avatar
      Large number of changes to support building RPMs using CMake, along · cb327fd8
      Jonathan Perkin authored
      with other merges from the old distribution-specific spec file.
      
       - update copyright notices
      
       - remove __os_install_post override, it was only necessary as a
         hack to build debuginfo packages - now that we no longer make
         them we can revert to the distribution macro which likely has
         other useful bits we might want
      
       - remove _unpackaged_files_terminate_build override, we want to
         know of any orphaned files
      
       - include native distribution support
      
       - no longer build separate debuginfo RPMs, instead just include
         debug/symbols in all binaries, which is more useful for support
      
       - include support for building commercial RPMs, requires a
         commercial source tree
      
       - remove cluster RPM support, we don't build them from this
         source tree
      
       - use CMake for building, and update package lists to match the
         new install layout/files.  Remove any options which were only
         useful for automake builds (e.g. yassl/zlib).
      
       - other minor cleanups
      cb327fd8
  10. 11 May, 2010 2 commits
  11. 07 May, 2010 2 commits
  12. 05 May, 2010 8 commits
    • Konstantin Osipov's avatar
      Clean-up, give better names, add comments to · cca59e83
      Konstantin Osipov authored
      thd->in_multi_stmt_transaction() and thd->active_transaction().
      cca59e83
    • Magne Mahre's avatar
      Bug#49193 CREATE TABLE reacts differently depending on whether · 24a14875
      Magne Mahre authored
                data is selected or not
      
      Temporary and permanent tables should live in different 
      namespaces.  In this case, resolving a permanent table
      name gave the temporary table, resulting in a name
      collision.
      24a14875
    • Alexander Nozdrin's avatar
      Patch for Bug#50511 (Sometimes wrong handling of user variables containing NULL). · d91c271b
      Alexander Nozdrin authored
            
      The bug happened under the following condition:
        - there was a user variable of type REAL, containing NULL value
        - there was a table with a NOT_NULL column of any type but REAL, having
          default value (or auto increment);
        - a row was inserted into the table with the user variable as value.
          A warning was emitted here.
      
      The problem was that handling of NULL values of REAL type was not properly
      implemented: it didn't expect that REAL NULL value can be assigned to other
      data type.
      
      Basically, the problem was that set_field_to_null() was used instead of
      set_field_to_null_with_conversions().
      
      The fix is to use the right function, or more generally, to allow conversion of
      REAL NULL values to other data types.
      d91c271b
    • Alexander Barkov's avatar
      Bug#51571 load xml infile causes server crash · 25d31b8f
      Alexander Barkov authored
        
        Problem:
        item->name was NULL for Item_user_var_as_out_param
        which made strcmp(something, item->name) crash in the LOAD XML code.
        
        Fix:
        - item_func.h: Adding set_name() in constuctor for Item_user_var_as_out_param
        - sql_load.cc: Changing the condition in write_execute_load_query_log_event() which
        distiguished between Item_user_var_as_out_param and Item_field
        from
          if (item->name == NULL)
        to
          if (item->type() == Item::FIELD_ITEM)
        - loadxml.result, loadxml.test: adding tests
      25d31b8f
    • Magne Mahre's avatar
      Bug#48800 CREATE TABLE t...SELECT fails if t is a temporary · 1cf9861f
      Magne Mahre authored
                table
      
      If a temporary table A exists, and a (permanent) table 
      with the same name is attempted created with 
      "CREATE TABLE ... AS SELECT", the create would fail with 
      an error.
         1050: Table 'A' already exists
      
      The error occured in MySQL 5.1 releases, but is not
      present in MySQL 5.5.   This patch adds a regression
      test to ensure that the problem does not reoccur.
      1cf9861f
    • Alexander Barkov's avatar
      Bug#52849 [Com]: datetime index not work · 6bf10a86
      Alexander Barkov authored
      Problem: after introduction of "WL#2649 Number-to-string conversions"
      
      This query:
        SET NAMES cp850; -- Or any other non-latin1 ASCII-based character set
        SELECT * FROM t1
        WHERE datetime_column='2010-01-01 00:00:00'
      started to add extra character set conversion: 
        SELECT * FROM t1
        WHERE CONVERT(datetime_column USING cp850)='2010-01-01 00:00:00';
      
      so index on DATETIME column was not used anymore.
      Fix:
        avoid convertion of NUMERIC/DATETIME items
        (i.e. those with derivation DERIVATION_NUMERIC).
      6bf10a86
    • Horst.Hunger's avatar
      Patch for 47759 to trunk-bugfixing. · 8975d476
      Horst.Hunger authored
      8975d476
    • Jon Olav Hauglid's avatar
      merge from mysql-trunk-bugfixing · 27da41cc
      Jon Olav Hauglid authored
      27da41cc
  13. 04 May, 2010 5 commits
  14. 30 Apr, 2010 1 commit
    • Alexander Nozdrin's avatar
      Patch for Bug#52356: query_cache_debug fails on Linux. · c784ee27
      Alexander Nozdrin authored
      There were two problems here:
        1. misleading error message
        2. abusing KILL QUERY in the test case
      
      1. The server reported "'DELETE FROM t1' failed: 1689: Wait on a lock was
      aborted due to a pending exclusive lock", while the proper error message
      should be "'DELETE FROM t1' failed: 1317: Query execution was interrupted".
      
      The problem is that the server has two different flags for
      signalling that a query is being killed: THD::killed and
      mysys_var::abort. The test case triggers a race: sometimes
      mysys_var::abort is set earlier than THD::killed. That leads
      to the following situation:
      
        - thr_lock() checks mysys_var::abort and returns error status,
          since mysys_var::abort is set;
      
        - the caller (mysql_lock_tables()) gets an error from thr_lock(),
          but THD::killed is not set, so it decides that thr_lock() couldn't
          get a lock due to a pending exclusive lock.
      
      This is a known issue with the server and it's not going to be fixed soon.
      
      5.5 differs from 5.1 here as follows: when thr_lock() returns an error:
        - 5.1 continues trying thr_lock() until success;
        - 5.5 propagates the error
      
      2. The test case uses KILL QUERY is a highly concurent environment.
      
      The fix is to wait for the dying statement to rest in peace before
      executing another DELETE FROM t1.
      c784ee27
  15. 29 Apr, 2010 1 commit