Commit graph

195664 commits

Author SHA1 Message Date
Marko Mäkelä
2d8e38bc94 Merge 10.6 into 10.7 2022-04-06 13:00:09 +03:00
Marko Mäkelä
4e1ca38838 MDEV-26781 InnoDB hangs when using SUX_LOCK_GENERIC
The Shared/Update/Exclusive locks that were introduced in
commit 03ca6495df (MDEV-24142)
did not work correctly when a futex-like system call interface
was not available.

On all tested implementations (IBM AIX as well as FreeBSD and GNU/Linux
with the futex interface artificially disabled), the old implementation
would cause hangs in some SPATIAL INDEX tests (innodb_gis suite).
On FreeBSD, a hang was also observed in an encryption test.

We will simply emulate the futex system calls with a single mutex
and two condition variables, one for each wait queue. The condition
variables basically shadow the lock words and are used as wait queues,
just like the futex system calls would be.

The storage overhead of ssux_lock_impl will be increased by 32 bits
when using SUX_LOCK_GENERIC. Compared to the futex-based implementation,
the SUX_LOCK_GENERIC implementation has an overhead of
sizeof(pthread_mutex_t)+2*sizeof(pthread_cond_t).

rw_lock: Remove all SUX_LOCK_GENERIC extensions.

pthread_mutex_wrapper: A simple wrapper of pthread_mutex that
implements srw_spin_mutex and srw_mutex for SUX_LOCK_GENERIC.

srw_mutex_impl: Define this also for SUX_LOCK_GENERIC, but in
that case add the fields mutex, cond.

ssux_lock_impl: Define for SUX_LOCK_GENERIC with a minimal difference:
adding readers_cond.
2022-04-06 12:51:27 +03:00
Marko Mäkelä
ff99413804 MDEV-25975: Merge 10.5 into 10.6 2022-04-06 12:45:14 +03:00
Marko Mäkelä
9d94c60f2b Merge 10.5 into 10.6 2022-04-06 12:08:30 +03:00
Marko Mäkelä
fd6a464ae5 MDEV-13005 after-merge fixup 2022-04-06 11:51:36 +03:00
Marko Mäkelä
5d8dcfd86c MDEV-25975: Merge 10.4 into 10.5 2022-04-06 10:30:49 +03:00
Marko Mäkelä
cbdf62ae90 MDEV-25975 merge fixup 2022-04-06 10:13:21 +03:00
Marko Mäkelä
cacb61b6be Merge 10.4 into 10.5 2022-04-06 10:06:39 +03:00
Marko Mäkelä
d172df9913 MDEV-25975: Merge 10.3 into 10.4 2022-04-06 09:18:38 +03:00
Marko Mäkelä
f089f8d95e MDEV-23328 fixup: sign mismatch in format strings
kill_one_thread(): Fix integer sign mismatch in some format strings.
Some of this was introduced
in commit 5c230b21bf
2022-04-06 08:59:41 +03:00
Marko Mäkelä
d6d66c6e90 Merge 10.3 into 10.4 2022-04-06 08:59:09 +03:00
sjaakola
d6758efbe1 MDEV-23328 Server hang due to Galera lock conflict resolution
Cherry-pick the sql_kill and sql_user_kill from ef2dbb8dbc

Changed ER_CANNOT_USER to ER_KILL_DENIED_ERROR to match
other kill denied user messages.

Cherry-pick by Daniel Black.

Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
2022-04-06 15:23:25 +10:00
Faustin Lammler
aed87f1e0a Change MDBF mirror URL
As as discussed with @dbart we decided to move
https://deb.mariadb.org/repo to https://deb.mariadb.org so that a
request on https://deb.mariadb.org will end up directly in
https://mirror.mariadb.org/repo.

The same behavior was configured for rpms (https://rpm.mariadb.org -->
https://mirror.mariadb.org/yum) this also makes the old yum.mariadb.org
service transparently compatible with this new service (after DNS change
to point to rpm.mariadb.org).

See also: https://jira.mariadb.org/browse/MDBF-297
2022-04-06 15:09:53 +10:00
Marko Mäkelä
e9735a8185 MDEV-25975 innodb_disallow_writes causes shutdown to hang
We will remove the parameter innodb_disallow_writes because it is badly
designed and implemented. The parameter was never allowed at startup.
It was only internally used by Galera snapshot transfer.
If a user executed
SET GLOBAL innodb_disallow_writes=ON;
the server could hang even on subsequent read operations.

During Galera snapshot transfer, we will block writes
to implement an rsync friendly snapshot, as follows:

sst_flush_tables() will acquire a global lock by executing
FLUSH TABLES WITH READ LOCK, which will block any writes
at the high level.

sst_disable_innodb_writes(), invoked via ha_disable_internal_writes(true),
will suspend or disable InnoDB background tasks or threads that could
initiate writes. As part of this, log_make_checkpoint() will be invoked
to ensure that anything in the InnoDB buf_pool.flush_list will be written
to the data files. This has the nice side effect that the Galera joiner
will avoid crash recovery.

The changes to sql/wsrep.cc and to the tests are based on a prototype
that was developed by Jan Lindström.

Reviewed by: Jan Lindström
2022-04-06 08:06:49 +03:00
Marko Mäkelä
7c584d8270 Merge 10.2 into 10.3 2022-04-06 08:06:35 +03:00
Daniel Black
7ae46ced37 Merge branch 10.8 into 10.9
Closes #2084
2022-04-06 14:33:27 +10:00
Daniel Black
7b06bc9a94 Merge branch 10.7 into 10.8
Closes #2083
2022-04-06 14:23:20 +10:00
Daniel Black
b249abde57 Merge branch '10.6' into 10.7
Closes #2082
2022-04-06 14:11:58 +10:00
Tuukka Pasanen
b4f3969a6c MDEV-28121: Add new compression plugins as autopkg dependencies
Add compression plugins:
  * bzip2
  * lz4
  * lzma
  * lzo
  * snappy
To Autopkg's basic smoke-test dependencies.

Also make sure that MariaDB service is reloaded
when smoke-test is executed.
2022-04-06 11:34:52 +10:00
Dmitry Shulga
f6b09a7ce5 MDEV-21173: Assertion `m_thd == __null' failed in sp_head::~sp_head
Some SQL statements that involves subqueries or stored routines could
fail since execution of subqueries or stored routines is not supported
for theses statements. Unfortunately, parsing error could result in
abnormal termination by firing the following assert
  DBUG_ASSERT(m_thd == NULL);
in a destructor of the class sp_head.

The reason of the assert firing is that the method
  sp_head::restore_thd_mem_root()
is not called on semantic action code to clean up resources allocated
during parsing. This happens since the macros YYABORT is called instead of
MYSQL_YYABORT by semantic action code for some grammar rules.

So, to fix the bug YYABORT was just replaced with MYSQL_YYABORT.
2022-04-05 20:20:09 +07:00
Sergei Golubchik
2d2c3da8ec MDEV-27673 Warning after "select progress from information_schema.processlist"
after moving fields in optimize_schema_tables_memory_usage()
store default values into their new, moved, locations.
2022-04-05 13:09:44 +02:00
Sergei Golubchik
cf8d30efd2 Revert "MDEV-28131 Unexpected warning while selecting from information_schema.processlist"
This reverts commit 0812d0de8d.
But keeps the test case.
2022-04-05 13:09:44 +02:00
Sergei Golubchik
d7fd76456e MDEV-19525 fix the test for embedded
followup for 58cd2a8ded
2022-04-05 13:09:44 +02:00
Marko Mäkelä
8d9c2561cd Merge 10.5 into 10.6 2022-04-05 10:08:44 +03:00
Otto Kekäläinen
8c919330a7 Deb: Sync Salsa-CI from Debian MariaDB 10.6
As MariaDB 10.5 has been removed from Debian Sid and MariaDB 10.6 has
entered it, the Salsa-CI testing needs to adapt.

To achieve this, essentially sync most the the salsa-ci.yml contents from
https://salsa.debian.org/mariadb-team/mariadb-server/-/tree/debian/latest

This includes removing Stretch builds, as Stretch does not support uring
nor pmem libraries, which MariaDB 10.6 depends on.

Also add a couple Lintian overrides to make Salsa-CI pass.

NOTE TO MERGERS: This commit is made on 10.6 branch and can be merged to
all later branches (10.7, 10.8, 10.9..) for now, but later somebody needs
to go in and update all the testing stages to do the upgrade testing
correctly for 10.6->10.7->10.8->10.9 etc.
2022-04-05 16:49:57 +10:00
Thirunarayanan Balathandayuthapani
db655e1310 MDEV-28237 Assertion `0' failed in row_upd_sec_index_entry on DELETE
- InnoDB bulk insert operation fails to rollback when it detect
DB_DUPLICATE_KEY error. It leads to orphaned records in primary
indexes. Consecutive update/delete operation assumes that record
should exist in secondary index and it leads to failure.
2022-04-04 19:34:59 +05:30
Thirunarayanan Balathandayuthapani
b678f8811b MDEV-28138 MariaDB Assertion Failed in mtr_buf_t::has_space
- After MDEV-24621, InnoDB does buffer the insert bulk operation
for all indexes expect spatial one. But it leads to search the
primary key lookup and it leads to failure. So InnoDB should avoid
bulk insert when table has spatial index involved.
2022-04-04 19:34:36 +05:30
Monty
c4ebb2bd04 Fixed that mysql_upgrade doesn't give errors about mariadb.sys
The reason for this fix was that when I tried to run mysql_upgrade
at home to update an old 10.5 installation, mysql_upgrade failed
with warnings about mariadb.sys user not existing.

If the server was started with --skip-grants, there would be no warnings
from mysql_upgrade, but in some cases running mysql_upgrade again could
produce new warnings.

The reason for the warnings was that any access of the mysql.user view
will produce a warning if the mariadb.sys user does not exists.

Fixed with the following changes:
- Disable warnings about mariadb.sys user not existing
- Don't overwrite old mariadb.sys entries in tables_priv and global_priv
- Ensure that tables_priv has an entry for mariadb.sys if the user exists.
  This fixes an issue that tables_priv would not be updated if there
  was a failure directly after global_priv was updated.
2022-04-04 16:14:22 +03:00
Monty
09c7f78c2e Fixed double free issue in events
Server crashed during shutdown with:
"corrupted double-linked list"
when running mysql_upgrade multiple times against the server.

Reason was that db_repostitory could be freed twice.
2022-04-04 16:14:22 +03:00
Julius Goryavsky
daed558b2c MDEV-28204: The tr utility does not work as expected on rsync SST
This commit contains a fix to use modern syntax for selecting
character classes in the tr utility options.

Also one of the tests for SST via rsync (galera_sst_rysnc2) is made
more reliable (to avoid rare failures during automatic testing).
2022-04-04 11:46:06 +02:00
Vlad Lesin
6a3545dd1e MDEV-26322 Last binlog file and position are "empty" in mariabackup --prepare output
The issue is caused by 59a0236da4 commit.
The initial intention of the commit was to speed up
"mariabackup --prepare".

The call stack of binlog position reading is the following:
▾ trx_rseg_mem_restore
  ▾ trx_rseg_array_init
      ▾ trx_lists_init_at_db_start
            ▸ srv_start
Both trx_lists_init_at_db_start() and trx_rseg_mem_restore() contain
special cases for srv_operation == SRV_OPERATION_RESTORE condition, and
on this condition only rseg headers are read to parse binlog position.
Performance impact is not so big.

The solution is to revert 59a0236da4.
2022-04-04 12:19:09 +03:00
Daniel Black
7f5a3cd253 MDEV-28231: innodb: format string warning on aix UINT64PFx (ib_id_t)
ib_id_t is a uint64. On AIX this isn't a long long unsigned and to
prevent the compile warnings and potential wrong type, the UINT64PFx
defination is corrected.

As INT64PF is unused (last use, xtradb in 10.2), it is removed to
remove the confusion that INT64PF and UINT64PFx would be different
types otherwise.
2022-04-04 12:06:37 +03:00
Dmitry Shulga
cd56b40f6d MDEV-28129: MariaDB UAF issue at lex_end_nops(LEX*)
This bug report is not about ASAN Use After Free issue. This bug is
about missed calling of the method LEX::cleanup_lex_after_parse_error
that should happen on parse error.

Aforementioned method calls sphead::restore_thd_mem_root to clean up
resources acquired on processing a stored routine. Particularly,
the method sp_head::restore_tht_mem_root is called to restore
an original mem root and reset LEX::sphead into nullptr.

The method LEX::cleanup_lex_after_parse_error is invoked by the macros
MYSQL_YYABORT. Unfortunately, some rules of grammar for handling
user variables in SQL use YYABORT instead of MYSQL_YYABORT to handle
parser errors. As a consequence, in case a statement with setting of
a user variable is called inside a stored routine, it results in
assert failure in sp_head destructor.

To fix the issue the macros YYABORT should be replaced by MYSQL_YYABORT
in those grammar rules that handle assignment of user variables.
2022-04-04 14:32:16 +07:00
Alexander Barkov
0ffaf19c53 Adding a "const" qualifier to arguments of create_func(), create_native() etc
The "const" qualifier was obviously forgotten.

This change will also simpily fixing of MDEV-27744.
2022-04-04 09:50:32 +04:00
Alexander Barkov
d271fbd392 MDEV-28224 error: cannot initialize return object of type 'bool' with an rvalue of type 'nullptr_t'
Fixing a typo in the fix for MDEV-19804, wrong return value in a bool function:
 < return NULL;
 > return true;

The problem was found because it did not compile on some platforms.

Strangley, it did not have visible problems on other platforms,
which did not fail to compile, although "return NULL" should compile to
"return false" rather than "return true".
2022-04-04 08:50:24 +04:00
Daniel Black
75b9014fed MDEV-26136: Correct AIX/macOS cast warning (my_time.h)
tv_usec is a (suseconds_t) so we cast to it. Prevents the AIX(gcc-10) warning:

include/my_time.h: In function 'void my_timeval_trunc(timeval*, uint)':
include/my_time.h:249:65: warning: conversion from 'long int' to 'suseconds_t' {aka 'int'} may change value [-Wconversion]
  249 |   tv->tv_usec-= my_time_fraction_remainder(tv->tv_usec, decimals);
      |

macOS is: conversion from 'long int' to '__darwin_suseconds_t' {aka 'int'} may change value

On Windows suseconds_t isn't defined so we use the existing
long return type of my_time_fraction_remainder.

Reviewed by Marko Mäkelä

Closes: #2079
2022-04-04 08:31:40 +10:00
Sergei Golubchik
d48774e0e0 MDEV-27354 Change maturity of plugins 2022-04-02 17:19:43 +02:00
Dmitry Shulga
8c169f5e03 MDEV-28220: Assert failure in sp_head::~sp_head on parsing a syntax incorrect statement CREATE SEQUENCE ... RESTART inside CREATE PROCEDURE/CREATE FUNCTION
This bug report is about the same issue as MDEV-28129 and MDEV-21173.
The issue is that the macros YYABORT is called instead of MYSQL_YYABORT
on parse error. In result the method LEX::cleanup_lex_after_parse_error
is not called to clean up data structures created on parsing of
the statement.
2022-04-02 16:43:51 +07:00
Anel Husakovic
1118b66a22 MDEV-23626: CONNECT VIR tables return inconsistent error for UPDATE
- Before the patch UPDATE error message for VIR tables was different from TRUNCATE,UPDATE,DELETE
Reviewed by: <Olivier Bertrand>, vicentiu@mariadb.org
2022-04-01 06:40:28 -07:00
Jan Lindström
49aee1a153 MDEV-28210 : SIGSEGV in the test galera.galera_sst_rsync2
We should make sure that wsrep exists before calling wsrep->post_rollback
2022-04-01 13:29:31 +03:00
Daniel Black
32ab64c390 MDBF-348: libfmt=system, custom include path
With testing the system libfmt, use the
LIBFMT_INCLUDE_DIR in case the system
include path isn't sufficient.
2022-04-01 20:53:22 +11:00
Daniel Black
28116ca361 MDBF-348: innodb aix htm support
CMAKE_SYSTEM_PROCESSOR on AIX is "powerpc". To
deconflict with the Linux 32bit arch of the same
name, CMAKE_SYSTEM_NAME was used in the CMakeLists.txt
test to enable -mhtm in the same way that was required
for Linux ppc64{,le} compilers in MDEV-27936
2022-04-01 18:31:29 +11:00
Aleksey Midenkov
2407dbbfc4 MDEV-27600 partition_debug fails with warnings "Table is open on rename new table"
Table must be closed before running ddl log revert. That is done by
handle_alter_part_error().
2022-04-01 09:06:53 +03:00
Brandon Nesterenko
c62843a055 MDEV-25580: rpl.rpl_semi_sync_slave_compressed_protocol crashes because of wrong packet
rpl.rpl_semi_sync_slave_compressed_protocol.test was manually
re-enabled only in 10.3 but left disabled in 10.4+. The fix went
into 10.3+, but the test was left disabled in later versions. This
commit re-enables the test in 10.4+.
2022-03-31 13:03:24 -06:00
Nayuta Yanagisawa
f78fdf087f MDEV-28005 Deprecate Spider plugin variables regarding UDFs
Configuring UDFs via plugin variables looks not a good idea.
The more variables Spider has, the more complex it becomes.
Further, I expect that only a few users use Spider UDFs.

Deprecate the following plugin variables regarding Spider UDFs:

* spider_udf_ds_bulk_insert_rows
* spider_udf_ds_table_loop_mode
* spider_udf_ds_use_real_table
* spider_udf_ct_bulk_insert_interval
* spider_udf_ct_bulk_insert_rows

spider_udf_table_lock_mutex_count and spider_udf_table_mon_mutex_count
are also for tweaking UDFs but they are already read-only. So,
there is no need to deprecate them.
2022-03-31 23:55:38 +09:00
Nayuta Yanagisawa
ef930dcad5 Spider: Remove unnecessary files for Autotools 2022-03-31 22:55:11 +09:00
Nayuta Yanagisawa
f76da7f662 MDEV-27474 Spider: remove #WITH_PARTITION_STORAGE_ENGINE
"#ifdef WITH_PARTITION_STORAGE_ENGINE ... #endif" appears frequently
in the Spider code base. However, there is no need to maintain such
ifdefs because Spider is disabled if the partitioning engine is disabled.
2022-03-31 21:43:59 +09:00
Monty
69be3c13b6 Fixed unlikely assert/crash if initialization of translog failed
This was noticed as part of verifying
MDEV-28186 "crash on startup after crash while regular use"
but is probably not related to the users issue.
Still good to have it fixed
2022-03-31 15:40:17 +03:00
Vlad Lesin
c1ab0e6fc6 MDEV-27343 Useless warning "InnoDB: Allocated tablespace ID <id> for <tablename>, old maximum was 0" during backup stage
mariabackup does not load dictionary during backup, but it loads
tablespaces, that is why fil_system.max_assigned_id is not set with
dict_check_tablespaces_and_store_max_id(). There is no sense to issue the
warning during backup.
2022-03-30 19:42:35 +03:00
Marko Mäkelä
35425cfc55 Cleanup: Remove some unused functions 2022-03-30 15:57:08 +03:00