1. 05 Apr, 2020 2 commits
  2. 04 Apr, 2020 1 commit
    • Igor Babaev's avatar
      MDEV-21673 Calling stored procedure twice in the same session causes MariaDB to crash · 21b87437
      Igor Babaev authored
      This bug could happen only with a stored procedure containing queries with
      more than one reference to a CTE that used local variables / parameters.
      
      This bug was the result of an incomplete merge of the fix for the bug
      MDEV-17154. The merge covered usage of parameter markers occurred in a CTE
      that was referenced more than once, but missed coverage of local variables.
      21b87437
  3. 03 Apr, 2020 1 commit
  4. 02 Apr, 2020 4 commits
    • Aleksey Midenkov's avatar
      MDEV-20515 multi-update tries to position updated table by null reference · 0932c580
      Aleksey Midenkov authored
      Cause
      
      Join tmp table inserts null row because of OUTER JOIN, that's
      expected. Since `multi_update::prepare2()` converted
      `Item_temptable_rowid` into `Item_field` (28dbdf3d)
      `multi_update::send_data()` accesses join tmp record directly and
      treats it as a normal row ignoring null status of ref field. NULL ref
      field is then treated as normal in `multi_update::do_updates()` which
      tries to position updated table by reference 0.
      
      Note that reference 0 may be valid reference and the first row of
      table can be wrongly updated (see multi_update.test).
      
      Fix
      
      Do not add row into multi-update tmp table in case of null ref
      field. Join tmp table does not have null_row status at this time (as
      well as `STATUS_NULL_ROW`) and cannot be skipped by these properties
      (see first comment in multi_update::send_data()). But it has all null
      fields (including the ref field).
      0932c580
    • Aleksey Midenkov's avatar
      MDEV-21688 Assertion or ER_WARN_DATA_OUT_OF_RANGE upon ALTER on previously versioned table · ba34f409
      Aleksey Midenkov authored
      Earlier skip of history row. Cleanup of dead code for VTMD.
      ba34f409
    • Aleksey Midenkov's avatar
      MDEV-21342 Assertion in set_ok_status() upon spatial field error on system-versioned table · 44c6c7a9
      Aleksey Midenkov authored
      SQL_SELECT::check_quick() returns error status only
      test_quick_select() returns -1. Fix error handling when lower frames
      throw error, but it is ignored by test_quick_select(). Fix return
      status for out-of-memory errors which are obviously must be processed
      as error in upper frames.
      44c6c7a9
    • Nikita Malyavin's avatar
      MDEV-17091 - Assertion failed after dropping versioning · 9149017b
      Nikita Malyavin authored
      Assertion `old_part_id == m_last_part' failed in ha_partition::update_row or `part_id == m_last_part' in ha_partition::delete_row upon UPDATE/DELETE after dropping versioning
      
      PRIMARY KEY change hadn't been treated as partition reorganization in case of partitioning by KEY() (without parameters).
      
      * set `*partition_changed= true` in the described case.
      * since add/drop system versioning does not affect alter_info->key_list, it required separate attention
      9149017b
  5. 01 Apr, 2020 1 commit
    • Sergey Vojtovich's avatar
      MDEV-21348 - column compression memory leak · b40b3720
      Sergey Vojtovich authored
      The Storage-Engine Independent Column Compression does not call
      deflateEnd() when deflate() does not return Z_STREAM_END.
      
      This for instance happens when the data is already (externally)
      compressed and deflate() needs more space than the original data.
      
      This patch is based on contribution by Martijn Broenland.
      b40b3720
  6. 30 Mar, 2020 5 commits
    • Marko Mäkelä's avatar
      MDEV-20590 Introduce a file format constraint to ALTER TABLE · b092d35f
      Marko Mäkelä authored
      If a table is altered using the MDEV-11369/MDEV-15562/MDEV-13134
      ALGORITHM=INSTANT, it can force the table to use a non-canonical
      format:
      
      * A hidden metadata record at the start of the clustered index
      is used to store each column's DEFAULT value. This makes it possible
      to add new columns that have default values without rebuilding the table.
      
      * Starting with MDEV-15562 in MariaDB Server 10.4, a BLOB in the
      hidden metadata record is used to store column mappings. This makes
      it possible to drop or reorder columns without rebuilding the table.
      This also makes it possible to add columns to any position or drop
      columns from any position in the table without rebuilding the table.
      
      If a column is dropped without rebuilding the table, old records
      will contain garbage in that column's former position, and new records
      will be written with NULL values, empty strings, or dummy values.
      
      This is generally not a problem. However, there may be cases where
      users may want to avoid putting a table into this format.
      For example, users may want to ensure that future UPDATE operations
      after an ADD COLUMN will be performed in-place, to reduce write
      amplification. (Instantly added columns are essentially always
      variable-length.) Users might also want to avoid bugs similar to
      MDEV-19916, or they may want to be able to export tables to
      older versions of the server.
      
      We will introduce the option innodb_instant_alter_column_allowed,
      with the following values:
      
      * never (0): Do not allow instant add/drop/reorder,
      to maintain format compatibility with MariaDB 10.x and MySQL 5.x.
      If the table (or partition) is not in the canonical format, then
      any ALTER TABLE (even one that does not involve instant column
      operations) will force a table rebuild.
      
      * add_last (1, default in 10.3): Store a hidden metadata record that
      allows columns to be appended to the table instantly (MDEV-11369).
      In 10.4 or later, if the table (or partition) is not in this format,
      then any ALTER TABLE (even one that does not involve column changes)
      will force a table rebuild.
      
      Starting with 10.4:
      
      * add_drop_reorder (2, default): Like 'add_last', but allow the
      metadata record to store a column map, to support instant
      add/drop/reorder of columns (MDEV-15562).
      b092d35f
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-21832 FORCE all partition to rebuild if any one of the · f8ec3ba0
      Thirunarayanan Balathandayuthapani authored
      		partition does rebuild
      
      - In ha_innobase::commit_inplace_alter_table() assumes that all partition
      should do the same kind of alter operations. During DDL, if one partition
      requires table rebuild and other partition doesn't need rebuild
      then all partition should be forced to rebuild.
      f8ec3ba0
    • Marko Mäkelä's avatar
      Fix GCC -Wstringop-truncation · 67f27824
      Marko Mäkelä authored
      67f27824
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · 1a9b6c4c
      Marko Mäkelä authored
      1a9b6c4c
    • Varun Gupta's avatar
      MDEV-22019: Sig 11 in next_breadth_first_tab | max_sort_length setting +... · b11ff3d4
      Varun Gupta authored
      MDEV-22019: Sig 11 in next_breadth_first_tab | max_sort_length setting + double GROUP BY leads to crash
      
      No need to create a temp table for aggregation if we have encountered some error.
      b11ff3d4
  7. 26 Mar, 2020 2 commits
  8. 24 Mar, 2020 2 commits
    • seppo's avatar
      MDEV-21473 conflicts with async slave BF aborting (#1475) · 5918b170
      seppo authored
      If async slave thread (slave SQL handler), becomes a BF victim, it may occasionally happen that rollbacker thread is used to carry out the rollback instead of the async slave thread.
      This can happen, if async slave thread has flagged "idle" state when BF thread tries to figure out how to kill the victim.
      The issue was possible to test by using a galera cluster as slave for external master, and issuing high load of conflicting writes through async replication and directly against galera cluster nodes.
      However, a deterministic mtr test for the "conflict window" has not yet been worked on.
      
      The fix, in this patch makes sure that async slave thread state is never set to IDLE. This prevents the rollbacker thread to intervene.
      The wsrep_query_state change was refactored to happen by dedicated function to make controlling the idle state change in one place.
      5918b170
    • Igor Babaev's avatar
      MDEV-21883 Server crashes when joining a subselect with 32 tables and GROUP BY · caf110fa
      Igor Babaev authored
      This bug could cause a crash for any query that used a derived table/view/CTE
      whose specification was a SELECT with a GROUP BY clause and a FROM list
      containing 32 or more table references.
      The problem appeared only in the cases when the splitting optimization
      could be applied to such derived table/view/CTE.
      caf110fa
  9. 23 Mar, 2020 6 commits
  10. 21 Mar, 2020 4 commits
  11. 20 Mar, 2020 12 commits
    • Marko Mäkelä's avatar
      fd5c36be
    • Eugene Kosov's avatar
      InnoDB: reduce size of dtuple_t · 45973ec6
      Eugene Kosov authored
      Making a linked list of dtuple_t is needed only for inserting
      records. It's better to store tuples in a non-intrusive
      container to not affect all other use cases of dtuple_t
      
      dtuple_t::tuple_list: removed, it was 2 * sizeof(void*) bytes
      
      ins_node_t::entry_list: now it's std::vector<dtuple_t*>
      
      ins_node_t::entry: now it's std::vector<dtuple_t*>::iterator
      
      DBUG_EXECUTE_IF("row_ins_skip_sec": this dead code removed
      45973ec6
    • Eugene Kosov's avatar
      correct comment in buf_page_is_corrupted() · 54b2da95
      Eugene Kosov authored
      54b2da95
    • Eugene Kosov's avatar
      st_::span fixes · 1f53335d
      Eugene Kosov authored
      move span.h to a proper place to make it available for the whole server
      
      Reformat it.
      
      Constuctors from a contigous container are fixed
      to use cont.data() instead of cont.begin()
      
      span<>::index_type is replaced with span<>::size_type
      1f53335d
    • Eugene Kosov's avatar
      remove fishy reinterpret_cast from buf_page_is_zeroes() · 884d22f2
      Eugene Kosov authored
      In my micro-benchmarks memcmp(4196) 3 times faster than old
      implementation. Also, it's generally better to use as less
      reinterpret_casts<> as possible.
      
      buf_is_zeroes(): renamed from buf_page_is_zeroes() and
      argument changed to span<> for convenience.
      
      st_::span<T>::const_iterator: fixed
      
      page_zip-verify_checksum(): make argument byte* instead of void*
      884d22f2
    • Igor Babaev's avatar
      MDEV-17177 Crash in Item_func_in::cleanup() for SELECT executed via · 2bde0655
      Igor Babaev authored
                 prepared statement
      
      The method Item_func_in::build_clone() that builds a clone item for an
      Item_func_in item first calls a generic method Item_func::build_item()
      that builds the the clones for the arguments of the Item_func_in item
      to be cloned, creates a copy of the Item_func_in object and attaches the
      clones for the arguments to this copy. Then the method Item_func_in::build_clone()
      makes the copy fully independent on the copied object in order to
      guarantee a proper destruction of the clone. The fact is the copy of the
      Item_func_in object is registered as any other item object and should be
      destructed as any other item object.
      If the method Item_func::build_item fails to build a clone of an argument
      then it returns 0. In this case no copy of the Item_func_in object should
      be created. Otherwise the finalizing actions for this copy would not be
      performed and the copy would remain in a state that would prevent its
      proper destruction.
      
      The code of Item_func_in::build_clone() before this patch created the copy
      of the Item_func_in object before cloning the argument items. If this
      cloning failed the server crashed when trying to destruct the copy item.
      
      The code of Item_row::build_clone() was changed similarly to the code of
      Item_func::build_clone though this code could not cause any problems.
      2bde0655
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · 44298e4d
      Marko Mäkelä authored
      Also, clean up the test innodb_gis.geometry a little further.
      44298e4d
    • Marko Mäkelä's avatar
      9f7b8625
    • Marko Mäkelä's avatar
      MDEV-21549: Clean up the import/export tests · b034d708
      Marko Mäkelä authored
      Remove CREATE/DROP database.
      
      Remove some unnecessary suppressions, replacements, and
      SQL statements.
      
      Populate tables via have_sequence.inc to avoid the creation of
      explicit InnoDB record locks in INSERT...SELECT. This will remove
      some gaps in AUTO_INCREMENT values.
      b034d708
    • Marko Mäkelä's avatar
      MDEV-21549 IMPORT TABLESPACE fails to adjust all tablespace ID in root pages · b8b3edff
      Marko Mäkelä authored
      After MDEV-12353, the consistency check that I originally added for
      commit 1b9fe0bb
      (InnoDB Plugin for MySQL 5.1) started randomly failing.
      
      It turns out that the IMPORT TABLESPACE code was always incorrect:
      it did not update the (redundantly stored) tablespace ID
      in index tree root pages. It only does that for page headers
      and BLOB pointers.
      
      PageConverter::update_index_page(): Update the tablespace ID
      in the BTR_SEG_TOP and BTR_SEG_LEAF of index root pages.
      b8b3edff
    • Marko Mäkelä's avatar
      Merge 10.1 into 10.2 · c9ec1cc7
      Marko Mäkelä authored
      c9ec1cc7
    • Alexander Barkov's avatar
      MDEV-21977 main.func_math fails due to undefined behaviour · 328edf85
      Alexander Barkov authored
      The problem happened in these line:
      
      uval0= (ulonglong) (val0_negative ? -val0 : val0);
      uval1= (ulonglong) (val1_negative ? -val1 : val1);
      
      return check_integer_overflow(val0_negative ? -(longlong) res : res,
                                    !val0_negative);
      
      when unary minus was performed on -9223372036854775808.
      This behavior is undefined in C/C++.
      328edf85