1. 26 Jul, 2018 8 commits
    • Alexander Barkov's avatar
      MDEV-16614 signal 7 after calling stored procedure, that uses regexp · 5c5a116b
      Alexander Barkov authored
      The problem happened in the derived condition pushdown code:
      - When Item_func_regex::build_clone() was called, it created a copy of
        the original Item_func_regex, and this copy got registered in free_list.
        Class specific additional dynamic members (such as "re") made
        a shallow copy, rather than a deep copy, in the cloned Item_func_regex.
        As a result, the Regexp_processor_pcre::m_pcre of the cloned Item_func_regex
        and of the original Item_func_regex pointed to the same compiled regular
        expression.
      - On cleanup_items(), both original and cloned copies of Item_func_regex
        called re.cleanup(), which called pcre_free(m_pcre). So the same compiled
        regular expression was freed two times, which was noticed by ASAN.
      
      The same problem was repeatable for Item_func_regexp_instr.
      
      A similar problem happened for Item_func_sp, for the sp_result_field member.
      Both original and cloned copies of Item_func_sp pointed the same Field instance
      and both deleted it on cleanup().
      
      A possible solution would be to fix build_clone() to create deep
      (instead of shallow) copies for the dynamic members of the affected classes
      (Item_func_regex, Item_func_regexp_instr, Item_func sp).
      However, this would be too complex.
      
      As agreed with Galina and Igor, this patch disallows using using these
      affected classes in derived condition pushdown by overriding get_clone()
      to return NULL.
      5c5a116b
    • Igor Babaev's avatar
      MDEV-15087 Item_func::fix_fields: · 3c141e31
      Igor Babaev authored
                 Assertion `used_tables_cache == 0' failed
      
      This bug manifested itself when executing queries
      over materialized derived tables /vies and with
      conjunctive always true predicates containing
      inexpensive single-row subqueries.
      This bug disappeared after the patch mdev-15035
      had been applied.
      3c141e31
    • Marko Mäkelä's avatar
      MDEV-16809 Allow full redo logging for ALTER TABLE · 0f90728b
      Marko Mäkelä authored
      Introduce the configuration option innodb_log_optimize_ddl
      for controlling whether native index creation or table-rebuild
      in InnoDB should keep optimizing the redo log
      (and writing MLOG_INDEX_LOAD records to ensure that
      concurrent backup would fail).
      
      By default, we have innodb_log_optimize_ddl=ON, that is,
      the default behaviour that was introduced in MariaDB 10.2.2
      (with the merge of InnoDB from MySQL 5.7) will be unchanged.
      
      BtrBulk::m_trx: Replaces m_trx_id. We must be able to check for
      KILL QUERY even if !m_flush_observer (innodb_log_optimize_ddl=OFF).
      
      page_cur_insert_rec_write_log(): Declare globally, so that this
      can be called from PageBulk::insert().
      
      row_merge_insert_index_tuples(): Remove the unused parameter trx_id.
      
      row_merge_build_indexes(): Enable or disable redo logging based on
      the innodb_log_optimize_ddl parameter.
      
      PageBulk::init(), PageBulk::insert(), PageBulk::finish(): Write
      redo log records if needed. For ROW_FORMAT=COMPRESSED, redo log
      will be written in PageBulk::compress() unless we called
      m_mtr.set_log_mode(MTR_LOG_NO_REDO).
      0f90728b
    • Marko Mäkelä's avatar
      32eb5823
    • Marko Mäkelä's avatar
      Remove unused BtrBulk::m_heap · 4a456eac
      Marko Mäkelä authored
      4a456eac
    • Marko Mäkelä's avatar
      a3b22147
    • Marko Mäkelä's avatar
      PageBulk: Remove dead code · 172199b8
      Marko Mäkelä authored
      Native ALTER TABLE is never invoked on temporary tables.
      172199b8
    • Marko Mäkelä's avatar
      Remove mtr_set_flush_observer() · 7f548943
      Marko Mäkelä authored
      7f548943
  2. 25 Jul, 2018 3 commits
    • Igor Babaev's avatar
      MDEV-16820 Lost 'Impossible where' from query with inexpensive subquery · aad70e9b
      Igor Babaev authored
      This patch fixes another problem introduced by the patch for mdev-4817.
      The latter changed Item_cond::fix_fields() in such a way that it could
      call the virtual method is_expensive(). With the first its call
      the method saves the result in Item::is_expensive_cache. For all next
      calls the method returns the result from this cache. So if the item
      once was determined as expensive the method always returns true.
      For subqueries it's not good, because non-optimized subqueries always
      is considered as expensive.
      It means that the cache should be invalidated after the call of
      optimize_constant_subqueries().
      aad70e9b
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-16713 Hangs server with repeating log entry · de853554
      Thirunarayanan Balathandayuthapani authored
      	At most one transaction can be active at a time for temporary
      tables. There is no need to check previous version of record for the
      temporary tables.
      de853554
    • Sachin's avatar
      MDEV-16821 Set password for user makes rpl test to fail · 969939e8
      Sachin authored
      Actually if we use "set password for " command this changes the checksum
      of mysql.user table
      -localhost      root            Y       Y       Y       Y       Y       Y       Y       Y     YY       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y     $
      Y       Y       Y       Y       Y       Y       Y                                       0     00       0                       N       N               0.000000
      +localhost      root            Y       Y       Y       Y       Y       Y       Y       Y     YY       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y     Y
      Y       Y       Y       Y       Y       Y       Y                                       0     00       0       mysql_native_password           N       N               0.000000
      In short we replace '' with mysql_native_password
      which make checksum to be different, and hence check test case fails.
      
      So we use UPDATE mysql.user command.
      969939e8
  3. 24 Jul, 2018 1 commit
  4. 23 Jul, 2018 7 commits
    • Jacob Mathew's avatar
      MDEV-15786: ERROR 1062 (23000) at line 365: Duplicate entry 'spider' for key 'PRIMARY' · 45ab00f0
      Jacob Mathew authored
      The problem occurs on Ubuntu where a Spider package is installed on the system
      separately from the MariaDB package.  MariaDB and Spider upgrades leave the
      Spider plugin improperly installed.  Spider is present in the mysql.plugin
      table but is not present in information_schema.
      
      The problem has been corrected in Spider's installation script.  Logic has
      been added to check for Spider entries in both information_schema and
      mysql.plugin.  If Spider is present in mysql.plugin but is not present in
      information_schema, then Spider is first removed from mysql.plugin.  The
      subsequent plugin install of Spider will insert entries in both mysql.plugin
      and information_schema.
      
      Author:
        Jacob Mathew.
      
      Reviewer:
        Kentoku Shiba.
      
      Cherry-Picked:
        Commit 0897d81 on branch bb-10.3-MDEV-15786
      45ab00f0
    • Marko Mäkelä's avatar
      row_purge_poss_sec(): Add debug instrumentation · 9d1f3bf2
      Marko Mäkelä authored
      This helped fix MDEV-16779.
      9d1f3bf2
    • Marko Mäkelä's avatar
      MDEV-15855 cleanup: Privatize purge_vcol_info_t · c5ba13dd
      Marko Mäkelä authored
      Declare all fields of purge_vcol_info_t private, and add
      accessor functions.
      c5ba13dd
    • Marko Mäkelä's avatar
      Follow-up to MDEV-15855: Remove bogus debug assertions · a7a0c533
      Marko Mäkelä authored
      During a table-rebuilding operation, the function table_name_parse()
      can encounter a table name that starts with #sql. Here is an example
      of a failure:
      
      CURRENT_TEST: gcol.innodb_virtual_basic
      mysqltest: At line 1204: query 'alter table t drop column d ' failed:
      2013: Lost connection to MySQL server during query
      
      Let us just remove these bogus debug assertions.
      
      If the final renaming phase during ALTER TABLE never fails, it
      should not do any harm to skip the purge. If it does fail, then
      we might end up 'leaking' some delete-marked records in the
      indexes on virtual columns of the original table, and these
      garbage records would keep consuming space until the indexes are
      dropped or the table is successfully rebuilt.
      a7a0c533
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-16779 Assertion !rw_lock_own failed upon purge · 730f6c91
      Thirunarayanan Balathandayuthapani authored
      This is a regression caused by the fix of MDEV-15855.
      
      purge_vcol_info_t::set_used(): Add a missing condition.
      
      row_purge_poss_sec(): Invoke set_used() in order to
      have !is_first_fetch() when retrying.
      730f6c91
    • Marko Mäkelä's avatar
      ut_print_buf_hex(): Correctly dump the hex · b660261b
      Marko Mäkelä authored
      This should affect at least rec_printer() output.
      b660261b
    • Marko Mäkelä's avatar
      Reduce the number of rw_lock_own() calls · 73af0753
      Marko Mäkelä authored
      Replace pairs of rw_lock_own() calls with
      calls to rw_lock_own_flagged().
      
      These calls are only present in debug builds.
      73af0753
  5. 21 Jul, 2018 1 commit
  6. 18 Jul, 2018 1 commit
    • Sachin's avatar
      MDEV-16192 Table 't' is specified twice, both as a target for 'CREATE' and... · 9827c5e1
      Sachin authored
      as a separate source for data
      
      Actually MDEV-15867 and MDEV-16192 are same, Slave adds "or replace" to create
      table stmt. So create table t1 is create or replace on slave. So this bug
      is not because of replication, We can get this bug on general server if we
      manually add or replace to create query.
      
      Problem:- So if we try to create table t1 (same name as of temp table t1 ) via
         CREATE or replace TABLE t AS SELECT * FROM t;
      Since in this query we are creating table from select * from t1 , we call
      unique_table function to see whether if source and destination table are same.
      But there is one issue unique_table does not account if source table is tmp table
      in this case source and destination table can be same.
      
      Solution:- We will change find_dup_table to not to look for temp table if
      CHECK_DUP_SKIP_TEMP_TABLE flag is on.
      9827c5e1
  7. 07 Jul, 2018 1 commit
    • Marko Mäkelä's avatar
      MDEV-16664: Change the default to innodb_lock_schedule_algorithm=fcfs · 1cc1d042
      Marko Mäkelä authored
      The parameter innodb_lock_schedule_algorithm was introduced in
      MariaDB Server 10.1.19, 10.2.13, 10.3.4 as part of MDEV-11039.
      In MariaDB 10.1, the default value of the parameter is 'fcfs',
      that is, the existing algorithm is used by default. But in
      later versions of MariaDB Server, the parameter was 'vats',
      enabling the new algorithm.
      
      Because the new algorithm is triggering a debug assertion failure
      that suggests corruption of the transactional lock data structures,
      we will revert to the old algorithm by default until we have
      resolved the problem.
      1cc1d042
  8. 06 Jul, 2018 2 commits
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-15855 Deadlock between purge thread and DDL statement · 8b0d4cff
      Thirunarayanan Balathandayuthapani authored
      Problem:
      ========
      Truncate operation holds MDL on the table (t1) and tries to
      acquire InnoDB dict_operation_lock. Purge holds dict_operation_lock
      and tries to acquire MDL on the table (t1) to evaluate virtual
      column expressions for indexed virtual columns.
      It leads to deadlock of purge and truncate table (DDL).
      
      Solution:
      =========
      If purge tries to acquire MDL on the table then it should do the following:
      
      i) Purge should release all innodb latches (including dict_operation_lock)
      before acquiring metadata lock on the table.
      
      ii) After acquiring metadata lock on the table, it should check whether the
      table was dropped or renamed. If the table is dropped then purge should
      ignore the undo log record. If the table is renamed then it should
      release the old MDL and acquire MDL on the new name.
      
      iii) Once purge acquires MDL, it should use the SQL table handle for all
      the remaining virtual index for the purge record.
      
      purge_node_t: Introduce new virtual column information to know whether
      the MDL was acquired successfully.
      
      This is joint work with Marko Mäkelä.
      8b0d4cff
    • Marko Mäkelä's avatar
      MDEV-14188 mariabackup.incremental_encrypted wrong result · e3207b6c
      Marko Mäkelä authored
      Add an explicit redo log flush. In this test
      innodb_flush_log_at_trx_commit was 2 by default.
      It is also possible that this failure occurs because of MDEV-15740.
      e3207b6c
  9. 05 Jul, 2018 6 commits
  10. 02 Jul, 2018 1 commit
  11. 01 Jul, 2018 2 commits
    • 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
    • Vladislav Vaintroub's avatar
      amend fix for MDEV-16596 - do not use CREATE_NEW flag when reopening redo log file. · b71c9ae0
      Vladislav Vaintroub authored
      use OPEN_ALWAYS instead, since we know file already exist.
      b71c9ae0
  12. 30 Jun, 2018 1 commit
    • Vladislav Vaintroub's avatar
      MDEV-16596 : Windows - redo log does not work on native 4K sector disks. · c612a1e7
      Vladislav Vaintroub authored
      Disks with native 4K sectors need 4K alignment and size for  unbuffered IO
      (i.e for files opened with FILE_FLAG_NO_BUFFERING)
      
      Innodb opens redo log with FILE_FLAG_NO_BUFFERING, however it always does
      512byte IOs. Thus, the IO on 4K native sectors will fail, rendering
      Innodb non-functional.
      
      The fix is to check whether OS_FILE_LOG_BLOCK_SIZE is multiple of logical
      sector size, and if it is not, reopen the redo log without
      FILE_FLAG_NO_BUFFERING flag.
      c612a1e7
  13. 28 Jun, 2018 6 commits