1. 18 Nov, 2009 3 commits
    • Magne Mahre's avatar
      merge · c37250dd
      Magne Mahre authored
      c37250dd
    • Magne Mahre's avatar
      Bug #46425 crash in Diagnostics_area::set_ok_status , empty statement, · 9e6cb377
      Magne Mahre authored
                 DELETE IGNORE
      
      The ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG error was set in the
      diagnostics area when it happened, but the DELETE cleanup code
      never checked for a non-fatal error condition, thus trying to
      set diag.area to "ok".  This triggered an assert checking that
      the diag.area was empty.
      
      The fix was to test if there existed a non-fatal error condition
      (thd->is_error() before ok'ing the operation.
      9e6cb377
    • Jon Olav Hauglid's avatar
      Bug #47682 strange behaviour of INSERT DELAYED · a6733b52
      Jon Olav Hauglid authored
      The problem was a "self-deadlock" if the connection issuing INSERT DELAYED
      had both the global read lock (FLUSH TABLES WITH READ LOCK) and LOCK TABLES
      mode active. The table being inserted into had to be different from the 
      table(s) locked by LOCK TABLES.
      
      For INSERT DELAYED, the connection thread waits until the handler thread has
      opened and locked its table before returning. But since the global read lock
      was active, the handler thread would be unable to lock and would wait for the
      global read lock to go away.
      
      So the handler thread would be waiting for the connection thread to release
      the global read lock while the connection thread was waiting for the handler
      thread to lock the table. This gave a "self-deadlock" (same connection,
      different threads).
      
      The deadlock would only happen if we also had LOCK TABLES mode since the
      INSERT otherwise will try to get protection against global read lock before
      starting the handler thread. It will then notice that the global read lock
      is owned by the same connection and report ER_CANT_UPDATE_WITH_READLOCK.
      
      This patch removes the deadlock by reporting ER_CANT_UPDATE_WITH_READLOCK
      also if we are inside LOCK TABLES mode.
      
      Test case added to delayed.test.
      a6733b52
  2. 17 Nov, 2009 3 commits
  3. 13 Nov, 2009 1 commit
    • Jorgen Loland's avatar
      Bug#48052: Valgrind warning - uninitialized value in · 2a254a13
      Jorgen Loland authored
                 init_read_record() - (records.cc:274)
            
      Item_cond::used_tables_cache was accessed in
      records.cc#init_read_record() without being initialized. It had
      not been initialized because it was wrongly assumed that the
      Item's variables would not be accessed, and hence
      quick_fix_field() was used instead of fix_fields() to save a few
      CPU cycles at creation time.
      
      The fix is to properly initilize the Item by replacing
      quick_fix_field() with fix_fields().
      2a254a13
  4. 12 Nov, 2009 4 commits
  5. 11 Nov, 2009 2 commits
    • Christopher Powers's avatar
      Merge · edfd29dd
      Christopher Powers authored
      edfd29dd
    • Anurag Shekhar's avatar
      Bug #47012 archive tables are not upgradeable, and server crashes · 862c422c
      Anurag Shekhar authored
             on any access
      
      Archive engine for 5.1 (and latter) version uses a modified 
      version of zlib (azlib). These two version are incompatible
      so a proper upgrade is needed before tables created in 5.0 
      can be used reliable.
      
      This upgrade can be performed using repair. But due to lack 
      of test its risky to allow upgrade for now. This patch addresses
      only the crashing issue. Any attempt to repair will be blocked.
      
      Eventually repair can be allowed to run through (which will also
      cause an upgrade from older version to newer) but only after a 
      thorough testing.
      862c422c
  6. 10 Nov, 2009 1 commit
    • Christopher Powers's avatar
      Bug#47382 'mysqladmin debug' crash on 64-bit Windows · 9bb40dc1
      Christopher Powers authored
      The crash occurs because SAFEMALLOC is defined for the MySQL server
      but not for the Archive or Federated engines, resulting in a 
      parameter mismatch between the function prototype and definition
      for functions using the CALLER_INFO macro.
      9bb40dc1
  7. 09 Nov, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #48458: simple query tries to allocate enormous amount of · 48c67b2c
      Georgi Kodinov authored
        memory
      
      The server was doing a bad class typecast causing setting of 
      wrong value for the maximum number of items in an internal
      structure used in equality propagation.
      Fixed by not doing the wrong typecast and asserting the type
      of the Item where it should be done.
      48c67b2c
  8. 10 Nov, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #42760: Select doesn't return desired results when we have null · 154c3480
      Georgi Kodinov authored
       values
       
       We should re-set the access method functions when changing the access
       method when switching to another index to avoid sorting.
       
       Fixed by doing a little re-engineering : encapsulating all the function
       assignment into a special function and calling it when flipping the 
       indexes.
      154c3480
  9. 06 Nov, 2009 2 commits
    • Alexey Kopytov's avatar
      Automerge. · 5d725601
      Alexey Kopytov authored
      5d725601
    • Alexey Kopytov's avatar
      Bug #48475: DISTINCT is ignored with GROUP BY WITH ROLLUP and · 9fff9acf
      Alexey Kopytov authored
                  only const tables
      
      The problem was caused by two shortcuts in the optimizer that
      are inapplicable in the ROLLUP case.
      
      Normally in a case when only const tables are involved in a
      query, DISTINCT clause can be safely optimized away since there
      may be only one row produced by the join. Similarly, we don't
      need to create a temporary table to resolve DISTINCT/GROUP
      BY/ORDER BY. Both of these are inapplicable when the WITH
      ROLLUP modifier is present.
      
      Fixed by disabling the said optimizations for the WITH ROLLUP
      case.
      9fff9acf
  10. 04 Nov, 2009 4 commits
  11. 03 Nov, 2009 6 commits
    • Timothy Smith's avatar
    • Timothy Smith's avatar
      Bug#48031: mysql_secure_installation -- bash bug regarding passwords with · 3aff1e95
      Timothy Smith authored
        special chars
      
      This script failed when the user tried passwords with multiple spaces, \, # or
      ' characters.  Now proper escaping and quoting is used in all contexts.
      
      This problem occurs in the Perl version of this script, too, so fix it in both
      places.
      3aff1e95
    • Timothy Smith's avatar
      Bug#48086: mysql_secure_installation does NOT work on Solaris · 9e7cd0fb
      Timothy Smith authored
      Remove a bash-ism (if ! ...).
      9e7cd0fb
    • Davi Arnaut's avatar
      fc55339e
    • Konstantin Osipov's avatar
      A fix and a test case for · d2babeaf
      Konstantin Osipov authored
      Bug#41756 "Strange error messages about locks from InnoDB".
      
      In JT_EQ_REF (join_read_key()) access method,
      don't try to unlock rows in the handler, unless certain that
      a) they were locked
      b) they are not used.
      
      Unlocking of rows is done by the logic of the nested join loop,
      and is unaware of the possible caching that the access method may
      have. This could lead to double unlocking, when a row
      was unlocked first after reading into the cache, and then
      when taken from cache, as well as to unlocking of rows which
      were actually used (but taken from cache).
      
      Delegate part of the unlocking logic to the access method,
      and in JT_EQ_REF count how many times a record was actually
      used in the join. Unlock it only if it's usage count is 0.
      
      Implemented review comments.
      d2babeaf
    • 's avatar
      BUG#48216 Replication fails on all slaves after upgrade to 5.0.86 on master · 133bfc7f
      authored
      When a sessione is closed, all temporary tables of the session are automatically 
      dropped and are binlogged. But it will be binlogged with wrong database names when
      the length of the temporary tables' database names are greater than the 
      length of the current database name or the current database is not set.
      
      Query_log_event's db_len is forgot to set when Query_log_event's db is set.
      This patch wrote code to set db_len immediately after db has set.
      
      133bfc7f
  12. 02 Nov, 2009 1 commit
  13. 30 Oct, 2009 6 commits
    • Timothy Smith's avatar
      Bug#35106: mysql_secure_installation fails on Windows, missing "use · 61973d67
      Timothy Smith authored
      Term::ReadKey"
      
      Add the missing module import.  Also, while here, fix a few glaring problems
      with the script, and ensure that it behaves properly.  It seems this script
      may have never been working correctly (e.g., reading password didn't chomp()
      the result, so password was set with \n at the end; comparing the re-typed
      password to original was done with inverted test).
      
      Add END { cleanup(); } block to ensure the script removes temporary working
      files.
      
      Add SIG{INT} / SIG{QUIT} handler.
      
      Do a bit of reorganization to make the code easier to understand.
      
      Limit failed connection attempts to 3.
      
      Use ./bin/mysql if it exists, and then fall back on mysql in PATH (before it
      assumed 'mysql' in the path).  Print a nicer error if 'mysql' can't be called.
      
      This has been tested on Windows (ActivePerl from cmd.exe, no cygwin needed)
      and Linux.
      61973d67
    • Alexey Kopytov's avatar
      Automerge. · 406e680b
      Alexey Kopytov authored
      406e680b
    • Alexey Kopytov's avatar
      Bug #48131: crash group by with rollup, distinct, filesort, · 23b05d00
      Alexey Kopytov authored
                  with temporary tables
      
      There were two problems the test case from this bug was
      triggering:
      
      1. JOIN::rollup_init() was supposed to wrap all constant Items
      into another object for queries with the WITH ROLLUP modifier
      to ensure they are never considered as constants and therefore
      are written into temporary tables if the optimizer chooses to
      employ them for DISTINCT/GROUP BY handling.
      
      However, JOIN::rollup_init() was called before
      make_join_statistics(), so Items corresponding to fields in
      const tables could not be handled as intended, which was
      causing all kinds of problems later in the query execution. In
      particular, create_tmp_table() assumed all constant items
      except "hidden" ones to be removed earlier by remove_const()
      which led to improperly initialized Field objects for the
      temporary table being created. This is what was causing crashes
      and valgrind errors in storage engines.
      
      2. Even when the above problem had been fixed, the query from
      the test case produced incorrect results due to some
      DISTINCT/GROUP BY optimizations being performed by the
      optimizer that are inapplicable in the WITH ROLLUP case.
      
      Fixed by disabling inapplicable DISTINCT/GROUP BY optimizations
      when the WITH ROLLUP modifier is present, and splitting the
      const-wrapping part of JOIN::rollup_init() into a separate
      method which is now invoked after make_join_statistics() when
      the const tables are already known.
      23b05d00
    • Georgi Kodinov's avatar
      merge from 5.0-main · ea412fc2
      Georgi Kodinov authored
      ea412fc2
    • Georgi Kodinov's avatar
      Bug #48291 : crash with row() operator,select into @var, and · a0bea5ee
      Georgi Kodinov authored
        subquery returning multiple rows
      
      Error handling was missing when handling subqueires in WHERE 
      and when assigning a SELECT result to a @variable.
      This caused crash(es). 
      
      Fixed by adding error handling code to both the WHERE 
      condition evaluation and to assignment to an @variable.
      a0bea5ee
    • Georgi Kodinov's avatar
      Bug #48293: crash with procedure analyse, view with > 10 columns, · 7ba875d6
      Georgi Kodinov authored
      having clause...
      
      The fix for bug 46184 was not very complete. It was not covering
      views using temporary tables and multiple tables in a FROM clause.
      Fixed by reverting the fix for 46184 and making a more general
      check that is checking at the right execution stage and for all
      of the non-supported cases.
      Now PROCEDURE ANALYZE on non-top level SELECT is also forbidden.
      Updated the analyse.test and subselect.test accordingly.
      7ba875d6
  14. 29 Oct, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #42116 : Mysql crash on specific query · 1d8cceae
      Georgi Kodinov authored
      Queries with nested outer joins may lead to crashes or 
      bad results because an internal data structure is not handled
      correctly.
      The optimizer uses bitmaps of nested JOINs to determine
      if certain table can be placed at a certain place in the
      JOIN order.
      It does maintain a bitmap describing in which JOINs 
      last placed table is nested.
      When it puts a table it makes sure the bit of every JOIN that
      contains the table in question is set (because JOINs can be nested).
      It does that by recursively setting the bit for the next enclosing
      JOIN when this is the first table in the JOIN and recursively 
      resetting the bit if it's the last table in the JOIN.
      When it removes a table from the join order it should do the
      opposite : recursively unset the bit if it's the only remaining 
      table in this join and and recursively set the bit if it's removing
      the last table of a JOIN.
      There was an error in how the bits was set for the upper levels :
      when removing a table it was setting the bit for all the enclosing 
      nested JOINs even if there were more tables left in the current JOIN
      (which practically means that the upper nested JOINs were not affected).
      Fixed by stopping the recursion at the relevant level.
      1d8cceae
  15. 28 Oct, 2009 1 commit
  16. 27 Oct, 2009 2 commits
    • Georgi Kodinov's avatar
      merge from 4.1 · 95dce2b0
      Georgi Kodinov authored
      95dce2b0
    • Georgi Kodinov's avatar
      Bug #47930: MATCH IN BOOLEAN MODE returns too many results · 49a7e818
      Georgi Kodinov authored
        inside subquery
      
      Re-setting a fulltext index was a no-operation if not all
      the matches of a search were consumed by reading them.
      This was preventing a joined table using a fulltext index
      in a subquery that requires only 1 row of output (e.g. EXISTS) 
      from working correctly because the second execution of the 
      sub-query has the fulltext index cursor in a wrong state and
      was not finding results.
      Fixed by making the re-init code _ftb_init_index_search() 
      to re-set open cursors in addition to depleted ones.
      49a7e818
  17. 10 Nov, 2009 1 commit