1. 01 Jul, 2020 1 commit
    • Otto Kekäläinen's avatar
      Fix RocksDB detection of ZSTD · 2ed41576
      Otto Kekäläinen authored
      The library finder needs to have capitals in its name so that FIND_PACKAGE
      will load the correct finder and actually detect that libzstd is available.
      
      Without this change the CMake would just always silently skip ZSTD since
      it would never find it.
      
      Simplify Debian autopkgtest RocksDB part and make it more verbose so that
      future regressions like this are easier to debug.
      
      Also remove QUIET from the RocksDB FIND_PACKAGE call so that it is easier
      to read in build logs what libraries were detected. Also add missing
      underscores to error messages.
      2ed41576
  2. 27 Jun, 2020 4 commits
    • Kentoku SHIBA's avatar
      MDEV-18993 The keep-alive connection (set spider_conn_recycle_mode = 1) in... · c032c2ef
      Kentoku SHIBA authored
      MDEV-18993 The keep-alive connection (set spider_conn_recycle_mode = 1) in spider would cause cash in MariaDB (#1269)
      
      Fix the following valgrind error.
      
      ==94390== Thread 29:
      ==94390== Invalid read of size 8
      ==94390== at 0x78389D: thd_increment_bytes_sent (sql_class.cc:4265)
      ==94390== by 0xC8EC46: net_real_write (net_serv.cc:730)
      ==94390== by 0xC8E0C8: net_flush (net_serv.cc:383)
      ==94390== by 0xC8E4D0: net_write_command (net_serv.cc:521)
      ==94390== by 0xADCE61: cli_advanced_command (client.c:468)
      ==94390== by 0xAE3CAF: mysql_close_slow_part (client.c:3671)
      ==94390== by 0xAE3D28: mysql_close (client.c:3683)
      ==94390== by 0x149E69A8: spider_db_mbase::disconnect() (spd_db_mysql.cc:2217)
      ==94390== by 0x1491EA26: spider_db_disconnect(st_spider_conn*) (spd_db_conn.cc:297)
      ==94390== by 0x14948EBE: spider_free_conn_alloc(st_spider_conn*) (spd_conn.cc:196)
      ==94390== by 0x1494B26A: spider_free_conn(st_spider_conn*) (spd_conn.cc:1251)
      ==94390== by 0x1494941F: spider_free_conn_from_trx(st_spider_transaction*, st_spider_conn*, bool, bool, int*) (spd_conn.cc:315)
      ==94390== Address 0x1f0e0990 is 4,832 bytes inside a block of size 25,728 free'd
      ==94390== at 0x4C2ACBD: free (vg_replace_malloc.c:530)
      ==94390== by 0x13F5545: my_free (my_malloc.c:222)
      ==94390== by 0x6C75B7: ilink::operator delete(void*, unsigned long) (sql_list.h:618)
      ==94390== by 0x77B9F6: THD::~THD() (sql_class.cc:1724)
      ==94390== by 0x1494FCE0: spider_bg_conn_action(void*) (spd_conn.cc:2580)
      ==94390== by 0x4E3DDD4: start_thread (in /usr/lib64/libpthread-2.17.so)
      ==94390== by 0x5FBFEAC: clone (in /usr/lib64/libc-2.17.so)
      ==94390== Block was alloc'd at
      ==94390== at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
      ==94390== by 0x13F4DFA: my_malloc (my_malloc.c:101)
      ==94390== by 0x1491CF06: ilink::operator new(unsigned long) (sql_list.h:614)
      ==94390== by 0x1494F7FD: spider_bg_conn_action(void*) (spd_conn.cc:2501)
      ==94390== by 0x4E3DDD4: start_thread (in /usr/lib64/libpthread-2.17.so)
      ==94390== by 0x5FBFEAC: clone (in /usr/lib64/libc-2.17.so)
      ==94390== Invalid write of size 8
      ==94390== at 0x7838AF: thd_increment_bytes_sent (sql_class.cc:4265)
      ==94390== by 0xC8EC46: net_real_write (net_serv.cc:730)
      ==94390== by 0xC8E0C8: net_flush (net_serv.cc:383)
      ==94390== by 0xC8E4D0: net_write_command (net_serv.cc:521)
      ==94390== by 0xADCE61: cli_advanced_command (client.c:468)
      ==94390== by 0xAE3CAF: mysql_close_slow_part (client.c:3671)
      ==94390== by 0xAE3D28: mysql_close (client.c:3683)
      ==94390== by 0x149E69A8: spider_db_mbase::disconnect() (spd_db_mysql.cc:2217)
      ==94390== by 0x1491EA26: spider_db_disconnect(st_spider_conn*) (spd_db_conn.cc:297)
      ==94390== by 0x14948EBE: spider_free_conn_alloc(st_spider_conn*) (spd_conn.cc:196)
      ==94390== by 0x1494B26A: spider_free_conn(st_spider_conn*) (spd_conn.cc:1251)
      ==94390== by 0x1494941F: spider_free_conn_from_trx(st_spider_transaction*, st_spider_conn*, bool, bool, int*) (spd_conn.cc:315)
      ==94390== Address 0x1f0e0990 is 4,832 bytes inside a block of size 25,728 free'd
      ==94390== at 0x4C2ACBD: free (vg_replace_malloc.c:530)
      ==94390== by 0x13F5545: my_free (my_malloc.c:222)
      ==94390== by 0x6C75B7: ilink::operator delete(void*, unsigned long) (sql_list.h:618)
      ==94390== by 0x77B9F6: THD::~THD() (sql_class.cc:1724)
      ==94390== by 0x1494FCE0: spider_bg_conn_action(void*) (spd_conn.cc:2580)
      ==94390== by 0x4E3DDD4: start_thread (in /usr/lib64/libpthread-2.17.so)
      ==94390== by 0x5FBFEAC: clone (in /usr/lib64/libc-2.17.so)
      ==94390== Block was alloc'd at
      ==94390== at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
      ==94390== by 0x13F4DFA: my_malloc (my_malloc.c:101)
      ==94390== by 0x1491CF06: ilink::operator new(unsigned long) (sql_list.h:614)
      ==94390== by 0x1494F7FD: spider_bg_conn_action(void*) (spd_conn.cc:2501)
      ==94390== by 0x4E3DDD4: start_thread (in /usr/lib64/libpthread-2.17.so)
      ==94390== by 0x5FBFEAC: clone (in /usr/lib64/libc-2.17.so)
      c032c2ef
    • Eugene Kosov's avatar
      MDEV-19298 Assertion `space->id != 0xFFFFFFFEU || space ==... · e4cff9a8
      Eugene Kosov authored
      MDEV-19298 Assertion `space->id != 0xFFFFFFFEU || space == fil_system.temp_space' failed in Check::validate upon crash upgrade from 10.2.22
      
      This issue is pretty much the same as MDEV-20213.
      The fix is similar to:
      3c238ac5
      52c4abbf
      
      Check::validate(): fix a debug assertion
      
      SysTablespace::open_or_create(): protect assigning to a shared
      variable with a mutex
      e4cff9a8
    • Eugene Kosov's avatar
      MDEV-20213 binlog_encryption.binlog_incident failed in buildbot, server crashed in Check::validate · 52c4abbf
      Eugene Kosov authored
      follow up
      
      fil_system.sys_space is a shared variable between the thread
      which assigns a value to it, and the thread which does Check::validate()
      
      SysTablespace::open_or_create(): protect a shared variable with
      a mutex to avoid any data race surprises.
      52c4abbf
    • Eugene Kosov's avatar
      MDEV-20213 binlog_encryption.binlog_incident failed in buildbot, server crashed in Check::validate · 3c238ac5
      Eugene Kosov authored
      Check::validate(): Relax a debug assertion. TRX_SYS_SPACE fil_space_t
      can be created and became visible to this assertion before
      fil_system.sys_space becomes initialized
      3c238ac5
  3. 23 Jun, 2020 1 commit
    • Sergei Petrunia's avatar
      MDEV-22866: Crash in join optimizer with constant outer join nest · 69727355
      Sergei Petrunia authored
      Starting from 10.3, the optimizer is able to detect that entire outer join
      nests are constants (because of "Impossible ON") and remove them (see
      mark_join_nest_as_const)
      
      However, this was not properly accounted for in NESTED_JOIN structure
      and the way check_interleaving_with_nj() uses its n_tables member to
      check if the join prefix order is allowed.
      
      (The result was that the optimizer could conclude that no join prefix is
      allowed and fail an assertion)
      69727355
  4. 22 Jun, 2020 1 commit
  5. 16 Jun, 2020 3 commits
  6. 14 Jun, 2020 2 commits
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · 32b34cb9
      Marko Mäkelä authored
      32b34cb9
    • Marko Mäkelä's avatar
      MDEV-22889: Disable innodb.innodb_force_recovery_rollback · 2cd6afb0
      Marko Mäkelä authored
      The test case that was added for MDEV-21217
      (commit b68f1d84)
      should have only two possible outcomes for the locking SELECT statement:
      
      (1) The statement is blocked, and the test will eventually fail
      with a lock wait timeout. This is what I observed when the
      code fix for MDEV-21217 was missing.
      
      (2) The lock conflict will ensure that the statement will execute
      after the rollback has completed, and an empty table will be observed.
      This is the expected outcome with the recovery fix.
      
      What occasionally happens (in some of our CI environments only, so far)
      is that the locking SELECT will return all 1,000 rows of the table that
      had been inserted by the transaction that was never supposed to be
      committed. One possibility is that the transaction was unexpectedly
      committed when the server was killed.
      
      Let us disable the test until the reason of the failure has been
      determined and addressed.
      2cd6afb0
  7. 13 Jun, 2020 3 commits
  8. 12 Jun, 2020 1 commit
  9. 11 Jun, 2020 3 commits
  10. 10 Jun, 2020 5 commits
  11. 09 Jun, 2020 3 commits
    • Varun Gupta's avatar
      MDEV-11563: GROUP_CONCAT(DISTINCT ...) may produce a non-distinct list · 81a08c54
      Varun Gupta authored
       Backported from MYSQL
       Bug #25331425: DISTINCT CLAUSE DOES NOT WORK IN GROUP_CONCAT
          Issue:
          ------
          The problem occurs when:
          1) GROUP_CONCAT (DISTINCT ....) is used in the query.
          2) Data size greater than value of system variable:
          tmp_table_size.
      
          The result would contain values that are non-unique.
      
          Root cause:
          -----------
          An in-memory structure is used to filter out non-unique
          values. When the data size exceeds tmp_table_size, the
          overflow is written to disk as a separate file. The
          expectation here is that when all such files are merged,
          the full set of unique values can be obtained.
      
          But the Item_func_group_concat::add function is in a bit of
          hurry. Even as it is adding values to the tree, it wants to
          decide if a value is unique and write it to the result
          buffer. This works fine if the configured maximum size is
          greater than the size of the data. But since tmp_table_size
          is set to a low value, the size of the tree is smaller and
          hence requires the creation of multiple copies on disk.
      
          Item_func_group_concat currently has no mechanism to merge
          all the copies on disk and then generate the result. This
          results in duplicate values.
      
          Solution:
          ---------
          In case of the DISTINCT clause, don't write to the result
          buffer immediately. Do the merge and only then put the
          unique values in the result buffer. This has be done in
          Item_func_group_concat::val_str.
      
          Note regarding result file changes:
          -----------------------------------
          Earlier when a unique value was seen in
          Item_func_group_concat::add, it was dumped to the output.
          So result is in the order stored in SE. But with this fix,
          we wait until all the data is read and the final set of
          unique values are written to output buffer. So the data
          appears in the sorted order.
      
          This only fixes the cases when we have DISTINCT without ORDER BY clause
          in GROUP_CONCAT.
      81a08c54
    • Daniel Black's avatar
      innodb: dict_mem_table_add_col - compile warning fix argument 1 null where... · 90274278
      Daniel Black authored
      innodb: dict_mem_table_add_col - compile warning fix argument 1 null where non-null expected (#1584)
      
      cd /build-mariadb-server-10.5-mysql_release/storage/innobase && /usr/bin/powerpc64le-linux-gnu-g++  -DBTR_CUR_ADAPT -DBTR_CUR_HASH_ADAPT -DCOMPILER_HINTS -DDBUG_TRACE -DEMBEDDED_LIBRARY -DHAVE_BZIP2=1 -DHAVE_C99_INITIALIZERS -DHAVE_CONFIG_H -DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1 -DHAVE_IB_LINUX_FUTEX=1 -DHAVE_LZ4=1 -DHAVE_LZ4_COMPRESS_DEFAULT=1 -DHAVE_LZMA=1 -DHAVE_NANOSLEEP=1 -DHAVE_OPENSSL -DHAVE_SCHED_GETCPU=1 -DLINUX_NATIVE_AIO=1 -DMUTEX_EVENT -DWITH_INNODB_DISALLOW_WRITES -D_FILE_OFFSET_BITS=64 -Iwsrep-lib/include -Iwsrep-lib/wsrep-API/v26 -I/home/dan/build-mariadb-server-10.5-mysql_release/include -Istorage/innobase/include -Istorage/innobase/handler -Ilibbinlogevents/include -Itpool -Iinclude -Isql  -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -Wconversion -Wno-sign-conversion -O3 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -D_FORTIFY_SOURCE=2 -DDBUG_OFF -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings   -DUNIV_LINUX -D_GNU_SOURCE=1 -fPIC -fvisibility=hidden -std=gnu++11 -o CMakeFiles/innobase_embedded.dir/dict/dict0load.cc.o -c storage/innobase/dict/dict0load.cc
      storage/innobase/dict/dict0load.cc: In function ‘const char* dict_process_sys_columns_rec(mem_heap_t*, const rec_t*, dict_col_t*, table_id_t*, const char**, ulint*)’:
      storage/innobase/dict/dict0load.cc:1653:26: warning: argument 1 null where non-null expected [-Wnonnull]
          dict_mem_table_add_col(table, heap, name, mtype,
          ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
                   prtype, col_len);
                   ~~~~~~~~~~~~~~~~
      In file included from storage/innobase/include/dict0dict.h:32:0,
                       from storage/innobase/include/btr0pcur.h:30,
                       from storage/innobase/dict/dict0load.cc:31:
      storage/innobase/include/dict0mem.h:323:1: note: in a call to function ‘void dict_mem_table_add_col(dict_table_t*, mem_heap_t*, const char*, ulint, ulint, ulint)’ declared here
       dict_mem_table_add_col(
       ^~~~~~~~~~~~~~~~~~~~~~
      90274278
    • rucha174's avatar
      MDEV-22830: SQL_CALC_FOUND_ROWS not working properly for single SELECT for DUAL · 44339123
      rucha174 authored
      In case of SELECT without tables which returns either 0 or 1 rows,
      JOIN::exec_inner() did not check if the flag representing SQL_CALC_FOUND_ROWS
      is set or not and send_records was direclty assigned 0. So SELECT FOUND_ROWS()
      was giving 0 in the output. Now it checks if the flag is set, if it is set
      send_record=1 else 0. 1 is the number of rows that could have been sent
      to the client if the SELECT query had SQL_CALC_FOUND_ROWS.
      It is 0 when no rows were sent because the SELECT query did not have
      SQL_CALC_FOUND_ROWS.
      44339123
  12. 08 Jun, 2020 4 commits
  13. 07 Jun, 2020 3 commits
  14. 06 Jun, 2020 6 commits
    • Varun Gupta's avatar
      MDEV-22728: SIGFPE in Unique::get_cost_calc_buff_size from... · d218d1aa
      Varun Gupta authored
      MDEV-22728: SIGFPE in Unique::get_cost_calc_buff_size from prepare_search_best_index_intersect on optimized builds
      
      For low sort_buffer_size, in the cost calculation of using the Unique object the elements in the tree were evaluated to 0, make sure to have atleast 1 element in the Unique tree.
      
      Also for the function Unique::get allocate memory for atleast MERGEBUFF2+1 keys.
      d218d1aa
    • Igor Babaev's avatar
      MDEV-22748 MariaDB crash on WITH RECURSIVE large query · e9dbbf11
      Igor Babaev authored
      This bug is the same as the bug MDEV-17024. The crashes caused by these
      bugs were due to premature cleanups of the unit specifying recursive CTEs
      that happened in some cases when there were several outer references the
      same recursive CTE.
      The problem of premature cleanups for recursive CTEs could be already
      resolved by the correction in TABLE_LIST::set_as_with_table() introduced
      in this patch. ALL other changes introduced by the patches for MDEV-17024
      and MDEV-22748 guarantee that this clean-ups are performed as soon as
      possible: when the select containing the last outer reference to a
      recursive CTE is being cleaned up the specification of the recursive CTE
      should be cleaned up as well.
      e9dbbf11
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · 4612cb88
      Marko Mäkelä authored
      4612cb88
    • Marko Mäkelä's avatar
      MDEV-22817: Skip the test in --embedded · be0c46eb
      Marko Mäkelä authored
      be0c46eb
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · b3e395a1
      Marko Mäkelä authored
      b3e395a1
    • Marko Mäkelä's avatar
      MDEV-22721 fixup for 32-bit GCC · e14ffd85
      Marko Mäkelä authored
      lock_check_trx_id_sanity(): Because the argument of UNIV_LIKELY
      or __builtin_expect() can be less than sizeof(trx_id_t) on 32-bit
      systems, it cannot reliably perform an implicit comparison to 0.
      e14ffd85