Commit graph

178581 commits

Author SHA1 Message Date
Sergei Golubchik
88cbe2f081 MDEV-18496 Crash when Aria encryption is enabled but plugin not available
wait_while_table_is_used() should return an error if handler::extra() fails
2020-07-29 14:56:24 +02:00
Karthik Kamath
e6cb263ef3 MDEV-15961: Fix stacktraces under FreeBSD (aarch64)
Largely based on MySQL commit
75271e51d6

MySQL Ref:
    BUG#24566529: BACKPORT BUG#23575445 TO 5.6

    (cut)
    Also, the PTR_SANE macro which tries to check if a pointer
    is invalid (used when printing pointer values in stack traces)
    gave false negatives on OSX/FreeBSD. On these platforms we
    now simply check if the pointer is non-null. This also removes
    a sbrk() deprecation warning when building on OS X. (It was
    before only disabled with building using XCode).

Removed execinfo path of MySQL patch that was already included.

sbrk doesn't exist on FreeBSD aarch64.

Removed HAVE_BSS_START based detection and replaced with __linux__
as it doesn't exist on OSX, Solaris or Windows.  __bss_start
exists on mutiple Linux architectures.

Tested on FreeBSD and Linux x86_64. Being in FreeBSD ports for 2
years implies a good testing there on all FreeBSD architectures there
too. MySQL-8.0.21 code is functionally identical to original commit.
2020-07-28 11:10:25 +10:00
Daniel Black
beec8404fa MDEV-17076: mtr int options aren't negative 2020-07-28 09:08:36 +10:00
Daniel Black
99af3cbc85 MDEV-17076: mtr max-{core,datadir} 0 means 0
There was no ability to set the mtr arguments of:
* --max-save-core; and
* --max-save-datadir

to 0. This is desireable in an automatied scenario where space
is limited hence targeting 10.1 branch.

We take away the 0 means unlimited aspect for these,
however, perl can handle some big numbers so they may as well be
close enough to unlimited for all meaningful purposes.
2020-07-28 09:08:36 +10:00
Teodor Mircea Ionita
1ce97358bb MDEV-17076: increment only if saving occurs 2020-07-28 09:08:36 +10:00
Daniel Black
c81a2d2322 MDEV-23088: Change LimitNOFILE default from 16364 to 16384
Correct to a true 2^14 rather than some different number that
was actually just a number typo.

Bug report thanks to Hartmut Holzgraefe.
2020-07-28 08:08:20 +10:00
Alexander Barkov
29851b677e MDEV-23282 FLOAT(53,0) badly handles out-of-range values
truncate_double() did not take into account the max_value
limit in case when dec<NOT_FIXED_DEC.
2020-07-27 08:03:23 +04:00
Sergei Petrunia
8460db12b5 Add testcases for MDEV-20557, MDEV-21649 2020-07-25 12:59:53 +03:00
Sergei Petrunia
b000d6952f MDEV-23221: A subquery causes crash
* Fix the crash: IN-to-EXISTS rewrite causes an error (and so
  JOIN::optimize() fails with an error, too), don't call
  update_used_tables(). Terminate the query execution instead.

* Fix the cause of the error in the IN-to-EXISTS rewrite: don't do
  the rewrite if doing it will cause an error of this kind:
  This version of MariaDB doesn't yet support 'SUBQUERY in ROW in left
  expression of IN/ALL/ANY'

* Fix another issue exposed by this testcase:
  JOIN::setup_subquery_caches() may be invoked before any select has
  saved its query plan, and will crash because none of the SELECTs
  has called create_explain_query_if_not_exists() to create the Explain
  Data Structure for this SELECT.

TODO: When merging this to 10.2, remove the poorly-placed call to
create_explain_query_if_not_exists made by fix for M_D_E_V-16153
2020-07-24 22:32:04 +03:00
Daniel Black
4b97f14a3d mysql_install_db: help lists --defaults-file twice
Removed duplicate.

Also move the --no-defaults option close to the other "default*"
options.
2020-07-24 17:12:48 +10:00
Teemu Ollakka
8ef41c6084 MDEV-23272 Galera stack-use-after-scope error with ASAN build
THD proc info was assigned from stack allocated temporary buffer
which went out of scope immediately after assignment.

Fixed by removing the use of temp buffer and assign proc info
from string literal.
2020-07-24 08:50:15 +03:00
Ian Gilfillan
7d22d666d2 MDEV-15207: mysql_upgrade cannot create file mysql_upgrade_info 2020-07-23 18:22:00 +02:00
Thirunarayanan Balathandayuthapani
adeb736f9a MDEV-22903 heap-use-after-free while accessing fts cache deleted doc ids
Problem:
=======
  fts_cache_append_deleted_doc_ids() holds the deleted_lock and tries to
access size of deleted_doc_ids. In the meantime, fts_cache_clear()
clears the sync_heap before clearing deleted_doc_ids. It leads to
invalid access of deleted_doc_ids.

Fix:
===
fts_cache_clear() should free the sync_heap after clearing
deleted_doc_ids.
2020-07-23 16:34:38 +05:30
Marko Mäkelä
52ccedd6dd MDEV-23268 SIGSEGV on srv_monitor_event if InnoDB is read-only
The srv_monitor_event and the srv_monitor_thread would not be
created when InnoDB is in read-only mode. Yet, some code would
unconditionally invoke os_event_set(srv_monitor_event).
2020-07-23 09:59:16 +03:00
Ian Gilfillan
d2982331a6 Code comment spellfixes 2020-07-22 23:18:12 +02:00
Varun Gupta
62d73df6b2 MDEV-19232: Floating point precision / value comparison problem
The issue occurs when the subquery_cache is enabled.
When there is a cache miss the division was leading to a value with scale 9.
In the case of cache hit the value returned was of scale 9 and due to the different
values for the scales the where condition evaluated to FALSE, hence the output
was incomplete.

To fix this problem we need to round up the decimal to the limit mentioned in
Item::decimals. This would make sure the values are compared with the same
scale.
2020-07-22 14:44:25 +05:30
Marko Mäkelä
57ec42bc32 MDEV-23190 InnoDB data file extension is not crash-safe
When InnoDB is extending a data file, it is updating the FSP_SIZE
field in the first page of the data file.

In commit 8451e09073 (MDEV-11556)
we removed a work-around for this bug and made recovery stricter,
by making it track changes to FSP_SIZE via redo log records, and
extend the data files before any changes are being applied to them.

It turns out that the function fsp_fill_free_list() is not crash-safe
with respect to this when it is initializing the change buffer bitmap
page (page 1, or generally, N*innodb_page_size+1). It uses a separate
mini-transaction that is committed (and will be written to the redo
log file) before the mini-transaction that actually extended the data
file. Hence, recovery can observe a reference to a page that is
beyond the current end of the data file.

fsp_fill_free_list(): Initialize the change buffer bitmap page in
the same mini-transaction.

The rest of the changes are fixing a bug that the use of the separate
mini-transaction was attempting to work around. Namely, we must ensure
that no other thread will access the change buffer bitmap page before
our mini-transaction has been committed and all page latches have been
released.

That is, for read-ahead as well as neighbour flushing, we must avoid
accessing pages that might not yet be durably part of the tablespace.

fil_space_t::committed_size: The size of the tablespace
as persisted by mtr_commit().

fil_space_t::max_page_number_for_io(): Limit the highest page
number for I/O batches to committed_size.

MTR_MEMO_SPACE_X_LOCK: Replaces MTR_MEMO_X_LOCK for fil_space_t::latch.

mtr_x_space_lock(): Replaces mtr_x_lock() for fil_space_t::latch.

mtr_memo_slot_release_func(): When releasing MTR_MEMO_SPACE_X_LOCK,
copy space->size to space->committed_size. In this way, read-ahead
or flushing will never be invoked on pages that do not yet exist
according to FSP_SIZE.
2020-07-20 14:48:56 +03:00
Marko Mäkelä
98e2c17e9e Cleanup: Remove fil_check_adress_in_tablespace() 2020-07-20 14:48:56 +03:00
Marko Mäkelä
14543afd59 Cleanup: Remove unused AbstractCallback::m_free_limit 2020-07-20 14:48:56 +03:00
Varun Gupta
c400ef2586 Making the stat_tables_innodb test deterministic 2020-07-18 10:19:13 +05:30
Julius Goryavsky
1ba8df4c60 MDEV-20401: revert unnecessary change 2020-07-16 16:31:27 +02:00
Julius Goryavsky
4412a461a1 MDEV-20401: Server incorrectly auto-sets lower_case_file_system value
Server auto-sets lower_case_file_system value based on default
datadir's behavior instead of instead of using the directory specified
by the user through the configuration file or command line options.

This patch fixes this problem.
2020-07-16 12:17:01 +02:00
Daniel Black
7473e1841c check_linker_flag: use for linker flags
-Wl,-z,relro,-z,now are linker flags and should
be checked as such.

TODO: perform module, exe shared checks separately
rather than a pure linker check.
2020-07-15 09:23:53 +03:00
Varun Gupta
dfdfeecb03 MDEV-22851: Engine independent index statistics are incorrect for large tables on Windows
An oveflow was happening on windows because on Windows sizeof(ulong) is 4 bytes
while it is 8 bytes on Linux.
Switched avg_frequency and avg length for column statistics to ulonglong.
Switched avg_frequency for index statistics to ulonglong.
2020-07-15 11:27:32 +05:30
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
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
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
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ä
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
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
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
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
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
Jan Lindström
9fb8d87d2d Test fixes. 2020-06-24 09:38:54 +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