1. 04 Sep, 2020 8 commits
    • Marko Mäkelä's avatar
      Merge 10.4 into 10.5 · 5ff7e68c
      Marko Mäkelä authored
      5ff7e68c
    • Marko Mäkelä's avatar
      Merge 10.3 into 10.4 · 7f8cd326
      Marko Mäkelä authored
      7f8cd326
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · c5cb59ce
      Marko Mäkelä authored
      c5cb59ce
    • Marko Mäkelä's avatar
      MDEV-23651: Fix the Windows build · 1a3ce7e7
      Marko Mäkelä authored
      In the Microsoft environment, my_atomic requires int32.
      1a3ce7e7
    • Marko Mäkelä's avatar
      MDEV-23600 follow-up: uninitialized rec_field_is_prefix · c029d456
      Marko Mäkelä authored
      build_template_field(): Initialize templ->rec_field_is_prefix
      also for indexes on virtual columns. This was caught on 10.5 by
      MemorySanitizer as use-of-uninitialized-value in
      row_search_with_covering_prefix() when running the test
      main.fast_prefix_index_fetch_innodb.
      c029d456
    • Sergei Petrunia's avatar
      Fix a typo in the previous cset · 8c2909a2
      Sergei Petrunia authored
      8c2909a2
    • Marko Mäkelä's avatar
      MDEV-23633 fixup: Add missing semicolon · b0c194ca
      Marko Mäkelä authored
      b0c194ca
    • Marko Mäkelä's avatar
      MDEV-23633 MY_RELAX_CPU performs unnecessary compare-and-swap on ARM · 24f510bb
      Marko Mäkelä authored
      This follows up MDEV-14374, which was filed against MariaDB Server 10.3.
      Back then, on a 48-core Qualcomm Centriq 2400, the performance of
      delay loops for spinloops was tested both with and without the dummy
      compare-and-swap operation, and it was decided to keep the dummy
      operation.
      
      On target architectures where nothing special is available (other than
      x86 (IA-32, AMD64) or POWER), we perform a dummy compare-and-swap operation.
      This is contrary to the idea of the x86 PAUSE instruction and the
      __ppc_get_timebase(), which aim to keep the memory bus idle for a while,
      to allow other cores to better execute code while a spinloop is waiting
      for something to be changed.
      
      On MariaDB Server 10.4 and another implementation of the ARMv8 ISA,
      omitting the dummy compare-and-swap improved performance by up to 12%.
      So, let us avoid the dummy compare-and-swap on ARM.
      
      For now, we are retaining the dummy compare-and-swap on other ISAs
      (such as SPARC, MIPS, S390x, RISC-V) because we do not have any
      performance data for them.
      24f510bb
  2. 03 Sep, 2020 12 commits
    • Sergei Petrunia's avatar
      MDEV-23661: RocksDB produces "missing initializer for member" warnings · d63fcbc2
      Sergei Petrunia authored
      Add -Wno-missing-field-initializers for MyRocks and gcc version below 5.0
      d63fcbc2
    • Marko Mäkelä's avatar
      Merge 10.3 into 10.4 · 1cda462f
      Marko Mäkelä authored
      1cda462f
    • Marko Mäkelä's avatar
      Cleanup: Remove os0proc.* · 938db048
      Marko Mäkelä authored
      938db048
    • Marko Mäkelä's avatar
      Merge 10.3 into 10.4 · c9cf6b13
      Marko Mäkelä authored
      c9cf6b13
    • Sergei Petrunia's avatar
      Make rowid_filter_innodb test stable · b795adcf
      Sergei Petrunia authored
      It was failing on mac-1012-bintar.
      b795adcf
    • Marko Mäkelä's avatar
      MDEV-23651 InnoDB: Failing assertion: !space->referenced() · a7dd7c89
      Marko Mäkelä authored
      commit de942c9f (MDEV-15983)
      introduced a race condition that we inadequately fixed in
      commit 93b69825 (MDEV-16169).
      
      Because fil_space_t::release() or fil_space_t::acquire() are
      not protected by fil_system.mutex like their predecessors,
      it is possible that stop_new_ops was set between the time
      a thread checked fil_space_t::is_stopping() and invoked
      fil_space_t::acquire().
      
      In an execution trace, this happened in fil_system_t::keyrotate_next(),
      causing an assertion failure in fil_delete_tablespace()
      in the other thread that seeked to stop new operations.
      
      We fix this bug by merging the flag fil_space_t::stop_new_ops
      and the reference count fil_space_t::n_pending_ops into a
      single word that is only being accessed by atomic memory operations.
      
      fil_space_t::set_stopping(): Accessor for changing the state of
      the former stop_new_ops flag.
      
      fil_space_t::acquire(): Return whether the acquisition succeeded.
      It would fail between set_stopping(true) and set_stopping(false).
      a7dd7c89
    • Jan Lindström's avatar
      MDEV-21578 : CREATE OR REPLACE TRIGGER in Galera cluster not replicating · 33ae1616
      Jan Lindström authored
      In 10.3 OR REPLACE trigger option is part of create_info.
      33ae1616
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · c3752cef
      Marko Mäkelä authored
      c3752cef
    • Marko Mäkelä's avatar
      Merge 10.1 into 10.2 · 2a93e632
      Marko Mäkelä authored
      2a93e632
    • Marko Mäkelä's avatar
      MDEV-22387: Do not pass null pointer to some memcpy() · 94a520dd
      Marko Mäkelä authored
      Passing a null pointer to a nonnull argument is not only undefined
      behaviour, but it also grants the compiler the permission to optimize
      away further checks whether the pointer is null. GCC -O2 at least
      starting with version 8 may do that, potentially causing SIGSEGV.
      
      These problems were caught in a WITH_UBSAN=ON build with the
      Bug#7024 test in main.view.
      94a520dd
    • Marko Mäkelä's avatar
      MDEV-7110 follow-up fix: Do not pass NULL as nonnull parameter · a256070e
      Marko Mäkelä authored
      Passing a null pointer to the "%s" argument of a printf-like
      function is undefined behaviour. In the GNU libc implementation
      of the printf() family of functions, it happens to work.
      
      GCC 10.2.0 would diagnose this with -Wformat-overflow -Og.
      In -fsanitize=undefined (WITH_UBSAN=ON) builds, a runtime error
      would be generated. In some other builds, GCC 8 or later might infer
      that the parameter is nonnull and optimize away further checks whether
      the parameter is null, leading to SIGSEGV.
      a256070e
    • Alexander Barkov's avatar
      Part2: MDEV-23568 Improve performance of my_{time|date|datetime}_to_str() · 48ab5a49
      Alexander Barkov authored
      As an additional improvement, let's store string representations of
      the numbers using an array uint16[256] instead of char[512].
      This allows to use int2store(), which copies two bytes at a time on x86,
      instead of copying the two bytes with digits one-by-one.
      
      This change gives an additional 7% to 26% query time reduce for:
          SELECT BENCHMARK(10*1000*1000,CONCAT(TIME'10:20:30'));
          SELECT BENCHMARK(10*1000*1000,CONCAT(TIME'10:20:30.123456'));
          SELECT BENCHMARK(10*1000*1000,CONCAT(DATE'2001-01-01'));
          SELECT BENCHMARK(10*1000*1000,CONCAT(TIMESTAMP'2001-01-01 10:20:30'));
          SELECT BENCHMARK(10*1000*1000,CONCAT(TIMESTAMP'2001-01-01 10:20:30.123456'));
      
      The total time reduce (part1 + part2) is now between 15% to 38%
      for these queries.
      48ab5a49
  3. 02 Sep, 2020 5 commits
  4. 01 Sep, 2020 9 commits
  5. 31 Aug, 2020 6 commits
    • Andrei Elkin's avatar
      MDEV-16372 ER_BASE64_DECODE_ERROR upon replaying binary log via mysqlbinlog --verbose · feac078f
      Andrei Elkin authored
      (This commit is exclusively for 10.1 branch, do not merge it to upper ones)
      
      In case of a pattern of non-STMT_END-marked Rows-log-event (A) followed by
      a STMT_END marked one (B) mysqlbinlog mixes up the base64 encoded rows events
      with their pseudo sql representation produced by the verbose option:
            BINLOG '
              base64 encoded data for A
              ### verbose section for A
              base64 encoded data for B
              ### verbose section for B
            '/*!*/;
      In effect the produced BINLOG '...' query is not valid and is rejected with the error.
      Examples of this way malformed BINLOG could have been found in binlog_row_annotate.result
      that gets corrected with the patch.
      
      The issue is fixed with introduction an auxiliary IO_CACHE to hold on the verbose
      comments until the terminal STMT_END event is found. The new cache is emptied
      out after two pre-existing ones are done at that time.
      The correctly produced output now for the above case is as the following:
            BINLOG '
              base64 encoded data for A
              base64 encoded data for B
            '/*!*/;
              ### verbose section for A
              ### verbose section for B
      
      Thanks to Alexey Midenkov for the problem recognition and attempt to tackle,
      Venkatesh Duggirala who produced a patch for the upstream whose
      idea is exploited here, as well as to MDEV-23077 reporter LukeXwang who
      also contributed a piece of a patch aiming at this issue.
      
      Extra: mysqlbinlog_row_minimal refined to not produce mutable numeric values into the result file.
      feac078f
    • Andrei Elkin's avatar
      MDEV-16372 ER_BASE64_DECODE_ERROR upon replaying binary log via mysqlbinlog --verbose · caa35f8e
      Andrei Elkin authored
      (This commit is for 10.3 and upper branches)
      
      In case of a pattern of non-STMT_END-marked Rows-log-event (A) followed by
      a STMT_END marked one (B) mysqlbinlog mixes up the base64 encoded rows events
      with their pseudo sql representation produced by the verbose option:
            BINLOG '
              base64 encoded data for A
              ### verbose section for A
              base64 encoded data for B
              ### verbose section for B
            '/*!*/;
      In effect the produced BINLOG '...' query is not valid and is rejected with the error.
      Examples of this way malformed BINLOG could have been found in binlog_row_annotate.result
      that gets corrected with the patch.
      
      The issue is fixed with introduction an auxiliary IO_CACHE to hold on the verbose
      comments until the terminal STMT_END event is found. The new cache is emptied
      out after two pre-existing ones are done at that time.
      The correctly produced output now for the above case is as the following:
            BINLOG '
              base64 encoded data for A
              base64 encoded data for B
            '/*!*/;
              ### verbose section for A
              ### verbose section for B
      
      Thanks to Alexey Midenkov for the problem recognition and attempt to tackle,
      and to Venkatesh Duggirala who produced a patch for the upstream whose
      idea is exploited here, as well as to MDEV-23077 reporter LukeXwang who
      also contributed a piece of a patch aiming at this issue.
      caa35f8e
    • Andrei Elkin's avatar
      MDEV-16372 ER_BASE64_DECODE_ERROR upon replaying binary log via mysqlbinlog --verbose · 6112a0f9
      Andrei Elkin authored
      (This commit is exclusively for 10.2 branch. Do not merge it to 10.3)
      
      In case of a pattern of non-STMT_END-marked Rows-log-event (A) followed by
      a STMT_END marked one (B) mysqlbinlog mixes up the base64 encoded rows events
      with their pseudo sql representation produced by the verbose option:
            BINLOG '
              base64 encoded data for A
              ### verbose section for A
              base64 encoded data for B
              ### verbose section for B
            '/*!*/;
      In effect the produced BINLOG '...' query is not valid and is rejected with the error.
      Examples of this way malformed BINLOG could have been found in binlog_row_annotate.result
      that gets corrected with the patch.
      
      The issue is fixed with introduction an auxiliary IO_CACHE to hold on the verbose
      comments until the terminal STMT_END event is found. The new cache is emptied
      out after two pre-existing ones are done at that time.
      The correctly produced output now for the above case is as the following:
            BINLOG '
              base64 encoded data for A
              base64 encoded data for B
            '/*!*/;
              ### verbose section for A
              ### verbose section for B
      
      Thanks to Alexey Midenkov for the problem recognition and attempt to tackle,
      and to Venkatesh Duggirala who produced a patch for the upstream whose
      idea is exploited here, as well as to MDEV-23077 reporter LukeXwang who
      also contributed a piece of a patch aiming at this issue.
      6112a0f9
    • Oleksandr Byelkin's avatar
      MDEV-23094: Multiple calls to a Stored Procedure from another Stored Procedure crashes server · 0f080dd6
      Oleksandr Byelkin authored
      Added system-SELECT to IF/WHILE/REPET/FOR for correct subqueries connecting.
      
      Added control of system/usual selects for correct error detection.
      0f080dd6
    • Eugene Kosov's avatar
      fix clang build · 9bb17ecf
      Eugene Kosov authored
      FAILED: sql/CMakeFiles/sql.dir/sql_test.cc.o
      /home/kevgs/bin/clang++ -DHAVE_CONFIG_H -DHAVE_EVENT_SCHEDULER -DHAVE_POOL_OF_THREADS -DMYSQL_SERVER -D_FILE_OFFSET_BITS=64 -Iinclude -I../include -I../sql -Ipcre -I../pcre -I../zlib -Izlib -I../extra/yassl/include -I../extra/yassl/taocrypt/include -Isql -I../wsrep -O2 -fdiagnostics-color=always -fno-omit-frame-pointer -gsplit-dwarf -march=native -mtune=native -fPIC -fno-rtti -g -DENABLED_DEBUG_SYNC -ggdb3 -DSAFE_MUTEX -Wall -Wdeclaration-after-statement -Wextra -Wformat-security -Wno-init-self -Wno-null-conversion -Wno-unused-parameter -Wno-unused-private-field -Woverloaded-virtual -Wvla -Wwrite-strings -Werror   -DHAVE_YASSL -DYASSL_PREFIX -DHAVE_OPENSSL -DMULTI_THREADED -MD -MT sql/CMakeFiles/sql.dir/sql_test.cc.o -MF sql/CMakeFiles/sql.dir/sql_test.cc.o.d -o sql/CMakeFiles/sql.dir/sql_test.cc.o -c ../sql/sql_test.cc
      ../sql/sql_test.cc:390:20: error: '::' and '*' tokens forming pointer to member type are separated by whitespace [-Werror,-Wcompound-token-split-by-space]
      Item* (List<Item>:: *dbug_list_item_elem_ptr)(int)= &List<Item>::elem;
                       ~~^~
      ../sql/sql_test.cc:391:32: error: '::' and '*' tokens forming pointer to member type are separated by whitespace [-Werror,-Wcompound-token-split-by-space]
      Item_equal* (List<Item_equal>:: *dbug_list_item_equal_elem_ptr)(int)=
                                   ~~^~
      ../sql/sql_test.cc:393:32: error: '::' and '*' tokens forming pointer to member type are separated by whitespace [-Werror,-Wcompound-token-split-by-space]
      TABLE_LIST* (List<TABLE_LIST>:: *dbug_list_table_list_elem_ptr)(int) =
                                   ~~^~
      3 errors generated.
      9bb17ecf
    • Marko Mäkelä's avatar
      MDEV-20386 WITH_MSAN fails due to inline asm · 31e6c96b
      Marko Mäkelä authored
      In commit 94d0bb4d (MDEV-20377)
      we replaced some inline assembler code with calls to GCC-style
      builtin functions. These functions would only be available if
      the target allows SSE4.2 instructions to be used. Hence, the
      cmake -DWITH_MSAN=ON build would fail unless the default x86 (IA-32)
      or AMD64 target was overridden.
      
      It turns out that the problem can be solved by overriding the default
      target architecture for specific functions with the help of GCC function
      attributes.
      
      ut_crc32c_8(), ut_crc32c_64(): Use the compiler-builtin intrinsic
      functions. For GCC before 5, the header file <nmmintrin.h> does not
      really work, and we must keep using the compiler built-in functions.
      
      For the Microsoft compiler, we will keep using <intrin.h> because
      we will also need the definition of the __cpuid() function.
      On GCC and clang, we prefer to invoke inline assembler for that.
      
      Curiously, the inline assembler in has_sse4_2() or crc32_pclmul()
      is not causing any trouble for MSAN. Also, the inline assembler
      in WolfSSL appears to be fine now. Something might have changed
      between clang-8 and clang-10 (10.0.1).
      31e6c96b