Commit graph

196686 commits

Author SHA1 Message Date
Yuchen Pei
8c8684b17f
MDEV-28226 Remove HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
handler::need_info_for_auto_inc() was added in MDEV-7720 / MDEV-7726
in commit dc17ac1638
2024-09-10 11:15:15 +10:00
Yuchen Pei
affcb0713d
MDEV-26178 spider: remove PARTITION_HAS_GET_PART_SPEC
This macro is unused, and not in 11.5 c96b23f994
2024-09-10 11:15:15 +10:00
Yuchen Pei
6d0d09ebc2
MDEV-26178 Spider: remove HANDLER_HAS_TOP_TABLE_FIELDS
This macro is unused
2024-09-10 11:15:14 +10:00
Yuchen Pei
1cb75d9a33
MDEV-27660 Remove #ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS
The flag argument was added to handler::start_bulk_insert() in
the MDEV-539 commit
ca2cdaad86
2024-09-10 11:15:14 +10:00
Yuchen Pei
aaba68ac1e
MDEV-28896 Spider: remove #ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
new_data is const since at least 2017: a05a610d60
2024-09-10 11:15:14 +10:00
Yuchen Pei
f16c037753
MDEV-28895 Spider: remove #ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
handler has can_use_for_auto_inc_init() since at latest 2017:
dc17ac1638
2024-09-10 11:15:14 +10:00
Yuchen Pei
0650c87d9b
MDEV-27647 Spider: remove HANDLER_HAS_DIRECT_UPDATE_ROWS 2024-09-10 11:15:13 +10:00
Yuchen Pei
d5d65b948b
MDEV-26178 Spider: remove HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF
HA_EXTRA_USE_CMP_REF is undefined, and remains so as of 11.5
c96b23f994
2024-09-10 11:15:13 +10:00
Yuchen Pei
de3dd942c0
MDEV-28894 Spider: remove #ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN
HA_EXTRA_STARTING_ORDERED_INDEX_SCAN was added latest 2018:
921c5e9314
2024-09-10 11:15:13 +10:00
Yuchen Pei
64581c83e8
MDEV-28893 Spider: remove #ifdef SPIDER_NET_HAS_THD
net has thd since 2015 in 56aa19989f for MDEV-6152
2024-09-10 11:15:12 +10:00
Yuchen Pei
ba9bebd719
MDEV-28892 remove #ifdef SPIDER_Item_args_arg_count_IS_PROTECTED
arg_count was protected since 2015 in commit
afa1773439
2024-09-10 11:15:12 +10:00
Yuchen Pei
05fafaf82d
MDEV-27646 remove SPIDER_HAS_HASH_VALUE_TYPE
unifdef -DSPIDER_HAS_HASH_VALUE_TYPE -m storage/spider/spd_* storage/spider/ha_spider.* storage/spider/hs_client/*
2024-09-10 11:15:12 +10:00
Marko Mäkelä
f06060f5ed Cleanup: Remove the function dict_remove_db_name() 2024-09-06 14:31:55 +03:00
Marko Mäkelä
024a18dbcb MDEV-34823 Invalid arguments in ib_push_warning()
In the bug report MDEV-32817 it occurred that the function
row_mysql_get_table_status() is outputting a fil_space_t*
as if it were a numeric tablespace identifier.

ib_push_warning(): Remove. Let us invoke push_warning_printf() directly.

innodb_decryption_failed(): Report a decryption failure and set the
dict_table_t::file_unreadable flag. This code was being duplicated in
very many places. We return the constant value DB_DECRYPTION_FAILED
in order to avoid code duplication in the callers and to allow tail calls.

innodb_fk_error(): Report a FOREIGN KEY error.

dict_foreign_def_get(), dict_foreign_def_get_fields(): Remove.
This code was being used in dict_create_add_foreign_to_dictionary()
in an apparently uncovered code path. That ib_push_warning() call
would pass the integer i+1 instead of a pointer to NUL terminated
string ("%s"), and therefore the call should have resulted in a crash.

dict_print_info_on_foreign_key_in_create_format(),
innobase_quote_identifier(): Add const qualifiers.

row_mysql_get_table_error(): Replaces row_mysql_get_table_status().
Display no message on DB_CORRUPTION; it should be properly reported at
the SQL layer anyway.
2024-09-06 14:29:09 +03:00
Yuchen Pei
e886c2ba02
MDEV-34757 Check leaf_tables_saved in partition pruning in UPDATE and DELETE 2024-09-06 11:41:59 +10:00
Yuchen Pei
00cb344085
MDEV-33858 Assertion `(mem_root->flags & 4) == 0' fails on 2nd execution of PS with -DWITH_PROTECT_STATEMENT_MEMROOT=ON
Simply adding tests as the bug is fixed with a backport of MDEV-34447
2024-09-06 11:41:59 +10:00
Yuchen Pei
2c3e07df47
MDEV-34447: Memory leakage is detected on running the test main.ps against the server 11.1
The memory leak happened on second execution of a prepared statement
that runs UPDATE statement with correlated subquery in right hand side of
the SET clause. In this case, invocation of the method
  table->stat_records()
could return the zero value that results in going into the 'if' branch
that handles impossible where condition. The issue is that this condition
branch missed saving of leaf tables that has to be performed as first
condition optimization activity. Later the PS statement memory root
is marked as read only on finishing first time execution of the prepared
statement. Next time the same statement is executed it hits the assertion
on attempt to allocate a memory on the PS memory root marked as read only.
This memory allocation takes place by the sequence of the following
invocations:
 Prepared_statement::execute
  mysql_execute_command
   Sql_cmd_dml::execute
    Sql_cmd_update::execute_inner
     Sql_cmd_update::update_single_table
      st_select_lex::save_leaf_tables
       List<TABLE_LIST>::push_back

To fix the issue, add the flag SELECT_LEX::leaf_tables_saved to control
whether the method SELECT_LEX::save_leaf_tables() has to be called or
it has been already invoked and no more invocation required.

Similar issue could take place on running the DELETE statement with
the LIMIT clause in PS/SP mode. The reason of memory leak is the same as for
UPDATE case and be fixed in the same way.
2024-09-06 11:41:58 +10:00
Daniel Black
8024b8e4c1 MDEV-33091 pcre2 headers - handle columnstore
From e735cf2ed7cefb2af36f10f3cb47dfc060789df3, the PCRE_INCLUDES
changed to PCRE_INCLUDE_DIRS for consistency.

The columnstore module depends on the old name.

Create a mapping for the columnstore submodule.

10.6+ fix for submodule is:
* https://github.com/mariadb-corporation/mariadb-columnstore-engine/pull/3304
2024-09-05 12:14:06 +10:00
Daniel Black
dff354e7df MDEV-34825: my_cpu.h - non-glibc ism for POWER
Taking both the FreeBSD[1] and Alpine[1] patch concepts;

provide non-GLIBC definations for HMT_*.

Provide FreeBSD ASM base for __ppc_get_timebase.
On alternately use __builtin_ppc_get_timebase which is described
on https://gcc.gnu.org/onlinedocs/gcc/Basic-PowerPC-Built-in-Functions-Available-on-all-Configurations.html
an not depended on glibc/musl.

[1] 15d22e1c70/databases/mariadb106-server/files/patch-include_my__cpu.h
[2] https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/mariadb/ppc-remove-glibc-dep.patch
2024-09-05 12:14:06 +10:00
Piotr Kubaj
e9b70e59a3 MDEV-34825 FreeBSD - upstream riscv64 compatibility patch
From 15d22e1c70/databases/mariadb106-server/files/patch-sql_mysqld.cc
2024-09-05 12:14:06 +10:00
Piotr Kubaj
7b2b03c4f2 MDEV-34825 FreeBSD fails to build under clang natively
Upstream the patch from: 15d22e1c70/databases/mariadb106-server/files/patch-mysys_crc32_crc32c.cc
2024-09-05 12:14:06 +10:00
Sergei Golubchik
566c22e814 pcre.cmake: always check the library with check_library_exists()
even if pkg-config has it. otherwise build dependencies
aren't detected.
2024-09-05 12:14:06 +10:00
Sergei Golubchik
b2ebe1cb7b MDEV-33091 pcre2 headers aren't found on Solaris
use pkg-config to find pcre2, if possible

rename PCRE_INCLUDES to use PKG_CHECK_MODULES naming, PCRE_INCLUDE_DIRS
2024-09-05 12:14:06 +10:00
Daniel Black
2e23c7342f MDEV-34567 unit.my_apc always failing on FreeBSD-14
Without the call to my_mutex_init, the mutex attributes
my_fast_mutexattr and my_errorcheck_mutexattr are uninitialized.

Linux tolerates this but FreeBSD doesn't (and segfaults).

We fix for all since the unit text should be testing the
standard mutexes of the system.
2024-09-05 12:14:06 +10:00
Daniel Black
c991efd9c3 MDEV-34825 FreeBSD fails to build under clang natively
clang doesn't have /usr/local/lib in the path. As such
there are various depedency linkages that will fail.

For example pcre and libfmt.`
2024-09-05 12:14:06 +10:00
Daniel Black
d1dc70675c MDEV-34864 SHOW INDEX FROM - SEQ_IN_INDEX to ULong
MySQL-Connector-Net casts SEQ_IN_INDEX to uint and will
raise an exception if the type is a System.Int64.

As we don't support a huge number of multi-columns in
an index reducing to a uint is sufficient to represent
all values and maintain compatibility with MySQL-Connector-Net.

This matches the type (uint) returned by MySQL-8.3 and 8.0.

Reviewer: Alexander Barkov <bar@mariadb.com>
2024-09-04 17:17:32 +10:00
Denis Protivensky
235f33e360 MDEV-33133: MDL conflict handling code should skip BF-aborted trxs
It's possible that MDL conflict handling code is called more
than once for a transaction when:
- it holds more than one conflicting MDL lock
- reschedule_waiters() is executed,
which results in repeated attempts to BF-abort already aborted
transaction.
In such situations, it might be that BF-aborting logic sees
a partially rolled back transaction and erroneously decides
on future actions for such a transaction.

The specific situation tested and fixed is when a SR transaction
applied in the node gets BF-aborted by a started TOI operation.
It's then caught with the server transaction already rolled back,
but with no MDL locks yet released. This caused wrong state
detection for such a transaction during repeated MDL conflict
handling code execution.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-09-01 16:19:59 +02:00
Jan Lindström
7e748d075b MDEV-34841 : Enable working Galera tests
* Fixes galera.galera_bf_kill_debug test case.
* Enable galera_ssl_upgrade, galera_ssl_reload, galera_pc_bootstrap
* Add MDEV to disabled tests that miss it

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-09-01 03:51:10 +02:00
Jan Lindström
dd64f29d6b MDEV-33897 : Galera test failure on galera_3nodes.galera_gtid_consistency
Based on logs SST was started before donor reached
Primaty state. Add wait_conditions to make sure that
nodes reach Primary state before starting next node.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-09-01 03:01:37 +02:00
Alexey Yurchenko
83196a7b23 Add a basic MTR test for DDL error voting to ensure that all DDLs
generate consistent error messages,

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-09-01 02:58:34 +02:00
Alexey Yurchenko
731a5aba0b Use only MySQL code for TOI error vote
For TOI events specifically we have a situation where in case of the
same error different nodes may generate different messages. This may
be for two reasons:
 - different locale setting between the current client session and
   server default (we can reasonably require server locales to be
   identical on all nodes, but user can change message locale for the
   session)
 - non-deterministic course of STATEMENT execution e.g. for ALTER TABLE

On the other hand we may reasonably expect TOI event failures since
they are executed after replication, so we must ensure that voting is
consistent. For that purpose error codes should be sufficiently unique
and deterministic for TOI event failures as DDLs normally deal with
a single object, so we can merely use MySQL error codes to vote on.

Notice that this problem does not happen with regular transactional
writesets, since the originator node will always vote success and
replica nodes are assumed to have the same global locale setting.
As such different error messages indicate different errors even if
the error code is the same (e.g. ER_DUP_KEY can happen on different
rows tables).

Use only MySQL error code (without the error message) for error voting
in case of TOI event failure.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-09-01 02:58:27 +02:00
Alexey Yurchenko
7119149f83 If donor loop receives unknown signal from the SST script it is an
error condition (SST failure), so it should set error code before
exiting.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-09-01 02:54:05 +02:00
Alexey Yurchenko
69c6cb5dc4 Fix recovering state GTID in case log file contains non-text bytes -
use grep with -a option.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-09-01 02:52:52 +02:00
Teemu Ollakka
54a10a4293 MDEV-32363 Shut down Galera networking and logging on fatal signal
When handling fatal signal, shut down Galera networking
before printing out stack trace and writing core file.
This is to achieve fail-silent semantics on crashes which may
keep the process running for a long time, but not fully responding
e.g. due to core dumping or symbol resolving.

Also suppress all Galera/wsrep logging to avoid logging from
background threads to garble crash information from signal handler.

Notice that for fully fail-silent crash, Galera 26.4.19 is needed.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-09-01 02:48:19 +02:00
Julius Goryavsky
b65bbb2fae MDEV-34647: small refactoring after main fix 2024-08-30 21:50:33 +02:00
Igor Babaev
74d7168765 MDEV-25084 Assertion failure when moving equality from having to where
This bug was fixed by the patch for bug MDEV-26402.
Only a test case that failed before this patch was applied is added
in this commit.
2024-08-30 10:28:28 -07:00
Jan Lindström
9091afdc55 MDEV-31173 : Server crashes when setting wsrep_cluster_address after adding invalid value to wsrep_allowlist table
Problem was that wsrep_schema tables were not marked as
category information. Fix allows access to wsrep_schema
tables even when node is detached.

This is 10.4-10.9 version of fix.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-08-29 13:41:23 +02:00
Jan Lindström
b1d74b7e72 MDEV-33997 : Assertion `((WSREP_PROVIDER_EXISTS_ && this->variables.wsrep_on) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()' failed in int THD::binlog_write_row(TABLE*, bool, const uchar*)
Problem was that we did not found that table was partitioned
and then we should find what is actual underlaying storage
engine.

We should not use RSU for !InnoDB tables.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-08-29 13:41:23 +02:00
Oleksandr Byelkin
5a61fd5819 MDEV-34831: MDEV-34704 introduces a typo, --qick
Fix MDEV-34704 typos.
2024-08-29 12:30:05 +02:00
Oleksandr Byelkin
03a5455cb3 MDEV-34833 Assertion failure in Item_float::do_build_clone (Item_static_float_func)
Added missing method of Item_static_float_func
2024-08-29 09:32:29 +02:00
Oleksandr Byelkin
872dbec935 MDEV-34704 Quick mode produces the bug for mariadb client
--quick-max-column-width parameter added to limit field
    width in --quick mode.
2024-08-28 19:07:50 +02:00
Marko Mäkelä
1ff6b6f0b4 MDEV-34802 Recovery fails to note some log corruption
recv_recovery_from_checkpoint_start(): Abort startup due to log
corruption if we were unable to parse the entire log between
the latest log checkpoint and the corresponding FILE_CHECKPOINT record.

Also, reduce some code bloat related to log output and log_sys.mutex.

Reviewed by: Debarun Banerjee
2024-08-28 15:44:42 +03:00
Marko Mäkelä
e7bb9b7c55 MDEV-24923 fixup: Correct a function comment 2024-08-27 18:06:24 +03:00
Yuchen Pei
58bc83e1a7
[fixup] Spider: Restored lines accidentally deleted in MDEV-32157
Also restored a change that resulted in off-by-one, as well as
appending the correctly indexed key_hint.
2024-08-27 15:36:39 +10:00
Kristian Nielsen
8642453ce6 Fix sporadic failure of test case rpl.rpl_start_stop_slave
The test was expecting the I/O thread to be in a specific state, but thread
scheduling may cause it to not yet have reached that state. So just have a
loop that waits for the expected state to occur.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-08-26 14:39:24 +02:00
Kristian Nielsen
25e0224814 Skip mariabackup.slave_provision_nolock in --valgrind, it uses a lot of CPU
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-08-26 14:39:24 +02:00
Kristian Nielsen
214e6c5b3d Fix sporadic failure of test case rpl.rpl_old_master
Remove the test for MDEV-14528. This is supposed to test that parallel
replication from pre-10.0 master will update Seconds_Behind_Master. But
after MDEV-12179 the SQL thread is blocked from even beginning to fetch
events from the relay log due to FLUSH TABLES WITH READ LOCK, so the test
case is no longer testing what is was intended to. And pre-10.0 versions are
long since out of support, so does not seem worthwhile to try to rewrite the
test to work another way.

The root cause of the test failure is MDEV-34778. Briefly, depending on
exact timing during slave stop, the rli->sql_thread_caught_up flag may end
up with different value. If it ends up as "true", this causes
Seconds_Behind_Master to be 0 during next slave start; and this caused test
case timeout as the test was waiting for Seconds_Behind_Master to become
non-zero.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-08-26 14:39:24 +02:00
Kristian Nielsen
7dc4ea5649 Fix sporadic test failure in rpl.rpl_create_drop_event
Depending on timing, an extra event run could start just when the event
scheduler is shut down and delay running until after the table has been
dropped; this would cause the test to fail with a "table does not exist"
error in the log.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-08-26 14:39:24 +02:00
Kristian Nielsen
33854d7324 Restore skiping rpl.rpl_mdev6020 under Valgrind
(Revert a change done by mistake when XtraDB was removed.)

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-08-26 14:39:24 +02:00
Kristian Nielsen
b4c2e23954 MDEV-34696: do_gco_wait() completes too early on InnoDB dict stats updates
Before doing mark_start_commit(), check that there is no pending deadlock
kill. If there is a pending kill, we won't commit (we will abort, roll back,
and retry). Then we should not mark the commit as started, since that could
potentially make the following GCO start too early, before we completed the
commit after the retry.

This condition could trigger in some corner cases, where InnoDB would take
temporarily table/row locks that are released again immediately, not held
until the transaction commits. This happens with dict_stats updates and
possibly auto-increment locks.

Such locks can be passed to thd_rpl_deadlock_check() and cause a deadlock
kill to be scheduled in the background. But since the blocking locks are
held only temporarily, they can be released before the background kill
happens. This way, the kill can be delayed until after mark_start_commit()
has been called. Thus we need to check the synchronous indication
rgi->killed_for_retry, not just the asynchroneous thd->killed.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-08-26 14:39:24 +02:00