An error occurred fetching the project authors.
  1. 12 Feb, 2010 1 commit
    • Dmitry Lenev's avatar
      Fix for bug #50908 "Assertion `handler_tables_hash.records == 0' · 0ec868ca
      Dmitry Lenev authored
      failed in enter_locked_tables_mode".
      
      Server was aborted due to assertion failure when one tried to 
      execute statement requiring prelocking (i.e. firing triggers
      or using stored functions) while having open HANDLERs.
      
      The problem was that THD::enter_locked_tables_mode() method
      which was called at the beginning of execution of prelocked 
      statement assumed there are no open HANDLERs. It had to do 
      so because corresponding THD::leave_locked_tables_mode()
      method was unable to properly restore MDL sentinel when
      leaving LOCK TABLES/prelocked mode in the presence of open 
      HANDLERs.
      
      This patch solves this problem by changing the latter method
      to properly restore MDL sentinel and thus removing need for 
      this assumption. As a side-effect, it lifts unjustified
      limitation by allowing to keep HANDLERs open when entering 
      LOCK TABLES mode.
      0ec868ca
  2. 01 Feb, 2010 1 commit
    • Dmitry Lenev's avatar
      Implement new type-of-operation-aware metadata locks. · afd15c43
      Dmitry Lenev authored
      Add a wait-for graph based deadlock detector to the
      MDL subsystem.
      
      Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and
      bug #37346 "innodb does not detect deadlock between update and
      alter table".
      
      The first bug manifested itself as an unwarranted abort of a
      transaction with ER_LOCK_DEADLOCK error by a concurrent ALTER
      statement, when this transaction tried to repeat use of a
      table, which it has already used in a similar fashion before
      ALTER started.
      
      The second bug showed up as a deadlock between table-level
      locks and InnoDB row locks, which was "detected" only after
      innodb_lock_wait_timeout timeout.
      
      A transaction would start using the table and modify a few
      rows.
      Then ALTER TABLE would come in, and start copying rows
      into a temporary table. Eventually it would stumble on
      the modified records and get blocked on a row lock.
      The first transaction would try to do more updates, and get
      blocked on thr_lock.c lock.
      This situation of circular wait would only get resolved
      by a timeout.
      
      Both these bugs stemmed from inadequate solutions to the
      problem of deadlocks occurring between different
      locking subsystems.
      
      In the first case we tried to avoid deadlocks between metadata
      locking and table-level locking subsystems, when upgrading shared
      metadata lock to exclusive one.
      Transactions holding the shared lock on the table and waiting for
      some table-level lock used to be aborted too aggressively.
      
      We also allowed ALTER TABLE to start in presence of transactions
      that modify the subject table. ALTER TABLE acquires
      TL_WRITE_ALLOW_READ lock at start, and that block all writes
      against the table (naturally, we don't want any writes to be lost
      when switching the old and the new table). TL_WRITE_ALLOW_READ
      lock, in turn, would block the started transaction on thr_lock.c
      lock, should they do more updates. This, again, lead to the need
      to abort such transactions.
      
      The second bug occurred simply because we didn't have any
      mechanism to detect deadlocks between the table-level locks
      in thr_lock.c and row-level locks in InnoDB, other than
      innodb_lock_wait_timeout.
      
      This patch solves both these problems by moving lock conflicts
      which are causing these deadlocks into the metadata locking
      subsystem, thus making it possible to avoid or detect such
      deadlocks inside MDL.
      
      To do this we introduce new type-of-operation-aware metadata
      locks, which allow MDL subsystem to know not only the fact that
      transaction has used or is going to use some object but also what
      kind of operation it has carried out or going to carry out on the
      object.
      
      This, along with the addition of a special kind of upgradable
      metadata lock, allows ALTER TABLE to wait until all
      transactions which has updated the table to go away.
      This solves the second issue.
      Another special type of upgradable metadata lock is acquired
      by LOCK TABLE WRITE. This second lock type allows to solve the
      first issue, since abortion of table-level locks in event of
      DDL under LOCK TABLES becomes also unnecessary.
      
      Below follows the list of incompatible changes introduced by
      this patch:
      
      - From now on, ALTER TABLE and CREATE/DROP TRIGGER SQL (i.e. those
        statements that acquire TL_WRITE_ALLOW_READ lock)
        wait for all transactions which has *updated* the table to
        complete.
      
      - From now on, LOCK TABLES ... WRITE, REPAIR/OPTIMIZE TABLE
        (i.e. all statements which acquire TL_WRITE table-level lock) wait
        for all transaction which *updated or read* from the table
        to complete.
        As a consequence, innodb_table_locks=0 option no longer applies
        to LOCK TABLES ... WRITE.
      
      - DROP DATABASE, DROP TABLE, RENAME TABLE no longer abort
        statements or transactions which use tables being dropped or
        renamed, and instead wait for these transactions to complete.
      
      - Since LOCK TABLES WRITE now takes a special metadata lock,
        not compatible with with reads or writes against the subject table
        and transaction-wide, thr_lock.c deadlock avoidance algorithm
        that used to ensure absence of deadlocks between LOCK TABLES
        WRITE and other statements is no longer sufficient, even for
        MyISAM. The wait-for graph based deadlock detector of MDL
        subsystem may sometimes be necessary and is involved. This may
        lead to ER_LOCK_DEADLOCK error produced for multi-statement
        transactions even if these only use MyISAM:
      
        session 1:         session 2:
        begin;
      
        update t1 ...      lock table t2 write, t1 write;
                           -- gets a lock on t2, blocks on t1
      
        update t2 ...
        (ER_LOCK_DEADLOCK)
      
      - Finally,  support of LOW_PRIORITY option for LOCK TABLES ... WRITE
        was abandoned.
        LOCK TABLE ... LOW_PRIORITY WRITE from now on has the same
        priority as the usual LOCK TABLE ... WRITE.
        SELECT HIGH PRIORITY no longer trumps LOCK TABLE ... WRITE  in
        the wait queue.
      
      - We do not take upgradable metadata locks on implicitly
        locked tables. So if one has, say, a view v1 that uses
        table t1, and issues:
        LOCK TABLE v1 WRITE;
        FLUSH TABLE t1; -- (or just 'FLUSH TABLES'),
        an error is produced.
        In order to be able to perform DDL on a table under LOCK TABLES,
        the table must be locked explicitly in the LOCK TABLES list.
      afd15c43
  3. 25 Jan, 2010 1 commit
  4. 21 Jan, 2010 1 commit
    • Dmitry Lenev's avatar
      Patch that changes metadata locking subsystem to use mutex per lock and · a63f8480
      Dmitry Lenev authored
      condition variable per context instead of one mutex and one conditional
      variable for the whole subsystem.
      
      This should increase concurrency in this subsystem.
      
      It also opens the way for further changes which are necessary to solve
      such bugs as bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock"
      and bug #37346 "innodb does not detect deadlock between update and alter
      table".
      
      Two other notable changes done by this patch:
      
      - MDL subsystem no longer implicitly acquires global intention exclusive
        metadata lock when per-object metadata lock is acquired. Now this has
        to be done by explicit calls outside of MDL subsystem.
      - Instead of using separate MDL_context for opening system tables/tables
        for purposes of I_S we now create MDL savepoint in the main context
        before opening tables and rollback to this savepoint after closing
        them. This means that it is now possible to get ER_LOCK_DEADLOCK error
        even not inside a transaction. This might happen in unlikely case when
        one runs DDL on one of system tables while also running DDL on some
        other tables. Cases when this ER_LOCK_DEADLOCK error is not justified
        will be addressed by advanced deadlock detector for MDL subsystem which
        we plan to implement.
      a63f8480
  5. 07 Jan, 2010 1 commit
  6. 22 Dec, 2009 2 commits
    • Konstantin Osipov's avatar
      A prerequisite patch for the fix for Bug#46224 · 39a1a50d
      Konstantin Osipov authored
      "HANDLER statements within a transaction might lead to deadlocks".
      Introduce a notion of a sentinel to MDL_context. A sentinel
      is a ticket that separates all tickets in the context into two
      groups: before and after it. Currently we can have (and need) only
      one designated sentinel -- it separates all locks taken by LOCK
      TABLE or HANDLER statement, which must survive COMMIT and ROLLBACK
      and all other locks, which must be released at COMMIT or ROLLBACK.
      The tricky part is maintaining the sentinel up to date when
      someone release its corresponding ticket. This can happen, e.g.
      if someone issues DROP TABLE under LOCK TABLES (generally,
      see all calls to release_all_locks_for_name()).
      MDL_context::release_ticket() is modified to take care of it.
      
      ******
      A fix and a test case for Bug#46224 "HANDLER statements within a
      transaction might lead to deadlocks".
      
      An attempt to mix HANDLER SQL statements, which are transaction-
      agnostic, an open multi-statement transaction,
      and DDL against the involved tables (in a concurrent connection) 
      could lead to a deadlock. The deadlock would occur when
      HANDLER OPEN or HANDLER READ would have to wait on a conflicting
      metadata lock. If the connection that issued HANDLER statement
      also had other metadata locks (say, acquired in scope of a 
      transaction), a classical deadlock situation of mutual wait
      could occur.
      
      Incompatible change: entering LOCK TABLES mode automatically
      closes all open HANDLERs in the current connection.
      
      Incompatible change: previously an attempt to wait on a lock
      in a connection that has an open HANDLER statement could wait
      indefinitely/deadlock. After this patch, an error ER_LOCK_DEADLOCK
      is produced.
      
      The idea of the fix is to merge thd->handler_mdl_context
      with the main mdl_context of the connection, used for transactional
      locks. This makes deadlock detection possible, since all waits
      with locks are "visible" and available to analysis in a single
      MDL context of the connection.
      
      Since HANDLER locks and transactional locks have a different life
      cycle -- HANDLERs are explicitly open and closed, and so
      are HANDLER locks, explicitly acquired and released, whereas
      transactional locks "accumulate" till the end of a transaction
      and are released only with COMMIT, ROLLBACK and ROLLBACK TO SAVEPOINT,
      a concept of "sentinel" was introduced to MDL_context.
      All locks, HANDLER and others, reside in the same linked list.
      However, a selected element of the list separates locks with
      different life cycle. HANDLER locks always reside at the
      end of the list, after the sentinel. Transactional locks are
      prepended to the beginning of the list, before the sentinel.
      Thus, ROLLBACK, COMMIT or ROLLBACK TO SAVEPOINT, only
      release those locks that reside before the sentinel. HANDLER locks
      must be released explicitly as part of HANDLER CLOSE statement,
      or an implicit close. 
      The same approach with sentinel
      is also employed for LOCK TABLES locks. Since HANDLER and LOCK TABLES
      statement has never worked together, the implementation is
      made simple and only maintains one sentinel, which is used either
      for HANDLER locks, or for LOCK TABLES locks.
      39a1a50d
    • Sergei Golubchik's avatar
      WL#4738 streamline/simplify @@variable creation process · ae2768ce
      Sergei Golubchik authored
      Bug#16565 mysqld --help --verbose does not order variablesBug#20413 sql_slave_skip_counter is not shown in show variables
      Bug#20415 Output of mysqld --help --verbose is incomplete
      Bug#25430 variable not found in SELECT @@global.ft_max_word_len;
      Bug#32902 plugin variables don't know their names
      Bug#34599 MySQLD Option and Variable Reference need to be consistent in formatting!
      Bug#34829 No default value for variable and setting default does not raise error
      Bug#34834 ? Is accepted as a valid sql mode
      Bug#34878 Few variables have default value according to documentation but error occurs  
      Bug#34883 ft_boolean_syntax cant be assigned from user variable to global var.
      Bug#37187 `INFORMATION_SCHEMA`.`GLOBAL_VARIABLES`: inconsistent status
      Bug#40988 log_output_basic.test succeeded though syntactically false.
      Bug#41010 enum-style command-line options are not honoured (maria.maria-recover fails)
      Bug#42103 Setting key_buffer_size to a negative value may lead to very large allocations 
      Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
      Bug#44797 plugins w/o command-line options have no disabling option in --help
      Bug#46314 string system variables don't support expressions
      Bug#46470 sys_vars.max_binlog_cache_size_basic_32 is broken
      Bug#46586 When using the plugin interface the type "set" for options caused a crash.
      Bug#47212 Crash in DBUG_PRINT in mysqltest.cc when trying to print octal number
      Bug#48758 mysqltest crashes on sys_vars.collation_server_basic in gcov builds
      Bug#49417 some complaints about mysqld --help --verbose output
      Bug#49540 DEFAULT value of binlog_format isn't the default value
      Bug#49640 ambiguous option '--skip-skip-myisam' (double skip prefix)
      Bug#49644 init_connect and \0
      Bug#49645 init_slave and multi-byte characters
      Bug#49646 mysql --show-warnings crashes when server dies
      ae2768ce
  7. 15 Dec, 2009 1 commit
    • Sergey Vojtovich's avatar
      Backport from 6.0-codebase. · 94098b22
      Sergey Vojtovich authored
      WL#3771
        "Audit Plugin Interface"
        Implement new plug-in type - AUDIT
        New plug-in: audit_null
          simply increments counter for how many times it was called.
      94098b22
  8. 10 Dec, 2009 1 commit
  9. 09 Dec, 2009 1 commit
    • Jon Olav Hauglid's avatar
      Backport of revno: 2617.68.13 · 17252c32
      Jon Olav Hauglid authored
      Introduce a counter for protection against global read lock on thread level.
      
      The functions for protection against global read lock sometimes need a local
      variable to signal when the protection is set, and hence need to be released.
      It would be better to control this behaviour via a counter on the THD struct,
      telling how many times the protection has been claimed by the current thread.
      A side-effect of the fix is that if protection is claimed twice for a thread,
      only a simple increment is required for the second claim, instead of a
      mutex-protected increment of the global variable protect_against_global_read_lock.
      17252c32
  10. 08 Dec, 2009 1 commit
    • Konstantin Osipov's avatar
      Backport of: · a66a2608
      Konstantin Osipov authored
      ----------------------------------------------------------
      revno: 2617.69.20
      committer: Konstantin Osipov <kostja@sun.com>
      branch nick: 5.4-4284-1-assert
      timestamp: Thu 2009-08-13 18:29:55 +0400
      message:
        WL#4284 "Transactional DDL locking"
        A review fix.
        Since WL#4284 implementation separated MDL_request and MDL_ticket,
        MDL_request becamse a utility object necessary only to get a ticket.
        Store it by-value in TABLE_LIST with the intent to merge
        MDL_request::key with table_list->table_name and table_list->db
        in future.
        Change the MDL subsystem to not require MDL_requests to
        stay around till close_thread_tables().
        Remove the list of requests from the MDL context.
        Requests for shared metadata locks acquired in open_tables()
        are only used as a list in recover_from_failed_open_table_attempt(),
        which calls mdl_context.wait_for_locks() for this list.
        To keep such list for recover_from_failed_open_table_attempt(),
        introduce a context class (Open_table_context), that collects
        all requests.
        A lot of minor cleanups and simplications that became possible
        with this change.
      a66a2608
  11. 04 Dec, 2009 1 commit
    • Konstantin Osipov's avatar
      Backport of revno ## 2617.31.1, 2617.31.3, 2617.31.4, 2617.31.5, · 0b39c189
      Konstantin Osipov authored
      2617.31.12, 2617.31.15, 2617.31.15, 2617.31.16, 2617.43.1
      - initial changeset that introduced the fix for 
      Bug#989 and follow up fixes for all test suite failures
      introduced in the initial changeset. 
      ------------------------------------------------------------
      revno: 2617.31.1
      committer: Davi Arnaut <Davi.Arnaut@Sun.COM>
      branch nick: 4284-6.0
      timestamp: Fri 2009-03-06 19:17:00 -0300
      message:
      Bug#989: If DROP TABLE while there's an active transaction, wrong binlog order
      WL#4284: Transactional DDL locking
      
      Currently the MySQL server does not keep metadata locks on
      schema objects for the duration of a transaction, thus failing
      to guarantee the integrity of the schema objects being used
      during the transaction and to protect then from concurrent
      DDL operations. This also poses a problem for replication as
      a DDL operation might be replicated even thought there are
      active transactions using the object being modified.
      
      The solution is to defer the release of metadata locks until
      a active transaction is either committed or rolled back. This
      prevents other statements from modifying the table for the
      entire duration of the transaction. This provides commitment
      ordering for guaranteeing serializability across multiple
      transactions.
      
      - Incompatible change:
      
      If MySQL's metadata locking system encounters a lock conflict,
      the usual schema is to use the try and back-off technique to
      avoid deadlocks -- this schema consists in releasing all locks
      and trying to acquire them all in one go.
      
      But in a transactional context this algorithm can't be utilized
      as its not possible to release locks acquired during the course
      of the transaction without breaking the transaction commitments.
      To avoid deadlocks in this case, the ER_LOCK_DEADLOCK will be
      returned if a lock conflict is encountered during a transaction.
      
      Let's consider an example:
      
      A transaction has two statements that modify table t1, then table
      t2, and then commits. The first statement of the transaction will
      acquire a shared metadata lock on table t1, and it will be kept
      utill COMMIT to ensure serializability.
      
      At the moment when the second statement attempts to acquire a
      shared metadata lock on t2, a concurrent ALTER or DROP statement
      might have locked t2 exclusively. The prescription of the current
      locking protocol is that the acquirer of the shared lock backs off
      -- gives up all his current locks and retries. This implies that
      the entire multi-statement transaction has to be rolled back.
      
      - Incompatible change:
      
      FLUSH commands such as FLUSH PRIVILEGES and FLUSH TABLES WITH READ
      LOCK won't cause locked tables to be implicitly unlocked anymore.
      0b39c189
  12. 03 Dec, 2009 5 commits
    • Konstantin Osipov's avatar
      Backport of: · a3a23ec4
      Konstantin Osipov authored
      ----------------------------------------------------------
      revno: 2617.23.20
      committer: Konstantin Osipov <kostja@sun.com>
      branch nick: mysql-6.0-runtime
      timestamp: Wed 2009-03-04 16:31:31 +0300
      message:
        WL#4284 "Transactional DDL locking"
        Review comments: "Objectify" the MDL API.
        MDL_request and MDL_context still need manual construction and
        destruction, since they are used in environment that is averse
        to constructors/destructors.
      a3a23ec4
    • Konstantin Osipov's avatar
      ------------------------------------------------------------ · 67c1b06f
      Konstantin Osipov authored
      revno: 2617.22.4
      committer: Davi Arnaut <Davi.Arnaut@Sun.COM>
      branch nick: mysql-6.0-runtime
      timestamp: Mon 2009-01-26 15:19:14 -0200
      message:
      Move checks for OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN to a separate
      helper function.
      67c1b06f
    • Konstantin Osipov's avatar
      Backport of: · 36897c86
      Konstantin Osipov authored
      -----------------------------------------------------------
      2497.479.10 Sergei Golubchik    2008-08-27
                  proc_info_hook, mysys access to thd->proc_info
      
      This patch is necessary for backport of WL#4284 "Transactional
      DDL locking".
      36897c86
    • Konstantin Osipov's avatar
      Backport of: · c43f894c
      Konstantin Osipov authored
      ------------------------------------------------------------
      revno: 2630.22.3
      committer: Davi Arnaut <Davi.Arnaut@Sun.COM>
      branch nick: 4284-6.0
      timestamp: Thu 2008-08-07 22:33:43 -0300
      message:
      WL#4284: Transactional DDL locking
      
      Make transaction management more modular through a new interface.
      
      The overall objective of this change is to provide groundwork
      for the design of transactional DDL locking by cleaning up the
      transaction high level API to better distinguish operations implicit
      and explicit, and single statement transaction from operations on
      the normal transaction.
      
      Having a a high-level interface for transaction management provides
      a better base for implementing transactional concepts that are not
      always tied to storage engines and also makes it easier to interect
      with other higher level modules of the server.
      c43f894c
    • Konstantin Osipov's avatar
      Backport of: · 45a5d797
      Konstantin Osipov authored
      ------------------------------------------------------------
      revno: 2630.4.39
      committer: Dmitry Lenev <dlenev@mysql.com>
      branch nick: mysql-6.0-3726-w2
      timestamp: Thu 2008-06-26 13:08:27 +0400
      message:
        Fix warnings about passing pointer to not fully-initialized THD
        object to constructor of base Open_tables_state classe, which
        appeared on Windows and were introduced by one of the patches
        implementing WL#3726 "DDL locking for all metadata objects".
      45a5d797
  13. 02 Dec, 2009 1 commit
    • Konstantin Osipov's avatar
      Backport of: · bcae0d9b
      Konstantin Osipov authored
      ----------------------------------------------------------
      revno: 2630.10.1
      committer: Konstantin Osipov <konstantin@mysql.com>
      branch nick: mysql-6.0-lock-tables-tidyup
      timestamp: Wed 2008-06-11 15:49:58 +0400
      message:
        WL#3726, review fixes.
        Now that we have metadata locks, we don't need to keep a crippled
        TABLE instance in the table cache to indicate that a table is locked.
        Remove all code that used this technique. Instead, rely on metadata
        locks and use the standard open_table() and close_thread_table()
        to manipulate with the table cache tables.
        Removes a list of functions that have become unused (see the comment
        for sql_base.cc for details).
        Under LOCK TABLES, keep a TABLE_LIST instance for each table
        that may be temporarily closed. For that, implement an own class for
        LOCK TABLES mode, Locked_tables_list.
      
      This is a pre-requisite patch for WL#4144.
      This is not exactly a backport: there is no new 
      online ALTER table in Celosia, so the old alter table
      code was changed to work with the new table cache API.
      bcae0d9b
  14. 01 Dec, 2009 1 commit
    • Konstantin Osipov's avatar
      Backport of: · 1523cea6
      Konstantin Osipov authored
      ----------------------------------------------------------
      revno: 2630.4.26
      committer: Konstantin Osipov <konstantin@mysql.com>
      branch nick: mysql-6.0-prelocked_mode-to-push
      timestamp: Fri 2008-06-06 23:19:04 +0400
      message:
        WL#3726: work on review comments.
        Remove thd->locked_tables. Always store MYSQL_LOCK instances in
        thd->lock.
        Rename thd->prelocked_mode to thd->locked_tables_mode.
        Use thd->locked_tables_mode to determine if we
        are under LOCK TABLES. Update the code to not assume that
        if thd->lock is set, LOCK TABLES mode is off.
        Review comments.
      1523cea6
  15. 30 Nov, 2009 1 commit
    • Konstantin Osipov's avatar
      Initial import of WL#3726 "DDL locking for all metadata objects". · 69b9761f
      Konstantin Osipov authored
      Backport of:
      ------------------------------------------------------------
      revno: 2630.4.1
      committer: Dmitry Lenev <dlenev@mysql.com>
      branch nick: mysql-6.0-3726-w
      timestamp: Fri 2008-05-23 17:54:03 +0400
      message:
        WL#3726 "DDL locking for all metadata objects".
      
        After review fixes in progress.
      ------------------------------------------------------------
      
      This is the first patch in series. It transforms the metadata 
      locking subsystem to use a dedicated module (mdl.h,cc). No 
      significant changes in the locking protocol. 
      The import passes the test suite with the exception of 
      deprecated/removed 6.0 features, and MERGE tables. The latter
      are subject to a fix by WL#4144.
      Unfortunately, the original changeset comments got lost in a merge,
      thus this import has its own (largely insufficient) comments.
      
      This patch fixes Bug#25144 "replication / binlog with view breaks".
      Warning: this patch introduces an incompatible change:
      Under LOCK TABLES, it's no longer possible to FLUSH a table that 
      was not locked for WRITE.
      Under LOCK TABLES, it's no longer possible to DROP a table or
      VIEW that was not locked for WRITE.
      
      ******
      Backport of:
      ------------------------------------------------------------
      revno: 2630.4.2
      committer: Dmitry Lenev <dlenev@mysql.com>
      branch nick: mysql-6.0-3726-w
      timestamp: Sat 2008-05-24 14:03:45 +0400
      message:
        WL#3726 "DDL locking for all metadata objects".
      
        After review fixes in progress.
      
      ******
      Backport of:
      ------------------------------------------------------------
      revno: 2630.4.3
      committer: Dmitry Lenev <dlenev@mysql.com>
      branch nick: mysql-6.0-3726-w
      timestamp: Sat 2008-05-24 14:08:51 +0400
      message:
        WL#3726 "DDL locking for all metadata objects"
      
        Fixed failing Windows builds by adding mdl.cc to the lists
        of files needed to build server/libmysqld on Windows.
      
      ******
      Backport of:
      ------------------------------------------------------------
      revno: 2630.4.4
      committer: Dmitry Lenev <dlenev@mysql.com>
      branch nick: mysql-6.0-3726-w
      timestamp: Sat 2008-05-24 21:57:58 +0400
      message:
        WL#3726 "DDL locking for all metadata objects".
      
        Fix for assert failures in kill.test which occured when one
        tried to kill ALTER TABLE statement on merge table while it
        was waiting in wait_while_table_is_used() for other connections
        to close this table.
      
        These assert failures stemmed from the fact that cleanup code
        in this case assumed that temporary table representing new
        version of table was open with adding to THD::temporary_tables
        list while code which were opening this temporary table wasn't
        always fulfilling this.
      
        This patch changes code that opens new version of table to
        always do this linking in. It also streamlines cleanup process
        for cases when error occurs while we have new version of table
        open.
      
      ******
      WL#3726 "DDL locking for all metadata objects"
      Add libmysqld/mdl.cc to .bzrignore.
      ******
      Backport of:
      ------------------------------------------------------------
      revno: 2630.4.6
      committer: Dmitry Lenev <dlenev@mysql.com>
      branch nick: mysql-6.0-3726-w
      timestamp: Sun 2008-05-25 00:33:22 +0400
      message:
        WL#3726 "DDL locking for all metadata objects".
      
        Addition to the fix of assert failures in kill.test caused by
        changes for this worklog.
      
      
      Make sure we close the new table only once.
      69b9761f
  16. 25 Nov, 2009 1 commit
    • MySQL Build Team's avatar
      Backport into build-200911241145-5.1.40sp1 · d8f41c85
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 1810.3961.7
      > committer: Georgi Kodinov <joro@sun.com>
      > branch nick: B48291-5.0-bugteam
      > timestamp: Fri 2009-10-30 15:15:43 +0200
      > message:
      >   Bug #48291 : crash with row() operator,select into @var, and
      >     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.
      > ------------------------------------------------------------
      d8f41c85
  17. 24 Nov, 2009 1 commit
  18. 23 Nov, 2009 1 commit
    • Konstantin Osipov's avatar
      Backport of: · 777c3034
      Konstantin Osipov authored
      ------------------------------------------------------------
      revno: 2630.13.2
      committer: Davi Arnaut <davi@sun.com>
      branch nick: WL4284-6.0
      timestamp: Thu 2008-07-03 18:26:51 -0300
      message:
      Remove unused USING_TRANSACTIONS macro which unnecessarily
      cumbers the code. This macro is a historical leftover and
      has no practical use since its unconditionally defined.
      777c3034
  19. 20 Nov, 2009 1 commit
    • Konstantin Osipov's avatar
      Backport of: · 948ee7e5
      Konstantin Osipov authored
      revno: 2476.784.2
      committer: davi@moksha.local
      timestamp: Thu 2007-09-27 16:56:27 -0300 
      message:
      Bug#28870 check that table locks are released/reset
          
      The problem is that some mysql_lock_tables error paths are not
      resetting the tables lock type back to TL_UNLOCK. If the lock
      types are not reset properly, a table might be returned to the
      table cache with wrong lock_type.
            
      The proposed fix is to ensure that the tables lock type is always
      properly reset when mysql_lock_tables fails. This is a
      incompatible change with respect to the process state information.
      948ee7e5
  20. 10 Nov, 2009 3 commits
    • Davi Arnaut's avatar
      Backport of Bug#41860 to mysql-next-mr · 5783428f
      Davi Arnaut authored
      ------------------------------------------------------------
      revno: 3317
      revision-id: davi.arnaut@sun.com-20090522170916-fzc5ca3tjs9roy1t
      parent: patrick.crews@sun.com-20090522152933-ole8s3suy4zqyvku
      committer: Davi Arnaut <Davi.Arnaut@Sun.COM>
      branch nick: 41860-6.0
      timestamp: Fri 2009-05-22 14:09:16 -0300
      message:
        Bug#41860: Without Windows named pipe
      
        The problem was that the patch for Bug#10374 broke named pipe
        and shared memory transports on Windows due to a failure to
        implement a dummy poll method for transports other than BSD
        sockets. Another problem was that mysqltest lacked support
        for named pipe and shared memory connections, which lead to
        misleading test cases that were supposed run common queries
        over both transports.
      
        The solution is to properly implement, at the VIO layer, the
        poll and is_connected methods. The is_connected method is
        implemented for every suppported transport and the poll one
        only where it makes sense. Furthermore, support for named pipe
        and shared memory connections is added to mysqltest as to
        enable testing of both transports using the test suite.
      5783428f
    • Davi Arnaut's avatar
      Backport of Bug#10374 to mysql-next-mr · 58706b3f
      Davi Arnaut authored
      ------------------------------------------------------------
      revno: 2597.37.3
      revision-id: sp1r-davi@mysql.com/endora.local-20080328123626-16430
      parent: sp1r-anozdrin/alik@quad.opbmk-20080327125300-11290
      committer: davi@mysql.com/endora.local
      timestamp: Fri 2008-03-28 09:36:26 -0300
      message:
        Bug#10374 GET_LOCK does not let connection to close on the server side if it's aborted
      
        The problem is that the server doesn't detect aborted connections which
        are waiting on a lock or sleeping (user sleep), wasting system resources
        for a connection that is already dead.
      
        The solution is to peek at the connection every five seconds to verify if
        the connection is not aborted. A aborted connection is detect by polling
        the connection socket for available data to be read or end of file and in
        case of eof, the wait is aborted and the connection killed.
      58706b3f
    • Martin Hansson's avatar
      Backport of Bug#33204 from mysql-pe to · b4a3083d
      Martin Hansson authored
      mysql-next-mr-bugfixing.
      
      Bug no 32858 was fixed in two different ways in what was
      then called mysql 5.1 and 6.0. The fix in 6.0 was very
      different since bugfix no 33204 was present.  Furthermore,
      the two fixes were not compatible. Hence in order to
      backport Bug#33204 to the 5.1-based mysql-next-mr-bugfixing,
      it was necessary to remove the 5.1 fix of 32858 and apply
      the 6.0 version of the fix.
      b4a3083d
  21. 03 Nov, 2009 1 commit
    • Alfranio Correia's avatar
      WL#2687 WL#5072 BUG#40278 BUG#47175 · 60d46624
      Alfranio Correia authored
      Non-transactional updates that take place inside a transaction present problems
      for logging because they are visible to other clients before the transaction
      is committed, and they are not rolled back even if the transaction is rolled
      back. It is not always possible to log correctly in statement format when both
      transactional and non-transactional tables are used in the same transaction.
      
      In the current patch, we ensure that such scenario is completely safe under the
      ROW and MIXED modes.
      60d46624
  22. 02 Nov, 2009 1 commit
  23. 30 Oct, 2009 1 commit
    • 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
  24. 28 Oct, 2009 1 commit
    • Konstantin Osipov's avatar
      A patch and a test case for · fdcf0aff
      Konstantin Osipov authored
      Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT FOR UPDATE.
      
      If a transaction was rolled back inside InnoDB due to a deadlock
      or lock wait timeout, and the statement had IGNORE clause,
      the server could crash at the end of the statement or on shutdown.
      
      This was caused by the error handling infrastructure's attempt to 
      ignore a non-ignorable error.
      
      When a transaction rollback request is raised, switch off 
      current_select->no_error flag, so that the following error
      won't be ignored.
      
      Instead, we could add !thd->is_fatal_sub_stmt_error to
      my_message_sql(), but since in write_record() we switch
      off no_error, the same approach is used in 
      thd_mark_transaction_to_rollback().
      
      @todo: call thd_mark_transaction_to_rollback() from 
      handler::print_error(), then we can easily make sure
      that the error reported by print_error is not ignored.
      fdcf0aff
  25. 22 Oct, 2009 1 commit
    • Alexander Nozdrin's avatar
      Backporting a patch for Bug#43138. That patch had been already backported · 67dbff68
      Alexander Nozdrin authored
      to 5.1 partially. This patch brings what was left to mysql-next-mr.
      
      Original revisions in 6.0:
      ------------------------------------------------------------
      revno: 2617.31.26
      committer: Alexander Nozdrin <alik@sun.com>
      branch nick: 6.0-rt-bug43138.3
      timestamp: Thu 2009-04-30 19:31:30 +0400
      message:
        Fix for Bug#43138: DROP DATABASE failure does not clean up message list.
        
        The problem was that the high-level function mysql_rm_db() invoked
        low-level mysql_rm_table_part2(), which reported low-level error
        (Unknown table) if SE refused to delete a table. Also when
        mysql_rm_table_part2() reported an error, it didn't add corresponding
        warning into the list (because it is used from other places where such
        behaviour is required).
        
        The fix is to
          1. Remove no_warnings_for_error usage from sql_table.cc
          2. Improve internal error handler support in THD, so that
             a stack of error handlers is allowed.
          3. Create an internal error handler (Drop_table_error_handler)
             to silence useless warnings.
          4. Use the handler in DROP DATABASE and DROP TABLE statements.
      ------------------------------------------------------------
      revno: 2617.69.38
      committer: Alexander Nozdrin <alik@sun.com>
      branch nick: mysql-next-bugfixing-bug37431
      timestamp: Mon 2009-08-24 21:52:09 +0400
      message:
        A test case for Bug#37431 (DROP TABLE does not report errors correctly).
      ------------------------------------------------------------
      revno: 2617.31.29
      committer: Dmitry Lenev <dlenev@mysql.com>
      branch nick: mysql-6.0-runtime
      timestamp: Fri 2009-05-01 17:37:34 +0400
      message:
        Follow-up for fix for bug "Bug#43138: DROP DATABASE failure
        does not clean up message list".
        
        Fixed drop.test failure under non-debug server by moving part
        of test dependent on debug-only feature to separate .test file,
        which won't be run for non-debug versions of server.
      ------------------------------------------------------------
      revno: 2617.45.17
      committer: Sergei Golubchik <serg@mysql.com>
      branch nick: 6.0-maria
      timestamp: Wed 2009-05-13 20:08:58 +0200
      message:
        followup for bug#43138
        if delete fails with a permission denied error, we want to show it
      ------------------------------------------------------------
      
      The patch was backported to 5.1 in scope of Bug#42364 by
      the following revision:
      ------------------------------------------------------------
      revno: 2497.975.3
      committer: Sergey Glukhov <Sergey.Glukhov@sun.com>
      branch nick: mysql-5.1-bugteam
      timestamp: Fri 2009-07-03 13:22:06 +0500
      message:
        Bug#42364 SHOW ERRORS returns empty resultset after dropping non existent table
        enabled message storing into error message list
        for 'drop table' command
      ------------------------------------------------------------
      67dbff68
  26. 21 Oct, 2009 1 commit
    • Konstantin Osipov's avatar
      Backport of revno 2630.28.10, 2630.28.31, 2630.28.26, 2630.33.1, · d4632dff
      Konstantin Osipov authored
      2630.39.1, 2630.28.29, 2630.34.3, 2630.34.2, 2630.34.1, 2630.29.29,
      2630.29.28, 2630.31.1, 2630.28.13, 2630.28.10, 2617.23.14 and
      some other minor revisions.
      
      This patch implements: 
      
      WL#4264 "Backup: Stabilize Service Interface" -- all the
      server prerequisites except si_objects.{h,cc} themselves (they can
      be just copied over, when needed).
      
      WL#4435: Support OUT-parameters in prepared statements.
      
      (and all issues in the initial patches for these two
      tasks, that were discovered in pushbuild and during testing).
      
      Bug#39519: mysql_stmt_close() should flush all data
      associated with the statement.
      
      After execution of a prepared statement, send OUT parameters of the invoked
      stored procedure, if any, to the client.
      
      When using the binary protocol, send the parameters in an additional result
      set over the wire.  When using the text protocol, assign out parameters to
      the user variables from the CALL(@var1, @var2, ...) specification.
      
      The following refactoring has been made:
        - Protocol::send_fields() was renamed to Protocol::send_result_set_metadata();
        - A new Protocol::send_result_set_row() was introduced to incapsulate
          common functionality for sending row data.
        - Signature of Protocol::prepare_for_send() was changed: this operation
          does not need a list of items, the number of items is fully sufficient.
      
      The following backward incompatible changes have been made:
        - CLIENT_MULTI_RESULTS is now enabled by default in the client;
        - CLIENT_PS_MULTI_RESUTLS is now enabled by default in the client.
      d4632dff
  27. 16 Oct, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #40877: multi statement execution fails in 5.1.30 · 8f6f3dba
      Georgi Kodinov authored
            
      Implemented the server infrastructure for the fix:
      
      1. Added a function LEX_STRING *thd_query_string(THD) to return
      a LEX_STRING structure instead of char *.
      This is the function that must be called in innodb instead of 
      thd_query()
      
      2. Did some encapsulation in THD : aggregated thd_query and 
      thd_query_length into a LEX_STRING and made accessor and mutator 
      methods for easy code updating. 
      
      3. Updated the server code to use the new methods where applicable.
      8f6f3dba
  28. 14 Oct, 2009 2 commits
    • Konstantin Osipov's avatar
      Backport of: · 64dbe379
      Konstantin Osipov authored
      ----------------------------------------------------------
      revno: 2617.22.5
      committer: Konstantin Osipov <kostja@sun.com>
      branch nick: mysql-6.0-runtime
      timestamp: Tue 2009-01-27 05:08:48 +0300
      message:
        Remove non-prefixed use of HASH.
        Always use my_hash_init(), my_hash_inited(), my_hash_search(),
        my_hash_element(), my_hash_delete(), my_hash_free() rather
        than non-prefixed counterparts (hash_init(), etc).
        Remove the backward-compatible defines.
      64dbe379
    • Sven Sandberg's avatar
      BUG#39934: Slave stops for engine that only support row-based logging · 73b296c4
      Sven Sandberg authored
      Post-push fix.
      Problem: After the original bugfix, if a statement is unsafe,
      binlog_format=mixed, and engine is statement-only, a warning was
      generated and the statement executed. However, it is a fundamental
      principle of binlogging that binlog_format=mixed should guarantee
      correct logging, no compromise. So correct behavior is to generate
      an error and don't execute the statement.
      Fix: Generate error instead of warning.
      Since issue_unsafe_warnings can only generate one error message,
      this allows us to simplify the code a bit too:
      decide_logging_format does not have to save the error code for
      issue_unsafe_warnings
      73b296c4
  29. 13 Oct, 2009 1 commit
    • Konstantin Osipov's avatar
      Introduce thd->query_cache_tls (thread · ea6a22bf
      Konstantin Osipov authored
      local storage for query cache). 
      We need more than one pointer in a thread to
      represent the query cache and net->query_cache_query can not be used
      any more (due to ABI compatibility issues and to different life
      time of NET and THD).
      This is a backport of the following patch from 6.0:
      ----------------------------------------------------------
      revno: 2476.1157.2
      committer: kostja@bodhi.(none)
      timestamp: Sat 2007-06-16 13:29:24 +0400
      ea6a22bf
  30. 12 Oct, 2009 1 commit
  31. 09 Oct, 2009 2 commits
    • Dmitry Lenev's avatar
      Fix for bug #39932 "create table fails if column for FK is in different · 268da1b1
      Dmitry Lenev authored
      case than in corr index".
      
      Server was unable to find existing or explicitly created supporting
      index for foreign key if corresponding statement clause used field
      names in case different than one used in key specification and created
      yet another supporting index.
      In cases when name of constraint (and thus name of generated index)
      was the same as name of existing/explicitly created index this led
      to duplicate key name error.
      
      The problem was that unlike all other code Key_part_spec::operator==()
      compared field names in case sensitive fashion. As result routines
      responsible for getting rid of redundant generated supporting indexes
      for foreign key were not working properly for versions of field names
      using different cases.
      268da1b1
    • Dmitry Lenev's avatar
      This patch is prerequisite for the 2nd milestone of WL#148 "Foreign keys" · d4669dc4
      Dmitry Lenev authored
      storing and restoring information about foreign keys in the .FRM files and
      properly displaying it in SHOW CREATE TABLE output and I_S tables.
      
      The idea of this patch is to change type of Key_part_spec::field_name and
      Key::name to LEX_STRING in order to avoid extra strlen() calls during
      semantic analysis and statement execution, particularly, in code to be
      implemented on the 2nd milestone of WL#148.
      
      Note that since we are not using LEX_STRING everywhere yet (e.g. in
      Create_field and KEY) and we want to limit scope of our changes we
      have to do strlen() in places where we create Key and Key_part_spec
      instances from objects using plain (char*) for strings. These calls
      will go away during the process of further (char*) -> LEX_STRING
      refactoring.
      
      We have introduced these changes in 6.0 and backported them to 5.5
      tree to make people aware of these changes as early as possible and
      to simplify merges with mysql-fk and mysql-6.1-fk trees.
      
      No test case is needed since this patch does not introduce any
      user visible changes.
      d4669dc4