Commit graph

183586 commits

Author SHA1 Message Date
Vladislav Vaintroub
9c8420fe8c Fix compile warning 2020-07-15 09:49:48 +02:00
Marko Mäkelä
07e89bf7d1 MDEV-23163 Merge new release of InnoDB 5.7.31 to 10.2
The only InnoDB change between MySQL 5.7.30 and MySQL 5.7.31
that is applicable to MariaDB Server was applied in
commit 8d061996e6 (MDEV-23161).
2020-07-14 15:13:40 +03:00
Marko Mäkelä
646a6005e7 Merge 10.1 into 10.2 2020-07-14 15:10:59 +03:00
Marko Mäkelä
67a03b7c94 XtraDB 5.6.48-88.0
The only InnoDB changes between Percona XtraDB Server 5.6.47-87.0
and 5.6.48-88.0 are related to InnoDB changes between MySQL 5.6.47
and MySQL 5.6.48, which we had already applied.
2020-07-14 13:32:32 +03:00
Marko Mäkelä
142f85142a Update the InnoDB version number to 5.6.49
There were no InnoDB changes between MySQL 5.6.48 and MySQL 5.6.49.
2020-07-14 13:25:18 +03:00
Marko Mäkelä
8d061996e6 MDEV-23161 avg_count_reset may wrongly be NULL in I_S.INNODB_METRICS
This issue was originally reported by Fungo Wang, along with a fix, as
MySQL Bug #98990.

His suggested fix was applied as part of
mysql/mysql-server@a003fc373d
and released in MySQL 5.7.31.

i_s_metrics_fill(): Add the missing call to Field::set_notnull(),
and simplify some code.
2020-07-14 13:21:01 +03:00
Thirunarayanan Balathandayuthapani
dc58987eb7 MDEV-22765 i_s_fts_index_cache_fill_one_index() is not protect by the lock
- i_s_fts_index_cache_fill() should take shared lock of fts cache
before accessing index cache to avoid reading stale data.
2020-07-14 14:26:49 +05:30
Julius Goryavsky
6b6c012f33 Merge branch '10.4-MDEV-18838' of https://github.com/codership/mariadb-server into 10.2-MDEV-18838 2020-07-14 10:45:41 +02:00
Thirunarayanan Balathandayuthapani
e80183dbd5 MDEV-15662 mariabackup.huge_lsn fails sporadically with "log sequence number is in the future"
- Problem is that test case creates iblogfile* files. So existing
ibdata pages could point to future LSN. Fix is that taking the
backup of data before iblogfile* creation and apply it before
exiting the test case.
2020-07-14 13:24:37 +05:30
Thirunarayanan Balathandayuthapani
194a720e28 MDEV-22890 DEADLOCK of threads detected: row0sel.cc S-LOCK / btr0cur.cc S-LOCK / row0quiesce.cc X-LOCK
Problem:
=======
- Read operations are always allowed to hold a secondary index leaf
latch and then look up the corresponding clustered index record.
Flush table operation acquires secondary index latch while holding
a clustered index latch. It leads to deadlock violation.

Fix:
====
- Flush table operation should acquire secondary index before taking
clustered index to avoid deadlock violation with select operation.
2020-07-14 12:47:32 +05:30
Vicențiu Ciorbaru
f73db93329 MDEV-23027 symlink_wsrep_sst_rsync target built when WITH_WSREP is off
Only install wsrep scripts and links if WSREP_ON is actually set
2020-07-13 20:40:52 +03:00
Varun Gupta
b0df247db6 MDEV-22463: Element_type &Bounds_checked_array<Item *>::operator[](size_t) [Element_type = Item *]: Assertion `n < m_size' failed.
Allocate space for fields inside the window function (arguments, PARTITION BY and ORDER BY clause)
in the ref pointer array. All fields inside the window function are part of the temporary
table that is required for the window function computation.
2020-07-13 22:04:54 +05:30
Rucha Deodhar
0994af43e5 MDEV-22058: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status
Error state is not stored in check_and_do_in_subquery_rewrites() when there is
illegal combination of optimizer switches. So all the functions eventually
return false. Thus the assetion failure.
2020-07-12 20:03:32 +05:30
Rucha Deodhar
f81ff93287 MDEV-19119: main.ssl_crl fails in buildbot with wrong error code
The client can only find out if the server has disconnected when it tries to
read or send something. If the server gets disconnected before
send_client_reply_packet(), the client will try sending authentication
information but it will fail. But, if the client is fast enough to send
autentication information before disconnecting, it will notice that when
reading the ok packet. So the client can fail on read or on write.
It is unpredictable because, the process are unsynchronized and this
could happen in any order.
2020-07-10 21:27:20 +05:30
Varun Gupta
737c3025e9 MDEV-10120: Wrong result of UNION .. ORDER BY GROUP_CONCAT()
Reject queries that have aggregate functions with UNION as these
are not allowed by standard.
2020-07-10 00:01:24 +05:30
Oleksandr Byelkin
a759f9af51 Fix typo in the comment (and old info) 2020-07-09 08:54:59 +02:00
Vicențiu Ciorbaru
f18c5a7ed7 MDEV-23114 AUTH_PAM plugin can not be disabled when using mysql_release config
When setting the PLUGIN_AUTH_PAM variable, mark it as a "CACHE" variable
so it can be overridden by the user.
2020-07-07 17:59:47 +03:00
Varun Gupta
253aa7bbc4 MDEV-12059: Assertion `precision > 0' failed with a window function or window aggregate function
Pass the unsigned flag from the Item_sum to the window function
2020-07-07 17:30:53 +05:30
Rucha Deodhar
a536625553 MDEV-22654: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())'
failed in Diagnostics_area::set_ok_status on FUNCTION replace

When there is REPLACE in the statement, sp_drop_routine_internal() returns
0 (SP_OK) on success which is then assigned to ret. So ret becomes false
and the error state is lost. The expression inside DBUG_ASSERT()
evaluates to false and thus the assertion failure.
2020-07-06 21:17:15 +05:30
Vladislav Vaintroub
cad9a9b1f8 MDEV-23098 mariadb-upgrade-service.exe does not work on WAMPServer
While trying to detect datadir, take into account that one can use
Windows service name as section name in options file, for Windows service.

The historical obscurity is being used by WAMP installations.
2020-07-06 13:51:25 +02:00
Varun Gupta
6163af9397 MDEV-22390: Assertion `m_next_rec_ptr >= m_rawmem' failed in Filesort_buffer::spaceleft | SIGSEGV in __memmove_avx_unaligned_erms from my_b_write
Make sure that the sort_buffer that is allocated has atleast space for MERGEBUFF2 keys.
The issue here was that the record length is quite high and sort buffer size is very small,
due to which we end up with zero number of keys in the sort buffer. The Sort_param::max_keys_per_buffer
was zero in such a case, due to which we were flushing empty sort_buffer to the disk.
2020-07-06 16:30:27 +05:30
Daniel Black
3efdac2064 MDEV-22173: socket accept - test for failure
accept might return an error, including SOCKET_EAGAIN/
SOCKET_EINTR. The caller, usually handle_connections_sockets
can these however and invalid file descriptor isn't something
to call fcntl on.

Thanks to Etienne Guesnet (ATOS) for diagnosis,
sample patch description and testing.
2020-07-06 12:33:35 +02:00
Marko Mäkelä
dba7e1e8e1 Merge 10.1 into 10.2 2020-07-02 06:05:13 +03:00
Marko Mäkelä
c43a666662 Revert "Fix result of merge."
This reverts commit e0793d3865.

In idiomatic C++, accessor functions should not discard qualifiers.
2020-07-02 06:04:42 +03:00
Marko Mäkelä
90d1e58ed0 MDEV-22941: Fix the DBUG_ENTER name 2020-07-02 06:04:31 +03:00
Marko Mäkelä
838a1046b2 MDEV-20377: Fix cmake -DPLUGIN_PERFSCHEMA=NO 2020-07-02 06:03:59 +03:00
Marko Mäkelä
69df4f834b MDEV-20377: Fix -Wunused-but-set-variable 2020-07-01 20:34:06 +03:00
Vladislav Vaintroub
41b0d98e69 MDEV-23067 Windows : manually registered services rejected mysql_upgrade_service
- service not using "--defaults-file" can have any name not just "MySQL"
- service with "--defaults-file", without datadir in them
use default datadir (install_root\data)
2020-07-01 18:43:21 +02:00
Marko Mäkelä
be51738465 MDEV-20428 after-merge fix: Stabilize the test 2020-07-01 17:43:44 +03:00
Marko Mäkelä
c36834c832 MDEV-20377: Make WITH_MSAN more usable
MemorySanitizer (clang -fsanitize=memory) requires that all code
be compiled with instrumentation enabled. The only exception is the
C runtime library. Failure to use instrumented libraries will cause
bogus messages about memory being uninitialized.

In WITH_MSAN builds, we must avoid calling getservbyname(),
because even though it is a standard library function, it is
not instrumented, not even in clang 10.

Note: Before MariaDB Server 10.5, ./mtr will typically fail
due to the old PCRE library, which was updated in MDEV-14024.

The following cmake options were tested on 10.5
in commit 94d0bb4dbe:

cmake \
-DCMAKE_C_FLAGS='-march=native -O2' \
-DCMAKE_CXX_FLAGS='-stdlib=libc++ -march=native -O2' \
-DWITH_EMBEDDED_SERVER=OFF -DWITH_UNIT_TESTS=OFF -DCMAKE_BUILD_TYPE=Debug \
-DWITH_INNODB_{BZIP2,LZ4,LZMA,LZO,SNAPPY}=OFF \
-DPLUGIN_{ARCHIVE,TOKUDB,MROONGA,OQGRAPH,ROCKSDB,CONNECT,SPIDER}=NO \
-DWITH_SAFEMALLOC=OFF \
-DWITH_{ZLIB,SSL,PCRE}=bundled \
-DHAVE_LIBAIO_H=0 \
-DWITH_MSAN=ON

MEM_MAKE_DEFINED(): An alias for VALGRIND_MAKE_MEM_DEFINED()
and __msan_unpoison().

MEM_GET_VBITS(), MEM_SET_VBITS(): Aliases for
VALGRIND_GET_VBITS(), VALGRIND_SET_VBITS(), __msan_copy_shadow().

InnoDB: Replace the UNIV_MEM_ macros with corresponding MEM_ macros.

ut_crc32_8_hw(), ut_crc32_64_low_hw(): Use the compiler built-in
functions instead of inline assembler when building WITH_MSAN.
This will require at least -msse4.2 when building for IA-32 or AMD64.
The inline assembler would not be instrumented, and would thus cause
bogus failures.
2020-07-01 17:23:00 +03:00
Sergei Golubchik
5a097c5556 MDEV-21222 mariabackup.incremental_backup failed with memory allocation failure
mariabackup tries to allocate a buffer of page_size*page_size/4 size.
for 64k page it means 1Gb, which doesn't work very well on 32-bit builders.

Skip the 64k page test on 32bit.
2020-07-01 17:22:22 +03:00
Marko Mäkelä
9ed50ece33 MDEV-22779: Fix a memory leak in the unit test 2020-07-01 17:22:22 +03:00
Vladislav Vaintroub
fe05c16c8d MDEV-23052 mysql_install_db.exe can run on existing non-empty directory,
and remove it on error

Disable existing non-empty datadir for mysql_install_db.exe
2020-07-01 13:03:51 +02:00
Marko Mäkelä
ea2bc974dc Merge 10.1 into 10.2 2020-07-01 12:03:55 +03:00
Varun Gupta
fbfb5b5f68 MDEV-22852: SIGSEGV in sortlength (optimized builds)
The issue here is for a DEPENDENT subquery that has an aggregate function in the ORDER BY clause,
is wrapped inside an Item_aggregate_ref. For computation of ORDER BY we need to refer to the
temp table field corresponding to this item. But in the function make_sortorder, we were
explicitly casting Item_aggrgate_ref to Item_sum, which leads to us not getting the temp
table field corresponding to the item.
2020-07-01 11:39:22 +05:30
Eugene Kosov
1ea266f3ef MDEV-23003 INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION requires SUPER instead PROCESS privilege
Fix a typo in a source code. Now real required privileges corresponds
to a ones mentions in documentation.

Documentation states that this table requires PROCESS privilege:
https://mariadb.com/kb/en/information-schema-innodb_tablespaces_encryption-table/
2020-06-30 21:31:49 +03:00
Varun Gupta
4a2e7b5368 MDEV-22984: Throw an error when arguments to window functions are window functions
Window function is not allowed as arguments to window functions according to the standard.
2020-06-30 18:16:01 +05:30
Eugene Kosov
17109001d6 speed up fil_validate() in debug builds
This function is very common in a debug build. I can even see it in
profiler.

This patch reduces execution time of fil_validate() from
8948ns
8367ns
8650ns
8906ns
8448ns

to
260ns
232ns
403ns
275ns
169ns
in my environment.

The trick is a faster fil_space_t iteration. Hash table
is typically initialized with a size of 50,000. And looping through
it is slow. Slower, than iterating an exact amount of fil_space_t
which is typically less than ten.

Only debug builds are affected.
2020-06-30 12:17:53 +03:00
Daniel Black
ca55e09e9a signal handler: use mariadb kb URL rather than MySQL one 2020-06-29 05:49:52 +02:00
Varun Gupta
37cb7a0071 MDEV-17606: Query returns wrong results (while using CHARACTER SET utf8)
The issue here was that the left expr and right expr of the ANY subquery
had different character sets, so we were converting the left expr to utf8 character set.
So when this conversion was happening we were actually converting the item inside the cache,
it looked like <cache>(convert(t1.l1 using utf8)), which is incorrect.
To fix this problem we are going to store the reference of the left expr and convert that
to utf8 character set, it would look like convert(<cache>(`test`.`t1`.`l1`) using utf8)
2020-06-27 12:55:55 +05:30
Sujatha
3bc8939552 MDEV-22806: MSAN reports use-of-uninitialized-value for rpl_parallel_conflicts.test
Problem:
========
Relay_log_info::flush reports following MSAN issue.
==17820==WARNING: MemorySanitizer: use-of-uninitialized-value is reported
#5  0x00005584f0981441 in my_write (Filedes=22,
Buffer=0x72500003e818 "5\n./slave-relay-bin.000003\n21385\n
master-bin.000001\n21643\n0\n", '\245' <repeats 141 times>..., Count=118,
MyFlags=532) at /home/sujatha/bug_repo/test-10.5-msan/mysys/my_write.c:49

Analysis:
=========
In parallel replication at the end of each statement execution the worker execution
status is updated in 'relay-log.info' file. When two workers try to flush
the status at the same time, since the write to cache is not serialized both
workers write to the same address simultaneously and increment the
length twice. Because of this the length of buffer is more than actual data.
When flush code tries to read the buffer beyond valid data length MSAN
reports uninitialized values error.

Fix:
===
Serialize the relay log flush operation using "rli->data_lock".
2020-06-25 16:14:23 +05:30
Julius Goryavsky
bebc576422 Merge branch '10.1-MDEV-22763' of https://github.com/codership/mariadb-server into 10.1-MDEV-22763 2020-06-25 10:12:06 +02:00
Vladislav Vaintroub
7ee6a3ae5f MDEV-22950 followup
Deadlock in DbugParse, on Linux.

In 10.1, DBUG recursive mutex was improperly implemented.
CODE_STATE::locked counter was never updated.

Copy the code around LockMutex/UnlockMutex from 10.2
2020-06-25 10:00:15 +02:00
Sujatha
f1838434b8 MDEV-22706: Assertion `!current' failed in PROFILING::start_new_query
Analysis:
========
When "Profiling" is enabled, server collects the resource usage of each
statement that gets executed in current session. Profiling doesn't support
nested statements. In order to ensure this behavior when profiling is enabled
for a statement, there should not be any other active query which is being
profiled. This active query information is stored in 'current' variable. When
a nested query arrives it finds 'current' being not NULL and server aborts.

When 'init_connect' and 'init_slave' system variables are set they contain a
set of statements to be executed. "execute_init_command" is the function call
which invokes "dispatch_command" for each statement provided in
'init_connect', 'init_slave' system variables. "execute_init_command" invokes
"start_new_query" and it passes the statement list to "dispatch_command". This
"dispatch_command" intern invokes "start_new_query" which leads to nesting of
queries. Hence '!current' assert is triggered.

Fix:
===
Remove profiling from "execute_init_command" as it will be done within
"dispatch_command" execution.
2020-06-25 13:03:34 +05:30
Vlad Lesin
97f7d4a9b4 MDEV-22726: Add check that one can't change general or slow log to a
transactional engine
2020-06-24 14:37:54 +03:00
Aleksey Midenkov
e3104c4a8c MDEV-22179 rr support for mtr
* --rr-dir to change store dir
* --rr-arg doesn't enable --rr (good for scripts)
* Bootstrap is saved to rr.boot
2020-06-24 10:15:21 +03:00
Jan Lindström
9fb8d87d2d Test fixes. 2020-06-24 09:38:54 +03:00
Vincent Milum Jr
fe0cf85d5a MDEV-21709 ZFS snapdir=visible breaks Galera rsync SST replcation
Fix for Galera rsync SST with the specific conditions listed in MDEV-21709
Exclude needs to be on receiving side too
2020-06-24 08:14:32 +03:00
Alexey Yurchenko
8e58eeba78 MTR tests to test Galera fix for node joining over several configuration
changes.

This requires Galera commit 065e484144c5999709ae8fd19844da72bb785073
2020-06-24 08:10:57 +03:00
Oleksandr Byelkin
e0793d3865 Fix result of merge. 2020-06-23 13:42:11 +02:00