1. 12 Mar, 2019 7 commits
    • Sergei Golubchik's avatar
      MDEV-15945 --ps-protocol does not test some queries · a62e9a83
      Sergei Golubchik authored
      Make mysqltest to use --ps-protocol more
      
      use prepared statements for everything that server supports
      with the exception of CALL (for now).
      
      Fix discovered test failures and bugs.
      
      tests:
      * PROCESSLIST shows Execute state, not Query
      * SHOW STATUS increments status variables more than in text protocol
      * multi-statements should be avoided (see tests with a wrong delimiter)
      * performance_schema events have different names in --ps-protocol
      * --enable_prepare_warnings
      
      mysqltest.cc:
      * make sure run_query_stmt() doesn't crash if there's
        no active connection (in wait_until_connected_again.inc)
      * prepare all statements that server supports
      
      protocol.h
      * Protocol_discard::send_result_set_metadata() should not send
        anything to the client.
      
      sql_acl.cc:
      * extract the functionality of getting the user for SHOW GRANTS
        from check_show_access(), so that mysql_test_show_grants() could
        generate the correct column names in the prepare step
      
      sql_class.cc:
      * result->prepare() can fail, don't ignore its return value
      * use correct number of decimals for EXPLAIN columns
      
      sql_parse.cc:
      * discard profiling for SHOW PROFILE. In text protocol it's done in
        prepare_schema_table(), but in --ps it is called on prepare only,
        so nothing was discarding profiling during execute.
      * move the permission checking code for SHOW CREATE VIEW to
        mysqld_show_create_get_fields(), so that it would be called during
        prepare step too.
      * only set sel_result when it was created here and needs to be
        destroyed in the same block. Avoid destroying lex->result.
      * use the correct number of tables in check_show_access(). Saying
        "as many as possible" doesn't work when first_not_own_table isn't
        set yet.
      
      sql_prepare.cc:
      * use correct user name for SHOW GRANTS columns
      * don't ignore verbose flag for SHOW SLAVE STATUS
      * support preparing REVOKE ALL and ROLLBACK TO SAVEPOINT
      * don't ignore errors from thd->prepare_explain_fields()
      * use select_send result for sending ANALYZE and EXPLAIN, but don't
        overwrite lex->result, because it might be needed to issue execute-time
        errors (select_dumpvar - too many rows)
      
      sql_show.cc:
      * check grants for SHOW CREATE VIEW here, not in mysql_execute_command
      
      sql_view.cc:
      * use the correct function to check privileges. Old code was doing
        check_access() for thd->security_ctx, which is invoker's sctx,
        not definer's sctx. Hide various view related errors from the invoker.
      
      sql_yacc.yy:
      * initialize lex->select_lex for LOAD, otherwise it'll contain garbage
        data that happen to fail tests with views in --ps (but not otherwise).
      a62e9a83
    • Sergei Golubchik's avatar
      cleanup: misc · 22f1cf92
      Sergei Golubchik authored
      22f1cf92
    • Sergei Golubchik's avatar
      pass the slow logging information in thd->query_plan_flags · dda2e940
      Sergei Golubchik authored
      This solves the following issues:
      
      * unlike lex->m_sql_cmd and lex->sql_command, thd->query_plan_flags
        is not reset in Prepared_statement::execute, it survives
        till the log_slow_statement(), so slow logging behaves correctly in --ps
      
      * using thd->query_plan_flags for both slow_log_filter and
        log_slow_admin_statements means the definition of "admin" statements
        for the slow log is the same no matter how it is filtered out.
      dda2e940
    • Oleksandr Byelkin's avatar
      bc8ae50e
    • Oleksandr Byelkin's avatar
      MDEV-11975: SQLCOM_PREPARE of EXPLAIN & ANALYZE statement do not return correct metadata info · 83123412
      Oleksandr Byelkin authored
      Added metadate info after prepare EXPLAIN/ANALYZE.
      83123412
    • Oleksandr Byelkin's avatar
      MDEV-11966: Impossible to execute prepared ANALYZE SELECT · 01c49e66
      Oleksandr Byelkin authored
      Prepare os ANALYZE now respond as EXPLAIN.
      01c49e66
    • Marko Mäkelä's avatar
      MDEV-18749: Fix GCC -flifetime-dse · 32de60bb
      Marko Mäkelä authored
      row_merge_create_fts_sort_index(): Initialize dict_col_t in
      an unambiguous way. GCC 6 and later appear to be able to optimize
      away the memset() that is part of mem_heap_zalloc() in the
      placement new call. Let us avoid using placement new in order
      to ensure that the objects will actually be initialized.
      
      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71388
      
      https://gcc.gnu.org/ml/gcc/2016-02/msg00207.html
      
      While the latter reference hints that the optimization is only
      applicable to non-POD types (and dict_col_t does not define
      any member functions before 10.2), it is most consistent to
      use the same initialization across all versions.
      32de60bb
  2. 11 Mar, 2019 4 commits
  3. 09 Mar, 2019 6 commits
  4. 08 Mar, 2019 2 commits
  5. 07 Mar, 2019 5 commits
  6. 06 Mar, 2019 7 commits
    • Sergei Golubchik's avatar
      ASAN loves stack, give it some · 84645366
      Sergei Golubchik authored
      fixes these test failures in ASAN builds (in 10.1 and 10.4):
      * main.signal_demo3
      * main.sp
      * sys_vars.max_sp_recursion_depth_func
      * mroonga/storage.foreign_key_delete_existent
      * mroonga/storage.foreign_key_delete_nonexistent
      * mroonga/storage.foreign_key_insert_existent
      * mroonga/storage.foreign_key_update_existent
      * mroonga/storage.foreign_key_update_nonexistent
      * mroonga/storage.function_command_auto-escape
      * mroonga/storage.function_command_select
      * mroonga/storage.variable_enable_operations_recording_insert
      84645366
    • Sergei Golubchik's avatar
      5ce6fb59
    • Alexander Barkov's avatar
      A cleanup for MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned off · 26f0d72a
      Alexander Barkov authored
      thd->lex->m_sql_cmd was not cleared between queries.
      log_slow_query() could crash (when running mtr --ps) because of this.
      26f0d72a
    • Marko Mäkelä's avatar
      MDEV-18637 Assertion `cache' failed in fts_init_recover_doc · 485dcb07
      Marko Mäkelä authored
      I know no test case for this bug in 10.1. So a test case will be
      committed separately in 10.2
      
      fts_reset_get_doc(): properly initialize fts_get_doc_t::cache
      485dcb07
    • Marko Mäkelä's avatar
      MDEV-18659: Revert a non-functional change · 4b5dc47f
      Marko Mäkelä authored
      fts_fetch_index_words(): Restore the initialization len=0.
      The test innodb_fts.create in 10.2 would end up in an infinite loop
      if this assignment is removed, because a following iteration of the
      while() loop would assign zip->zp->avail_in=len with the original value
      instead of the 0 that was reset in the previous iteration.
      4b5dc47f
    • Marko Mäkelä's avatar
      MDEV-18659: Fix string truncation/overflow in InnoDB and XtraDB · b7612116
      Marko Mäkelä authored
      Fix the warnings issued by GCC 8 -Wstringop-truncation
      and -Wstringop-overflow in InnoDB and XtraDB.
      
      This work is motivated by Jan Lindström. The patch mainly differs
      from his original one as follows:
      
      (1) We remove explicit initialization of stack-allocated string buffers.
      The minimum amount of initialization that is needed is a terminating
      NUL character.
      (2) GCC issues a warning for invoking strncpy(dest, src, sizeof dest)
      because if strlen(src) >= sizeof dest, there would be no terminating
      NUL byte in dest. We avoid this problem by invoking strncpy() with
      a limit that is 1 less than the buffer size, and by always writing
      NUL to the last byte of the buffer.
      (3) We replace strncpy() with memcpy() or strcpy() in those cases
      when the result is functionally equivalent.
      
      Note: fts_fetch_index_words() never deals with len==UNIV_SQL_NULL.
      This was enforced by an assertion that limits the maximum length
      to FTS_MAX_WORD_LEN. Also, the encoding that InnoDB uses for
      the compressed fulltext index is not byte-order agnostic, that is,
      InnoDB data files that use FULLTEXT INDEX are not portable between
      big-endian and little-endian systems.
      b7612116
    • Marko Mäkelä's avatar
      MDEV-18749: Uninitialized value upon ADD FULLTEXT INDEX · b21930fb
      Marko Mäkelä authored
      row_merge_create_fts_sort_index(): Initialize dict_col_t.
      
      This fixes an access to uninitialized dict_col_t::ind when a debug
      assertion in MariaDB 10.4 invokes is_dropped() in
      rec_get_converted_size_comp_prefix_low(). Older MariaDB versions
      seem to be unaffected by the uninitialized values, but it should
      not hurt to initialize everything.
      b21930fb
  7. 04 Mar, 2019 2 commits
  8. 01 Mar, 2019 1 commit
  9. 28 Feb, 2019 6 commits
    • Oleksandr Byelkin's avatar
      Increase the version · 2d347132
      Oleksandr Byelkin authored
      2d347132
    • Marko Mäkelä's avatar
      MDEV-18601 Can't create table with ENCRYPTED=DEFAULT when innodb_default_encryption_key_id!=1 · e39d6e0c
      Marko Mäkelä authored
      The problem with the InnoDB table attribute encryption_key_id is that it is
      not being persisted anywhere in InnoDB except if the table attribute
      encryption is specified and is something else than encryption=default.
      MDEV-17320 made it a hard error if encryption_key_id is specified to be
      anything else than 1 in that case.
      
      Ideally, we would always persist encryption_key_id in InnoDB. But, then we
      would have to be prepared for the case that when encryption is being enabled
      for a table whose encryption_key_id attribute refers to a non-existing key.
      
      In MariaDB Server 10.1, our best option remains to not store anything
      inside InnoDB. But, instead of returning the error that MDEV-17320
      introduced, we should merely issue a warning that the specified
      encryption_key_id is going to be ignored if encryption=default.
      
      To improve the situation a little more, we will issue a warning if
      SET [GLOBAL|SESSION] innodb_default_encryption_key_id is being set
      to something that does not refer to an available encryption key.
      
      Starting with MariaDB Server 10.2, thanks to MDEV-5800, we could open the
      table definition from InnoDB side when the encryption is being enabled,
      and actually fix the root cause of what was reported in MDEV-17320.
      e39d6e0c
    • Oleksandr Byelkin's avatar
      Merge branch '5.5' into 10.0 · 7b5c6385
      Oleksandr Byelkin authored
      7b5c6385
    • Oleksandr Byelkin's avatar
      MDEV-17055: Server crashes in find_order_in_list upon 2nd (3rd) execution of SP with UPDATE · cb11b3fb
      Oleksandr Byelkin authored
      1. Always drop merged_for_insert flag on cleanup (there could be errors which prevent TABLE to be assigned)
      2. Make more precise cleanup of select parts which was touched
      cb11b3fb
    • Alexander Barkov's avatar
      A cleanup in derived table handling: removing duplicate code from st_select_lex::handle_derived() · 0ad598a0
      Alexander Barkov authored
      st_select_lex::handle_derived() and mysql_handle_list_of_derived() had
      exactly the same implementations.
      
      - Adding a new method LEX::handle_list_of_derived() instead
      - Removing public function mysql_handle_list_of_derived()
      - Reusing LEX::handle_list_of_derived() in st_select_lex::handle_derived()
      0ad598a0
    • Jan Lindström's avatar
      MDEV-18265: Replace deprecated variable debug to debug_dbug on Galera tests · 622e9e8a
      Jan Lindström authored
      Replaced debug to debug_dbug on 10.1 on galera suite. Nothing to do
      in wsrep and galera_3nodes suites.
      622e9e8a