1. 31 Aug, 2018 3 commits
    • Marko Mäkelä's avatar
      Merge 10.1 into 10.2 · 206528f7
      Marko Mäkelä authored
      206528f7
    • Marko Mäkelä's avatar
      MDEV-16647 InnoDB fails to drop large temporary table on disconnect · f693170c
      Marko Mäkelä authored
      This regression was introduced in MDEV-16515.
      We would fail to drop a temporary table on client disconnect,
      because trx_is_interrupted() would hold. To add insult to
      injury, in MariaDB 10.1, InnoDB temporary tables are actually
      persistent, so the garbage temporary tables will never be dropped.
      
      row_drop_table_for_mysql(): If several iterations of
      buf_LRU_drop_page_hash_for_tablespace() are needed,
      do not interrupt dropping a temporary table even after
      the transaction was marked as killed.
      
      Server shutdown will still terminate the loop, and also DROP TABLE
      of persistent tables will keep checking if the execution was aborted.
      f693170c
    • Marko Mäkelä's avatar
      Revert MDEV-9519 due to regressions · 3b5d3cd6
      Marko Mäkelä authored
      This reverts commit 75dfd4ac.
      3b5d3cd6
  2. 30 Aug, 2018 3 commits
  3. 29 Aug, 2018 2 commits
  4. 28 Aug, 2018 2 commits
  5. 27 Aug, 2018 2 commits
    • Monty's avatar
      MDEV-15797 Assertion `thd->killed != 0' failed in ha_maria::enable_indexes · cded083a
      Monty authored
      Problem was that a parallel open of a table, overwrote info->state that
      was in used by repair.
      
      Fixed by changing _ma_tmp_disable_logging_for_table() to use
      a new state buffer state.no_logging to store the temporary state.
      
      Other things:
      - Use original number of rows when retrying repair to get rid of a
        potential warning "Number of rows changed from X to Y"
      - Changed maria_commit() to make it easier to merge with 10.4
      - If table is not locked (like with show commands), use the global
        number of rows as the local number may not be up to date.
        (Minor not critical fix)
      - Added some missing DBUG_RETURN
      cded083a
    • Galina Shalygina's avatar
      MDEV-16803: Pushdown Item_func_in item that uses vectors in several SELECTs · 55163ba1
      Galina Shalygina authored
      The bug appears because of the Item_func_in::build_clone() method.
      The 'array' field for the Item_func_in item that can be pushed into
      the materialized view/derived table was built in the wrong way.
      It becomes lame after the pushdown of the condition into the first
      SELECT that defines that view/derived table. The server crashes in
      the pushdown into the next SELECT while trying to use already lame
      'array' field.
      
      To fix it Item_func_in::build_clone() was changed.
      55163ba1
  6. 26 Aug, 2018 1 commit
    • Ming Lin's avatar
      MDEV-16703: Update AUTO_INCREMENT in the UPDATE statement · 2b76f6f6
      Ming Lin authored
      Currently RocksDB engine doesn't update AUTO_INCREMENT in the UPDATE statement.
      For example,
      
      CREATE TABLE t1 (pk INT AUTO_INCREMENT, a INT, PRIMARY KEY(pk)) ENGINE=RocksDB;
      INSERT INTO t1 (a) VALUES (1);
      UPDATE t1 SET pk = 3; ==> AUTO_INCREMENT should be updated to 4.
      
      Without this fix, it hits the Assertion `dd_val >= last_val' failed in
      myrocks::ha_rocksdb::load_auto_incr_value_from_index.
      
      (cherry picked from commit f7154242)
      2b76f6f6
  7. 25 Aug, 2018 2 commits
  8. 24 Aug, 2018 3 commits
    • Marko Mäkelä's avatar
      MDEV-15511 Use stunnel during rsync SST if available · 8b949d96
      Marko Mäkelä authored
      Merge the 10.2 version, which was created by Vasil Dimov.
      8b949d96
    • benrubson's avatar
      Use stunnel during rsync SST if available · 4c652fc6
      benrubson authored
      (cherry picked from commit 1adc382c)
      4c652fc6
    • Marko Mäkelä's avatar
      MDEV-16868 Same query gives different results · 1b4c5b73
      Marko Mäkelä authored
      An INSERT into a temporary table would fail to set the
      index page as modified. If there were no other write operations
      (such as UPDATE or DELETE) to the page, and the page was evicted,
      we would read back the old contents of the page, causing
      corruption or loss of data.
      
      page_cur_insert_rec_write_log(): Call mtr_t::set_modified()
      for temporary tables. Normally this is part of the mlog_open()
      call, but the mlog_open() call was only present in debug builds.
      This regression was caused by
      commit 48192f96
      which was preparation for MDEV-11369 and supposed to affect
      debug builds only.
      
      Thanks to Thirunarayanan Balathandayuthapani for debugging.
      1b4c5b73
  9. 23 Aug, 2018 2 commits
    • Marko Mäkelä's avatar
      c164d0cc
    • Marko Mäkelä's avatar
      MDEV-17043 Purge of indexed virtual columns may cause hang on table-rebuilding DDL · 9a815401
      Marko Mäkelä authored
      When a table is renamed to an internal #sql2 or #sql-ib name during
      a table-rebuilding DDL operation such as OPTIMIZE TABLE or ALTER TABLE,
      and shortly after that a purge operation in an index on virtual columns
      is attempted, the operation could fail, but purge would fail to release
      the table reference.
      
      innodb_acquire_mdl(): Release the reference if the table name is not
      valid for acquiring a meta-data lock (MDL).
      
      innodb_find_table_for_vc(): Add a debug assertion if the table name
      is not valid. This code path is for DML execution. The table
      should have a valid name for executing DML, and furthermore a MDL
      will prevent the table from being renamed.
      
      row_vers_build_clust_v_col(): Add a debug assertion that both indexes
      must belong to the same table.
      9a815401
  10. 22 Aug, 2018 1 commit
    • Sergei Golubchik's avatar
      MDEV-16961 Assertion `!table || (!table->read_set ||... · 5d650d36
      Sergei Golubchik authored
      MDEV-16961 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed upon concurrent DELETE and DDL with virtual blob column
      
      After iterating all fields and setting PART_INDIRECT_KEY_FLAG as
      necessary, TABLE::mark_columns_used_by_virtual_fields() remembers
      in TABLE_SHARE that this operation was done and need not be repeated.
      
      But as the flag is set in TABLE_SHARE, PART_INDIRECT_KEY_FLAG must
      be set in TABLE_SHARE::field[], not only in TABLE::field[].
      
      Otherwise all new TABLEs opened from this TABLE_SHARE will
      never have it.
      5d650d36
  11. 21 Aug, 2018 8 commits
  12. 20 Aug, 2018 1 commit
    • Galina Shalygina's avatar
      MDEV-16765: Missing rows with pushdown condition defined with CASE using Item_cond · 0de3c423
      Galina Shalygina authored
      The bug appears because of the wrong pushdown into the WHERE clause of the
      materialized derived table/view work. For the excl_dep_on_grouping_fields()
      method that checks if the condition can be pushed into the WHERE clause
      the case when Item_cond is used is missing. For Item_cond elements this
      method always returns positive result (that condition can be pushed).
      So this condition is pushed even if is shouldn't be pushed.
      
      To fix it new Item_cond::excl_dep_on_grouping_fields() method is added.
      0de3c423
  13. 18 Aug, 2018 1 commit
  14. 17 Aug, 2018 2 commits
    • Igor Babaev's avatar
      MDEV-16934 Query with very large IN clause lists runs slowly · 4eac5df3
      Igor Babaev authored
      This patch introduces support for the system variable eq_range_index_dive_limit
      that existed in MySQL starting from 5.6. The variable sets a limit for
      index dives into equality ranges. Index dives are performed by optimizer
      to estimate the number of rows in range scans. Index dives usually provide
      good estimate but they are pretty expensive. To estimate the number of rows
      in equality ranges statistical data on indexes can be employed. Its usage gives
      not so good estimates but it's cheap. So if the number of equality dives
      required by an index scan exceeds the set limit no dives for equality
      ranges are performed by the optimizer for this index.
      
      As the new system variable is introduced in a stable version the default
      value for it is set to a special value meaning there is no limit for the number
      of index dives performed by the optimizer.
      
      The patch partially uses the MySQL code for WL 5957
      'Statistics-based Range optimization for many ranges'.
      4eac5df3
    • Julius Goryavsky's avatar
  15. 16 Aug, 2018 7 commits
    • Marko Mäkelä's avatar
      MDEV-13564: Refuse MLOG_TRUNCATE in mariabackup · d6f7fd60
      Marko Mäkelä authored
      The MySQL 5.7 TRUNCATE TABLE is inherently incompatible
      with hot backup, because it is creating and deleting a separate
      log file, and it is not writing redo log for all changes of the
      InnoDB data dictionary tables. Refuse to create a corrupted backup
      if the unsafe form of TRUNCATE was executed.
      
      Note: Undo log tablespace truncation cannot be detected easily.
      Also it is incompatible with backup, for similar reasons.
      
      xtrabackup_backup_func(): "Subscribe to" the log events before
      the first invocation of xtrabackup_copy_logfile().
      
      recv_parse_or_apply_log_rec_body(): If the function pointer
      log_truncate is set, invoke it to report MLOG_TRUNCATE.
      d6f7fd60
    • Marko Mäkelä's avatar
      Re-enable the test mariabackup.unsupported_redo · 1b49c894
      Marko Mäkelä authored
      Remove the logic for skipping the test if a log checkpoint occurred,
      and the logic for tolerating failures. Thanks to MDEV-16791,
      MLOG_INDEX_LOAD is supposed to always work.
      1b49c894
    • Vladislav Vaintroub's avatar
    • Marko Mäkelä's avatar
      Report all redo log corruption · 05153a67
      Marko Mäkelä authored
      Amend commit b853b4fd
      that was reverted in commit 29150e23.
      
      recv_parse_log_recs(): Do check for corrupted redo log or file
      system before checking for len==0, but only read *ptr if
      it is not past the end of the buffer (end_ptr).
      
      recv_parse_log_rec(): Report incorrect redo log type
      in a consistent way with recv_parse_or_apply_log_rec_body().
      This is a follow-up to commit f30c5af4.
      05153a67
    • Marko Mäkelä's avatar
      MDEV-16136 Various ASAN failures after MDEV-15030 · a0ce3216
      Marko Mäkelä authored
      The Pool poisoning that was introduced in MDEV-15030 introduced
      race conditions in AddressSanitizer builds, because concurrent
      poisoning and unpoisoning were not prevented by any synchronization
      primitive.
      
      Pool::get(): Protect the unpoisoning by m_lock_strategy.
      
      Pool::mem_free(): Protect the poisoning by m_lock_strategy.
      
      Pool::putl(): Renamed from put(), because now the caller is
      responsible for invoking m_lock_strategy.
      a0ce3216
    • Marko Mäkelä's avatar
      MDEV-16136: Prevent wrong reuse in trx_reference() · fa2a74e0
      Marko Mäkelä authored
      If trx_free() and trx_create_low() were called while a call to
      trx_reference() was pending, we could get a reference to a wrong
      transaction object.
      
      trx_reference(): Return NULL if the trx->id no longer matches.
      
      lock_trx_release_locks(): Assign trx->id = 0, so that trx_reference()
      will not return a reference to this object.
      
      trx_cleanup_at_db_startup(): Assign trx->id = 0.
      
      assert_trx_is_free(): Assert !trx->n_ref. Assert trx->id == 0,
      now that it will be cleared as part of a transaction commit.
      fa2a74e0
    • Marko Mäkelä's avatar
      Rename lock_pool_t to lock_list · 65835065
      Marko Mäkelä authored
      Also, replace reverse iteration with forward iteration.
      
      lock_table_has(): Remove a redundant condition.
      65835065