1. 20 Nov, 2019 3 commits
    • Aleksey Midenkov's avatar
      927ea880
    • Aleksey Midenkov's avatar
      MDEV-20729 Fix REFERENCES constraint in column definition · daabc5cc
      Aleksey Midenkov authored
      Add support of referential constraints directly in column defininions:
      
      create table t1 (id1 int primary key);
      create table t2 (id2 int references t1(id1));
      
      Referenced field name can be omitted if equal to foreign field name:
      
      create table t1 (id int primary key);
      create table t2 (id int references t1);
      
      Until 10.5 this syntax was understood by the parser but was silently
      ignored.
      
      In case of generated columns this syntax is disabled at parser level
      by ER_PARSE_ERROR. Note that separate FOREIGN KEY clause for generated
      columns is disabled at storage engine level.
      daabc5cc
    • Aleksey Midenkov's avatar
      MDEV-20480 Obsolete internal parser for FK in InnoDB · 5130f520
      Aleksey Midenkov authored
      Currently InnoDB uses internal parser for adding foreign keys. Remove
      internal parser and use data parsed by SQL parser (sql_yacc) for
      adding foreign keys.
      
      - create_table_info_t::create_foreign_keys() replacement for
        dict_create_foreign_constraints_low();
      - Pass constraint name via Foreign_key object.
      
      Temporary until MDEV-20865:
      
      - Pass alter_info as part of create_info.
      5130f520
  2. 19 Nov, 2019 3 commits
  3. 18 Nov, 2019 4 commits
    • Marko Mäkelä's avatar
      Merge 10.3 into 10.4 · 589a1235
      Marko Mäkelä authored
      589a1235
    • Marko Mäkelä's avatar
      MDEV-13564 follow-up: Remove unused code · 39d8652c
      Marko Mäkelä authored
      DropIndex, CreateIndex: Remove. The file row0trunc.cc only exists
      in MariaDB Server 10.3 so that the crash recovery of TRUNCATE TABLE
      operations from older 10.2 and 10.3 servers will work. This dead code
      was being used for implementing the MySQL 5.7 WL#6501 TRUNCATE TABLE
      that was replaced with a backup-safe implementation in MDEV-13564.
      39d8652c
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · 613e1307
      Marko Mäkelä authored
      613e1307
    • Marko Mäkelä's avatar
      MDEV-21069 Crash on DROP TABLE if the data file is corrupted · b80df9eb
      Marko Mäkelä authored
      buf_read_ibuf_merge_pages(): Discard any page numbers that are
      outside the current bounds of the tablespace, by invoking the
      function ibuf_delete_recs() that was introduced in MDEV-20934.
      This could avoid an infinite change buffer merge loop on
      innodb_fast_shutdown=0, because normally the change buffer merge
      would only be attempted if a page was successfully loaded into
      the buffer pool.
      
      dict_drop_index_tree(): Add the parameter trx_t*.
      To prevent the DROP TABLE crash, do not invoke btr_free_if_exists()
      if the entire .ibd file will be dropped. Thus, we will avoid a crash
      if the BTR_SEG_LEAF or BTR_SEG_TOP of the index is corrupted,
      and we will also avoid unnecessarily accessing the to-be-dropped
      tablespace via the buffer pool.
      
      In MariaDB 10.2, we disable the DROP TABLE fix if innodb_safe_truncate=0,
      because the backup-unsafe MySQL 5.7 WL#6501 form of TRUNCATE TABLE
      requires that the individual pages be freed inside the tablespace.
      b80df9eb
  4. 17 Nov, 2019 1 commit
  5. 16 Nov, 2019 2 commits
  6. 15 Nov, 2019 18 commits
    • Vladislav Vaintroub's avatar
      Fix compile error on centos6. it does not like std::this_thread::sleep() · c233d406
      Vladislav Vaintroub authored
      Simplify task_group destructor.
      No tasks must be running or queued into task group is being destroyed.
      c233d406
    • Marko Mäkelä's avatar
      MDEV-16264: Minor cleanup · 15c7f684
      Marko Mäkelä authored
      Add missing static qualifiers.
      15c7f684
    • Sergei Petrunia's avatar
      MDEV-20611: MRR scan over partitioned InnoDB table produces "Out of memory" error · 86167e90
      Sergei Petrunia authored
      Fix partitioning and DS-MRR to work together
      
      - In ha_partition::index_end(): take into account that ha_innobase (and
        other engines using DS-MRR) will have inited=RND when initialized for
        DS-MRR scan.
      - In ha_partition::multi_range_read_next(): if the MRR scan is using
        HA_MRR_NO_ASSOCIATION mode, it is not guaranteed that the partition's
        handler will store anything into *range_info.
      - In DsMrr_impl::choose_mrr_impl(): ha_partition will inquire partitions
        about how much memory their MRR implementation needs by passing
        *buffer_size=0. DS-MRR code didn't know about this (actually it used
        uint for buffer size calculation and would have an under-flow).
        Returning *buffer_size=0 made ha_partition assume that partitions do
        not need MRR memory and pass the same buffer to each of them.
      
        Now, this is fixed. If DS-MRR gets *buffer_size=0, it will return
        the amount of buffer space needed, but not more than about
        @@mrr_buffer_size.
      
      * Fix ha_{innobase,maria,myisam}::clone. If ha_partition uses MRR on its
        partitions, and partition use DS-MRR, the code will call handler->clone
        with TABLE (*NOT partition*) name as an argument.
        DS-MRR has no way of knowing the partition name, so the solution was
        to have the ::clone() function for the affected storage engine to ignore
        the name argument and get it elsewhere.
      86167e90
    • Marko Mäkelä's avatar
      MDEV-16264: Remove IORequest::IGNORE_MISSING · a69cff29
      Marko Mäkelä authored
      After MDEV-11556, not even crash recovery should attempt to access
      non-existing pages. But, buf_load() is not validating its input
      and must thus be able to ignore missing pages, so that is why
      buf_read_page_background() does that.
      a69cff29
    • Marko Mäkelä's avatar
      MDEV-16264: Fix some white space · 80409986
      Marko Mäkelä authored
      80409986
    • Marko Mäkelä's avatar
      MDEV-21054 Crash on shutdown due to btr_search_latches=NULL · 37f1ab23
      Marko Mäkelä authored
      innodb_shutdown(): Invoke os_aio_free() before btr_search_sys_free().
      37f1ab23
    • Vladislav Vaintroub's avatar
      Make .clang-format work with clang-8 · a808c18b
      Vladislav Vaintroub authored
      Remove keywords that are too new.
      a808c18b
    • Vladislav Vaintroub's avatar
      4e30a57e
    • Vladislav Vaintroub's avatar
      MDEV-16264 Use threadpool for Innodb background work. · 5e62b6a5
      Vladislav Vaintroub authored
      Almost all threads have gone
      - the "ticking" threads, that sleep a while then do some work)
      (srv_monitor_thread, srv_error_monitor_thread, srv_master_thread)
      were replaced with timers. Some timers are periodic,
      e.g the "master" timer.
      
      - The btr_defragment_thread is also replaced by a timer , which
      reschedules it self when current defragment "item" needs throttling
      
      - the buf_resize_thread and buf_dump_threads are substitutes with tasks
      Ditto with page cleaner workers.
      
      - purge workers threads are not tasks as well, and purge cleaner
      coordinator is a combination of a task and timer.
      
      - All AIO is outsourced to tpool, Innodb just calls thread_pool::submit_io()
      and provides the callback.
      
      - The srv_slot_t was removed, and innodb_debug_sync used in purge
      is currently not working, and needs reimplementation.
      5e62b6a5
    • Vladislav Vaintroub's avatar
      MDEV-16264: Add threadpool library · 00ee8d85
      Vladislav Vaintroub authored
      The library is capable of
      - asynchronous execution of tasks (and optionally waiting for them)
      - asynchronous file IO
        This is implemented using libaio on Linux and completion ports on
        Windows. Elsewhere, async io is "simulated", which means worker threads
        are performing synchronous IO.
      - timers, scheduling work asynchronously in some point of the future.
        Also periodic timers are implemented.
      00ee8d85
    • Vladislav Vaintroub's avatar
      MDEV-16264 prerequisite patch, ha_preshutdown. · 7e08dd85
      Vladislav Vaintroub authored
      This is a prerequisite patch required to remove Innodb's
      thd_destructor_proxy thread.
      
      The patch implement pre-shutdown functionality for handlers.
      
      A storage engine might need to perform some work after all user
      connections are shut down, but before killing off the plugins.
      
      The reason is that an SE could still be using some of the
      server infrastructure. In case of Innodb this would be purge threads,
      that call into the server to calculate results of virtual function,
      acquire MDL locks on tables, or possibly also use the audit plugins.
      7e08dd85
    • Vladislav Vaintroub's avatar
      MDEV-16264 - prerequisite patch - true background THDs · e7549917
      Vladislav Vaintroub authored
      Create background THDs that are not counted, and do not block
      close_connections(), in other words they are just something that plugin
      can use internally.
      
      These THD will be used later by Innodb purge threads, and they need THD
      to calculate virtual functions.
      e7549917
    • Vladislav Vaintroub's avatar
      MDEV-16264 prerequisite patch, enable thr_timer in embedded · 2fb23b89
      Vladislav Vaintroub authored
      Since threadpool is using thr_timer, and it also exist in embedded version,
      initialize timer also in embedded version
      2fb23b89
    • Vladislav Vaintroub's avatar
      MDEV-16264 - prerequisite patch, periodic thr_timer · ad17c98d
      Vladislav Vaintroub authored
      Threadpool will need a functionality for periodic thr_timer
      (the threadpool maintainence task is a timer that runs periodically).
      
      Also increase the stack size for the timer thread, 8k won't be enough.
      ad17c98d
    • Vladislav Vaintroub's avatar
      Fix a couple of clang-cl warnings · 009674dc
      Vladislav Vaintroub authored
      009674dc
    • Vladislav Vaintroub's avatar
      MDEV-21062 Buildbot, Windows - sporadically missing lines from mtr's "exec" · 6df0bb7d
      Vladislav Vaintroub authored
      
      Provide own version of popen/pclose, in attempt to workaround
      sporadic erratic behavior of UCRT's one.
      6df0bb7d
    • Marko Mäkelä's avatar
      Cleanup: More use of mtr_memo_type_t · 786b0049
      Marko Mäkelä authored
      786b0049
    • Sergei Golubchik's avatar
      update create_w_max_indexes_128.result · bd2b05df
      Sergei Golubchik authored
      using create_w_max_indexes_64.result as a template
      bd2b05df
  7. 14 Nov, 2019 9 commits
    • Marko Mäkelä's avatar
      Merge 10.4 into 10.5 · ae90f843
      Marko Mäkelä authored
      ae90f843
    • Marko Mäkelä's avatar
      Merge 10.3 into 10.4 · 89ae01fd
      Marko Mäkelä authored
      89ae01fd
    • Marko Mäkelä's avatar
      MDEV-20949: Merge 10.3 into 10.4 · 746ee785
      Marko Mäkelä authored
      746ee785
    • Marko Mäkelä's avatar
      Merge 10.3 into 10.4 · 3bee95d7
      Marko Mäkelä authored
      3bee95d7
    • Jean Weisbuch's avatar
      MDEV-4476: mytop tracker · c454b896
      Jean Weisbuch authored
      - Added dynamic column width fro `user` and `db` columns
      - Added option `%` to hide the progress
      - Follow up changes from Ubuntu
      - Take `INFORMATION_SCHEMA.PROCESSLIST` into account to determine
        progress of the `actual stage`
      - Indentation fixes
      
      Closes #215
      c454b896
    • Marko Mäkelä's avatar
      MDEV-12353 preparation: Replace mtr_x_lock() and friends · 3d4a8015
      Marko Mäkelä authored
      Apart from page latches (buf_block_t::lock), mini-transactions
      are keeping track of at most one dict_index_t::lock and
      fil_space_t::latch at a time, and in a rare case, purge_sys.latch.
      
      Let us introduce interfaces for acquiring an index latch
      or a tablespace latch.
      
      In a later version, we may want to introduce mtr_t members
      for holding a latched dict_index_t* and fil_space_t*,
      and replace the remaining use of mtr_t::m_memo
      with std::set<buf_block_t*> or with a map<buf_block_t*,byte*>
      pointing to log records.
      3d4a8015
    • Marko Mäkelä's avatar
      MDEV-20949: Merge 10.2 into 10.3 · 4ded5fb9
      Marko Mäkelä authored
      In the test innodb.instant_alter,4k we would be flagging an error
      for too large row size. That error was previously only being reported
      if the table was being rebuilt. Thus, this merge is fixing a small
      omission in MDEV-11369 (instant ADD COLUMN).
      4ded5fb9
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · bc5cfe77
      Marko Mäkelä authored
      bc5cfe77
    • Sujatha's avatar
      MDEV-20707: Missing memory barrier in parallel replication error handler in wait_for_prior_commit() · caa79081
      Sujatha authored
      revision-id: 673e253724979fd9fe43a4a22bd7e1b2c3a5269e
      Author: Kristian Nielsen
      
      Fix missing memory barrier in wait_for_commit.
      
      The function wait_for_commit::wait_for_prior_commit() has a fast path where it
      checks without locks if wakeup_subsequent_commits() has already been called.
      This check was missing a memory barrier. The waitee thread does two writes to
      variables `waitee' and `wakeup_error', and if the waiting thread sees the
      first write it _must_ also see the second or incorrect behavior will occur.
      This requires memory barriers between both the writes (release semantics) and
      the reads (acquire semantics) of those two variables.
      
      Other accesses to these variables are done under lock or where only one thread
      will be accessing them, and can be done without barriers (relaxed semantics).
      caa79081