1. 27 Nov, 2016 2 commits
    • Alexander Barkov's avatar
      MDEV-11360 Dynamic SQL: DEFAULT as a bind parameter · 9bfde897
      Alexander Barkov authored
      This patch adds DEFAULT as a possible dynamic SQL parameter, e.g.:
        EXECUTE IMMEDIATE 'INSERT INTO t1 (column) VALUES(?)' USING DEFAULT;
        EXECUTE IMMEDIATE 'UPDATE t1 SET column=?' USING DEFAULT;
      and for similar PREPARE..EXECUTE queries.
      
      This is done for symmetry with the STMT_INDICATOR_DEFAULT indicator in
      the client-server PS protocol.
      
      The changes include:
      - Allowing DEFAULT as a possible option in execute USING clause (sql_yacc.yy)
      - Adding "virtual bool Item::save_in_param(THD *thd, Item_param *param)",
        because "normal" items (that have real values) and Item_default_value
        have now different actions when assigning itself as an Item_param value.
      - Fixing switch() statements in a few Item_param methods not to have "default",
        because it was easy to forget to add a new "case" when adding a new XXX_VALUE
        value into the enum Item_param::enum_item_param_state.
        This is important, as we'll be adding new values soon, e.g. for MDEV-11359.
        Removing "default" helped to find and report bugs MDEV-11361 and MDEV-11362,
        because DECIMAL_VALUE is obviously not properly handled in some cases.
      9bfde897
    • Igor Babaev's avatar
      Fixed bug mdev-11313. · 1d0f1741
      Igor Babaev authored
      The fix for bug 11072 was not complete though it also fixed
      the bug mdev-10800.
      This patch resolves the problems of all three bugs.
      1d0f1741
  2. 26 Nov, 2016 2 commits
  3. 25 Nov, 2016 11 commits
    • Marko Mäkelä's avatar
      618edd40
    • Marko Mäkelä's avatar
      Merge branch '10.2_warnings' of https://github.com/kevgs/server into kevgs-10.2_warnings · cc3aba26
      Marko Mäkelä authored
      Revert the XtraDB changes, because 10.2 does not currently build with XtraDB.
      
      Also omit some changes that need further investigation.
      
      Ensure that all callers of partition_info::get_clone() are passing this!=NULL.
      cc3aba26
    • Marko Mäkelä's avatar
      MDEV-11349 (2/2) Fix some bogus-looking Valgrind warnings · d247d649
      Marko Mäkelä authored
      buf_block_init(): Initialize buf_page_t::flush_type.
      For some reason, Valgrind 3.12.0 would seem to flag some
      bits in adjacent bitfields as uninitialized, even though only
      the two bits of flush_type were left uninitialized. Initialize
      the field to get rid of many warnings.
      
      buf_page_init_low(): Initialize buf_page_t::old.
      For some reason, Valgrind 3.12.0 would seem to flag all 32
      bits uninitialized when buf_page_init_for_read() invokes
      buf_LRU_add_block(bpage, TRUE). This would trigger bogus warnings
      for buf_page_t::freed_page_clock being uninitialized.
      (The V-bits would later claim that only "old" is initialized
      in the 32-bit word.) Perhaps recent compilers
      (GCC 6.2.1 and clang 4.0.0) generate more optimized x86_64 code
      for bitfield operations, confusing Valgrind?
      
      mach_write_to_1(), mach_write_to_2(), mach_write_to_3():
      Rewrite the assertions that ensure that the most significant
      bits are zero. Apparently, clang 4.0.0 would optimize expressions
      of the form ((n | 0xFF) <= 0x100) to (n <= 0x100). The redundant
      0xFF was added in the first place in order to suppress a
      Valgrind warning. (Valgrind would warn about comparing uninitialized
      values even in the case when the uninitialized bits do not affect
      the result of the comparison.)
      d247d649
    • Marko Mäkelä's avatar
      MDEV-11349 (1/2) Fix some clang 4.0 warnings · cdaa1d76
      Marko Mäkelä authored
      In functions that declare pointer parameters as nonnull,
      remove nullness checks, because GCC would optimize them away anyway.
      
      Use #ifdef instead of #if when checking for a configuration flag.
      
      Clang says that left shifts of negative values are undefined.
      So, use ~0U instead of ~0 in a number of macros.
      
      Some functions that were defined as UNIV_INLINE were declared as
      UNIV_INTERN. Consistently use the same type of linkage.
      
      ibuf_merge_or_delete_for_page() could pass bitmap_page=NULL to
      buf_page_print(), conflicting with the __attribute__((nonnull)).
      cdaa1d76
    • Sergey Vojtovich's avatar
      MDEV-11296 - InnoDB stalls under OLTP RW on P8 · 1a1749e3
      Sergey Vojtovich authored
      Threads may fall asleep forever while acquiring InnoDB rw-lock on Power8. This
      regression was introduced along with InnoDB atomic operations fixes.
      
      The problem was that proper memory order wasn't enforced between "writers"
      store and "lock_word" load:
      
        my_atomic_store32((int32*) &lock->waiters, 1);
        ...
        local_lock_word = lock->lock_word;
      
      Locking protocol is such that store to "writers" must be completed before load
      of "lock_word". my_atomic_store32() was expected to enforce memory order because
      it issues strongest MY_MEMORY_ORDER_SEQ_CST memory barrier.
      
      According to C11:
      - any operation with this memory order is both an acquire operation and a
        release operation
      - for atomic store order must be one of memory_order_relaxed
        memory_order_release or memory_order_seq_cst. Otherwise the behavior is
        undefined.
      
      That is it doesn't say explicitly that this expectation is wrong, but there are
      indications that acquire (which is actually supposed to guarantee memory order
      in this case) may not be issued along with MY_MEMORY_ORDER_SEQ_CST.
      
      A good fix for this is to encode waiters into lock_word, but it is a bit too
      intrusive. Instead we change atomic store to atomic fetch-and-store, which
      does memory load and is guaranteed to issue acquire.
      1a1749e3
    • Sergey Vojtovich's avatar
      MDEV-11296 - InnoDB stalls under OLTP RW on P8 · fb7caad7
      Sergey Vojtovich authored
      Simplify away recursive flag: it is not necessary for rw-locks to operate
      properly. Now writer_thread != 0 means recursive.
      
      As we only need correct value of writer_thread only in writer_thread itself
      it is rather safe to load and update it non-atomically.
      
      This patch also fixes potential reorder of "writer_thread" and "recursive"
      loads (aka MDEV-7148), which was reopened along with InnoDB thread fences
      simplification. Previous versions are unaffected, because they have os_rmb
      in rw_lock_lock_word_decr(). It wasn't observed at the moment of writing
      though.
      fb7caad7
    • Sergey Vojtovich's avatar
      MDEV-11296 - InnoDB stalls under OLTP RW on P8 · 68a85373
      Sergey Vojtovich authored
      Clean-up INNODB_RW_LOCKS_USE_ATOMICS: it is always set.
      68a85373
    • Sergey Vojtovich's avatar
      MDEV-11296 - InnoDB stalls under OLTP RW on P8 · 8d010c44
      Sergey Vojtovich authored
      Simplified away rw_lock_get_waiters(), rw_lock_set_waiter_flag(),
      rw_lock_reset_waiter_flag(). Let waiters have predictable data type.
      8d010c44
    • Sergey Vojtovich's avatar
      MDEV-11296 - InnoDB stalls under OLTP RW on P8 · bb7e84b7
      Sergey Vojtovich authored
      Simplified away rw_lock_lock_word_incr().
      bb7e84b7
    • Otto Kekäläinen's avatar
      Deb: make server core package breaks/replaces earlier client packages · e06e455e
      Otto Kekäläinen authored
      This is required, as the innochecksum binary has moved package.
      Without this change the following error would be emitted:
      
        Unpacking mariadb-server-core-10.2 (10.2.3+maria~jessie) over (10.2.2+maria-1~jessie) ...
        dpkg: error processing archive /var/cache/apt/archives/mariadb-server-core-10.2_10.2.3+maria~jessie_amd64.deb (--unpack):
          trying to overwrite '/usr/bin/innochecksum', which is also in package mariadb-client-10.2 10.2.2+maria-1~jessie
      e06e455e
    • Otto Kekäläinen's avatar
      Deb: skip invoke-rc.d mysql stop if no mysql process is running at all · 89236a8a
      Otto Kekäläinen authored
      Quite often in upgrades on systemd systems dpkg emitted an error like:
      
        Failed to stop mysql.service: Unit mysql.service not loaded.
        invoke-rc.d: initscript mysql, action "stop" failed.
        invoke-rc.d returned 5
        There is a MySQL server running, but we failed in our attempts to stop it.
        Stop it yourself and try again!
        dpkg: error processing archive /var/cache/apt/archives/mariadb-server-10.2
      
      This is because the mariadb/mysql.service file is not loaded during
      the upgrade/unpack stage of dpkg in certain situations. With this simple
      check we can easily skip the shutdown step when it is really not needed,
      which is for sure the case if no mysqld process at all is running on the
      entire system.
      89236a8a
  4. 24 Nov, 2016 2 commits
  5. 23 Nov, 2016 1 commit
    • Igor Babaev's avatar
      Fixed bug mdev-11315. · f4d6f26a
      Igor Babaev authored
      There were no implementations for the virtual functions
      exclusive_dependence_on_table_processor and
      exclusive_dependence_on_table_processor. As a result
      the procedure pushdown_cond_for_derived erroneously
      detected some conditions with outer references as pushable
      into materialized view / derived table.
      f4d6f26a
  6. 22 Nov, 2016 1 commit
  7. 21 Nov, 2016 7 commits
    • Nirbhay Choubey's avatar
      MDEV-10792: Assertion `thd->mdl_context.is_lock_owner .. · 4a27ab23
      Nirbhay Choubey authored
      .. (MDL_key::TABLE, table->db, table->table_name, MDL_SHARED)'
      failed in mysql_rm_table_no_locks
      
      Reset error flag after temporary table has been
      successfully dropped.
      4a27ab23
    • Nirbhay Choubey's avatar
      MDEV-10442: "Address already in use" on restart · ebe06190
      Nirbhay Choubey authored
      SST processes should inherit mysqld's process group.
      ebe06190
    • Nirbhay Choubey's avatar
      44ccb8f2
    • Bernard Spil's avatar
      Implement native/base process checks for FreeBSD · cf1b0c1a
      Bernard Spil authored
        - Make rsync process checks OS-dependent
        - Use (BSD) netstat on FreeBSD (not lsof)
      cf1b0c1a
    • Bernard Spil's avatar
      POSIX-ify wsrep scripts · f16ead51
      Bernard Spil authored
        - Replace #!/bin/bash with #!/bin/sh
        - Split username:password using POSIX compat %% and ##
        - Don't use array for FILTERS
        - Replace == tests with POSIX-compat =
      f16ead51
    • Igor Babaev's avatar
      Fixed bug mdev-11081. · 665045f9
      Igor Babaev authored
      The idea of this fix was taken from the patch by Roy Lyseng
      for mysql-5.6 bug iBug#14740889: "Wrong result for aggregate
      functions when executing query through cursor".
      
      Here's Roy's comment for his patch:
      "
      The problem was that a grouped query did not behave properly when
      executed using a cursor. On further inspection, the query used one
      intermediate temporary table for the grouping.
      Then, Select_materialize::send_result_set_metadata created a temporary
      table for storing the query result. Notice that get_unit_column_types()
      is used to retrieve column meta-data for the query. The items contained
      in this list are later modified so that their result_field points to
      the row buffer of the materialized temporary table for the cursor.
      But prior to this, these result_field objects have been prepared for
      use in the grouping operation, by JOIN::make_tmp_tables_info(), hence
      the grouping operation operates on wrong column buffers.
      
      The problem is solved by using the list JOIN::fields when copying data
      to the materialized table. This list is set by JOIN::make_tmp_tables_info()
      and points to the columns of the last intermediate temporary table of
      the executed query. For a UNION, it points to the temporary table
      that is the result of the UNION query.
      
      Notice that we have to assign a value to ::fields early in JOIN::optimize()
      in case the optimization shortcuts due to a const plan detection.
      
      A more optimal solution might be to avoid creating the final temporary
      table when the query result is already stored in a temporary table.
      "
      The patch does not contain a test case, but the description of the
      problem corresponds exactly what could be observed in the test
      case for mdev-11081.
      665045f9
    • Kristian Nielsen's avatar
  8. 20 Nov, 2016 8 commits
    • Sergei Petrunia's avatar
      Update the testcase for MDEV-10330 · 58532f36
      Sergei Petrunia authored
      Instead of restart_mysqld.inc, truncate the P_S tables that are used
      by the test. We don't want to query some irrelevant data.
      58532f36
    • Kristian Nielsen's avatar
      Fix use of `require` in mysql-test-run. · f77bd5fa
      Kristian Nielsen authored
      The motivation for this is that Perl is moving towards not having
      current directory ./ in @INC by default. This is causing
      mysql-test-run.pl to fail in latest Debian Unstable:
      
        https://lists.debian.org/debian-devel-announce/2016/08/msg00013.html
      
      However, we have `use "lib"`, there is no need for current directory
      in @INC, except for a gross hack. In mtr_cases.pm, there is a
      `require "mtr_misc.pl"`, which hides mtr_misc.pl away in mtr_cases
      namespace. And things only work because mysql-test-run.pl loads it
      with a different name, `require "lib/mtr_misc.pl"`! (Perl will
      `require` only once for each unique filename).
      
      Fix this by only using `require` in main program, and referencing
      functions with :: scope from other namespaces. For multi-use in
      different namespaces, proper `use` modules should be used.
      Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
      f77bd5fa
    • Otto Kekäläinen's avatar
      Deb: provide the libmysqlclient shim packages that exist in Debian/Ubuntu · d49cffa1
      Otto Kekäläinen authored
      This way all 3rd party apps configured to build against any MySQL or
      MariaDB version will pick up the libmariadb3-dev package instead.
      d49cffa1
    • Otto Kekäläinen's avatar
      Deb: make libmariadb3 to provide the libmariadbclient.so.18 link · dcfe6cb8
      Otto Kekäläinen authored
      In Debian many existing applications in Debian/Ubuntu have been built
      while libmariadbclient-dev or libmariadbclient-dev-compat was installed.
      
      To satisfy installation dependencies, the package name libmariadbclient18
      must be provided, and at runtime a shared library must by the name
      libmariadbclient.so.18.
      
      Provide these to remain backwards compatible.
      dcfe6cb8
    • Otto Kekäläinen's avatar
      Deb: rename client library packages to reflect its contents · 2bcc16c1
      Otto Kekäläinen authored
      The new library name libmariadb3 matches the libmariadb.so.3 filename.
      Packages that want to build against MariaDB Connector C have as
      build-dependency libmariadb-dev and as run-time dependency libmariadb3.
      
      Make the package provide libmariadbclient18 for backwards compatibility,
      though compatibility is not always assured. There library did change
      to a whole new generation after all, even though ABI compatibility has
      been a design goal.
      
      Also do the equivalent change for the -dev package. Packages that
      explicitly want to use the MariaDB Connector C should mark it as
      their build-depends.
      
      Also provide an empty libmariadbclient18 metapackage to facilitate
      upgrades from old MariaDB installs, just like there is an empty
      libmysqlclient18 package. Create more of these in the future as needed.
      2bcc16c1
    • Otto Kekäläinen's avatar
      Deb: provide the default-mysql-* packages that exist in Debian/Ubuntu · 54bd67a4
      Otto Kekäläinen authored
      Since Debian 9 (Stretch) and Ubuntu 16.10 (Yakkety) the following
      packages have existed:
      * virtual-mysql-client
      * virtual-mysql-client-core
      * virtual-mysql-server
      * virtual-mysql-server-core
      * virtual-libmysqlclient-dev
      
      They are metapackages that in Debian depend on MariaDB and in
      Ubuntu currently on MySQL. We need to provide them and point
      them to MariaDB so that systems that have the mariadb.org
      repositories enabled automatically get everything MariaDB
      and not MySQL.
      
      This change makes the packaging provide the four first ones,
      and later commits will fix the client library issues.
      54bd67a4
    • Otto Kekäläinen's avatar
      df8ba7a3
    • Otto Kekäläinen's avatar
  9. 19 Nov, 2016 2 commits
  10. 18 Nov, 2016 4 commits