Commit graph

191326 commits

Author SHA1 Message Date
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
Monty
10b2d5726f Fixed failing maria.create test
This comes from a wrong merge from 10.3
2020-11-09 19:36:10 +02: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
Marko Mäkelä
f424eb974d Clean up the merge of MDEV-22494
The merge commit f2a944516e
included some incorrect conflict resolution and left
an unused function wsrep_abort_slave_trx().

Also, we will clean up wsrep_innobase_kill_one_trx() a little.
2020-11-05 11:41:43 +02:00
Marko Mäkelä
4cbfdeca84 MDEV-24109 InnoDB hangs with innodb_flush_sync=OFF
MDEV-23855 broke the handling of innodb_flush_sync=OFF.
That parameter is supposed to limit the page write rate
in case the log capacity is being exceeded and log checkpoints
are needed.

With this fix, the following should pass:
./mtr --mysqld=--loose-innodb-flush-sync=0

One of our best regression tests for page flushing is
encryption.innochecksum. With innodb_page_size=16k and
innodb_flush_sync=OFF it would likely hang without this fix.

log_sys.last_checkpoint_lsn: Declare as Atomic_relaxed<lsn_t>
so that we are allowed to read the value while not holding
log_sys.mutex.

buf_flush_wait_flushed(): Let the page cleaner perform the flushing
also if innodb_flush_sync=OFF. After the page cleaner has
completed, perform a checkpoint if it is needed, because
buf_flush_sync_for_checkpoint() will not be run if
innodb_flush_sync=OFF.

buf_flush_ahead(): Simplify the condition. We do not really care
whether buf_flush_page_cleaner() is running.

buf_flush_page_cleaner(): Evaluate innodb_flush_sync at the low
level. If innodb_flush_sync=OFF, rate-limit the batches to
innodb_io_capacity_max pages per second.

Reviewed by: Vladislav Vaintroub
2020-11-04 16:55:36 +02:00
Dmitry Shulga
7b20aa576b MDEV-24116: Fix clang 12 -Wrange-loop-analysis 2020-11-04 16:54:25 +02: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
1418439d38
bump the VERSION 2020-11-03 11:00:36 -05: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ä
3bc6e0ea66 Merge bb-10.5-release into 10.5 2020-11-03 16:24:57 +02:00
Marko Mäkelä
133b4b46fe Merge 10.4 into 10.5 2020-11-03 16:24:47 +02: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
Marko Mäkelä
90f43d260e MDEV-24101 innodb_random_read_ahead=ON causes hang on DDL or shutdown
buf_read_ahead_random(): Do not leak a tablespace reference.
The reference was already acquired in fil_space_t::get(),
and we must only check that operations were not stopped.

This error was introduced when
commit 118e258aaa
merged n_pending_ios, n_pending_ops into a single n_pending.

This was not noticed earlier, because innodb_random_read_ahead
is OFF by default and our regression tests did not vary that
parameter at all.
2020-11-03 12:41:41 +02:00
Vladislav Vaintroub
44836bcd12 Fix appvyeor's perl.exe path
The one which is in PATH by default is MinGW perl, which uses Unix paths.
This perl does not work with mtr.
2020-11-03 10:47:25 +01: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
Marko Mäkelä
3fe306c891 fixup a593e03d58: nullptr
C++11 is allowed only starting with MariaDB Server 10.4.
2020-11-02 16:01:32 +02:00
Marko Mäkelä
c7f322c91f Merge 10.2 into 10.3 2020-11-02 15:48:47 +02:00
Marko Mäkelä
8036d0a359 MDEV-22387: Do not violate __attribute__((nonnull))
This follows up commit
commit 94a520ddbe and
commit 7c5519c12d.

After these changes, the default test suites on a
cmake -DWITH_UBSAN=ON build no longer fail due to passing
null pointers as parameters that are declared to never be null,
but plenty of other runtime errors remain.
2020-11-02 14:19:21 +02:00
Marko Mäkelä
d2fab68667 Merge bb-10.2-release into 10.2 2020-11-02 14:17:15 +02:00
Marko Mäkelä
ff0b6122a1 MDEV-23630 fixup: main.mysqldump result
This was missed in commit d6ea03fa94.
2020-11-02 14:17:09 +02:00
Marko Mäkelä
440d4b282d Fix clang -Winconsistent-missing-override 2020-11-02 12:21:14 +02:00
Vladislav Vaintroub
504d4c1ff6 Windows : require at least VS2019 for MSVC.
This will  avoid some errors on appveyor, due to outdated SDKs.
2020-11-02 11:11:05 +01:00
Nikita Malyavin
f244b499e7 handler: move row change start signal down after the checks 2020-11-02 14:21:08 +10:00
Nikita Malyavin
e618f7e9f6 MDEV-22506 Malformed error message for ER_KEY_CONTAINS_PERIOD_FIELDS
Though this is an error message task, the problem was deep in the
`mysql_prepare_create_table` implementation. The problem is described as
follows:

1. `append_system_key_parts` was called before
`mysql_prepare_create_table`, though key name generation was done close to
the latest stage of the latter.
2. We can't move `append_system_key_parts` in the end, because system keys
should be appended before some checks done.
3. If the checks from `append_system_key_parts` are moved to the end of
`mysql_prepare_create_table`, then some other inappropriate errors are
issued. like `ER_DUP_FIELDNAME`.

To have key name specified in error message, name generation should be done
before the checks, which consequenced in more changes.

The final design for key initialization in `mysql_prepare_create_table`
follows. The initialization is done in three phases:
1. Calculate a total number of keys created with respect to keys ignored.
 Allocate KEY* buffer.
2. Generate unique names; calculate a total number of key parts.
 Make early checks. Allocate KEY_PART_INFO* buffer.
3. Initialize key parts, make the rest of the checks.
2020-11-02 14:21:05 +10:00
Nikita Malyavin
a79c6e369e MDEV-22677 UPDATE crashes on partitioned HEAP table WITHOUT OVERLAPS
`ha_heap::clone` was creating a handler by share's handlerton, which is
partition handlerton.

handler's handlerton should be used instead.

Here in particular, HEAP handlerton will be used and it will create ha_heap
handler.
2020-11-02 14:11:43 +10:00