1. 16 Sep, 2019 3 commits
    • Sergei Petrunia's avatar
      MDEV-20371: Invalid reads at plan refinement stage: join->positions... · 72055d69
      Sergei Petrunia authored
      (Backported to 10.2-compatiblity, build 22257)
      
      best_access_path() is called from two optimization phases:
      
      1. Plan choice phase, in choose_plan(). Here, the join prefix being
         considered is in join->positions[]
      
      2. Plan refinement stage, in fix_semijoin_strategies_for_picked_join_order
         Here, the join prefix is in join->best_positions[]
      
      It used to access join->positions[] from stage #2. This didnt cause any
      valgrind or asan failures (as join->positions[] has been written-to before)
      but the effect was similar to that of reading the random data:
      The join prefix we've picked (in join->best_positions) could have
      nothing in common with the join prefix that was last to be considered
      (in join->positions).
      72055d69
    • Sergei Petrunia's avatar
      MDEV-20109: Optimizer ignores distinct key created for materialized... · 2facb2d3
      Sergei Petrunia authored
      (Backported to 10.2-compatiblity, build 22257)
      
      Adjust the testcase according to the review input
      2facb2d3
    • Sergei Petrunia's avatar
      MDEV-20109: Optimizer ignores distinct key created for materialized... · 0febf64e
      Sergei Petrunia authored
      (Backported to 10.3, addressed review input)
      (Backported to 10.2-compatiblity, build 22257)
      
      Sj_materialization_picker::check_qep(): fix error in cost/fanout
      calculations:
      - for each join prefix, add #prefix_rows / TIME_FOR_COMPARE to the cost,
        like best_extension_by_limited_search does
      - Remove the fanout produced by the subquery tables.
      - Also take into account join condition selectivity
      
      optimize_wo_join_buffering() (used by LooseScan and FirstMatch)
      - also add #prefix_rows / TIME_FOR_COMPARE to the cost of each prefix.
      - Also take into account join condition selectivity
      0febf64e
  2. 10 Oct, 2018 1 commit
    • Igor Babaev's avatar
      MDEV-17382 Hash join algorithm should not be used to join materialized · 5aeaba11
      Igor Babaev authored
                 derived table / view by equality
      
      Now rows of a materialized derived table are always put into a
      temporary table before join operation. If BNLH is used to join this
      table with the result of a partial join then both operands of the
      join are actually put into main memory. In most cases this is not
      efficient.
      We could avoid this by sending the rows of the derived table directly
      to the join operation. However this kind of data flow is not supported
      yet.
      Fixed by not allowing usage of hash join algorithm to join a materialized
      derived table if it's joined by an equality predicate of the form
      f=e where f is a field of the derived table.
      
      Adjusted the results of the test case for 10.2-compatibility.
      5aeaba11
  3. 04 Oct, 2018 1 commit
  4. 03 Oct, 2018 1 commit
  5. 19 Sep, 2018 3 commits
    • Igor Babaev's avatar
      MDEV-16711 Crash in Field_blob::store() while reading statistics · d3f01f64
      Igor Babaev authored
                for the small InnoDB table
      
      This bug was introduced by the patch 6c414fcf.
      The patch has not taken into account that some objects of the Field_* types
      are created only for TABLE_SHARE and the field 'table' is set to NULL
      for them. In particular such are objects created to store statistical
      min/max values for columns.
      d3f01f64
    • Igor Babaev's avatar
      MDEV-16757 Memory leak after adding manually min/max statistical data · 809d8837
      Igor Babaev authored
                 for blob column
      
      ANALYZE TABLE <table> does not collect statistical data on min/max values
      for BLOB columns of <table>. However these values can be added into
      mysql.column_stats manually by executing proper statements.
      Unfortunately this led to a memory leak because the memory allocated
      for these values was never freed.
      This patch provides the server with a function to free memory allocated
      for min/max statistical values of BLOB types.
      809d8837
    • Igor Babaev's avatar
      MDEV-16760 CREATE OR REPLACE TABLE never updates statistical tables · 7ccf06f4
      Igor Babaev authored
      If the command CREATE OR REPLACE TABLE really replaces a table then
      it should remove all data on this table from all statistical tables.
      7ccf06f4
  6. 17 Sep, 2018 1 commit
  7. 11 Sep, 2018 1 commit
    • Sergey Vojtovich's avatar
      MDEV-16773 - Assertion failed in tdc_remove_table · b835a121
      Sergey Vojtovich authored
      This assertion fails in thread that removes all table instances for
      particular table from table cache (e.g. "DROP TABLE") while another
      thread evicts table instance of the same table from table cache
      concurrently.
      
      After "MDEV-10296 - Multi-instance table cache" there is a gap in
      eviction code of tc_add_table() between removing table from free_tables
      and all_tables not protected by any mutexes.
      
      This is now valid table cache state, however assertion wasn't amended
      along with original patch. Moved assertion down, after waiting for such
      table instances to get closed.
      b835a121
  8. 05 Sep, 2018 1 commit
  9. 07 Aug, 2018 1 commit
  10. 31 Jul, 2018 1 commit
    • sachin's avatar
      MDEV-9266 Creating index on temporaray table breaks replication · 8dcf7bc6
      sachin authored
      Problem:- Create/drop index was logged into binlog.
      
      Goal:- Operation on temporary table should not be binlog when binlog format
      is row.
      
      Solution:-
      We should add CF_FORCE_ORIGINAL_BINLOG_FORMAT when there is ddl on temp
      table.
      For optimize, analyze, repair we wont change anything ,Then will
      be logged in binlog , But they also dont throw any error if operation fails
      Since slave wont be having any temp table , but these operation on tmp
      table will be processed without breaking replication.
      
      For rename we need a different logic MDEV-16728 will solve it.
      
      (cherry-pick from 10.0)
      8dcf7bc6
  11. 20 Jul, 2018 2 commits
  12. 19 Jun, 2018 1 commit
  13. 15 Jun, 2018 1 commit
    • Marko Mäkelä's avatar
      Disable MyRocks build · c81d6024
      Marko Mäkelä authored
      This branch contains a very old version of MyRocks, which is not
      really needed. Do not build it, so that the builds and tests will
      run faster and will not cause unnecessary failures.
      c81d6024
  14. 13 Jun, 2018 1 commit
  15. 07 Jun, 2018 2 commits
    • Marko Mäkelä's avatar
      MDEV-13935 INSERT stuck at state Unlocking tables · 894388bd
      Marko Mäkelä authored
      Revert the dead code for MySQL 5.7 multi-master replication (GCS),
      also known as
      WL#6835: InnoDB: GCS Replication: Deterministic Deadlock Handling
      (High Prio Transactions in InnoDB).
      
      Also, make innodb_lock_schedule_algorithm=vats skip SPATIAL INDEX,
      because the code does not seem to be compatible with them.
      
      Add FIXME comments to some SPATIAL INDEX locking code. It looks
      like Galera write-set replication might not work with SPATIAL INDEX.
      894388bd
    • Marko Mäkelä's avatar
      1d03409a
  16. 06 Apr, 2018 7 commits
    • Michael Widenius's avatar
      MDEV-14762 Server crashes in MDL_ticket::has_stronger_or_equal_type upon... · cce1d9bf
      Michael Widenius authored
      MDEV-14762 Server crashes in MDL_ticket::has_stronger_or_equal_type upon inserting into temporary sequence
      
      Fix is to not upgrade MDL locks for temporary tables
      cce1d9bf
    • Monty's avatar
      Initialize MYSQL_LOCK->flags variable · eef3dd27
      Monty authored
      This could crash in mysql_unlock_tables in servers compiled with DBUG
      eef3dd27
    • Michael Widenius's avatar
      Added test case for MDEV-15742 to prove that it works · f2f6b00b
      Michael Widenius authored
      MDEV-15742 Assertion `table_share->tmp_table != NO_TMP_TABLE ||
      m_lock_type == 1' failed in handler::ha_write_row
      f2f6b00b
    • Monty's avatar
      Fix for MDEV-14831 · a66a74df
      Monty authored
      MDEV-14831 CREATE OR REPLACE SEQUENCE under LOCK TABLE corrupts the
      sequence, causes ER_KEY_NOT_FOUND
      
      The problem was that sequence_insert didn't properly handle the case
      where there where there was a LOCK TABLE while creating the sequence.
      
      Fixed by opening the sequence table, for inserting the first record, in
      a new environment without any other open tables.
      
      Found also a bug in Locked_tables_list::reopen_tables() where the lock
      structure for the new tables was allocated in THD::mem_root, which causes
      crashes. This could cause problems with other create tables done under
      LOCK TABLES.
      a66a74df
    • Monty's avatar
      MDEV-15149 Assert upon concurrent creating / querying sequences · 95756d29
      Monty authored
      Problem was that sequence_insert closed and reopened the like table
      without proper locking.  Fixed by ensuring that the like table is
      not reopened in sequence_insert
      95756d29
    • Monty's avatar
      MDEV 13679 Enabled sequences to be used in DEFAULT · 3fcb5333
      Monty authored
      Other changes done to get this to work:
      - Added 'internal_tables' to TABLE object to list which sequence tables
        is needed to use the table.
      - Mark any expression using DEFAULT() with LEX->default_used.
        This is needed when deciding if we should open internal sequence
        tables when a table is opened (we don't need to open sequence tables
        if the main table is only used with SELECT).
      - Create_and_open_temporary_table() can now also open all internal
        sequence tables.
      - Added option MYSQL_LOCK_USE_MALLOC to mysql_lock_tables()
        to force memory allocation to be used with malloc instead of
        memroot.
      - Added flag to MYSQL_LOCK to remember if allocation was done with
        malloc or memroot (makes code simpler and safer).
      - init_one_table_for_prelocking() now takes argument for what lock to
        use instead of it's a routine or something else.
      - Renamed prelocking placeholders to make them more understandable as
        they are now used in more code.
      - Changed test in check_lock_and_start_stmt() if found table has correct
        locks. The old test didn't work for tables that has lock
        TL_WRITE_ALLOW_WRITE, which is what sequence tables are using.
      - Added VCOL_NOT_VIRTUAL option to ensure that sequence functions can't
        be used with virtual columns
      - More sequence tests
      3fcb5333
    • Monty's avatar
      Added CHECK_FIELD_EXPRESSION · 82305d7a
      Monty authored
      This is needed for MDEV 13679 Enabled sequences to be used in DEFAULT
      
      Added new option for count_cuted_fields: CHECK_FIELD_EXPRESSION
      which is used to check if a DEFAULT expression is correct before
      ALTER TABLE starts
      
      Changed also all test:
        if (thd->count_cuted_fields)
        to
        if (thd->count_cuted_fields > CHECK_FIELD_EXPRESSION)
      82305d7a
  17. 06 Mar, 2018 1 commit
  18. 28 Feb, 2018 1 commit
  19. 27 Feb, 2018 1 commit
    • Alexander Barkov's avatar
      MDEV-11952 Oracle-style packages: stage#5 · 5f7c764f
      Alexander Barkov authored
      Backporting from bb-10.2-compatibility to bb-10.2-ext
      
      Version: 2018-01-26
      
      - CREATE PACKAGE [BODY] statements are now
        entirely written to mysql.proc with type='PACKAGE' and type='PACKAGE BODY'.
      - CREATE PACKAGE BODY now supports IF NOT EXISTS
      - DROP PACKAGE BODY now supports IF EXISTS
      - CREATE OR REPLACE PACKAGE [BODY] is now supported
      - CREATE PACKAGE [BODY] now support the DEFINER clause:
      
          CREATE DEFINER user@host PACKAGE pkg ... END;
          CREATE DEFINER user@host PACKAGE BODY pkg ... END;
      
      - CREATE PACKAGE [BODY] now supports SQL SECURITY and COMMENT clauses, e.g.:
      
          CREATE PACKAGE p1 SQL SECURITY INVOKER COMMENT "comment" AS ... END;
      
      - Package routines are now created from the package CREATE PACKAGE BODY
        statement and don't produce individual records in mysql.proc.
      
      - CREATE PACKAGE BODY now supports package-wide variables.
        Package variables can be read and set inside package routines.
        Package variables are stored in a separate sp_rcontext,
        which is cached in THD on the first packate routine call.
      
      - CREATE PACKAGE BODY now supports the initialization section.
      
      - All public routines (i.e. declared in CREATE PACKAGE)
        must have implementations in CREATE PACKAGE BODY
      
      - Only public package routines are available outside of the package
      
      - {CREATE|DROP} PACKAGE [BODY] now respects CREATE ROUTINE and ALTER ROUTINE
        privileges
      
      - "GRANT EXECUTE ON PACKAGE BODY pkg" is now supported
      
      - SHOW CREATE PACKAGE [BODY] is now supported
      
      - SHOW PACKAGE [BODY] STATUS is now supported
      
      - CREATE and DROP for PACKAGE [BODY] now works for non-current databases
      
      - mysqldump now supports packages
      
      - "SHOW {PROCEDURE|FUNCTION) CODE pkg.routine" now works for package routines
      
      - "SHOW PACKAGE BODY CODE pkg" now works (the package initialization section)
      
      - A new package body level MDL was added
      
      - Recursive calls for package procedures are now possible
      
      - Routine forward declarations in CREATE PACKATE BODY are now supported.
      
      - Package body variables now work as SP OUT parameters
      
      - Package body variables now work as SELECT INTO targets
      
      - Package body variables now support ROW, %ROWTYPE, %TYPE
      5f7c764f
  20. 22 Feb, 2018 8 commits
  21. 21 Feb, 2018 1 commit