1. 17 May, 2018 7 commits
  2. 16 May, 2018 5 commits
    • Monty's avatar
      MDEV-14669 Assertion `file->trn == trn' failed in ha_maria::start_stmt · c2352c45
      Monty authored
      Can't repeat issue so I just added the test case
      c2352c45
    • Alexander Barkov's avatar
      Token precedence cleanup in *.yy · 48d70388
      Alexander Barkov authored
      We'll be fixing soon shift-reduce conflicts introduced in the new
      10.3 syntax (see MDEV-15818 for details) by defining precedence for
      a number of tokens (e.g. TIMESTAMP, TRANSACTION_SYM, TEXT_STRING)
      and adding "%prec" directives.
      
      Before doing this, it's better to have the existing precedences set properly,
      for easier readability and maintainability.
      
      Details:
      - Changing precedence of NOT to its proper position (between AND and IS).
        It was wrong. It worked fine only because the relevant grammar reside
        in different separate rules (expr and predicate).
      
      - Moving NOT2_SYM and BINARY to the same line with NEG and ~
        It worked fine because operators !, BINARY, ~ do not conflict
        to each other.
      
      - Fixing associativity of NOT_SYM, NOT2_SYM, BINARY, COLLATE_SYM
        from "right" to "left". They are not dyadic (operate on a single expression
        only). So "%left" or "%right" is needed only to set precedence,
        while associativity does not matter.
        Note, it would be better to use "%precedence" for these tokens
        instead of "%left" though, but we use an old version of Bison on windows,
        which may not support %precedence yet.
      
      This patch does not change behavior. The generated sql_yacc.cc and
      sql_yacc_ora.cc are exactly the same before and after this change.
      48d70388
    • Alexander Barkov's avatar
    • Marko Mäkelä's avatar
      MDEV-16168: Resurrect the record MLOG_UNDO_INIT · 66360506
      Marko Mäkelä authored
      While the record type MLOG_UNDO_INIT feels redundant, it does save
      redo log volume, and subtle changes to redo log volume appear to
      make a big difference for the log_sys.mutex contention.
      
      trx_undo_parse_page_init(): Allow type==0, which is what we write
      since MDEV-12288. Parse type in a simpler way; it always was written
      as a single byte.
      
      trx_undo_page_init(): Write a MLOG_UNDO_INIT record.
      66360506
    • Alexey Botchkov's avatar
      MDEV-15813 ASAN use-after-poison in hp_hashnr upon HANDLER READ on a versioned HEAP table. · a639eff5
      Alexey Botchkov authored
      Check index capabilities before executing HANDLER READ command.
      a639eff5
  3. 15 May, 2018 16 commits
    • Marko Mäkelä's avatar
      MDEV-16159 Use atomic memory access for purge_sys · cd15e764
      Marko Mäkelä authored
      Thanks to Sergey Vojtovich for feedback and many ideas.
      
      purge_state_t: Remove. The states are replaced with
      purge_sys_t::enabled() and purge_sys_t::paused() as follows:
      PURGE_STATE_INIT, PURGE_STATE_EXIT, PURGE_STATE_DISABLED: !enabled().
      PURGE_STATE_RUN, PURGE_STATE_STOP: paused() distinguishes these.
      
      purge_sys_t::m_paused: Renamed from purge_sys_t::n_stop.
      Protected by atomic memory access only, not purge_sys_t::latch.
      
      purge_sys_t::m_enabled: An atomically updated Boolean that
      replaces purge_sys_t::state.
      
      purge_sys_t::running: Remove, because it duplicates
      srv_sys.n_threads_active[SRV_PURGE].
      
      purge_sys_t::running(): Accessor for srv_sys.n_threads_active[SRV_PURGE].
      
      purge_sys_t::stop(): Renamed from trx_purge_stop().
      
      purge_sys_t::resume(): Renamed from trx_purge_run().
      Do not acquire latch; solely rely on atomics.
      
      purge_sys_t::is_initialised(), purge_sys_t::m_initialised: Remove.
      
      purge_sys_t::create(), purge_sys_t::close(): Instead of invoking
      is_initialised(), check whether event is NULL.
      
      purge_sys_t::event: Move before latch, so that fields that are
      protected by latch can reside on the same cache line with latch.
      
      srv_start_wait_for_purge_to_start(): Merge to the only caller srv_start().
      cd15e764
    • Marko Mäkelä's avatar
      MDEV-16172 Remove InnoDB 5.7 version number from MariaDB 10.3 onwards · 442a6e6b
      Marko Mäkelä authored
      Because the InnoDB implementation in MariaDB has diverged from MySQL,
      it is not meaningful to report a MySQL version number for InnoDB
      any more. Some examples include:
      
      MariaDB 10.1 (which is based on MySQL 5.6) included encryption and
      variable-size page compression before MySQL 5.7 introduced them.
      MariaDB 10.2 (based on MySQL 5.7) introduced persistent AUTO_INCREMENT
      (MDEV-6076) in a GA release before MySQL 8.0.
      MariaDB 10.3 (based on MySQL 5.7) introduced instant ADD COLUMN
      (MDEV-11369) before MySQL.
      
      All of these features use a different implementation and file format.
      Also, some features were never merged from MySQL 5.7, and thus MariaDB
      is not affected by related bugs. Examples include CREATE TABLESPACE
      and the reimplementation of the partitioning engine.
      442a6e6b
    • Marko Mäkelä's avatar
      MDEV-16143 Assertion failure in rec_offs_get_n_alloc() due to row_trx_id_offset() · 27f12c5d
      Marko Mäkelä authored
      row_trx_id_offset(): Add the missing rec_offs_init() call.
      This was broken by commit 97e51d24.
      27f12c5d
    • Marko Mäkelä's avatar
      MDEV-16169 InnoDB: Failing assertion: !space->referenced() · 93b69825
      Marko Mäkelä authored
      Before invoking fil_space_t::acquire(), check space->is_stopping()
      to ensure that the tablespace actually is accessible. This fixes
      a regression introduced by MDEV-15983.
      
      fil_space_next(): Remove some duplicated code for prev_space==NULL,
      and check is_stopping() also on the first tablespace.
      
      i_s_tablespaces_encryption_fill_table(),
      i_s_tablespaces_scrubbing_fill_table(): Check is_stopping().
      93b69825
    • Marko Mäkelä's avatar
      Correct a comment · 2b812abd
      Marko Mäkelä authored
      2b812abd
    • Oleksandr Byelkin's avatar
      dd0e960f
    • Alexander Barkov's avatar
      Removing redundant "%left INTERVAL_SYM" and "%prec INTERVAL_SYM" · 2e0c23d8
      Alexander Barkov authored
      These directives did not have any affect.
      
      All these affected lines:
      
      1.  | INTERVAL_SYM expr interval '+' expr
      
      2.  | INTERVAL_SYM '(' expr ',' expr ')'
      
      3.  | INTERVAL_SYM '(' expr ',' expr ',' expr_list ')'
      
      4.  | DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
      
      5.  | DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
      
      define the grammar unambiguously.
      
      "bison -v sql_yacc.yy" produces exactly the same sql_yacc.output
      before and after the change.
      2e0c23d8
    • Sergei Petrunia's avatar
      Revert the following patch brought in by "Merge pull request #753 from shinnok/10.3-macfixes" · 06f539da
      Sergei Petrunia authored
      It caused compile failures:
      
      commit 6620fbd6
      Author: Teodor Mircea Ionita <teodor@mariadb.org>
      Date:   Thu May 10 12:23:35 2018 +0300
      
          MDEV-15778: On macOS pthread_t is opaque, requires explicit cast
      
          On macOS pthread id is a pointer to struct _opaque_pthread_t type,
          requires explicit cast to ulint which in turn is size_t;
          Was failing with Clang 9.1.0 Debug build on macOS 10.13.4:
      
          sync0policy.h:53:4: error: cannot initialize a member subobject of type 'ulint'
          (aka 'unsigned long') with an rvalue of type 'os_thread_id_t' (aka '_opaque_pthread_t *')
          m_thread_id(os_thread_id_t(ULINT_UNDEFINED))
                                  ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          sync0policy.h:79:4: error: cannot initialize a parameter of type 'int64' (aka 'long long') with
          an rvalue of type 'os_thread_id_t' (aka '_opaque_pthread_t *')
          my_atomic_storelint(&m_thread_id, os_thread_get_curr_id());
      06f539da
    • Oleksandr Byelkin's avatar
      MDEV-15576: Server crashed in Cached_item_str::cmp / sortcmp or Assertion... · 0dd1ebcb
      Oleksandr Byelkin authored
      MDEV-15576: Server crashed in Cached_item_str::cmp / sortcmp or Assertion `item->null_value' failed in Type_handler_temporal_result::make_sort_key upon SELECT with NULLIF and ROLLUP
      
      Fixed null_value processing and is_null() usage.
      0dd1ebcb
    • Monty's avatar
      MDEV-16170 Server crashes in Item_null_result::type_handler on SELECT with ROLLUP · 8a9048bc
      Monty authored
      Problem was that I in a previous patch enabled ifdef:ed code intended for
      10.3 but that never worked.
      
      Reverted to original code
      8a9048bc
    • Monty's avatar
      MDEV-654 Assertion `share->now_transactional' failed in flush_log_for_bitmap... · e7fc8cd6
      Monty authored
      MDEV-654 Assertion `share->now_transactional' failed in flush_log_for_bitmap on concurrent workload with Aria tables
      
      I was able to repeat the problem with old version of randgen
      
      Reason for crash:
      
      - It's not safe to change share->now_transactional if there are changed
      bitmaps in the pagecache as flushing these can cause redo-entries and
      the bitmap flush code checks that share->now_transactional is set.
      
      Fixed by flushing bitmaps in _ma_tmp_disable_logging_for_table() before
      we set share->now_transactional to 0
      e7fc8cd6
    • Alexey Botchkov's avatar
      MDEV-15465 Server crash or ASAN heap-use-after-free in... · e06c0298
      Alexey Botchkov authored
      MDEV-15465 Server crash or ASAN heap-use-after-free in Item_func_match::cleanup upon using FT search with partitioning.
      
      Partition engine FT keys are implemented in such a way that
      the FT function's cleanup() methods use table's internals.
      So calling them after close_thread_tables is unsafe.
      e06c0298
    • Sergei Petrunia's avatar
      Merge pull request #753 from shinnok/10.3-macfixes · a0048378
      Sergei Petrunia authored
      MDEV-15778: 10.3 macOS build fixes
      a0048378
    • Sachin Setiya's avatar
      MDEV-15965 Invisible columns and LOAD DATA don't work well together:... ER_WARN_TOO_FEW_RECORDS · 9ee5406e
      Sachin Setiya authored
      Fix mysql_load iterator to skip invisible fields.
      9ee5406e
    • Alexander Barkov's avatar
      MDEV-16094 Crash when using AS OF with a stored function · 46be3198
      Alexander Barkov authored
      MDEV-16100 FOR SYSTEM_TIME erroneously resolves string user variables as transaction IDs
      
      Problem:
      
      Vers_history_point::resolve_unit() tested item->result_type() before
      item->fix_fields() was called.
      
      - Item_func_get_user_var::result_type() returned REAL_RESULT by default.
        This caused MDEV-16100.
      - Item_func_sp::result_type() crashed on assert.
        This caused MDEV-16094
      
      Changes:
      1. Adding item->fix_fields() into Vers_history_point::resolve_unit()
         before using data type specific properties of the history point
         expression.
      
      2. Adding a new virtual method Type_handler::Vers_history_point_resolve_unit()
      
      3. Implementing type-specific
         Type_handler_xxx::Type_handler::Vers_history_point_resolve_unit()
          in the way to:
          a. resolve temporal and general purpose string types to TIMESTAMP
          b. resolve BIT and general purpose INT types to TRANSACTION
          c. disallow use of non-relevant data type expressions in FOR SYSTEM_TIME
      
          Note, DOUBLE and DECIMAL data types are disallowed intentionally.
          - DOUBLE does not have enough precision to hold huge BIGINT UNSIGNED values
          - DECIMAL rounds on conversion to INT
          Both lack of precision and rounding might potentionally lead to
          very unpredictable results when a wrong transaction ID would be chosen.
          If one really wants dangerous use of DOUBLE and DECIMAL, explicit CAST
          can be used:
      
            FOR SYSTEM_TIME AS OF CAST(double_or_decimal AS UNSIGNED)
      
          QQ: perhaps DECIMAL(N,0) could still be allowed.
      
      4. Adding a new virtual method Item::type_handler_for_system_time(),
         to make HEX hybrids and bit literals work as TRANSACTION rather
         than TIMESTAMP.
      
      5. sql_yacc.yy: replacing the rule temporal_literal to "TIMESTAMP TEXT_STRING".
         Other temporal literals now resolve to TIMESTAMP through the new
         Type_handler methods. No special grammar needed. This removed
         a few shift/resolve conflicts.
         (TIMESTAMP related conflicts in "history_point:" will be removed separately)
      
      6. Removing the "timestamp_only" parameter from
         vers_select_conds_t::resolve_units() and Vers_history_point::resolve_unit().
         It was a hint telling that a table did not have any TRANSACTION-aware
         system time columns, so it's OK to resolve to TIMESTAMP in case of uncertainty.
         In the new reduction it works as follows:
         - the decision between TIMESTAMP and TRANSACTION is first made
           based only on the expression data type only
         - then, in case if the expression resolved to TRANSACTION, the table
           is checked if TRANSACTION-aware columns really exist.
         This way is safer against possible ALTER TABLE statements changing
         ROW START and ROW END columns from "BIGINT UNSIGNED" to "TIMESTAMP(x)"
         or the other way around.
      46be3198
    • Igor Babaev's avatar
      Adjusted test results after mdev-15159. · 1b45ede6
      Igor Babaev authored
      1b45ede6
  4. 14 May, 2018 7 commits
  5. 12 May, 2018 5 commits