1. 02 Nov, 2021 2 commits
    • Aleksey Midenkov's avatar
      MDEV-25803 innodb.alter_candidate_key fix · c6207ecb
      Aleksey Midenkov authored
      There is a case when implicit primary key may be changed when removing
      NOT NULL from the part of unique key. In that case we update
      modified_primary_key which is then used to not skip key sorting.
      
      According to is_candidate_key() there is no other cases when primary
      kay may be changed implicitly.
      c6207ecb
    • Aleksey Midenkov's avatar
      MDEV-25803 Inplace ALTER breaks MyISAM/Aria table when order of keys is changed · 63c922ae
      Aleksey Midenkov authored
      mysql_prepare_create_table() does my_qsort(sort_keys) on key
      info. This sorting is indeterministic: a table is created with one
      order and inplace alter may overwrite frm with another order. Since
      inplace alter does nothing about key info for MyISAM/Aria storage
      engines this results in discrepancy between frm and storage engine key
      definitions.
      
      The fix avoids the sorting of keys when no new keys added by ALTER
      (and this is ok for MyISAM/Aria since it cannot add new keys inplace).
      
      Notes:
      
      mi_keydef_write()/mi_keyseg_write() are used only in mi_create(). They
      should be used in ha_inplace_alter_table() as well.
      
      Aria corruption detection is unimplemented: maria_check_definition()
      is never used!
      
      MySQL 8.0 has this bug as well as of 8.0.26.
      
      This breaks main.long_unique in 10.4. The new result is correct and
      should be applied as it just different (original) order of keys.
      63c922ae
  2. 28 Oct, 2021 4 commits
  3. 27 Oct, 2021 4 commits
    • Sergei Petrunia's avatar
      Fix compile warning: · 3a9967d7
      Sergei Petrunia authored
      ha_rocksdb.h:459:15: warning: 'table_type' overrides a member
      function but is not marked 'override' [-Winconsistent-missing-override]
      3a9967d7
    • Alexander Barkov's avatar
      MDEV-25402 Assertion `!str || str != Ptr' failed in String::copy · 2ed148c8
      Alexander Barkov authored
      The assert inside String::copy() prevents copying from from "str"
      if its own String::Ptr also points to the same memory.
      
      The idea of the assert is that copy() performs memory reallocation,
      and this reallocation can free (and thus invalidate) the memory pointed by Ptr,
      which can lead to further copying from a freed memory.
      
      The assert was incomplete: copy() can free the memory pointed by its Ptr
      only if String::alloced is true!
      
      If the String is not alloced, it is still safe to copy even from
      the location pointed by Ptr.
      
      This scenario demonstrates a safe copy():
        const char *tmp= "123";
        String str1(tmp, 3);
        String str2(tmp, 3);
        // This statement is safe:
        str2.copy(str1->ptr(), str1->length(), str1->charset(), cs_to, &errors);
      
      Inside the copy() the parameter "str" is equal to String::Ptr in this example.
      But it's still ok to reallocate the memory for str2, because str2
      was a constant before the copy() call. Thus reallocation does not
      make the memory pointed by str1->ptr() invalid.
      
      Adjusting the assert condition to allow copying for constant strings.
      2ed148c8
    • Marko Mäkelä's avatar
      Fix tests for PLUGIN_PARTITION=NO · 4b8340d8
      Marko Mäkelä authored
      4b8340d8
    • Alexander Barkov's avatar
      MDEV-22380: Assertion `name.length == strlen(name.str)' failed ... · e97b785d
      Alexander Barkov authored
      Also fixes:
      MDEV-25399 Assertion `name.length == strlen(name.str)' failed in Item_func_sp::make_send_field
      
      Also fixes a problem that in this scenario:
      
      SET NAMES binary;
      SELECT 'some not well-formed utf8 string';
      
      the auto-generated column name copied the binary string value directly
      to the Item name, without checking utf8 well-formedness.
      
      After this change auto-generated column names work as follows:
      - Zero bytes 0x00 are copied to the name using HEX notation
      - In case of "SET NAMES binary", all bytes sequences that do not make
        well-formed utf8 characters are copied to the name using HEX notation.
      e97b785d
  4. 26 Oct, 2021 6 commits
  5. 25 Oct, 2021 4 commits
  6. 22 Oct, 2021 1 commit
  7. 21 Oct, 2021 13 commits
  8. 20 Oct, 2021 6 commits
    • Marko Mäkelä's avatar
    • Marko Mäkelä's avatar
      Update libmariadb · 69b3de83
      Marko Mäkelä authored
      69b3de83
    • Marko Mäkelä's avatar
      MDEV-22627 Failing assertion: dict_tf2_is_valid(flags, flags2) · b06e8167
      Marko Mäkelä authored
      create_table_info_t::innobase_table_flags(): Refuse to create
      a PAGE_COMPRESSED table with PAGE_COMPRESSION_LEVEL=0 if also
      innodb_compression_level=0.
      
      The parameter value innodb_compression_level=0 was only somewhat
      meaningful for testing or debugging ROW_FORMAT=COMPRESSED tables.
      For the page_compressed format, it never made any sense, and the
      check in dict_tf_is_valid_not_redundant() that was added in
      72378a25 (MDEV-12873) would cause
      the server to crash.
      b06e8167
    • Nikita Malyavin's avatar
      MDEV-22445 Crash on HANDLER READ NEXT after XA PREPARE · caebe151
      Nikita Malyavin authored
      The assertion is absolutely correct since no data access is possible after
      XA PREPARE.
      
      The check is added in mysql_ha_read.
      caebe151
    • Nikita Malyavin's avatar
      MDEV-26262 frm is corrupted after ER_EXPRESSION_REFERS_TO_UNINIT_FIELD · 1811fd51
      Nikita Malyavin authored
      This is a duplicate of MDEV-18278 89936f11, but I will add an
      additional assertion
      
      Description:
      
      The frm corruption should not be reported during CREATE TABLE. Normally
      it doesn't, and the data to fill TABLE is taken by open_table_from_share
      call. However, the vcol data is stored as SQL string in
      table->s->vcol_defs.str and is anyway parsed on each table open.
      It is impossible [or hard] to avoid, because it's hard to clone the
      expression tree in general (it's easier to parse).
      
      Normally parse_vcol_defs should only fail on semantic errors. If so,
      error_reported is set to true. Any other failure is not expected during
      table creation. There is either unhandled/unacknowledged error, or
      something went really wrong, like memory reject. This all should be
      asserted anyway.
      
      Solution:
      * Set *error_reported=true for the forward references check;
      * Assert for every unacknowledged error during table creation.
      1811fd51
    • Nikita Malyavin's avatar