1. 28 Feb, 2010 1 commit
    • Dmitry Lenev's avatar
      Fix for bug #51105 "MDL deadlock in rqg_mdl_stability test · a7530fb2
      Dmitry Lenev authored
      on Windows".
      
      On platforms where read-write lock implementation does not
      prefer readers by default (Windows, Solaris) server might
      have deadlocked while detecting MDL deadlock.
      
      MDL deadlock detector relies on the fact that read-write
      locks which are used in its implementation prefer readers
      (see new comment for MDL_lock::m_rwlock for details).
      So far MDL code assumed that default implementation of
      read/write locks for the system has this property.
      Indeed, this turned out ot be wrong, for example, for
      Windows or Solaris. Thus MDL deadlock detector might have
      deadlocked on these systems.
      
      This fix simply adds portable implementation of read/write
      lock which prefer readers and changes MDL code to use this
      new type of synchronization primitive.
      
      No test case is added as existing rqg_mdl_stability test can
      serve as one.
      
      config.h.cmake:
        Check for presence of pthread_rwlockattr_setkind_np to be
        able to determine if system natively supports read-write
        locks for which we can specify if readers or writers should
        be preferred.
      configure.cmake:
        Check for presence of pthread_rwlockattr_setkind_np to be
        able to determine if system natively supports read-write
        locks for which we can specify if readers or writers should
        be preferred.
      configure.in:
        Check for presence of pthread_rwlockattr_setkind_np to be
        able to determine if system natively supports read-write
        locks for which we can specify if readers or writers should
        be preferred.
      include/my_pthread.h:
        Added support for portable read-write locks which prefer
        readers.
        To do so extended existing my_rw_lock_t implementation to
        support selection of whom to prefer depending on a flag.
      mysys/thr_rwlock.c:
        Extended existing my_rw_lock_t implementation to support
        selection of whom to prefer depending on a flag.
        Added rw_pr_init() function implementing initialization of
        read-write locks preferring readers.
      sql/mdl.cc:
        Use portable read-write locks which prefer readers instead of
        relying on that system implementation of read-write locks has
        this property (this was true for Linux/NPTL but was false,
        for example, for Windows and Solaris).
        Added comment explaining why preferring readers is important
        for MDL deadlock detector (thanks to Serg for example!).
      sql/mdl.h:
        Use portable read-write locks which prefer readers instead of
        relying on that system implementation of read-write locks has
        this property (this was true for Linux/NPTL but was false,
        for example, for Windows and Solaris).
      a7530fb2
  2. 27 Feb, 2010 1 commit
    • Konstantin Osipov's avatar
      WL#5000 FLUSH TABLES|TABLE table_list WITH READ LOCK. · dd262230
      Konstantin Osipov authored
      Extend and implement the grammar that allows to FLUSH WITH READ LOCK
      a list of tables, rather than all of them.
      
      Incompatible grammar change:
      Previously one could perform FLUSH TABLES, HOSTS, PRIVILEGES in a single
      statement.
      After this change, FLUSH TABLES must always be alone on the list.
      Judging by the test suite, however, the old extended syntax
      was never or very rarely used.
      
      The new statement requires RELOAD ACL global privilege and
      LOCK_TABLES_ACL | SELECT_ACL on individual tables.
      In other words, it's an atomic combination of LOCK TALBES <list> READ
      and FLUSH TABLES <list>, and requires respective privileges.
      
      For additional information about the semantics, please
      see WL#5000 and the comment for flush_tables_with_read_lock()
      function in sql_parse.cc
      
      
      mysql-test/r/flush.result:
        Update test results (WL#5000).
      mysql-test/t/flush.test:
        Add test coverage for WL#5000.
      sql/sql_yacc.yy:
        Allow FLUSH TABLES <table_list> WITH READ LOCK.
        Disallow FLUSH TABLES <table_list>, flush_options.
      dd262230
  3. 26 Feb, 2010 9 commits
    • Dmitry Lenev's avatar
      Merged recent changes from mysql-next-mr-bugfixing · 6d8ae18b
      Dmitry Lenev authored
      into mysql-next-4284 tree.
      6d8ae18b
    • Jonathan Perkin's avatar
      Fix truncated GPL text. · 60eb0fdb
      Jonathan Perkin authored
      60eb0fdb
    • Dmitry Lenev's avatar
      Merge recent changes from mysql-next-mr into · 8165a75e
      Dmitry Lenev authored
      mysql-next-4284.
      8165a75e
    • Dmitry Lenev's avatar
      Merged recent changes from mysql-next-mr-bugfixing into · 0308a74a
      Dmitry Lenev authored
      mysql-next-4284 tree.
      0308a74a
    • Jon Olav Hauglid's avatar
      Bug #51240 ALTER TABLE of a locked MERGE table fails · 1dbdb338
      Jon Olav Hauglid authored
      The problem was that ALTER TABLE on a merge table which was locked 
      using LOCK TABLE ... WRITE, by mistake gave 
      ER_TABLE_NOT_LOCKED_FOR_WRITE.
      
      During opening of the table to be ALTERed, open_table() tried to
      get an upgradable metadata lock. In LOCK TABLEs mode, this lock
      must already exist (i.e. taken by LOCK TABLE) as new locks of this
      type cannot be acquired for fear of deadlock. So in LOCK TABLEs
      mode, open_table() tried to find an existing upgradable lock for
      the table to be altered.
      
      The problem was that open_table() also tried to find upgradable
      metadata locks for children of merge tables even if no such
      locks are needed to execute ALTER TABLE on merge tables.
      
      This patch fixes the problem by making sure that open tables code
      only searches for upgradable metadata locks for the merge table
      and not for the merge children tables. 
      
      The patch also fixes a related bug where an upgradable metadata
      lock was aquired outside of LOCK TABLEs mode even if the table in
      question was temporary. This bug meant that LOCK TABLES or DDL on
      temporary tables by mistake could be blocked/aborted by locks held
      on base tables with the same table name by other connections.
      
      Test cases added to merge.test and lock_multi.test.
      1dbdb338
    • Jon Olav Hauglid's avatar
      Bug #51336 Assert in reload_acl_and_cache during RESET QUERY CACHE · 24a9d6ac
      Jon Olav Hauglid authored
      Attempts to execute RESET statements within a transaction that
      had acquired metadata locks, led to an assertion failure on 
      debug servers. This bug didn't cause any problems on release
      builds.
      
      The triggered assert is designed to check that caches are not
      flushed or reset while having active transactions. It is triggered
      if acquired metadata locks exist that are not from LOCK TABLE or
      HANDLER statements.
      
      In this case it was triggered by RESET QUERY CACHE while having
      an active transaction that had acquired locks. The reason the
      assertion was triggered, was that RESET statements, unlike the
      similar FLUSH statements, was not causing an implicit commit.
      
      This patch fixes the problem by making sure RESET statements
      commit the current transaction before executing. The commit
      causes acquired metadata locks to be released, preventing the
      assertion from being triggered.
      
      Incompatible change: This patch changes RESET statements so
      that they cause an implicit commit.
      
      Test case added to query_cache.test.
      24a9d6ac
    • Alexander Nozdrin's avatar
      Auto-merge from mysql-next-mr. · b95268ee
      Alexander Nozdrin authored
      b95268ee
    • Alexander Nozdrin's avatar
      f83a40b0
    • Vladislav Vaintroub's avatar
      merge · a963ad57
      Vladislav Vaintroub authored
      a963ad57
  4. 25 Feb, 2010 11 commits
    • Vladislav Vaintroub's avatar
      Bug#51502: building with cmake creates an invalid mysqld_safe. · e5a9a7bb
      Vladislav Vaintroub authored
      The problem was incorrect escaping used inside a strnig : in \"$MYSQLD\" was written as "\MYSQL\" 
      (backslash and quote characters transposed), when defining FIND_PROC  variable for BSD or SysV
      style "ps" command-
      
      Additionally fixed obvious code duplication and random naming in CHECK_PID test.
      e5a9a7bb
    • Alexander Nozdrin's avatar
      Null-merge from mysql-trunk-bugfixing. · 05a074f1
      Alexander Nozdrin authored
      05a074f1
    • Alexander Nozdrin's avatar
      Null-merge from mysql-next-mr. · 79c4fbe5
      Alexander Nozdrin authored
      79c4fbe5
    • Alexander Nozdrin's avatar
      Null-merge from mysql-trunk. · 6391bf72
      Alexander Nozdrin authored
      6391bf72
    • Alexander Nozdrin's avatar
      Fix default.conf. · 6b0f9a7d
      Alexander Nozdrin authored
      6b0f9a7d
    • Alexander Nozdrin's avatar
      Fix default.conf. · 3ee53edd
      Alexander Nozdrin authored
      3ee53edd
    • Jon Olav Hauglid's avatar
      Bug #51355 handler stmt cause assertion in · a7eb883f
      Jon Olav Hauglid authored
                 bool MDL_context::try_acquire_lock(MDL_request*)
      
      This assert was triggered in the following way:
      1) HANDLER OPEN t1 from connection 1
      2) DROP TABLE t1 from connection 2. This will block due to the metadata lock
      held by the open handler in connection 1.
      3) DML statement (e.g. INSERT) from connection 1. This will close the table
      opened by the HANDLER in 1) and release its metadata lock. This is done due
      to the pending exclusive metadata lock from 2). 
      4) DROP TABLE t1 from connection 2 now completes and removes table t1.
      5) HANDLER READ from connection 1. Since the handler table was closed in 3),
      the handler code will try to reopen the table. First a new metadata lock on
      t1 will be granted before the command fails since the table was removed in 4).
      6) HANDLER READ from connection 1. This caused the assert.
      
      The reason for the assert was that the MDL_request's pointer to the lock
      ticket was not reset when the statement failed. HANDLER READ then tried to
      acquire a lock using the same MDL_request object, triggering the assert.
      This bug was only noticeable on debug builds and did not cause any problems
      on release builds.
      
      This patch fixes the problem by assuring that the pointer to the metadata 
      lock ticket is reset when reopening of handler tables fails.
      
      Test case added to handler.inc
      a7eb883f
    • Vladislav Vaintroub's avatar
      Workaround crash with dtraced shared libraries under GCC 3.4.6 on 32 bit Solaris. · 684f4c3c
      Vladislav Vaintroub authored
      Crash happens in dlopen() code when trying to load the library. Crash does not happen when library is 
      not DTrace instrumented . Additionally, crash does not happen with default Solaris 10 GCC 3.4.3 and
      it does not happen if main executable is instrumented.
      
      So , just check for this specific situation (32 bit, GCC3.4.6 , Solaris) and disable Dtrace in shared libraries.
      We have only single plugin so far that is instrumented (ha_example)
      684f4c3c
    • Jon Olav Hauglid's avatar
      merge from mysql-next-mr-bugfixing · 05e3560c
      Jon Olav Hauglid authored
      05e3560c
    • Alexey Botchkov's avatar
      Bug#41103 6.0 Windows embedded-server tests fail · 1e2a3e26
      Alexey Botchkov authored
          Two problems addressed here:
             Embedded-server linking failure.
                sql/sys_vars.cc absents in the libmysqld/CMakeLists.txt
             The PERFORMANCE_SCHEMA-related failure of the embedded-server compilation.
                We try to disable the PERFORMANCE_SCHEMA in the embedded server
                as it's considered useless there. But we do it in wrong way as
                we only disable header's links to the PF, not the PF's library itself.
                So on Unix-ex the embedded library still contains the PF code and
                grows bigger with no reason. On Windows that just fails to compile.
                   
      per-file comments:
        include/my_global.h
      Bug#41103      6.0 Windows embedded-server tests fail
            No PERFORMANCE_SCHEMA disabling in the embedded server. User can
            just use the --without-perfschema-engine-plugin option to exclude it
            from the compilation.
      1e2a3e26
    • Vladislav Vaintroub's avatar
      On Solaris, overwrite CMake's proposed thread library -lthread with -lpthread. · 0bc8d9a1
      Vladislav Vaintroub authored
      -lthread works fine in most cases, but at least with gcc 3.4.6 on x86, dlopen() crashes when libpthread is not used. 
      Note : the workaround existed prior and did not work  since CMAKE_THREADS_LIBS_INIT was already
       in cache.  Now, use SET(.. CACHE FORCE)  to overwrite the cached value.
      0bc8d9a1
  5. 24 Feb, 2010 10 commits
    • Vladislav Vaintroub's avatar
      merge · 2771f7b6
      Vladislav Vaintroub authored
      2771f7b6
    • Jonathan Perkin's avatar
      Some CMake packaging fixes: · 61ab61ec
      Jonathan Perkin authored
       - Remove INSTALL-BINARY from installed docs directory, we provide a copy
         in the root directory (but perhaps this should be revisited later).
      
       - Disable audit_null and daemon_example plugins.
      
       - Fix the docs directory.
      
       - Remove mysql-test/Makefile.in
      
       - Build and install mysql_tzinfo_to_sql
      
       - Remove share/charsets/languages.html
      61ab61ec
    • Vladislav Vaintroub's avatar
      #51466 : Source packages are broken with cmake in a cmake-agnostic environment · a2b69229
      Vladislav Vaintroub authored
      In the worst case possible scenario (no bzr, in-source build),
      make dist produced a package that compiled ok with autotools
      but failed to package because extra make_binary_distribution was
      found in source package and was not built. make_binary_distribution
      contained paths of the build machine.
      
      Fix:  exclude some scripts that are produced in cmake build. 
      Note that there is no good general fix for it in this specific scenario.
      it is advisable to build source packages out of source or in bzr repo.
      a2b69229
    • Vladislav Vaintroub's avatar
      Fix --with-ssl mappping (--with-ssl=dir should be "yes" or · 300622fd
      Vladislav Vaintroub authored
      actually "system"), --with-ssl should be "bundled".
      
      Fixes error on sol-gcc-x86, where build machine had  openssl but not
      the test box.
      300622fd
    • Jon Olav Hauglid's avatar
      Followup to Bug#45225 Locking: hang if drop table with no timeout · 0043c04e
      Jon Olav Hauglid authored
      This patch prevents system threads and system table accesses from
      using user-specified values for "lock_wait_timeout". Instead all
      such accesses are done using the default value (1 year).
      
      This prevents background tasks (such as replication, events, 
      accessing stored function definitions, logging, reading time-zone
      information, etc.) from failing in cases where the global value
      of "lock_wait_timeout" is set very low.
      
      The patch also simplifies the open tables API. Rather than adding
      another convenience function for opening and locking system tables,
      this patch removes most of the existing convenience functions for
      open_and_lock_tables_derived(). Before, open_and_lock_tables() was
      a convenience function that enforced derived tables handling, while
      open_and_lock_tables_derived() was the main function where derived
      tables handling was optional. Now, this convencience function is
      gone and the main function is renamed to open_and_lock_tables(). 
      
      No test case added as it would have required the use of --sleep to
      check that system threads and system tables have a different timeout
      value from the user-specified "lock_wait_timeout" system variable.
      0043c04e
    • Alexander Nozdrin's avatar
      c29b569c
    • Marc Alff's avatar
      Fixed tests for windows · 764ae771
      Marc Alff authored
      764ae771
    • Vladislav Vaintroub's avatar
      merge · 4a97d0b9
      Vladislav Vaintroub authored
      4a97d0b9
    • Vladislav Vaintroub's avatar
      Fix typo · 5e284555
      Vladislav Vaintroub authored
      HAVE_IBGCC_ATOMIC_BUILTINS=>HAVE_IB_GCC_ATOMIC_BUILTINS.
      Due to the typo, detection of atomics was broken. 
      It also lead to valgrind error during shutdown 
      (access to freed memory),which is likely present 
      in all builds where atomics are not used.
      5e284555
    • Marc Alff's avatar
      Bug#10143 Perror not showing error description · f575c59b
      Marc Alff authored
      Backport to 5.5.99
      f575c59b
  6. 23 Feb, 2010 8 commits