Commit graph

188854 commits

Author SHA1 Message Date
Andrei
2ef12cab42 MDEV-27536 invalid BINLOG_BASE64_EVENT and assertion Diagnostics_area:: !is_set()
The assert was caused by an error of XA transaction that had
BINLOG 'base64_string' statement.
The statement failed because of lack of checking whether the encoded
replication event was handled by the slave applier thread.
If it's not the slave applier no error should be generated, but it was
in this case, see a test added.

Fixed along with the idea borrowed the upstream to introduce a check
of which applier executes the replication event and do not
report any error if the applier is a regular server client.
2022-01-27 12:28:01 +02:00
Daniel Black
8b3b73808d MDEV-27635: selinux: allow read of /proc/sys/kernel/core_pattern
Prevent the error:

setroubleshoot[23678]: SELinux is preventing /usr/libexec/mysqld from read access on the file core_pattern.

Reading of the core pattern occurs on crash as added in MDEV-15051

RHEL-7.7

$  ls -laZ /proc/sys/kernel/core_pattern
-rw-r--r--. root root system_u:object_r:usermodehelper_t:s0 /proc/sys/kernel/core_pattern
2022-01-27 10:50:50 +11:00
Daniel Black
68b3fa8865 MDEV-27289: mtr test for WITH_SERVER_EMBEDDED=ON reenable
mtr is checking the wrong path for the embedded executable
on out of tree builds.

The is_embedded.inc tests are also checking the version rather
than the MTR MYSQL_EMBEDDED environment variable.

As a result, a few tests are out of date in the result recordings.
2022-01-27 10:36:39 +11:00
Daniel Black
2e81eab29f MDEV-27607: mysql_install_db to install mysql_upgrade_info
For compatibility this is under an extra option --upgrade-info

The goal here is to install a data directory with the required
info to let mysql_upgrade know that an upgrade isn't required.
2022-01-27 10:35:32 +11:00
Marko Mäkelä
2cbf92522b Cleanup: Remove an unused parameter of fts_add_doc_by_id() 2022-01-26 12:19:48 +02:00
Oleksandr Byelkin
7db489fc7d new CC 2022-01-26 10:42:01 +01:00
Vladislav Vaintroub
2925d0f2ee MDEV-27612 Connect : check buffer sizes, fix string format errors 2022-01-26 09:38:22 +01:00
Lena Startseva
b9623383cc MDEV-8652: Partitioned table creation problem when creating from procedure context twice in same session
The problem was solved in in MDEV-7990, this commit contains only test
2022-01-26 15:08:18 +07:00
Alexey Botchkov
020dc54dab MDEV-20770 Server crashes in JOIN::transform_in_predicates_into_in_subq upon 2nd execution of PS/SP comparing GEOMETRY with other types.
The Item_in_subselect::in_strategy keeps the value and as the error
happens the condition isn't modified. That leads to wrong ::fix_fields
execution on second PS run. Also the select->table_list is merged
but not restored if an error happens, which causes hanging loops on
the third PS execution.
2022-01-26 07:48:09 +04:00
Igor Babaev
0041265671 MDEV-27510 Query returns wrong result when using split optimization
This bug may affect the queries that uses a grouping derived table with
grouping list containing references to columns from different tables if
the optimizer decides to employ the split optimization for the derived
table. In some very specific cases it may affect queries with a grouping
derived table that refers only one base table.
This bug was caused by an improper fix for the bug MDEV-25128. The fix
tried to get rid of the equality conditions pushed into the where clause
of the grouping derived table T to which the split optimization had been
applied. The fix erroneously assumed that only those pushed equalities
that were used for ref access of the tables referenced by T were needed.
In fact the function remove_const() that figures out what columns from the
group list can be removed if the split optimization is applied can uses
other pushed equalities as well.
This patch actually provides a proper fix for MDEV-25128. Rather than
trying to remove invalid pushed equalities referencing the fields of SJM
tables with a look-up access the patch attempts not to push such equalities.

Approved by Oleksandr Byelkin <sanja@mariadb.com>
2022-01-25 17:12:37 -08:00
Brandon Nesterenko
8b15d0d4e0 MDEV-16091: Seconds_Behind_Master spikes to millions of seconds
This patch addresses two problems with
rpl.rpl_seconds_behind_master_spike

First, --sync_slave_with_master / select master_pos_wait
seems to have a bug where it will hang after all master
events have been executed.

This patch removes the sync_slave_with_master command from
the test, where it not required anyway as it is used to
declare explicit cleanup

Second, the test uses timestamps to ensure that the
Seconds_Behind_Master value does not point to a time too
far in the past. The checks of these timestamps were
too strict, because they could be slightly inconsistent
with the master and the SBM would be counted as invalid
when it was actually correct.

To fix this, a slight buffer was added to the check
to ensure the value is valid but still does not point
too far in the past

Reviewed By:
===========
Andrei Elkin <andrei.elkin@mariadb.com>
2022-01-25 15:32:23 -07:00
Alexey Botchkov
50e66db018 MDEV-25917 create table like fails if source table is partitioned and engine is myisam or aria with data directory.
Create table like removes data_file_path/index_file_path from the
thd->work_partition_info.
2022-01-25 12:58:17 +04:00
Alexander Barkov
da37bfd8d6 MDEV-18918 SQL mode EMPTY_STRING_IS_NULL breaks RBR upon CREATE TABLE .. SELECT
Removing DEFAULT from INFORMATION_SCHEMA columns.
DEFAULT in read-only tables is rather meaningless.
Upgrade should go smoothly.

Also fixes:
 MDEV-20254 Problems with EMPTY_STRING_IS_NULL and I_S tables
2022-01-25 10:31:03 +04:00
Oleksandr Byelkin
ebc77c6d17 Merge remote-tracking branch 'connect/10.2' into 10.2 2022-01-24 17:28:34 +01:00
Sergei Golubchik
8acc7fb39c MDEV-24088 Assertion in InnoDB's FTS code may be triggered by a repeated words fed to simple_parser plugin
increment `position` for every word, because the plugin doesn't
(FTS API doesn't use positions that InnoDB FTS relies on)
2022-01-24 11:30:48 +01:00
Marko Mäkelä
2c16fd9baf MDEV-24827, MDEV-20516 fixup: Use C90, plug memory leaks 2022-01-22 10:17:05 +02:00
Jan Lindström
2b6f235ae0 MDEV-21308 : WSREP: binlog ... cache not empty warnings on server with WSREP disabled
Remove output if wsrep is not enabled.
2022-01-22 09:14:26 +02:00
Dmitry Shulga
f99d141cd2 MDEV-20516: Assertion `!lex->proc_list.first && !lex->result && !lex->param_list.elements' failed in mysql_create_view
Execution of the CREATE VIEW statement sent via binary protocol
where the flags of the COM_STMT_EXECUTE request a cursor to be opened
before running the statement results in an assert failure.

This assert fails since the data member thd->lex->result has not null
value pointing to an instance of the class Select_materialize.
The data member thd->lex->result is assigned a pointer to the class
Select_materialize in the function mysql_open_cursor() that invoked
in case the packet COM_STMT_EXECUTE requests a cursor to be opened.

After thd->lex->result is assigned a pointer to an instance of the
class Select_materialize the function mysql_create_view() is called
(indirectly via the function mysql_execute_statement()) and the assert
fails.

The assert
  DBUG_ASSERT(!lex->proc_list.first && !lex->result &&
              !lex->param_list.elements);

was added by the commit 591c06d4b7.
Unfortunately , the condition
  !lex->result
was specified incorrect. It was supposed that the thd->lex->result
is set only by parser on handling the clauses SELECT ... INTO
but indeed it is also set inside mysql_open_cursor() and
that fact was missed by the assert's condition.

So, the fix for this issue is to just remove the condition
  !lex->result
from the failing assert.
2022-01-22 12:46:06 +07:00
Eugene Kosov
faaecc8fcf MDEV-27273 Confusing column count in IMPORT TABLESPACE error message
It's misleading to compare and write to user number of columns and fields.
Thus, it would be better to remove that check and let use see a subsequent
error message about missing or mispaced column.

row_import::match_schema(): remove misleading check
2022-01-21 20:25:56 +03:00
Maheedhar PV
991d5dce32 Bug#31374305 - FORMAT() NOT DISPLAYING WHOLE NUMBER SIDE CORRECTLY FOR ES_MX AND ES_ES LOCALES
Changed the grouping and decimal separator for spanish locales as per
ICU.

Change-Id: I5d80fa59d3e66372d904e17c22c532d4dd2c565b
2022-01-21 16:02:34 +01:00
Sergei Golubchik
4504e6d14e test cases for MySQL bugs
also fix a comment, and update a macro just in case
2022-01-21 16:02:34 +01:00
Sergei Golubchik
c9beef4315 don't build with OpenSSL 3.0, it doesn't work before MDEV-25785 2022-01-21 16:02:34 +01:00
Marko Mäkelä
c1d7b4575e MDEV-26870 --skip-symbolic-links does not disallow .isl file creation
The InnoDB DATA DIRECTORY attribute is not implemented via
symbolic links but something similar, *.isl files that contain
the names of data files.

InnoDB failed to ignore the DATA DIRECTORY attribute even though
the server was started with --skip-symbolic-links.

Native ALTER TABLE in InnoDB will retain the DATA DIRECTORY attribute
of the table, no matter if the table will be rebuilt or not.

Generic ALTER TABLE (with ALGORITHM=COPY) as well as TRUNCATE TABLE
will discard the DATA DIRECTORY attribute.

All tests have been run with and without the ./mtr option
--mysqld=--skip-symbolic-links
and some tests that use the InnoDB DATA DIRECTORY attribute
have been adjusted for this.
2022-01-21 14:43:59 +02:00
Sergei Petrunia
fa7a67ff49 MDEV-27149: Add rocksdb_ignore_datadic_errors
Add a --rocksdb_ignore_datadic_errors plugin option for MyRocks.

The default is 0, and this means MyRocks will call abort() if it detects
a DDL mismatch.

Setting rocksdb_ignore_datadic_errors=1 makes MyRocks to try to ignore the
errors and allow to start the server for repairs.
2022-01-21 09:31:16 +03:00
Sergei Petrunia
ad88c428c5 Avoid a crash on MyRocks data inconsistency.
In ha_rocksdb::open(), check if the number of indexes seen from the
SQL layer matches the number of indexes in the internal MyRocks data
dictionary.

Produce an error if there is a mismatch. (If we don't produce this error,
we are likely to crash as soon as we attempt to use an index)
2022-01-20 22:32:55 +03:00
Monty
d3143ef8a8 Improve --help and remove not-free warnings for mysql_tzinfo_to_sql 2022-01-20 15:14:59 +02:00
Monty
9d4c0a6cab Fixed compiler error in auth_pam plugin
Code copied from 10.6
2022-01-20 15:14:59 +02:00
Monty
0fd4d6d3bb MDEV-27068 running mariadb-upgrade in parallel make it hangs forever
MDEV-27107 prevent two mariadb-upgrade running in parallel
MDEV-27279 mariadb_upgrade add --check-if-upgrade-is-needed /
           restrict tests to major version

Code is based of pull request from Daniel Black, but with a several
extensions.

- mysql_upgrade now locks the mysql_upgrade file with my_lock()
  (Advisory record locking). This ensures that two mysql_upgrades
   cannot be run in parallel.
- Added --check-if-upgrade-is-needed to mysql_upgrade. This will return
  0 if one has to run mysql_upgrade.

Other changes:
- mysql_upgrade will now immediately exit if the major version and minor
  version  (two first numbers in the version string) is same as last run.
  Before this change mysql_upgrade was run if the version string was different
  from last run.
- Better messages when there is no need to run mysql_upgrade.
- mysql_upgrade --verbose now prints out a lot more information about
  the version checking.
- mysql_upgrade --debug now uses default debug arguments if there is no
  option to --debug
- "MySQL" is renamed to MariaDB in the messages
- mysql_upgrade version increased to 2.0

Notes
Verifying "prevent two mariadb-upgrade running in parallel" was
done in a debugger as it would be a bit complex to do that in mtr.

Reviewer: Danial Black <daniel@mariadb.org>
2022-01-20 15:14:59 +02:00
Dmitry Shulga
d28d3aee10 MDEV-24827: Follow-up patch to fix the test main.mysql_client_test_nonblock 2022-01-20 18:39:36 +07:00
Thirunarayanan Balathandayuthapani
474c6df804 MDEV-27417 InnoDB spatial index updates change buffer bitmap page
- InnoDB change buffer doesn't support spatial index. Spatial
index should avoid change the buffer bitmap page when the page
split happens.
2022-01-20 12:50:47 +02:00
Dmitry Shulga
7dcef65046 MDEV-24827: Follow-up patch to fix compilation warning
Mixed declarations and code is not allowed for C90 so
fix it to avoid compilation break on some platforms.
2022-01-20 12:50:27 +02:00
Alexey Botchkov
466d81709b MDEV-26768 Spider table crashes the server after the mysql_list_fields() client's call and produces weird result for SHOW FIELDS.
Suppress errors in ha_spider::info() called from mysqld_show_fields()
2022-01-20 14:44:56 +04:00
Daniel Black
1d27b5789a MDEV-27544 database() function should return 64 characters
Database names are 64 utf8 characters per the system tables
that refer to them.

The current database() function is returning 34 characters.

The result of limiting this function results to max length of 34
became apparent when used in a UNION ALL where the results are
truncated to 34 characters.

For (uninvestigated) reasons, SELECT DATABASE() on its own
would always return the right number of characters.

Thanks Alexander Barkov for the review.

Thanks dave for noticing the bug in the stackexchange post
https://dba.stackexchange.com/questions/306183/why-is-my-database-name-truncated
2022-01-20 19:01:36 +11:00
Sergei Petrunia
7922fbf7b7 MDEV-26249: Crash in Explain_node::print_explain_for_children with slow query log
The problem affected queries in form:

  SELECT FROM (SELECT where Split Materialized is applicable) WHERE 1=0

The problem was caused by this:
- The select in derived table uses two-phase optimization (due to a
  possible Split Materialized).
- The primary select has "Impossible where" and so it short-cuts its
  optimization.
- The optimization for the SELECT in the derived table is never finished,
  and EXPLAIN data structure has a dangling pointer to select #2.

Fixed with this: make JOIN::optimize_stage2() invoke optimization of
derived tables when it is handing a degenerate JOIN with zero tables.
We will not execute the derived tables but we need their query plans
for [SHOW]EXPLAIN.
2022-01-19 23:58:59 +03:00
Monty
dfbfd39e85 Updated rocksdb.corrupted_data_reads_debug result file
The change was because of new rocksdb error message.
2022-01-19 17:00:46 +02:00
Dmitry Shulga
810ef9117a MDEV-24827: MariaDB 10.5.5 crash (sig 11) during a SELECT
Running a query using cursor could lead to a server crash on
building a temporary table used for handling the query.

For example, the following cursor

DECLARE cur1 CURSOR FOR
  SELECT t2.c1 AS c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1
  WHERE EXISTS (SELECT 1 FROM t1 WHERE c2 = -1) ORDER BY c1;

declared and executed inside a stored routine could result in server
crash on creating a temporary table used for handling the ORDER BY clause.

Crash occurred on attempt to create the temporary table's fields based
on fields whose data located in a memory root that already freed.

It happens inside the function return_zero_rows() where the method
Select_materialize::send_result_set_metadata() is invoked for cursor case.
This method calls the st_select_lex_unit::get_column_types() in order to
get a list of items with types of columns for the temporary table being created.
The method st_select_lex_unit::get_column_types() returns
  first_select()->join->fields
in case it is invoked for a cursor. Unfortunately, this memory has been already
deallocated bit earlier by calling
  join->join_free();
inside the function return_zero_rows().

In case the query listed in the example is run in conventional way (without
using cursor) the method st_select_lex_unit::get_column_types()
returns first_select()->item_list that is not touched by invocation
of the method join->join_free() so everything is fine for that.

So, to fix the issue the resources allocated for the JOIN class should be
released after any activities with the JOIN class has been completed,
that is as the last statement before returning from the function
return_zero_rows().

This patch includes tests both for the case when a cursor is run explicitly
from within a stored routine and for the case when a cursor is opened
implicitly as prescribed by the STMT_ATTR_CURSOR_TYPE attribute of
binary protocol (the case of prepared statement).
2022-01-19 21:43:32 +07:00
Anel Husakovic
9cd6ecfe50 MDEV-18284: JSON casting using JSON_COMPACT doesn't always work with values from subqueries
- Cherry-pick 2fcff310d0 (MDEV-21902)
- Closed PR #1145
Reviewed by: holyfoot@mariadb.com
2022-01-19 09:29:02 +01:00
Daniel Black
410c4edef3 MDEV-27467: innodb to enforce the minimum innodb_buffer_pool_size in SET GLOBAL
.. to be the same as startup.

In resolving MDEV-27461, BUF_LRU_MIN_LEN (256) is the minimum number of
pages for the innodb buffer pool size. Obviously we need more than just
flushing pages. Taking the 16k page size and its default minimum, an
extra 25% is needed on top of the flushing pages to make a workable buffer
pool.

The minimum innodb_buffer_pool_chunk_size (1M) restricts the minimum
otherwise we'd have a pool made up of different chunk sizes.

The resulting minimum innodb buffer pool sizes are:

Page Size, Previously minimum (startup), with change.
        4k                            5M           2M
        8k                            5M           3M
       16k                            5M           5M
       32k                           24M          10M
       64k                           24M          20M

With this patch, SET GLOBAL innodb_buffer_pool_size minimums are
enforced.

The evident minimum system variable size for innodb_buffer_pool_size
is 2M, however this is only setable if using 4k page size. As
the order of the page_size and buffer_pool_size aren't fixed, we can't
hide this change.

Subsequent changes:
* innodb_buffer_pool_resize_with_chunks.test - raised of pool resize due to new
  minimums. Chunk size also needed increase as the test was for
  pool_size < chunk_size to generate a warning.
* Removed srv_buf_pool_min_size and replaced use with MYSQL_SYSVAR_NAME(buffer_pool_size).min_val
* Removed srv_buf_pool_def_size and replaced constant defination in
  MYSQL_SYSVAR_LONGLONG(buffer_pool_size)
* Reordered ha_innodb to allow for direct use of MYSQL_SYSVAR_NAME(buffer_pool_size).min_val
* Moved buf_pool_size_align into ha_innodb to access to MYSQL_SYSVAR_NAME(buffer_pool_size).min_val
* loose-innodb_disable_resize_buffer_pool_debug is needed in the
  innodb.restart.opt test so that under debug mode, resizing of the
  innodb buffer pool can occur.
2022-01-19 11:10:45 +11:00
Marko Mäkelä
4db6e86ebe MDEV-27539 Merge new release of InnoDB 5.7.37 to 10.2
There were no InnoDB changes in the MySQL 5.7.37 release that would be
relevant to MariaDB Server. We will merely update the reported
InnoDB version number.
2022-01-18 18:16:10 +02:00
Alexander Barkov
bf9bc99106 MDEV-26129 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column
Range optimizer incorrectly was used for ENUM columns
when the operation collation did not match the column collation.

Adding a virtual implementation of Field_enum::can_optimize_range()
which tests if the column and the operation collation match.
2022-01-18 15:32:01 +04:00
Igor Babaev
97425f740f MDEV-27132 Wrong result from query when using split optimization
This bug could affect queries with a grouping derived table containing
equalities in the where clause of its specification if the optimizer
chose to apply split optimization to access the derived table. In such
cases wrong results could be returned from the queries.
When the optimizer considers a possibility of using split optimization
to a derived table it injects equalities joining the derived table with
other tables into the where condition of the derived table. After the join
order for the execution using split optimization has been chosen as the
cheapest the injected equalities that are not used to access the derived
table are removed from the where condition of the derived table.
For this removal the optimizer looks through the conjuncts of the where
condition of the derived table, fetches the equalities and checks whether
they belong to the list of injected equalities.
As the injection of the list was performed just by the insertion of it
into the list of top level AND condition of the where condition some extra
conjuncts from the where condition could be automatically attached to the
end of the list of injected equalities. If such attached conjunct happened
to be an equality predicate it was removed from the where condition of the
derived table and thus lost for checking at the execution phase.
The bug has been fixed by injecting of a shallow copy of the list of the
pushed equalities rather than the list itself leaving the latter intact.

Approved by Oleksandr Byelkin <sanja@mariadb.com>
2022-01-17 23:04:39 -08:00
Vladislav Vaintroub
47e18af906 MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
Aleksey Midenkov
7105c810bd MDEV-27217 typo fix 2022-01-15 14:17:19 +03:00
Alexey Bychko
746050d02d MDEV-27109 mysql_config mariadb_config lists non existant -lmariadb
added dependency devel->shared and conflict with previous versions
update C/C 3.1 with the corresponding C/C part of the fix
2022-01-14 22:16:39 +01:00
Sergei Golubchik
b5a14f061b /usr/lib64/pkgconfig is not owned by MariaDB-devel 2022-01-14 22:16:39 +01:00
Sergei Golubchik
3548e80bc4 MDEV-4621 select returns null for information_schema.statistics.collation field
information_schema.statistics.collation column needs OPEN_FULL_TABLE,
because it checks index_flags() for HA_READ_ORDER capability.
2022-01-14 22:16:39 +01:00
Sergei Golubchik
a88a4336fc mtr failed to detect when a combination is forced
mtr detects a forced combination if the command line for a test already
includes all options from this combination. options are stored in a perl
hash as (key,value) pairs.

this breaks if the command line has two options with the same name,
like --plugin-load-add=foo --plugin-load-add=bar, and the combination
forces plugin foo.

In particular, this resulted in warnings when running
federated.federatedx_versioning test
2022-01-14 22:16:39 +01:00
Marko Mäkelä
d7f4fd30f2 MDEV-8851 innodb.innodb_information_schema fails sporadically
The column INFORMATION_SCHEMA.INNODB_LOCKS.LOCK_DATA
would report NULL when the page that contains the locked
record does not reside in the buffer pool.

Pages may be evicted from the buffer pool due to some background
activity, such as the purge of transaction history loading
undo log pages to the buffer pool. The regression tests intentionally
run with a small buffer pool size setting.

To prevent the intermittent test failures, we will filter out the
contents of the LOCK_DATA column from the output.
2022-01-14 15:53:29 +02:00
Aleksey Midenkov
c81677bebb rocksdb.tbl_opt_data_index_dir test fix
Handler error codes in storage engine may change as they depend on
volatile HA_ERR_LAST.
2022-01-14 12:06:15 +03:00
Aleksey Midenkov
585cb18ed1 MDEV-27452 TIMESTAMP(0) system field is allowed for certain creation of system-versioned table
First, we do not add VERS_UPDATE_UNVERSIONED_FLAG for system field and
that fixes SHOW CREATE result.

Second, we have to call check_sys_fields() for any CREATE TABLE and
there correct type is checked for system fields.

Third, we update system_time like as_row structures for ALTER TABLE
and that makes check_sys_fields() happy for ALTER TABLE when we make
system fields hidden.
2022-01-13 23:35:17 +03:00