Commit graph

195795 commits

Author SHA1 Message Date
Sergei Golubchik
761d5c8987 MDEV-33092 Undefined reference to concurrency on Solaris
remove thr_setconcurrency()
followup for 8bbcaab160

Fix by Rainer Orth
2024-01-10 10:16:20 +01:00
Sergei Golubchik
c4ebf87f86 MDEV-32984 Update federated table and column privileges
mark auto-inc columns for read/write on INSERT,
but only for read on UPDATE
2024-01-10 10:16:20 +01:00
Yuchen Pei
c9902a20b3
Merge branch '10.4' into 10.5 2024-01-10 18:01:46 +11:00
Yuchen Pei
bc3d416a17
MDEV-29718 Fix spider detection of same data node server
When the host is not specified, it defaults to localhost.
2024-01-10 16:37:36 +11:00
Yuchen Pei
eabc74aaef
MDEV-33008 Fix spider table discovery
A new column was introduced to the show index output in 10.6 in
f691d9865b

Thus we update the check of the number of columns to be at least 13,
rather than exactly 13.

Also backport an err number and format from 10.5 for better error
messages when the column number is wrong.
2024-01-10 16:36:39 +11:00
Rainer Orth
2310f659f5 MDEV-8941 Compile on Solaris (SPARC) fails with errors in filamvct.cpp
There are a large number of uses of `strerror` in the codebase,
the local declaration in `storage/connect/tabvct.cpp` is the only one.

Given that none is needed elsewhere, I conclude that this instance can
simply be removed.
2024-01-10 13:48:23 +11:00
Sergei Golubchik
c6e1ffd1a0 MDEV-33148 A connection can control RAND() in following connection
initialize THD::rand in THD::init() not in THD::THD(),
because the former is also called when a THD is reused -
in COM_CHANGE_USER and in taking a THD from the cache.

Also use current cycle timer for more unpreditability
2024-01-09 15:22:35 +01:00
Alexander Barkov
9322ef03e3 MDEV-32645 CAST(AS UNSIGNED) fails with --view-protocol
Item_float::neg() did not preserve the "presentation" from "this".
So
  CAST(-1e0 AS UNSIGNED)  -- cast from double to unsigned
changes its meaning to:
  CAST(-1 AS UNSIGNED)  -- cast signed to undigned

Fixing Item_float::neg() to construct the new value for
Item_float::presentation as follows:
- if the old value starts with minus, then the minus is truncated:
  '-2e0' -> '2e0'
- otherwise, minus sign followed by its old value:
  '1e0'  -> '-1e0'
2024-01-09 11:44:05 +04:00
Yuchen Pei
ca276a0f3f
MDEV-33169 Reset sequence used fields after check in alter sequence
The bitmap is temporarily flipped to ~0 for the sake of checking all
fields. It needs to be restored because it will be reused in second
and subsequent ps execution.
2024-01-09 09:50:54 +11:00
Sergei Golubchik
f7573e7a83 MDEV-33093 plugin/disks/information_schema_disks.cc doesn't compile on Solaris
Fix by Rainer Orth
2024-01-08 13:57:51 +01:00
Sergei Golubchik
8172d07785 MDEV-33090 plugin/auth_pam/testing/pam_mariadb_mtr.c doesn't compile on Solaris
Fix by Rainer Orth
2024-01-08 13:57:51 +01:00
Sergei Golubchik
ac0ce44519 ./mtr --skip-not-found should skip combinations too
With the result like

encryption.innochecksum 'debug'   [ skipped ] combination not found

instead of

*** ERROR: Could not run encryption.innochecksum with 'debug' combination(s)
2024-01-08 13:57:51 +01:00
Marko Mäkelä
0b612619ef MDEV-33098: Fix some instrumentation for innodb.doublewrite_debug
buf_flush_page_cleaner(): A continue or break inside DBUG_EXECUTE_IF
actually is a no-op. Use an explicit call to _db_keyword_() to
actually avoid advancing the checkpoint.

buf_flush_list_now_set(): Invoke os_aio_wait_until_no_pending_writes()
to ensure that the page write to the system tablespace is completed.
2024-01-08 14:36:54 +02:00
Marko Mäkelä
613d019497 MDEV-33160 show_status_array() calls various functions via incompatible pointer
In commit b4ff64568c the
signature of mysql_show_var_func was changed, but not all functions
of that type were adjusted.

When the server is configured with `cmake -DWITH_ASAN=ON` and
compiled with clang, runtime errors would be flagged for invoking
functions through an incompatible function pointer.

Reviewed by: Michael 'Monty' Widenius
2024-01-04 12:50:05 +02:00
Igor Babaev
54ed3939f7 MDEV-31657 Crash on query using CTE with the same name as a base table
If a query contained a CTE whose name coincided with the name of one of
the base tables used in the specification of the CTE and the query had at
least two references to this CTE in the specifications of other CTEs then
processing of the query led to unlimited recursion that ultimately caused
a crash of the server.

Any secondary non-recursive reference to a CTE requires creation of a copy
of the CTE specification. All the references to CTEs in this copy must be
resolved. If the specification contains a reference to a base table whose
name coincides with the name of then CTE then it should be ensured that
this reference in no way can be resolved against the name of the CTE.
2024-01-03 09:57:39 -08:00
Marko Mäkelä
cc5c0eda4c MDEV-33156 Crash on innodb_buf_flush_list_now=ON and innodb_force_recovery=6
srv_start(): Move a read only mode startup tweak from
innodb_init_params() to the correct location. Also if
innodb_force_recovery=6 we will disable the doublewrite buffer,
because InnoDB must run in read-only mode to prevent further corruption.

This change only affects debug checks. Whenever srv_read_only_mode holds,
the buf_pool.flush_list will be empty, that is, there will be no writes
of persistent InnoDB data pages.

Reviewed by: Thirunarayanan Balathandayuthapani
2024-01-03 12:08:21 +02:00
Marko Mäkelä
3a3a4f044f Merge 10.4 into 10.5 2024-01-03 12:07:51 +02:00
Thirunarayanan Balathandayuthapani
77b8bedf34 MDEV-33098 The test innodb.doublewrite_debug occasionally fails to start up InnoDB
- innodb.doublewrite_debug should avoid the checkpoint
before killing the server. So used debug sync and
innodb_flush_sync to avoid the checkpoint completely.
Test case allowed to skip on MSAN builder due to extra
checkpoint.
2024-01-03 15:08:22 +05:30
Marko Mäkelä
96130b1898 MDEV-33157 WSREP: Fix function pointer mismatch
wsrep_plugin_init(), wsrep_plugin_deinit(): Remove these dummy functions
in order to fix an error that would be flagged by cmake -DWITH_UBSAN=ON
when using clang.

wsrep_show_ready(), wsrep_show_bf_aborts(): Correct the signature.
2024-01-03 08:52:50 +02:00
Igor Babaev
832e96deb6 MDEV-29362 Crash with query using constant subquery as left part of IN subquery
If a query has a HAVING clause that contains a predicate with a constant
IN subquery whose lef part in its turn is a subquery and the predicate is
subject to pushdown from HAVING to WHERE then execution of the query could
cause a crash of the server.

The cause of the problem was the missing implementation of the walk()
method for the class Item_in_optimizer. As a result in some cases the left
operand of the Item_in_optimizer condition could be traversed twice by
the walk procedure. For many call-back functions used as an argument of
this procedure it does not matter. Yet it matters for the call-back
function cleanup_excluding_immutables_processor() used in pushdown of
predicates from HAVING to WHERE. If the processed item is marked with
the IMMUTABLE_FL flag then the processor just removes this flag, otherwise
it performs cleanup of the item making it unfixed. If an item is marked
with an the IMMUTABLE_FL and it traversed with this processor twice then
it becomes unfixed after the second traversal though the flag indicates
that the item should not be cleaned up.

Approved by Oleksandr Byelkin <sanja@mariadb.com>
2024-01-02 16:21:53 -08:00
Alexander Barkov
9695974e4b MDEV-33019 The database part is not case sensitive in SP names
Problem:

sp_cache erroneously looked up fully qualified SP names (e.g. `DB`.`SP`),
in case insensitive style. It was wrong, because only the "name"
part is always case insensitive, while the "db" part should be compared
according to lower_case_table_names (case sensitively for 0,
case insensitively for 1 and 2).

Fix:

Adding a "casedn_name" parameter make_qname() to tell
if the name part should be lower cased:
  `DB1`.`SP` -> "DB1.SP"  (when casedn_name=false)
  `DB1`.`SP` -> "DB1.sp"  (when casedn_name=true)
and using make_qname() with casedn_name=true when creating
sp_cache hash lookup keys.

Details:

As a result, it now works as follows:
- sp_head::m_db is converted to lower case if lower_case_table_names>0
  during the sp_name initialization phase. So when make_qname() is called,
  sp_head::m_db is already normalized. There are no changes in here.

- The initialization phase of sp_head when creating sp_head::m_qname
  now calls make_qname() with casedn_name=true,
  so sp_head::m_name gets written to sp_head::m_qname in lower case.

- sp_cache_lookup() now also calls make_qname() with casedn_name=true,
  so sp_head::m_name gets written to the temporary lookup key in lower case.

- sp_cache::m_hashtable now uses case sensitive comparison
2023-12-27 13:41:42 +04:00
Alexander Barkov
916caac2a5 MDEV-33019 The database part is not case sensitive in SP names
Part#1 A non-functional change

Changing the signature of Identifier_chain2::make_qname() from

  bool make_qname(MEM_ROOT *mem_root, LEX_CSTRING *dst) const;

to

  LEX_CSTRING make_qname(MEM_ROOT *mem_root) const;

Now the result is returned as LEX_CSTRING from the function rather than
is passed as a parameter.
The return value {NULL,0} means "EOM".
2023-12-27 13:22:49 +04:00
Alexander Barkov
371bf4abc6 A 11.3->10.4 backport for MDEV-31991 Split class Database_qualified_name
This is a requirement step to fix and merge easier
  MDEV-33019 The database part is not case sensitive in SP names

The original MDEV-31991 commit commend:

- Moving some of Database_qualified_name methods into a new class
  Identifier_chain2.

- Changing the data type of the following variables from
  Database_qualified_name to Identifier_chain2:

  * q_pkg_proc in LEX::call_statement_start()
  * q_pkg_func in LEX::make_item_func_call_generic()

Rationale:

The data type of Database_qualified_name::m_db will be changed
to Lex_ident_db soon. So Database_qualified_name won't be able
to store the `pkg.routine` part of `db.pkg.routine` any more,
because `pkg` must not depend on lower-case-table-names.
2023-12-27 13:02:58 +04:00
Vladislav Vaintroub
1b747ffd05 MDEV-33115 Update HeidiSQL to 12.6 2023-12-23 09:13:07 +01:00
Daniele Sciascia
c554f26832 Disable ps-protocol second execution on test that do not support it
MDEV-31003 has introduced second execution for SELECTs that execute
under ps-protocol. The following tests in galera suites do not support
this mode of execution, disable it:

  galera.MDEV-27862
  galera.galera_log_output_csv
  galera.galera_query_cache
  galera.galera_query_cache_sync_wait
  galera_3nodes_sr.GCF-336
  galera_3nodes_sr.galera_sr_isolate_master
  galera_sr.galera_sr_large_fragment
  galera_sr.galera_sr_many_fragments

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-22 14:29:44 +01:00
Daniele Sciascia
362c0950e8 MDEV-32549 Cluster inconsistent after SAVEPOINT is rolled back
Attempting to set a SAVEPOINT when one of the involved storage engines
does not support savepoints, raises an error, and results in statement
rollback. If Galera is enabled with binlog emulation, the above
scenario was not handled correctly, and resulted in cluster wide
inconsistency.

The problem was in wsrep_register_binlog_handler(), which is called
towards the beginning of SAVEPOINT execution. This function is
supposed to mark the beginning of statement position in trx cache
through `set_prev_position()`. However, it did so only on condition
that `get_prev_position()` returns `MY_OFF_T_UNDEF`.
This before statement position is typically reset to undefined at the
end of statement in `binlog_commit()` / `binlog_rollback()`.
However that's not the case with Galera and binlog emulation, for
which binlog commit / rollback hooks are not called due to the
optimization that avoids internal 2PC (MDEV-16509).

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-22 04:49:57 +01:00
sjaakola
c89f769f24 MDEV-31905 GTID inconsistency
This commit fixes GTID inconsistency which was injected by mariabackup SST.
Donor node now writes new info file: donor_galera_info, which is streamed
along the mariabackup donation to the joiner node. The donor_galera_info
file contains both GTID and gtid domain_id, and joiner will use these to
initialize the GTID state.

Commit has new mtr test case: galera_3nodes.galera_gtid_consistency, which
exercises potentially harmful mariabackup SST scenarios. The test has also
scenario with IST joining.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-22 00:10:23 +01:00
tommijkl
00a81516b0 MDEV-28953 sporadic failures with galera_sr.mysql-wsrep-features#165
Modified galera_sr.mysql-wsrep-features#165 test to be deterministic:
Added one wait condition to catch execution state after --send command.
Changed another wait condition to better match the execution state of the test thread.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-21 21:06:28 +01:00
Vladislav Vaintroub
569381df83 MDEV-33046 fixup. Do not try to schedule timer without dict_stats_start()
dict_stats_schedule() is executed for --innodb-force-recovery=3+,
but timer is not created.
2023-12-21 20:20:47 +01:00
Jan Lindström
1dc6ded8b1 MDEV-20485 : Galera test failure on galera.galera_var_node_address
Loopback interface might not be configured, thus do not test it.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-21 18:45:57 +01:00
Vladislav Vaintroub
7cc332b724 MDEV-33046 - delete unnecessary synchronization with dict_stats_mutex
Timer has internal synchronization, so that calling
set_time concurrently is not a problem.
2023-12-21 11:52:21 +01:00
Jan Lindström
630972825f MDEV-29876 : Galera test failure on galera_sst_encrypted
AES block cipher mode CTR is available at the moment
only from OpenSSL 1.0.1. Do not run this testcase
using CTR combination if it is not available.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-21 10:46:18 +01:00
Jan Lindström
dfd2eb529a MDEV-29892 : Galera test failure on galera_sr_kill_slave_after_apply_rollback2
Could not reproduce and bug report is incomplete i.e. there
is no error logs to analyze and 10.4 branch commit where
failure was seen is not mentioned. Enable test to get more information.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-21 10:46:17 +01:00
Jan Lindström
425ecc74f8 MDEV-29882 : Galera test failure on galera_sr_cc_master
Test case changes only to wait expected membership and
streaming replication status.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-21 10:46:17 +01:00
Marko Mäkelä
a3dd7ea09f Merge 10.4 into 10.5 2023-12-21 11:30:32 +02:00
Sergei Golubchik
c712a5302b fix test failures with ASAN
ASAN uses *a lot* more stack. use not_asan.inc for tests
that recursively put a lot of data on the stack
2023-12-21 10:21:05 +02:00
Yuchen Pei
c73417c68e
MDEV-32986 Make regexp operator work in spider group by handler
In spider_db_mbase_util::print_item_func(), if the sql item_func has
an UNKNOWN_FUNC type, by default the spider group by handler (gbh)
transform infix to prefix. But regexp should remain infix, so we add
an if condition to account for this.
2023-12-21 10:31:12 +11:00
Jan Lindström
cfaab614ea MDEV-24481 : galera_3nodes.galera_vote_rejoin_mysqldump MTR failed: mysql_shutdown failed
Improve test case to wait until cluster membership is
correct.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-20 15:29:47 +01:00
Julius Goryavsky
96e49c76a8 Revert "MDEV-32964: Expect DB_INTERRUPTED from wsrep_row_upd_check_foreign_constraints"
This reverts commit ddd8a90812 (additional correction required)
2023-12-20 14:20:40 +01:00
Sergei Petrunia
2b8c59fffa Fix main.type_timestamp: Change 10.10 in "End of 10.10 tests" to 10.5 2023-12-20 14:51:00 +03:00
Daniele Sciascia
0e1f4bd661 MDEV-31272 Statement rollback causes empty writeset replication
This patch fixes cases where a transaction caused empty writeset to be
replicated. This could happen in the case where a transaction executes
a statement that initially manages to modify some data and therefore
appended keys some for  certification. The statement is however rolled
back at some later stage due to some error (for example, a duplicate
key error). After statement rollback the transaction is still alive,
has no other changes. When committing such transaction, an empty
writeset was replicated through Galera.

The fix is to avoid calling into commit hook only when transaction
has appended one or keys for certification *and* has some data in
binlog cache to replicate. Otherwise, the commit is considered empty,
and goes through usual empty commit path.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-20 12:31:17 +01:00
Denis Protivensky
ddd8a90812 MDEV-32964: Expect DB_INTERRUPTED from wsrep_row_upd_check_foreign_constraints
Remove DB_LOCK_WAIT return code check as it should have been resolved to
one of the other errors by that point.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-20 12:31:17 +01:00
Jan Lindström
148cbf2aed MDEV-32995 : Remove not supported tests from wsrep suite
Changes to be committed:

	modified:   mysql-test/suite/wsrep/disabled.def
	deleted:    mysql-test/suite/wsrep/r/MDEV-22443.result
	deleted:    mysql-test/suite/wsrep/r/MDEV-23092.result
	deleted:    mysql-test/suite/wsrep/r/mdev_6832.result
	deleted:    mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result
	deleted:    mysql-test/suite/wsrep/t/MDEV-22443.cnf
	deleted:    mysql-test/suite/wsrep/t/MDEV-22443.test
	deleted:    mysql-test/suite/wsrep/t/MDEV-23092.cnf
	deleted:    mysql-test/suite/wsrep/t/MDEV-23092.test
	deleted:    mysql-test/suite/wsrep/t/mdev_6832.cnf
	deleted:    mysql-test/suite/wsrep/t/mdev_6832.test
	deleted:    mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf
	deleted:    mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test

These test cases used feature not available anymore.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-20 12:31:17 +01:00
Julius Goryavsky
87ae34ac83 galera: updating the list of disabled tests 2023-12-20 12:31:17 +01:00
Marko Mäkelä
12995559f9 Merge 10.4 into 10.5 2023-12-19 18:30:58 +02:00
Marko Mäkelä
476ff0927a MDEV-33062 innodb_undo_log_truncate=ON prevents fast shutdown
trx_purge_truncate_history(): If a fast shutdown has been initiated,
disregard innodb_undo_log_truncate=ON and return.
2023-12-19 14:45:39 +02:00
Kristian Nielsen
eaa4968fc5 MDEV-10653: Fix segfault in SHOW MASTER STATUS with NULL inuse_relaylog
The previous patch for MDEV-10653 changes the rpl_parallel::workers_idle()
function to use Relay_log_info::last_inuse_relaylog to check for idle
workers. But the code was missing a NULL check. Also, there was one place
during SQL slave thread start which was missing mutex synchronisation when
updating inuse_relaylog.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-12-19 12:08:54 +01:00
Kristian Nielsen
1cbba45e6e Attempt to fix rare race in test for MDEV-8031
The error-injection inject_mdev8031 simulates a deadlock kill in a specific
place, by setting killed_for_retry to RETRY_KILL_KILLED directly. If a real
deadlock kill triggers at the same time, it is possible for the thread to
complete its transaction retry and set rgi_slave to NULL before the real
readlock kill can complete in the background. This will cause a segfault
due to null-pointer access.

Fix by changing the error injection to do a real background deadlock kill,
which ensures that the thread will wait for any pending background kills to
complete.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-12-19 12:08:53 +01:00
Kristian Nielsen
a204ce2788 MDEV-33045: Server crashes in Item_func_binlog_gtid_pos::val_str / Binary_string::c_ptr_safe
Item::val_str() sets the Item::null_value flag, so call it before checking
the flag, not after.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-12-19 12:08:53 +01:00
hsser
be694384d4 MDEV-31925 Fix for File Leak in mysql_upgrade with --check-if-upgrade-is-needed Option
This commit addresses the file leakage problem encountered with the mysql_upgrade --check-if-upgrade-is-needed command.
2023-12-19 19:30:02 +11:00