1. 10 May, 2018 2 commits
    • Alexander Barkov's avatar
    • Alexander Barkov's avatar
      MDEV-16117 SP with a single FOR statement creates but further fails to load · fc63c1e1
      Alexander Barkov authored
      The code in the "sp_tail" rule in sql_yacc.yy always
      used YYLIP->get_cpp_tok_start() as the start of the body,
      and did not check for possible lookahead which happens
      for keywords "FOR", "VALUES" and "WITH" for LALR(2)
      resolution in Lex_input_stream::lex_token().
      
      In case of the lookahead token presence,
      get_tok_start_prev() should have been used instead
      of get_cpp_tok_start() as the beginning of the SP body.
      
      Change summary:
      
      This patch hides the implementation of the lookahead
      token completely inside Lex_input_stream.
      The users of Lex_input_stream now just get token-by-token
      transparently and should not care about lookahead any more.
      Now external users of Lex_input_stream
      are not aware of the lookahead token at all.
      
      Change details:
      
      - Moving Lex_input_stream::has_lookahead() into the "private" section.
      
      - Removing Lex_input_stream::get_tok_start_prev() and
        Lex_input_stream::get_cpp_start_prev().
      
      - Fixing the external code to call get_tok_start() and get_cpp_tok_start()
        in all places where get_tok_start_prev() and get_cpp_start_prev()
        where used.
      
      - Adding a test for has_lookahead() right inside
        get_tok_start() and get_cpp_tok_start().
        If there is a lookahead token, these methods now
        return the position of the previous token automatically:
      
         const char *get_tok_start()
         {
           return has_lookahead() ? m_tok_start_prev : m_tok_start;
         }
      
         const char *get_cpp_tok_start()
         {
          return has_lookahead() ? m_cpp_tok_start_prev : m_cpp_tok_start;
         }
      
      - Fixing the internal code inside Lex_input_stream methods
        to use m_tok_start and m_cpp_tok_start directly,
        instead of calling get_tok_start() and get_cpp_tok_start(),
        to make sure to access to the *current* token position
        (independently of a lookahead token presence).
      fc63c1e1
  2. 09 May, 2018 9 commits
    • Jacob Mathew's avatar
      MDEV-15697: Remote user used by Spider needs SUPER privilege · 8b087c63
      Jacob Mathew authored
      The remote users need the SUPER privilege because by default Spider sends a
      'SET SQL_LOG_OFF' statement to the data nodes.  This is controlled by the
      spider_internal_sql_log_off configuration setting on the Spider node, which
      can only be set to 0 or 1, with a default value of 1.
      
      I have fixed the problem by changing this configuration setting so that if it
      is NOT SET, which is the most likely case, the Spider node DOES NOT SEND the
      'SET SQL_LOG_OFF' statement to the data nodes.  However if the
      spider_internal_sql_log_off setting IS EXPLICITLY SET to either 0 or 1, then
      the Spider node DOES SEND the 'SET SQL_LOG_OFF' statement, requiring a remote
      user with the SUPER privilege.  The Spider documentation will be updated to
      reflect this change.
      
      Author:
        Jacob Mathew.
      
      Reviewer:
        Kentoku Shiba.
      
      Merged:
        Branch bb-10.3-MDEV-15697 into 10.3
      8b087c63
    • Marko Mäkelä's avatar
      Rename a test (fix merge error) · 85ccdd9f
      Marko Mäkelä authored
      85ccdd9f
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-16125 Crash or ASAN heap-buffer-overflow in... · d94a9553
      Thirunarayanan Balathandayuthapani authored
      MDEV-16125 Crash or ASAN heap-buffer-overflow in mach_read_from_n_little_endian upon ALTER TABLE with blob
      
      - Virtual column should be considered only to find the respective non-null fields.
      But virtual column can never changed from NULL to NOT NULL.
      d94a9553
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · e9f26097
      Marko Mäkelä authored
      e9f26097
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-16125 Shutdown crash when innodb_force_recovery >= 2 · fe95cb2e
      Thirunarayanan Balathandayuthapani authored
      Problem:
      =======
      InnoDB master thread encounters the shutdown state as SRV_SHUTDOWN_FLUSH_PHASE
      when innodb_force_recovery >=2 and slow scheduling of master thread during
      shutdown.
      
      Fix:
      ====
      There is no need for master thread itself if innodb_force_recovery >=2.
      Don't create the master thread if innodb_force_recovery >= 2
      fe95cb2e
    • Marko Mäkelä's avatar
      9be99dac
    • Marko Mäkelä's avatar
      MDEV-15916 Change buffer crash during TRUNCATE or DROP TABLE · 0ea625b3
      Marko Mäkelä authored
      ibuf_restore_pos(): Do not issue any messages if the tablespace
      is being dropped or truncated. In MariaDB 10.2, TRUNCATE TABLE
      would not change the tablespace ID, and therefore the tablespace
      would be found, even though TRUNCATE is in progress.
      
      Furthermore, do not commit suicide if restoring the change buffer
      cursor fails. The worst that could happen is that a secondary index
      becomes corrupted due to incomplete change buffer merge.
      0ea625b3
    • Igor Babaev's avatar
      MDEV-16104 Server crash in JOIN::fix_all_splittings_in_plan · fc0f5adb
      Igor Babaev authored
      upon select with view and subqueries
      
      This bug occurred when a splittable materialized derived/view
      were used inside another splittable materialized derived/view.
      The bug happened because the function JOIN::fix_all_splittings_in_plan()
      was called at the very beginning of the optimization phase 2 at
      the moment when the plan structure of the embedding derived/view
      were not valid. The proper position for this call is the very
      end of the optimization phase 1.
      fc0f5adb
    • Daniel Black's avatar
  3. 08 May, 2018 7 commits
  4. 07 May, 2018 9 commits
    • Igor Babaev's avatar
    • Monty's avatar
      Added test case for MDEV-13007 ALTER .. ENGINE on temporary sequence may go wrong · bd09c5ca
      Monty authored
      Looks like the bug was fixed some time ago (at least I can't repeat it).
      I added the test case just have this case tested properly.
      bd09c5ca
    • Daniel Black's avatar
      mysys: disable "optimized" memcpy from 18 years ago · d405bee0
      Daniel Black authored
      MDEV-15843 mysys: remove optimized memcpy from 18 years ago
      
      While this code has remained dormant for 18 years, libc implementers
      have used assembly features to gain improvements using achitecture
      features optimized and by the buffer length like:
      * https://svnweb.freebsd.org/base/head/lib/libc/amd64/string/memcmp.S
      * https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/aarch64/memcmp.S
      * https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/powerpc64/memcpy.S
      
      From an sysbench-1.0.6 oltp_read_only test on binary charset table:
      
      x86_64:
      was ptr_compare_0:
      perf report -g --no-children:
      +    3.37%  mysqld   mysqld               [.] hp_rec_hashnr
      +    3.15%  mysqld   libc-2.26.so         [.] __memmove_avx_unaligned_erms
      +    2.73%  mysqld   mysqld               [.] row_search_mvcc
      +    1.97%  mysqld   mysqld               [.] rec_get_offsets_func
      +    1.24%  mysqld   mysqld               [.] ptr_compare_0
      +    1.14%  mysqld   mysqld               [.] my_qsort2
      
      After: __memcmp_avx2_movbe
      +    3.42%  mysqld   mysqld               [.] hp_rec_hashnr
      +    2.96%  mysqld   libc-2.26.so         [.] __memmove_avx_unaligned_erms
      +    2.91%  mysqld   mysqld               [.] row_search_mvcc
      +    2.13%  mysqld   mysqld               [.] rec_get_offsets_func
      +    1.18%  mysqld   libc-2.26.so         [.] __memcmp_avx2_movbe
      +    1.04%  mysqld   mysqld               [.] evaluate_join_record
      +    1.02%  mysqld   mysqld               [.] my_qsort2
      
      Power9:
      Before: ptr_compare_0
      +    4.24%  mysqld   mysqld               [.] _Z15row_search_mvccPh15page_cur_mode_tP14row_prebuilt_tmm
      +    2.18%  mysqld   mysqld               [.] hp_rec_hashnr
      +    2.07%  mysqld   mysqld               [.] _Z20rec_get_offsets_funcPKhPK12dict_index_tPmbmPP16mem_block_info_t
      +    1.60%  mysqld   mysqld               [.] _ZL20evaluate_join_recordP4JOINP13st_join_tablei
      +    1.20%  mysqld   mysqld               [.] _ZN11ha_innobase13general_fetchEPhjj
      +    1.05%  mysqld   mysqld               [.] _ZN17Item_func_between15val_int_cmp_intEv
      +    0.92%  mysqld   mysqld               [.] _Z40row_sel_field_store_in_mysql_format_funcPhPK17mysql_row_templ_tPKhm
      +    0.91%  mysqld   mysqld               [.] _ZNK10Item_param6PValue7val_intEPK19Type_std_attributes
      +    0.84%  mysqld   mysqld               [.] ptr_compare_0
      
      After: __memcmp_power8
      +    2.29%  mysqld           mysqld                  [.] _Z15row_search_mvccPh15page_cur_mode_tP14row_prebuilt_tmm
      +    1.32%  mysqld           mysqld                  [.] hp_rec_hashnr
      +    1.18%  swapper          [kernel.kallsyms]       [k] power_enter_stop
      +    1.12%  mysqld           mysqld                  [.] _Z20rec_get_offsets_funcPKhPK12dict_index_tPmbmPP16mem_block_info_t
      +    0.87%  mysqld           mysqld                  [.] _ZL20evaluate_join_recordP4JOINP13st_join_tablei
      +    0.87%  mysqld           [kernel.kallsyms]       [k] ___bpf_prog_run
      +    0.76%  mysqld           libc-2.26.so            [.] __memcmp_power8
      +    0.68%  mysqld           mysqld                  [.] _ZN11ha_innobase13general_fetchEPhjj
      +    0.58%  mysqld           mysqld                  [.] _ZN17Item_func_between15val_int_cmp_intEv
      d405bee0
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · 1a4c355a
      Marko Mäkelä authored
      1a4c355a
    • Marko Mäkelä's avatar
      MDEV-14825 Assertion `col->ord_part' in row_build_index_entry_low upon... · e44ca6cc
      Marko Mäkelä authored
      MDEV-14825 Assertion `col->ord_part' in row_build_index_entry_low upon ROLLBACK or DELETE with concurrent ALTER on partitioned table
      
      If creating a secondary index fails (typically, ADD UNIQUE INDEX fails
      due to duplicate key), it is possible that concurrently running UPDATE
      or DELETE will access the index stub and hit the debug assertion.
      
      It does not make any sense to keep updating an uncommitted index whose
      creation has failed.
      
      dict_index_t::is_corrupted(): Replaces dict_index_is_corrupted().
      Also take online_status into account.
      
      Replace some calls to dict_index_is_clust() with calls to
      dict_index_t::is_primary().
      e44ca6cc
    • Daniel Black's avatar
      sp_cache_package_routine: fix compile warning · 005d53f6
      Daniel Black authored
      (clang-3.8)
      sql/sp.cc:2834:53: warning: implicit conversion of NULL constant to 'size_t' (aka 'unsigned long') [-Wnull-conversion]
          size_t prefix_length= dot ? dot - tmp.str + 1 : NULL;
                 ~~~~~~~~~~~~~                            ^~~~
                                                          0
      005d53f6
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-13134 Introduce ALTER TABLE attributes ALGORITHM=NOCOPY and ALGORITHM=INSTANT · c5b28e55
      Thirunarayanan Balathandayuthapani authored
      Remove the warning for InnoDB rebuilding table to add column FTS_DOC_ID.
      c5b28e55
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-13134 Introduce ALTER TABLE attributes ALGORITHM=NOCOPY and ALGORITHM=INSTANT · 85cc6b70
      Thirunarayanan Balathandayuthapani authored
      Introduced new alter algorithm type called NOCOPY & INSTANT for
      inplace alter operation.
      
      NOCOPY - Algorithm refuses any alter operation that would
      rebuild the clustered index. It is a subset of INPLACE algorithm.
      
      INSTANT - Algorithm allow any alter operation that would
      modify only meta data. It is a subset of NOCOPY algorithm.
      
      Introduce new variable called alter_algorithm. The values are
      DEFAULT(0), COPY(1), INPLACE(2), NOCOPY(3), INSTANT(4)
      
      Message to deprecate old_alter_table variable and make it alias
      for alter_algorithm variable.
      
      alter_algorithm variable for slave is always set to default.
      85cc6b70
    • Daniel Black's avatar
      mtr: extend func_math (CRC32) · 97486599
      Daniel Black authored
      97486599
  5. 06 May, 2018 12 commits
  6. 04 May, 2018 1 commit