Commit graph

189614 commits

Author SHA1 Message Date
Marko Mäkelä
150f447af1 Merge 10.2 into 10.3 2020-11-12 10:37:21 +02:00
Sujatha
984a06db2c MDEV-4633: multi_source.simple test fails sporadically
Analysis:
========
Writes to 'rli->log_space_total' needs to be synchronized, otherwise both
SQL_THREAD and IO_THREAD can try to modify the variable simultaneously
resulting in incorrect rli->log_space_total.  In the current test scenario
SQL_THREAD is trying to decrement 'rli->log_space_total' in 'purge_first_log'
and IO_THREAD is trying to increment the 'rli->log_space_total' in
'queue_event' simultaneously. Hence test occasionally fails with  result
mismatch.

Fix:
===
Convert 'rli->log_space_total' variable to atomic type.
2020-11-12 13:04:39 +05:30
Marko Mäkelä
dd33a70dad Merge mariadb-10.2.36 into 10.2 2020-11-11 18:31:42 +02:00
Marko Mäkelä
340feb01e4 Merge mariadb-10.3.27 into 10.3 2020-11-11 18:30:27 +02:00
sjaakola
2fbcddbeaf MDEV-24119 MDL BF-BF Conflict caused by TRUNCATE TABLE
A follow-up fix, for original fix for MDEV-21577, which did not handle well
temporary tables.

OPTIMIZE and REPAIR TABLE statements can take a list of tables as argument,
and some of the tables may be temporary. Proper handling of temporary tables
is to skip them and continue working on the real tables. The bad version, skipped all tables,
if a single temporary table was in the argument list. And this resulted so that FK parent
tables were not scnanned for the remaining real tables. Some mtr tests, using OPTIMIZE or REPAIR
for temporary tables caused regressions bacause of this, e.g. galera.galera_optimize_analyze_multi

The fix in this PR opens temporary and real tables first, and in the table handling loop skips
temporary tables, FK parent scanning is done only for real tables.

The test has new scenario for OPTIMIZE and REPAIR issued for two tables of which one is temporary table.

Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
2020-11-11 17:46:50 +02:00
sjaakola
ad432ef4c0 MDEV-24119 MDL BF-BF Conflict caused by TRUNCATE TABLE
This PR fixes same issue as MDEV-21577 for TRUNCATE TABLE.
MDEV-21577 fixed TOI replication for OPTIMIZE, REPAIR and ALTER TABLE
operating on FK child table. It was later found out that also TRUNCATE
has similar problem and needs a fix.

The actual fix is to do FK parent table lookup before TRUNCATE TOI
isolation and append found FK parent table names in certification key
list for the write set.

PR contains also new test scenario in galera_ddl_fk_conflict test where
FK child has two FK parent tables and there are two DML transactions operating
on both parent tables.

For development convenience, new TO isolation macro was added:
WSREP_TO_ISOLATION_BEGIN_IF and WSREP_TO_ISOLATION_BEGIN_ALTER macro was changed
to skip the goto statement.

Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
2020-11-11 17:46:50 +02:00
Marko Mäkelä
99a9774754 Merge mariadb-10.4.17 into 10.4 2020-11-11 17:26:51 +02:00
Daniel Bartholomew
940db6abc8
bump the VERSION 2020-11-11 10:19:27 -05:00
Daniel Bartholomew
bafbfb5530
bump the VERSION 2020-11-11 10:18:33 -05:00
Daniel Bartholomew
15550ed3a4
bump the VERSION 2020-11-11 10:17:22 -05:00
Marko Mäkelä
d6ee28582a Cleanup: Remove dict_space_is_empty(), dict_space_get_id()
As noted in commit 0b66d3f70d,
MariaDB does not support CREATE TABLESPACE for InnoDB.
Hence, some code that was added in
commit fec844aca8
and originally in
mysql/mysql-server@c71dd213bd
is unused in MariaDB and should be removed.
2020-11-11 15:48:43 +02:00
Marko Mäkelä
7b7e5922af MDEV-24156 trx_undo_left() fails to prevent overflow
trx_undo_left(): Return 0 in case of an overflow, instead of
returning a negative number interpreted as a large positive number.
Also, add debug assertions to check that the pointer is within
the page area. This should allow us to catch bugs like
MDEV-24096 easier in the future.
2020-11-11 15:48:43 +02:00
Marko Mäkelä
bd528b0c93 MDEV-24182 ibuf_merge_or_delete_for_page() contains dead code
The function ibuf_merge_or_delete_for_page() was always being
invoked with update_ibuf_bitmap=true ever since
commit cd623508df
fixed up something after MDEV-9566.

Furthermore, the parameter page_size is never being passed as a
null pointer, and therefore it should better be a reference to
a constant object.
2020-11-11 15:48:43 +02:00
Daniele Sciascia
83f3d12fcd Update wsrep-lib
Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
2020-11-11 07:37:05 +02:00
Anel Husakovic
3bf726f5ff MDEV-24130: Cannot launch mariadbd via mysqld_safe
- Patch 95bb3cb886 used `my_which` function in `10.2`
- Based on patch `355ee6877bec` from 10.3+ `command -v` is used instead of
`my_which` so we are changing in this patch also
- `ldconfig` is usually found in `/sbin` so make sure it is added in
`$PATH` variable
2020-11-10 21:27:25 +01:00
Anel Husakovic
cd927dd345 MDEV-23769: MTR can abort before it prints the test result summary
- Patch is solving generating report on warning
        To repeat the error run single worker:
        ```
        ./mtr --mysqld=--lock-wait-timeout=-xx 1st 1st --force --parallel 1
        ```
        or `N` workers with `N+1` tests with failures and `force`
        ```
        ./mtr --mysqld=--lock-wait-timeout=-xx 1st 1st grant5 --force --parallel 2
        ```
- Patch is doing cosmetic fix of `current_test` log file which holds the old log value of test `CURRENT TEST:..` in `mark_log()` in case of `unknown option` and as such
  the logic which is using it's content doesn't output valid log content and doesn't generate valid `$test->{'comment'}` message.asdf

- Closing the socket/handler after the removing the handler from IO for
consistency

Reviewed by: serg@mariadb.com
2020-11-10 21:20:44 +01:00
Vladislav Vaintroub
3a5cf14def MDEV-24175 Windows - fix detection of SSD 2020-11-10 13:24:45 +01:00
Marko Mäkelä
4e24b3187c MDEV-19951 followup: Remove unused st_handler_tablename, tablename_compare 2020-11-10 14:19:33 +02:00
Sergei Golubchik
5fbfdae130 Merge branch '10.3' into 10.4 2020-11-10 11:24:13 +01:00
Sergei Petrunia
dba846ce2a MDEV-24117: Memory management problem (in range optimizer)
Adjust the testcase for MariaDB 10.3+ : prevent IN-to-subquery conversion
optimization from working.
2020-11-10 12:29:20 +03:00
Marko Mäkelä
5171ab808c MDEV-24171 index_online_log is instrumented as rw-lock, not mutex
The row_log_t::mutex is a mutex, yet it was instrumented as
rw-lock in PERFORMANCE_SCHEMA.
2020-11-10 07:56:04 +02:00
Marko Mäkelä
a0536d4253 MDEV-24096 InnoDB assertion 'first_free <= srv_page_size - 8'
MDEV-23672 (commit 7eda556196)
introduced a regression that can corrupt not only undo log pages,
but anything that resides in the InnoDB buffer pool.

trx_undo_left(): Add debug assertions for the assumptions.
If the pointer is out of bounds, we will return a positive
number, not a negative one. Thus, once a page overflow occurs,
further overflow to adjacent pages will be allowed.
This allows us to remove some more relaxed debug assertions
from some callers.

trx_undo_log_v_idx(): Correctly calculate the size limit.
2020-11-09 23:35:21 +01:00
Sergei Golubchik
212d92ad26 Merge branch '10.2' into 10.3 2020-11-09 23:32:49 +01:00
Igor Babaev
bea84aefb0 MDEV-23811: With large number of indexes optimizer chooses an inefficient plan
This bug could manifest itself for a query with WHERE condition containing
top level OR formula such that each conjunct contained a single-range
condition supported by the same index. One of these range conditions must
be fully covered by another range condition that is used later in the OR
formula. Additionally at least one of these condition should be ANDed with
a sargable range condition supported by a different index.

There were several attempts to fix related problems for OR conditions after
the backport of range optimizer code from MySQL (commit
0e19f3e36f). Unfortunately the first of these
fixes contained typo remained unnoticed until recently. This typo bug led
to rejection of valid range accesses. This patch fixed this typo bug.
The fix revealed another two bugs: one in a constructor for SEL_ARG,
the other in the function tree_or(). Both are fixed in this patch.
2020-11-09 13:51:32 -08:00
Sergei Petrunia
1404f3bea7 MDEV-24117: Memory management problem ...: Add a testcase
Add a testcase.
2020-11-09 19:29:34 +03:00
Sergei Petrunia
f81eef62e7 MDEV-24117: Memory management problem in statistics state for ... IN
Part#1: Revert the patch that caused it:

commit 291be49474
Author: Igor Babaev <igor@askmonty.org>
Date:   Thu Sep 24 22:02:00 2020 -0700

    MDEV-23811: With large number of indexes optimizer chooses an inefficient plan
2020-11-09 19:29:21 +03:00
Marko Mäkelä
d01a034ac6 MDEV-7620: Remove the data structures
The instrumentation that was added in
commit 90635c6fb5 (MDEV-7620)
was effectively reverted in MariaDB Server 10.2.2, in
commit 2e814d4702
(which stopped reporting the statistics) and
commit fec844aca8
(which stopped updating the statistics).

Let us remove the orphan data members to reduce the memory footprint.
2020-11-09 15:50:37 +02:00
Daniel Black
f5d2d455a6 MDEV-24098 (Oracle mode) CREATE USER/ALTER USER PASSWORD EXPIRE/LOCK in either order
tested with:

$ mysql-test/mtr --mem --mysqld=--sql-mode=ORACLE main.lock_user

Observed Oracle syntax quoting difference in `SHOW CREATE USER`
output only.

Omission in syntax noticed by Robert Bindar.

Identical to previous patch except in sql_yacc_ora.yy
2020-11-09 09:33:08 +11:00
Oleksandr Byelkin
2845b656a3 Bump the version 2020-11-05 18:59:00 +01:00
Oleksandr Byelkin
19a847d40c MDEV-19838: followup to make happy following protocol implementations:
- mysqlnd from PHP < 7.3
- mysql-connector-python any version
- mysql-connector-java any version

Relaxed check about garbage at the end of the packet in case of no parameters.
Added check for array binding.
Fixed test according to the new paradigm (allow junk at the end of the packet)
2020-11-05 18:59:00 +01:00
Alice Sherepa
c048053c8a MDEV-23103 rpl.rpl_gtid_delete_domain failed in buildbot 2020-11-04 13:23:06 +01:00
Daniel Black
add6782636 MDEV-24098 CREATE USER/ALTER USER PASSWORD EXPIRE/LOCK in either order
Reviewed-by: vicentiu@mariadb.org
2020-11-04 22:17:05 +11:00
Daniel Black
fd7569ea6b MDEV-24098: SHOW CREATE USER invalid for both PASSWORD and LOCKED
The parser of CREATE USER accepts ACCOUNT LOCK before PASSWORD
EXPIRE but not the other way around.

This just changes the SHOW CREATE USER to output a sql syntax that
is valid.

Thanks to Robert Bindar for analysis.
2020-11-04 22:17:04 +11:00
Nayuta Yanagisawa
b13fe8e51b MDEV-18842: Unfortunate error message when the same column is used for application period start and end
An application-time period must be composed of two different columns.
We added a check that ensures that the above condition is met.
2020-11-04 12:33:13 +03:00
Jan Lindström
0f04f61395 Need more information about mysql-wsrep#198 sporadic test failure. 2020-11-04 09:28:02 +02:00
Daniele Sciascia
1f1fa07cd5 MDEV-24063 Assertion during graceful shutdown with wsrep_on=OFF
During graceful shutdowns, client connections are closed and
eventually and THD::awake() acquires LOCK_thd_data mutex which is
required later on in wsrep_thd_is_aborting(). Make sure LOCK_thd_data
is acquired, even if global wsrep_on is disabled.

Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
2020-11-03 19:47:17 +02:00
sjaakola
4d6c661144 MDEV-21577 MDL BF-BF conflict
Some DDL statements appear to acquire MDL locks for a table referenced by
foreign key constraint from the actual affected table of the DDL statement.
OPTIMIZE, REPAIR and ALTER TABLE belong to this class of DDL statements.

Earlier MariaDB version did not take this in consideration, and appended
only affected table in the certification key list in write set.
Because of missing certification information, it could happen that e.g.
OPTIMIZE table for FK child table could be allowed to apply in parallel
with DML operating on the foreign key parent table, and this could lead to
unhandled MDL lock conflicts between two high priority appliers (BF).

The fix in this patch, changes the TOI replication for OPTIMIZE, REPAIR and
ALTER TABLE statements so that before the execution of respective DDL
statement, there is foreign key parent search round. This FK parent search
contains following steps:
* open and lock the affected table (with permissive shared locks)
* iterate over foreign key contstraints and collect and array of Fk parent
  table names
* close all tables open for the THD and release MDL locks
* do the actual TOI replication with the affected table and FK parent
  table names as key values

The patch contains also new mtr test for verifying that the above mentioned
DDL statements replicate without problems when operating on FK child table.
The mtr test scenario #1, which can be used to check if some other DDL
(on top of OPTIMIZE, REPAIR and ALTER) could cause similar excessive FK
parent table locking.

Reviewed-by: Aleksey Midenkov <aleksey.midenkov@mariadb.com>
Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
2020-11-03 19:40:06 +02:00
Daniel Bartholomew
5739c7702d
bump the VERSION 2020-11-03 10:59:26 -05:00
Daniel Bartholomew
4548e74bcc
bump the VERSION 2020-11-03 10:58:05 -05:00
Daniel Bartholomew
8ba641a676
bump the VERSION 2020-11-03 10:56:50 -05:00
Marko Mäkelä
533a13af06 Merge 10.3 into 10.4 2020-11-03 14:49:17 +02:00
Marko Mäkelä
4b3690b504 fixup 67cb7ea22a 2020-11-03 14:48:08 +02:00
Daniele Sciascia
97f3207cf3 Fix MTR test galera.galera_trigger
Changed the test so that it does not rely on specific auto increment
ids. With Galera's default wsrep_auto_increment_control setting it is
not guaranteed that auto increments always start from 1. The test was
occasionally failing due to result content mismatch.

Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
2020-11-03 11:29:45 +02:00
Jan Lindström
67cb7ea22a Clean up wsrep.variables 2020-11-03 09:12:06 +02:00
Teemu Ollakka
4489b66afb MDEV-23872 Crash in galera::TrxHandle::state()
Prepared statements which were run over binary protocol crashed
a server if the statement did not have CF_PS_ARRAY_BINDING_OPTIMIZED
flag and the statement was executed in bulk mode and a BF abort occrurred.
This was because the bulk execution resulted in several statements without
calling wsrep_after_statement() between, which confused wsrep transaction
state tracking.

As a fix, call wsrep_after_statement() in bulk loop after each execution
if CF_PS_ARRAY_BINDING_OPTIMIZED is not set.

Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
2020-11-03 09:11:04 +02:00
Jan Lindström
2391582ec3 Merge remote-tracking branch 10.2 into 10.3 2020-11-03 09:00:23 +02:00
Jan Lindström
94859d985e Clean up wsrep.variables 2020-11-03 08:49:10 +02:00
Monty
a876121d24 MDEV-23824 SIGSEGV in end_io_cache on REPAIR LOCAL TABLE for Aria table
Bugs fixed:
- prepare_for_repair() didn't close all open files if table opened failed
  because of out-of-memory
- If dd_recreate_table() failed, the data file was not properly restored
  from it's temporary name
- Aria repair initializing code didn't properly clear all used structs
  before calling error, which caused crashed in memory-free calls.
- maria_delete_table() didn't register if table open failed. This could
  calls my_error() to be called without returning 1 to the caller, which
  cased failures in my_ok()

Note when merging to 10.5:
- Remove the #if MYSQL_VERSION from sql_admin.cc
2020-11-02 17:15:36 +02:00
Marko Mäkelä
9e14a2df8c MDEV-24072 Assertion 'ib_table.n_v_cols' failed in instant_alter_column_possible()
instant_alter_column_possible(): Relax a too strict debug assertion.
The existence of an index stub or a corrupted index on virtual columns
does not imply that virtual columns exist.
2020-11-02 16:07:06 +02:00
Marko Mäkelä
e6290a8270 Merge 10.2 into 10.3 2020-11-02 16:02:16 +02:00