1. 13 Feb, 2017 29 commits
    • Sergei Golubchik's avatar
      MDEV-11640 gcol.gcol_select_myisam fails in buildbot on Power · 8d99166c
      Sergei Golubchik authored
      JOIN_CACHE's were initialized in  check_join_cache_usage()
      from make_join_readinfo(). After that make_join_readinfo() was looking
      whether it's possible to use keyread. Later, after make_join_readinfo(),
      optimizer decided whether to use filesort. And even later, at the
      execution time, from join_read_first(), keyread was actually enabled.
      
      The problem is, that if a query uses a vcol, base columns that it
      depends on are automatically added to the read_set - because they're
      needed to calculate the vcol. But if we're doing keyread, vcol is taken
      from the index, not calculated, and base columns do not need to  be
      in the read set (even should not be - as they aren't getting values).
      
      The bug was that JOIN_CACHE used read_set with base columns,
      they were not read because of keyread, so it was caching garbage.
      
      So read_set is only known after the keyread was decided. And after the
      filesort was decided, as filesort doesn't use keyread. But
      check_join_cache_usage() needs to be done in make_join_readinfo(),
      as the code below depends on these checks,
      
      Fix: keep JOIN_CACHE checks where they were, but move initialization
      down to the very end of JOIN::optimize_inner. If keyread was enabled,
      update the read_set to include only columns that are part of the index.
      Copy the keyread logic from join_read_first() to happen at optimize time.
      8d99166c
    • Sergei Golubchik's avatar
      support keyread in READ_RECORD · 0e5230e1
      Sergei Golubchik authored
      make init_read_record() to detect enabled keyread
      and use index_* access methods, not rnd_*
      
      this makes MariaDB to use keyread a lot more often than before
      0e5230e1
    • Sergei Golubchik's avatar
      bugfix: disable ICP in InnoDB for indexes on virtual columns · 1913daf4
      Sergei Golubchik authored
      because it doesn't work, vcols are never calculated for ICP
      1913daf4
    • Sergei Golubchik's avatar
      cleanup: make a couple of tests more robust · 01dd3556
      Sergei Golubchik authored
      with --sorted_result
      01dd3556
    • Sergei Golubchik's avatar
      cleanup: handler::key_read · cff144a8
      Sergei Golubchik authored
      * rename to "keyread" (to avoid conflicts with tokudb),
      * change from bool to uint and store the keyread index number there
      * provide a bool accessor to check if keyread is enabled
      cff144a8
    • Sergei Golubchik's avatar
      find_all_keys: add an assert, remove current_thd · dafb507e
      Sergei Golubchik authored
      Filesort temporarily changes read_set to be tmp_set and marks only
      fields needed for filesort. Add an assert to ensure that it doesn't
      overwrite the old value of tmp_set, that is that read_set was *not*
      already tmp_set when filesort was invoked.
      
      Fix sql_update.cc that was was doing exactly that - changing read_set to
      tmp_set, configuring tmp_set for keyread, and then invoking filesort.
      dafb507e
    • Sergei Golubchik's avatar
      cleanup: TABLE::mark_columns_used_by_index() · e46c4221
      Sergei Golubchik authored
      mark_columns_used_by_index used to do
      reset + mark_columns_used_by_index_no_reset + start keyread + set bitmaps
      
      Now prepare_for_keyread does that, while mark_columns_used_by_index
      does only reset + mark_columns_used_by_index_no_reset,
      just as its name suggests.
      e46c4221
    • Sergei Golubchik's avatar
      bugfix: don't calculate vcols if doing keyread · 460ff398
      Sergei Golubchik authored
      old code didn't calculate vcols that were part of keyread,
      but calculated other vcols. It was wrong - there was no guarantee
      that vcol's base columns were part of keyread.
      
      Technically it's possible for the vcol not be a part of keyread,
      but all its base columns being part of keyread. But currently the
      optimizer doesn't do that, keyread is only used if it covers
      all columns used in the query.
      
      This fixes crashes of vcol.vcol_trigger_sp_innodb
      460ff398
    • Sergei Golubchik's avatar
      cleanup: remove TABLE::add_read_columns_used_by_index · 3cae225b
      Sergei Golubchik authored
      TABLE::add_read_columns_used_by_index() is conceptually wrong,
      it *adds* columns used by index to the bitmap, without clearing
      it first. But it also enables keyread, meaning that *only* columns
      from the index will be read. It is supposed to be used to
      add columns used by an index to a bitmap that already has columns
      of a primary key - for engines where a primary key is part of every
      index.
      
      The correct fix is to change mark_columns_used_by_index() to
      take into account extended keys.
      
      this reverts 1d0acc77 and cf97cbd1
      3cae225b
    • Sergei Golubchik's avatar
      bugfix: TABLE::mark_columns_used_by_index_no_reset · 9fa6589f
      Sergei Golubchik authored
      it should not mark base columns that a vcol depends on, because
      keyread (on a vcol) will not read them
      9fa6589f
    • Sergei Golubchik's avatar
      cleanup: mark_columns_used_by_index_no_reset in handler::get_auto_increment · 4dd7e113
      Sergei Golubchik authored
      use table->mark_columns_used_by_index, don't copy it
      4dd7e113
    • Sergei Golubchik's avatar
      cleanup: mark_columns_used_by_index_no_reset in opt_range.cc · bf8f70a4
      Sergei Golubchik authored
      use table->mark_columns_used_by_index, don't copy it
      bf8f70a4
    • Sergei Golubchik's avatar
      bugfix: TABLE::mark_columns_used_by_index · 0254f1a6
      Sergei Golubchik authored
      Do *not* modify write_set.
      keyread only affects what columns are *read*, UPDATE statement can
      *write* into columns that aren't part of the keyread.
      0254f1a6
    • Sergei Golubchik's avatar
      cleanup: style fixes, sql_join_cache.cc · 5d7607f3
      Sergei Golubchik authored
      5d7607f3
    • Sergei Golubchik's avatar
      cleanup: TABLE::non_determinstic_insert · 8246b0ac
      Sergei Golubchik authored
      move the check where it make sense, remove incorrect comment
      8246b0ac
    • Sergei Golubchik's avatar
      InnoDB: suppress posix_fallocate() failure errors when EINVAL · 6c4144a4
      Sergei Golubchik authored
      EINVAL means that the filesystem doesn't support posix_fallocate().
      
      There were two places where this error was issued, one checked for
      EINVAL, the other did not. This commit fixed the other place
      to also check for EINVAL.
      
      Also, remove the space after the REFMAN to get the valid url
      with no space in the middle.
      
      Also don't say "Make sure the file system supports this function."
      when posix_fallocate() fails, because this message is only shown
      when the filesystem does support this function.
      6c4144a4
    • Sergei Golubchik's avatar
      ef0db6bf
    • Sergei Golubchik's avatar
      MDEV-10352 Server crashes in Field::set_default on CREATE TABLE · d2f84ab9
      Sergei Golubchik authored
      fix Item_default_value not to pretend being const_item
      if the field's default_value expression isn't parsed yet
      d2f84ab9
    • Sergei Golubchik's avatar
      MDEV-11750 Assertion `vfield' failed in TABLE::update_virtual_fields after... · b6a3917b
      Sergei Golubchik authored
      MDEV-11750 Assertion `vfield' failed in TABLE::update_virtual_fields after crash recovery on corrupted MyISAM table
      
      Adjust the length of the BIT field
      (same as in _mi_put_key_in_record())
      b6a3917b
    • Sergei Golubchik's avatar
      MDEV-11836 vcol.vcol_keys_myisam fails in buildbot and outside · 29ed440d
      Sergei Golubchik authored
      move TABLE::key_read into handler. Because in index merge and DS-MRR
      there can be many handlers per table, and some of them use
      key read while others don't. "keyread" is really per handler,
      not per TABLE property.
      29ed440d
    • Sergei Golubchik's avatar
    • Sergei Golubchik's avatar
      MDEV-11784 View is created with invalid definition which causes ERROR 1241... · eda2ebef
      Sergei Golubchik authored
      MDEV-11784 View is created with invalid definition which causes ERROR 1241 (21000): Operand should contain 1 column(s)
      
      set the correct print precedence for IN subqueries
      eda2ebef
    • Sergei Golubchik's avatar
      Race condition in DEFAULT() with expressions · cf003933
      Sergei Golubchik authored
      Item_default_value::calculate was updating table->s->default_values,
      but it is supposed to be read-only
      cf003933
    • Sergei Golubchik's avatar
      MDEV-10201 Bad results for CREATE TABLE t1 (a INT DEFAULT b, b INT DEFAULT 4) · cd4dd2b6
      Sergei Golubchik authored
      Optionally do table->update_default_fields() even for INSERT
      that supposedly provides values for all column. Because these
      "values" might be DEFAULT, which would need table->update_default_fields()
      at the end.
      
      Also set Item_default_value::used_tables() from the default expression.
      Non-zero used_field() means that mysql_insert() will initialize all
      fields to their default values (with restore_record()) even if
      all columns are later provided with values. Because default expressions
      may refer to other columns and they must be initialized.
      cd4dd2b6
    • Marko Mäkelä's avatar
      Post-fix for MDEV-12050 Remove unused InnoDB Memcached hooks · 588eca31
      Marko Mäkelä authored
      Remove also the field trx_t::read_write that was only used by
      the Memcached hooks.
      588eca31
    • Marko Mäkelä's avatar
      MDEV-12050 Remove unused InnoDB Memcached hooks · a45866c6
      Marko Mäkelä authored
      Oracle introduced a Memcached plugin interface to the InnoDB
      storage engine in MySQL 5.6. That interface is essentially a
      fork of Memcached development snapshot 1.6.0-beta1 of an old
      development branch 'engine-pu'.
      
      To my knowledge, there have not been any updates to the Memcached code
      between MySQL 5.6 and 5.7; only bug fixes and extensions related to
      the Oracle modifications.
      
      The Memcached plugin is not part of the MariaDB Server. Therefore it
      does not make sense to include the InnoDB interfaces for the Memcached
      plugin, or to have any related configuration parameters:
      
          innodb_api_bk_commit_interval
          innodb_api_disable_rowlock
          innodb_api_enable_binlog
          innodb_api_enable_mdl
          innodb_api_trx_level
      
      Removing this code in one commit makes it possible to easily restore
      it, in case it turns out to be needed later.
      a45866c6
    • Marko Mäkelä's avatar
      MDEV-11782 preparation: Add separate code for validating the 10.1 redo log. · 3272a197
      Marko Mäkelä authored
      log_crypt_101_read_checkpoint(): Read the encryption information
      from a MariaDB 10.1 checkpoint page.
      
      log_crypt_101_read_block(): Attempt to decrypt a MariaDB 10.1
      redo log page.
      
      recv_log_format_0_recover(): Only attempt decryption on checksum
      mismatch. NOTE: With the MariaDB 10.1 innodb_encrypt_log format,
      we can actually determine from the cleartext portion of the redo log
      whether the redo log is empty. We do not really have to decrypt the
      redo log here, if we did not want to determine if the checksum is valid.
      3272a197
    • Marko Mäkelä's avatar
      MDEV-11782 preparation: Remove recv_sys_t::last_block. · 96c4b9d4
      Marko Mäkelä authored
      We can use log_sys->buf instead of recv_sys->last_block during
      crash recovery. Remove the redundant buffer.
      96c4b9d4
    • Marko Mäkelä's avatar
      Fix a memory leak on aborted InnoDB startup. · 412ee033
      Marko Mäkelä authored
      innodb_shutdown(), trx_sys_close(): Startup may be aborted between
      purge_sys and trx_sys creation. Therefore, purge_sys must be freed
      independently of trx_sys.
      
      innobase_start_or_create_for_mysql(): Remember to free purge_queue if
      it was not yet attached to purge_sys.
      412ee033
  2. 12 Feb, 2017 1 commit
    • Igor Babaev's avatar
      Fixed bugs mdev-12051, mdev-10885. · d35aea54
      Igor Babaev authored
      These are different bugs, but the fixing code is the same:
      if window functions are used over implicit grouping then
      now the execution should follow the general path calling
      the function set in JOIN::first_select.
      d35aea54
  3. 11 Feb, 2017 3 commits
  4. 10 Feb, 2017 7 commits