1. 30 Oct, 2009 1 commit
    • Alexey Kopytov's avatar
      Bug #48131: crash group by with rollup, distinct, filesort, · bbca373e
      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.
      
      mysql-test/r/olap.result:
        Added a test case for bug #48131.
      mysql-test/t/olap.test:
        Added a test case for bug #48131.
      sql/sql_select.cc:
        1. Disabled inapplicable DISTINCT/GROUP BY optimizations when
        the WITH ROLLUP modifier is present.
        2. Split the const-wrapping part of JOIN::rollup_init() into a
        separate method.
      sql/sql_select.h:
        Added rollup_process_const_fields() declaration.
      bbca373e
  2. 16 Oct, 2009 3 commits
  3. 15 Oct, 2009 1 commit
  4. 14 Oct, 2009 3 commits
  5. 13 Oct, 2009 1 commit
  6. 08 Oct, 2009 4 commits
    • Kent Boortz's avatar
      "MySQL Network" => "MySQL Enterprise" · 775e2fdc
      Kent Boortz authored
      775e2fdc
    • Joerg Bruehe's avatar
      Fix bug#47923 New "mf_keycache.c" requires thread support · fbdc04f8
      Joerg Bruehe authored
      The bug is a compilation issue:
      Function "find_key_block()" had thread operations
      which were not guarded by "#if THREAD", add that now.
      
      mysys/mf_keycache.c:
        Without thread-support, we are in a single-threaded world,
        so there is no parallelism, and the keycache cannot be
        within a resize operation while this request is being processed.
      fbdc04f8
    • Frazer Clement's avatar
      Fix compile break from bug#39663 fix · ed2ae0d7
      Frazer Clement authored
      ed2ae0d7
    • Ramil Kalimullin's avatar
      Fix for bug #42803: Field_bit does not have unsigned_flag field, · ee6dadf4
      Ramil Kalimullin authored
      can lead to bad memory access
      
      Problem: Field_bit is the only field which returns INT_RESULT
      and doesn't have unsigned flag. As it's not a descendant of the 
      Field_num, so using ((Field_num *) field_bit)->unsigned_flag may lead
      to unpredictable results.
      
      Fix: check the field type before casting.
      
      
      mysql-test/r/type_bit.result:
        Fix for bug #42803: Field_bit does not have unsigned_flag field,
        can lead to bad memory access
          - test result.
      mysql-test/t/type_bit.test:
        Fix for bug #42803: Field_bit does not have unsigned_flag field,
        can lead to bad memory access
          - test case.
      sql/opt_range.cc:
        Fix for bug #42803: Field_bit does not have unsigned_flag field,
        can lead to bad memory access
          - don't cast to (Field_num *) Field_bit, as it's not a Field_num
        descendant and is always unsigned by nature.
      ee6dadf4
  7. 06 Oct, 2009 3 commits
    • Kristofer Pettersson's avatar
      Automerge · eec205de
      Kristofer Pettersson authored
      eec205de
    • Kristofer Pettersson's avatar
      Bug#47768 pthread_cond_timedwait() is broken on windows · 26a7f4a8
      Kristofer Pettersson authored
      The pthread_cond_wait implementations for windows might
      dead lock in some rare circumstances.
      
      1) One thread (I) enter a timed wait and at a point in
         time ends up after mutex unlock and before
         WaitForMultipleObjects(...)
      2) Another thread (II) enters pthread_cond_broadcast.
         Grabs the mutex and discovers one waiter. It set
         the broadcast event and closes the broadcast gate
         then unlocks the mutex.
      3) A third thread (III) issues a pthread_cond_signal.
         It grabs the mutex, discovers one waiter, sets the
         signal event then unlock the mutex.
      4) The first threads (I) enters WaitForMultipleObjects
         and finds out that the signal object is in a
         signalled state and exits the wait.
      5) Thread (I) grabs the mutex and checks result status.
         The number of waiters is decreased and becomes equal
         to 0. The event returned was a signal event so the
         broadcast gate isn't opened. The mutex is released.
      6) Thread (II) issues a new broadcast. The mutex is
         acquired but the number of waiters are 0 hence
         the broadcast gate remains closed.
      7) Thread (I) enters the wait again but is blocked by
         the broadcast gate.
      
            This fix resolves the above issue by always resetting
            broadcast gate when there are no more waiters in th queue.
      
      
      mysys/my_wincond.c:
        * Always reset the broadcast gate if there are no more waiters left.
      26a7f4a8
    • Georgi Kodinov's avatar
      version update · 6f20e484
      Georgi Kodinov authored
      6f20e484
  8. 05 Oct, 2009 1 commit
  9. 04 Oct, 2009 1 commit
  10. 02 Oct, 2009 1 commit
  11. 30 Sep, 2009 10 commits
    • Davi Arnaut's avatar
      Post-merge cleanup: Reorganize code for better comprehensibility. · 52cbe9e4
      Davi Arnaut authored
                          Removes the need of a hack (the jump to label).
      52cbe9e4
    • Davi Arnaut's avatar
      Post-merge fix: DBUG macros are wrapped inside a loop. · 3372cc87
      Davi Arnaut authored
      sql/sql_parse.cc:
        DBUG macros are wrapped inside a loop. Allow to break
        the command switch from within a DBUG macro.
      3372cc87
    • Davi Arnaut's avatar
      Bug#47525: MySQL crashed (Federated) · f474f75b
      Davi Arnaut authored
      On Mac OS X or Windows, sending a SIGHUP to the server or a
      asynchronous flush (triggered by flush_time), would cause the
      server to crash.
      
      The problem was that a hook used to detach client API handles
      wasn't prepared to handle cases where the thread does not have
      a associated session.
      
      The solution is to verify whether the thread has a associated
      session before trying to detach a handle.
      
      mysql-test/r/federated_debug.result:
        Add test case result for Bug#47525
      mysql-test/t/federated_debug-master.opt:
        Debug point.
      mysql-test/t/federated_debug.test:
        Add test case for Bug#47525
      sql/slave.cc:
        Check whether a the thread has a associated session.
      sql/sql_parse.cc:
        Add debug code to simulate a reload without thread session.
      f474f75b
    • Jonathan Perkin's avatar
      bug#27693: Windows compilation from bk fails using WITH_BERKELEY_STORAGE_ENGINE · f5714642
      Jonathan Perkin authored
      Make configure.js bail with an error if trying to build bdb from a bzr
      tree.
      f5714642
    • Kristofer Pettersson's avatar
      Bug#34895 'show procedure status' or 'show function status' + · 0816b40e
      Kristofer Pettersson authored
                'flush tables' crashes
      
      The server crashes when 'show procedure status' and 'flush tables' are
      run concurrently.
      
      This is caused by the way mysql.proc table is added twice to the list
      of table to lock although the requirements on the current locking API
      assumes differently.
      
      No test case is submitted because of the nature of the crash which is 
      currently difficult to reproduce in a deterministic way.
      
      This is a backport from 5.1
      
      myisam/mi_dbug.c:
        * check_table_is_closed is only used in EXTRA_DEBUG mode but since it is
        iterating over myisam shared data it still needs to be protected by an
        appropriate mutex.
      sql/sql_yacc.yy:
        * Since the I_S mechanism is already handling the open and close of 
        mysql.proc there is no need for the method sp_add_to_query_tables.
      0816b40e
    • MySQL Build Team's avatar
      Backport into build-200909301147-5.0.84sp1 · 16efc5cd
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 2802.1.1
      > tags: mysql-5.0.86
      > revision-id: hery.ramilison@sun.com-20090909185217-mooeczu391ztp2fz
      > parent: joro@sun.com-20090902123318-8qe40pr91xmui5ue
      > committer: hery <hery.ramilison@sun.com>
      > branch nick: mysql-5.0.86-release
      > timestamp: Wed 2009-09-09 20:52:17 +0200
      > message:
      >   change c++ comment to c comment
      16efc5cd
    • MySQL Build Team's avatar
      Backport into build-200909301147-5.0.84sp1 · 51d041e6
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 2796
      > revision-id: sergey.glukhov@sun.com-20090827102219-sgjz0v5t1rfccs14
      > parent: joro@sun.com-20090824122803-1d5jlaysjc7a7j6q
      > committer: Sergey Glukhov <Sergey.Glukhov@sun.com>
      > branch nick: mysql-5.0-bugteam
      > timestamp: Thu 2009-08-27 15:22:19 +0500
      > message:
      >   Bug#46184 Crash, SELECT ... FROM derived table procedure analyze
      >   The crash happens because select_union object is used as result set
      >   for queries which have derived tables.
      >   select_union use temporary table as data storage and if
      >   fields count exceeds 10(count of values for procedure ANALYSE())
      >   then we get a crash on fill_record() function.
      51d041e6
    • MySQL Build Team's avatar
      Backport into build-200909301147-5.0.84sp1 · eb488ba6
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 2791.2.3
      > revision-id: joro@sun.com-20090827114042-h55n7qp9990bl6ge
      > parent: anurag.shekhar@sun.com-20090831073231-e55y1hsck6n08ux8
      > committer: Georgi Kodinov <joro@sun.com>
      > branch nick: B46749-5.0-bugteam
      > timestamp: Thu 2009-08-27 14:40:42 +0300
      > message:
      >   Bug #46749: Segfault in add_key_fields() with outer subquery level 
      >     field references
      >   
      >   This error requires a combination of factors : 
      >   1. An "impossible where" in the outermost SELECT
      >   2. An aggregate in the outermost SELECT
      >   3. A correlated subquery with a WHERE clause that includes an outer 
      >   field reference as a top level WHERE sargable predicate
      >   
      >   When JOIN::optimize detects an "impossible WHERE" it will bail out
      >   without doing the rest of the work and initializations. It will not
      >   call make_join_statistics() as well.  And make_join_statistics fills 
      >   in various structures for each table referenced.
      >   When processing the result of the "impossible WHERE" the query must
      >   send a single row of data if there are aggregate functions in it.
      >   In this case the server marks all the aggregates as having received 
      >   no rows and calls the relevant Item::val_xxx() method on the SELECT
      >   list. However if this SELECT list happens to contain a correlated 
      >   subquery this subquery is evaluated in a normal evaluation mode.
      >   And if this correlated subquery has a reference to a field from the 
      >   outermost "impossible where" SELECT the add_key_fields will mistakenly
      >   consider the outer field reference as a "local" field reference when 
      >   looking for sargable predicates.
      >   But since the SELECT where the outer field reference refers to is not
      >   completely initialized due to the "impossible WHERE" in this level
      >   we'll get a NULL pointer reference.
      >   Fixed by making a better condition for discovering if a field is "local"
      >   to the SELECT level being processed. 
      >   It's not enough to look for OUTER_REF_TABLE_BIT in this case since 
      >   for outer references to constant tables the Item_field::used_tables() 
      >   will return 0 regardless of whether the field reference is from the 
      >   local SELECT or not.
      eb488ba6
    • unknown's avatar
      Set version number for mysql-5.0.84sp1 release · b2bf7deb
      unknown authored
      b2bf7deb
    • unknown's avatar
      Bug #46998 mysqlbinlog can't output BEGIN even if the database is included in a transaction · dec257eb
      unknown authored
      The 'BEGIN/COMMIT/ROLLBACK' log event could be filtered out if the
      database is not selected by --database option of mysqlbinlog command.
      This can result in problem if there are some statements in the
      transaction are not filtered out.
      
      To fix the problem, mysqlbinlog will output 'BEGIN/ROLLBACK/COMMIT' 
      in regardless of the database filtering rules.
      
      client/mysqlbinlog.cc:
        Skip the database check for BEGIN/COMMIT/ROLLBACK log events.
      mysql-test/r/mysqlbinlog.result:
        Test result for bug#46998
      mysql-test/t/mysqlbinlog.test:
        Added test to verify if the 'BEGIN', 'COMMIT' and 'ROLLBACK' are output
        in regardless of database filtering
      dec257eb
  12. 29 Sep, 2009 2 commits
    • Kristofer Pettersson's avatar
      autocommit · 004ee4f4
      Kristofer Pettersson authored
      004ee4f4
    • Kristofer Pettersson's avatar
      Bug#42108 Wrong locking for UPDATE with subqueries leads to broken statement · fce76d29
      Kristofer Pettersson authored
                replication
                    
      MySQL server uses wrong lock type (always TL_READ instead of
      TL_READ_NO_INSERT when appropriate) for tables used in
      subqueries of UPDATE statement. This leads in some cases to
      a broken replication as statements are written in the wrong
      order to the binlog.
      
      sql/sql_yacc.yy:
        * Set lock_option to either TL_READ_NO_INSERT or
          TL_READ for any sub-SELECT following UPDATE.
        * Changed line adjusted for parser identation
          rules; code begins at column 13.
      fce76d29
  13. 28 Sep, 2009 3 commits
  14. 21 Sep, 2009 1 commit
  15. 18 Sep, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #47106: Crash / segfault on adding EXPLAIN to a non-crashing · 2e5b0828
      Georgi Kodinov authored
       query
            
      The fix for bug 46749 removed the check for OUTER_REF_TABLE_BIT 
      and substituted it for a check on the presence of 
      Item_ident::depended_from.
      Removing it altogether was wrong : OUTER_REF_TABLE_BIT should 
      still be checked in addition to depended_from (because it's not 
      set in all cases and doesn't contradict to the check of depended_from).
      Fixed by returning the old condition back as a compliment to the 
      new one.
      2e5b0828
  16. 28 Sep, 2009 1 commit
  17. 24 Sep, 2009 1 commit
    • Magnus Blåudd's avatar
      Bug#42850 race condition in my_thr_init.c · cc8bc86b
      Magnus Blåudd authored
       - Create the "dummy" thread joinable and wait for it to
         exit before continuing in 'my_thread_global_init'
       - This way we know that the pthread library is initialized
         by one thread only
      cc8bc86b
  18. 17 Sep, 2009 1 commit
    • Joerg Bruehe's avatar
      Fix bug#47137 · 68b72686
      Joerg Bruehe authored
          Solaris binary packages should be compiled with '-g0', not '-g'
      
      The main fix for this is done in the build tools,
      but in the sources it affects "configure.in"
      which sets "DEBUG_CXXFLAGS" to be used in all debug builds.
      68b72686
  19. 11 Sep, 2009 1 commit