An error occurred fetching the project authors.
  1. 13 Feb, 2019 2 commits
    • Monty's avatar
      MDEV-13916 Enforce check constraint on JSON type · 0f489494
      Monty authored
      When creating a field of type JSON, it will be automatically
      converted to TEXT with CHECK (json_valid(`a`)), if there wasn't any
      previous check for the column.
      
      Additional things:
      - Added two bug fixes that was found while testing JSON. These bug
        fixes has also been pushed to 10.3 (with a test case), but as they
        where minimal and needed to get this task done and tested, the fixes
        are repeated here.
        - CREATE TABLE ... SELECT drops constraints for columns that
          are both in the create and select part.
        - If one has both a default expression and check constraint for a
          column, one can get the error "Expression for field `a` is refering
          to uninitialized field `a`.
      - Removed some duplicate MYSQL_PLUGIN_IMPORT symbols
      0f489494
    • Varun Gupta's avatar
      MDEV-6111 Optimizer Trace · be8709eb
      Varun Gupta authored
      This task involves the implementation for the optimizer trace.
      
      This feature produces a trace for any SELECT/UPDATE/DELETE/,
      which contains information about decisions taken by the optimizer during
      the optimization phase (choice of table access method, various costs,
      transformations, etc). This feature would help to tell why some decisions were
      taken by the optimizer and why some were rejected.
      
      Trace is session-local, controlled by the @@optimizer_trace variable.
      To enable optimizer trace we need to write:
         set @@optimizer_trace variable= 'enabled=on';
      
      To display the trace one can run:
         SELECT trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
      
      This task also involves:
          MDEV-18489: Limit the memory used by the optimizer trace
          introduces a switch optimizer_trace_max_mem_size which limits
          the memory used by the optimizer trace. This was implemented by
          Sergei Petrunia.
      be8709eb
  2. 23 Jan, 2019 1 commit
  3. 29 Dec, 2018 1 commit
  4. 20 Dec, 2018 2 commits
  5. 19 Dec, 2018 2 commits
  6. 11 Dec, 2018 1 commit
  7. 09 Dec, 2018 1 commit
    • Monty's avatar
      Added new MDL_BACKUP locks for all backup stages · 965311ee
      Monty authored
      Part of MDEV-5336 Implement LOCK FOR BACKUP
      
      - Added new locks to MDL_BACKUP for all stages of backup locks and
        a new MDL lock needed for backup stages.
      - Renamed MDL_BACKUP_STMT to MDL_BACKUP_DDL
      - flush_tables() takes a new parameter that decides what should be flushed.
      - InnoDB, Aria (transactional tables with checksums), Blackhole, Federated
        and Federatedx tables are marked to be safe for online backup. We are
        using MDL_BACKUP_TRANS_DML instead of MDL_BACKUP_DML locks for these
        which allows any DML's to proceed for these tables during the whole
        backup process until BACKUP STAGE COMMIT which will block the final
        commit.
      965311ee
  8. 26 Nov, 2018 1 commit
    • Marko Mäkelä's avatar
      MDEV-17831 TRUNCATE TABLE removes ROW_FORMAT=COMPRESSED · 971e1d86
      Marko Mäkelä authored
      If a table had a KEY_BLOCK_SIZE attribute, but no ROW_FORMAT,
      it would be created as ROW_FORMAT=COMPRESSED in InnoDB.
      However, TRUNCATE TABLE would lose the KEY_BLOCK_SIZE attribute
      and create the table with the innodb_default_row_format (DYNAMIC).
      
      This is a regression that was introduced by MDEV-13564.
      
      update_create_info_from_table(): Copy also KEY_BLOCK_SIZE.
      971e1d86
  9. 06 Nov, 2018 1 commit
  10. 04 Nov, 2018 1 commit
    • Sergei Golubchik's avatar
      MDEV-17349 Assertion `!table || (!table->read_set ||... · af9649c7
      Sergei Golubchik authored
      MDEV-17349 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed on concurrent SELECT and DELETE after RENAME from table with index on virtual column
      
      Race condition. field->flags were copied from s->field->flags during
      field->clone(), early in open_table_from_share(). But s->field->flags
      were getting their PART_INDIRECT_KEY_FLAG bit much later in
      TABLE::mark_columns_used_by_virtual_fields() and only once per share.
      
      If two threads were executing the code between field->clone()
      and mark_columns_used_by_virtual_fields() at the same time, only
      one would get PART_INDIRECT_KEY_FLAG bits in field[].
      af9649c7
  11. 01 Oct, 2018 1 commit
  12. 28 Sep, 2018 2 commits
  13. 16 Sep, 2018 1 commit
  14. 09 Sep, 2018 2 commits
    • Sergey Vojtovich's avatar
      Fixed c++11 narrowing error · a0dfefb0
      Sergey Vojtovich authored
      sql/table.cc:8561:42: error: non-constant-expression cannot be narrowed
                                   from type 'uint' (aka 'unsigned int') to
                                   '__darwin_suseconds_t' (aka 'int') in
                                   initializer list [-Wc++11-narrowing]
        timeval end_time= {thd->query_start(), uint(thd->query_start_sec_part())};
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      sql/table.cc:8561:42: note: insert an explicit cast to silence this issue
        timeval end_time= {thd->query_start(), uint(thd->query_start_sec_part())};
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                               static_cast<__darwin_suseconds_t>( )
      a0dfefb0
    • Sergey Vojtovich's avatar
      Enable C++11 · d9613b75
      Sergey Vojtovich authored
      d9613b75
  15. 05 Sep, 2018 1 commit
  16. 04 Sep, 2018 2 commits
  17. 27 Aug, 2018 1 commit
    • Igor Babaev's avatar
      MDEV-17017 Explain for query using derived table specified with · 497d8627
      Igor Babaev authored
                 a table value constructor shows wrong number of rows
      
      This is another attempt to fix this bug. The previous patch did not take
      into account that a transformation for ALL/ANY subqueries could be applied
      to the materialized table that wrapped the table value constructor used as
      a specification of the subselect used an ALL/ANY subquery. In this case
      the result of the derived table used a sink of the class select_subselect
      rather than of the class select_unit. Thus the previous fix could cause
      memory overwrites when running EXPLAIN for queries with table value
      constructors in ALL/ANY subselects.
      497d8627
  18. 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
  19. 03 Aug, 2018 1 commit
  20. 10 Jul, 2018 1 commit
  21. 04 Jul, 2018 1 commit
  22. 01 Jul, 2018 1 commit
    • Anel Husakovic's avatar
      MDEV-16630: Ambiguous error message when check constraint matches table name · 8639e288
      Anel Husakovic authored
      One can create table with the same name for `field` and `table` `check` constraint.
      For example:
      `create table t(a int check(a>0), constraint a check(a>10));`
      But when inserting new rows same error is always raised.
      For example with
      ```insert into t values (-1);```
      and
      ```insert into t values (10);```
      same error `ER_CONSTRAINT_FAILED` is obtained and it is not clear which constraint is violated.
      This patch solve this error so that in case if field constraint is violated the first parameter
      in the error message is `table.field_name` and if table constraint is violated the first parameter
      in error message is `constraint_name`.
      8639e288
  23. 30 Jun, 2018 1 commit
  24. 27 Jun, 2018 1 commit
    • Michael Widenius's avatar
      Fixed MDEV-16512, crashing on re-execution of failing SP · 937c1931
      Michael Widenius authored
      MDEV-16512 Server crashes in find_field_in_table_ref on 2nd
      execution of SP referring to non-existing field
      
      Problem was in the natural join code that it changed TABLE_LIST and
      Item_fields but didn't restore changed things if things goes wrong
      and was not able to re-execute after failure.
      Some of the problems could have been avoided if we would have run
      fix_fields before doing natural join transformations.
      
      Fixed by marking functions complete AFTER they had executed, instead at
      start.
      I had also to change some tests that checked if Item_fields are usable.
      
      This doesn't fix all known problems, but at least avoids some crashes.
      What should be done in the near future is to mark the statement in the SP
      as 'not re-executable' and force a reparse of it on next execution.
      
      Reviewer: Sergei Petrunia <psergey@askmonty.org>
      937c1931
  25. 19 Jun, 2018 3 commits
  26. 14 Jun, 2018 1 commit
  27. 09 Jun, 2018 1 commit
    • Varun Gupta's avatar
      MDEV-16374: Filtered shows 0 for materilization scan for a semi join, which... · cd33280b
      Varun Gupta authored
      MDEV-16374: Filtered shows 0 for materilization scan for a semi join, which makes optimizer always picks
      materialization scan over materialization lookup
      
      For non-mergeable semi-joins we don't store the estimates of the IN subquery in table->file->stats.records.
      In the function TABLE_LIST::fetch_number_of_rows, we store the number of rows in the tables
      (estimates in case of derived table/views).
      Currently we don't store the estimates for non-mergeable semi-joins, which leads to a problem of selecting
      materialization scan over materialization lookup.
      Fixed this by storing these estimated appropriately
      cd33280b
  28. 08 Jun, 2018 1 commit
    • Alexander Barkov's avatar
      MDEV-11361 Equal condition propagation does not work for DECIMAL and temporal... · 9043dd7a
      Alexander Barkov authored
      MDEV-11361 Equal condition propagation does not work for DECIMAL and temporal dynamic SQL parameters
      MDEV-16426 Optimizer erroneously treats equal constants of different formats as same
      A cleanup for MDEV-14630: fixing a crash in Item_decimal::eq().
      
      Problems:
      - old implementations of Item_decimal::eq() and
        Item_temporal_literal::eq() were not symmetric
        with Item_param::eq(), this caused MDEV-11361.
      
      - old implementations for DECIMAL and temporal data types
        did not take into account that in case when eq() is called
        with binary_cmp==true, {{eq()}} should check not only equality
        of the two values, but also equality if their decimal precision.
        This cuases MDEV-16426.
      
      - Item_decimal::eq() crashes with "item" pointing
        to a non-DECIMAL value. Before MDEV-14630
        non-DECIMAL values were filtered out by the test:
          type() == item->type()
        as literals of different types had different type().
        After MDEV-14630 type() for literals of all data types return CONST_ITEM.
        This caused failures in tests:
          ./mtr engines/iuds.insert_number
          ./mtr --ps --embedded main.explain_slowquerylog
        (revealed by buildbot)
      
      The essence of the fix:
      Making literals and Item_param reuse the same code to avoid
      asymmetries between Item_param::eq(Item_literal) and
      Item_literal::eq(Item_param), now and in the future, and to
      avoid code duplication between Item_literal and Item_param.
      Adding tests for "decimals" for DECIMAL and temporal data types,
      to treat constants of different scale as not equal when "binary_cmp"
      is "true".
      
      Details:
      1. Adding a helper class Item_const to extract constant values from Items easier
      2. Deriving Item_basic_value from Item_const
      3. Joining Type_handler::Item_basic_value_eq() and Item_basic_value_bin_eq()
         into a single method with an extra "binary_cmp" argument
         (it looks simple this way) and renaming the new method to Item_const_eq().
         Modifying its implementations to operate with
         Item_const instead of Item_basic_value.
      4. Adding a new class Type_handler_hex_hybrid,
         to handle hex constants like 0x616263.
      5. Removing Item::VARBIN_ITEM and fixing Item_hex_constant to
         use type_handler_hex_hybrid instead of type_handler_varchar.
         Item_hex_hybrid::type() now returns CONST_ITEM, like all
         other literals do.
      6. Move virtual methods Item::type_handler_for_system_time() and
         Item::cast_to_int_type_handler() from Item to Type_handler.
      7. Removing Item_decimal::eq() and Item_temporal_literal::eq().
         These classes are now handled by the generic Item_basic_value::eq().
      8. Implementing Type_handler_temporal_result::Item_const_eq()
         and Type_handler_decimal_result::Item_const_eq(),
         this fixes MDEV-11361.
      9. Adding tests for "decimals" into
         Type_handler_decimal_result::Item_const_eq() and
         Type_handler_temporal_result::Item_const_eq()
         in case if "binary_cmp" is true.
         This fixes MDEV-16426.
      10. Moving Item_cache out of Item_basic_value.
         They share nothing. It simplifies implementation
         of Item_basic_value::eq(). Deriving Item_cache
         directly from Item.
      
      11. Adding class DbugStringItemTypeValue, which
          used Item::print() internally, and using
          in instead of the old debug printing code.
          This gives nicer output in func_debug.result.
      
      Changes N5 and N6 do not directly relate to the bugs fixed,
      but make the code fully symmetric across all literal types.
      Without a new handler Type_handler_hex_hybrid we'd have
      to keep two code branches (for regular literals and for
      hex hybrid literals).
      9043dd7a
  29. 06 Jun, 2018 1 commit
  30. 05 Jun, 2018 2 commits
    • Alexander Barkov's avatar
    • Alexander Barkov's avatar
      MDEV-16385 ROW SP variable is allowed in unexpected context · 106f0b57
      Alexander Barkov authored
      The problem described in the bug report happened because the code
      did not test check_cols(1) after fix_fields() in a few places.
      
      Additionally, fix_fields() could be called multiple times for SP variables,
      because they are all fixed at a early stage in append_for_log().
      
      Solution:
      1. Adding a few helper methods
         - fix_fields_if_needed()
         - fix_fields_if_needed_for_scalar()
         - fix_fields_if_needed_for_bool()
         - fix_fields_if_needed_for_order_by()
        and using it in many cases instead of fix_fields() where
        the "fixed" status is not definitely known to be "false".
      
      2. Adding DBUG_ASSERT(!fixed) into Item_splocal*::fix_fields()
         to catch double execution.
      
      3. Adding tests.
      
      As a good side effect, the patch removes a lot of duplicate code (~60 lines):
      
         if (!item->fixed &&
             item->fix_fields(..) &&
             item->check_cols(1))
           return true;
      106f0b57
  31. 04 Jun, 2018 1 commit