Commit graph

195766 commits

Author SHA1 Message Date
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
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
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
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
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
Marko Mäkelä
4c2e971841 MDEV-33052 MSAN use-of-uninitialized-value in buf_read_ahead_linear()
buf_read_ahead_linear(): Suppress a warning of comparing potentially
uninitialized FIL_PAGE_PREV and FIL_PAGE_NEXT fields.
2023-12-18 10:37:11 +02:00
Marko Mäkelä
4ae105a37d Merge 10.4 into 10.5 2023-12-18 08:59:07 +02:00
Marko Mäkelä
f98d2ef5b4 MDEV-33009 Server hangs for a long time with innodb_undo_log_truncate=ON
trx_purge_truncate_history(): Release buf_pool.flush_list_mutex
before starting a rescan of buf_pool.flush_list, to ensure that
the buf_flush_page_cleaner thread (which may be holding buf_pool.mutex)
will be able to proceed.

This fixes up commit a0f02f7438 (MDEV-32757).

Tested by: Axel Schwenke
Reviewed by: Vladislav Lesin
2023-12-15 15:38:31 +02:00
Sergei Golubchik
87a5d16911 add another missing result file
see also 4eca64e331
2023-12-15 12:11:26 +01:00
Thirunarayanan Balathandayuthapani
59a984b4d8 MDEV-32725 innodb.import_update_stats accesses uninitialized ib_table->stat_n_rows
- InnoDB should write all zeros into a table and its indexes
statistics members when table is unreadable.
2023-12-15 15:43:19 +05:30
Sergei Golubchik
a2c6d61db8 don't use dynstr_append() in mysqltest.cc
followup for ad796aaa94
2023-12-15 10:26:48 +01:00
Sisi Huang
c5d7036e1a MDEV-32942 Fix Memory Leak in my_print_defaults with Non-Existing Config Files 2023-12-15 10:22:40 +11:00
Sergei Golubchik
4eca64e331 add missing result file 2023-12-14 20:25:58 +01:00
Marko Mäkelä
852e1383e3 MDEV-21245 InnoDB: Using a partial-field key prefix in search
ha_innobase::compare_key_parts(): If a full column index is
being replaced with a column prefix index, return Compare_keys::NotEqual.
2023-12-14 09:57:38 +11:00
Daniel Black
2c60d43d7d MDEV-33006 Missing required privilege CONNECTION ADMIN
opt_kill_long_query_type being an enum could be 0 corresponding
to ALL. When ALL is specified, the CONNECTION ADMIN is still
required.

Also check REPLICA MONITOR privilege and make the tests
find the results by recording stderr.

Noticed thanks to bug report by Tim van Dijen.

Fixes: 79b58f1ca8
2023-12-14 09:08:43 +11:00
Rex
b4712242dd MDEV-31279 Crash when lateral derived is guaranteed to return no rows
Consider this query
SELECT t1.* FROM t1, (SELECT t2.b FROM t2 WHERE NOT EXISTS
(SELECT 1 FROM t3) GROUP BY b) sq where sq.b = t1.a;

If SELECT 1 FROM t3 is expensive, for example t3 has >
thd->variables.expensive_subquery_limit, first evaluation is deferred to
mysql_derived_fill().  There it is noted that, in the above case
 NOT EXISTS (SELECT 1 FROM t3) is constant and false.

This causes the join variable zero_result_cause to be set to
"Impossible WHERE noticed after reading const tables" and the handler
for this join is never "opened" via handler::ha_open.

When mysql_derived_fill() is called for the next group of results, this
unopened handler is not taken into account.

reviewed by Igor Babaev (igor@mariadb.com)
2023-12-14 06:14:24 +12:00
Marko Mäkelä
c17aca2f11 MDEV-18322 Assertion "wrong page type" on instant ALTER TABLE
row_ins_clust_index_entry_low(): Invoke btr_set_instant() in the same
mini-transaction that has successfully inserted the metadata record.
In this way, if inserting the metadata record fails before any
undo log record was written for it, the index root page will remain
consistent.

innobase_instant_try(): Remove the btr_set_instant() call.

Reviewed by: Thirunarayanan Balathandayuthapani
Tested by: Matthias Leich
2023-12-13 15:01:50 +02:00
Daniel Black
fbe604d883 MDEV-32795: ALTER SEQUENCE IF NOT EXISTS non_existing_seq Errors rather than note
Like all IF NOT EXISTS syntax, a Note should be generated.

The original commit of Seqeuences cleared the IF NOT EXISTS part
in the sql/sql_yacc.yy with lex->create_info.init(). Without this
bit set there was no way it could do anything other than error.

To remedy this removal, the sql_yacc.yy components have been
minimised as they where all set at the beginning of the ALTER.
This way the opt_if_not_exists correctly set the IF_EXISTS flag.

In MDEV-13005 (bb4dd70e7c) the error code changed, requiring
ER_UNKNOWN_SEQUENCES to be handled in the function
No_such_table_error_handler::handle_condition.
2023-12-13 17:48:03 +11:00
Daniel Black
7504985daf MDEV-21587: disk.disk{_notembedded} test result
Allow for a CI system to be almost out of space, or having so
little use, that the Total space is the same as available or used.

Thanks Otto Kekäläinen for the bug report and testing.
2023-12-13 08:54:39 +11:00
Sergei Glushchenko
6193d0cabb MDEV-20286 mariabackup fails when innodb_max_dirty_pages_pct contains a fraction (is not an integer)
This is a port of the Percona Server commit 5265f42e290573e9591f8ca28ab66afc051f89a3

which is the same as their bug PXB-1807: xtrabackup does not accept fractional values for
innodb_max_dirty_pages_pct

Problem:

Variable specified as double in MySQL server, but read as long in the
xtrabackup. This causes xtrabackup to fail at startup when the value
contains decimal point.

Fix:

Make xtrabackup to interpret the value as double to be compatible with
server.
2023-12-12 16:49:12 +00:00
Sergei Golubchik
e472b682e0 MDEV-32839 LONG UNIQUE gives error when used with REPLACE
calculate auto-inc value even if long duplicate check fails -
this is what the engine does for normal uniques.

auto-inc value is needed if it's a REPLACE
2023-12-12 15:21:43 +01:00
Sergei Golubchik
81609d8625 cleanup: remove innodb-specific code around update_auto_increment()
removed dead code
2023-12-12 15:21:43 +01:00
Sergei Golubchik
c5904702cd cleanup: remove partition-specific code around update_auto_increment() 2023-12-12 15:21:43 +01:00
Marko Mäkelä
68e7909be9 MDEV-31000 Assertion failed on ALTER TABLE...page_compressed=1
ha_innobase::check_if_supported_inplace_alter(): On ALTER_OPTIONS,
if innodb_file_per_table=1 and the table resides in the system tablespace,
require that the table be rebuilt (and moved to an .ibd file).

Reviewed by: Thirunarayanan Balathandayuthapani
Tested by: Matthias Leich
2023-12-12 14:40:45 +02:00
Marko Mäkelä
9f5078a1d7 MDEV-20139 innodb.innodb_buffer_pool_dump_pct failed in buildbot with timeout
This test was using a sleep of 1 second in an attempt to ensure that the
timestamp that is part of an InnoDB status string would increase.
This not only prolongs the test execution time by 1+1 seconds, but it
also is inaccurate. It is possible that the actual sleep duration is
less than a second.

Let us wait for the creation of the file ib_buffer_pool and then wait
for the buffer pool dump completion. In that way, the test can complete
in a dozen or two milliseconds (1% of the previous duration) and work
more reliably.
2023-12-12 11:43:23 +02:00
Daniele Sciascia
61daac54d6 MDEV-27806 GTIDs diverge in Galera cluster after CTAS
Add OPTION_GTID_BEGIN to applying side thread. This is needed to avoid
intermediate commits when CREATE TABLE AS SELECT is applied, causing
one more GTID to be consumed with respect to executing node.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-12 05:55:34 +01:00
Daniele Sciascia
9ab7dbc3be MDEV-28971 SEQUENCEs do not work with streaming replication
Return an error if user attempts to use SEQUENCEs in combination with
streaming replication in a Galera cluster. This is currently not
supported.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-12 05:55:34 +01:00
Marko Mäkelä
bd01029255 MDEV-29972 Crash emitting "Unsupported meta-data version number" error message
row_import_read_meta_data(): Use ER_NOT_SUPPORTED_YET instead of
ER_IO_READ_ERROR to have a matching error message pattern.
2023-12-12 15:09:31 +11:00
Yuchen Pei
b94ae3870b
[fixup] galera: Fix an accidental logical inversion in a recent merge
The merge was 13dd787530
2023-12-12 11:27:20 +11:00
Brandon Nesterenko
8dad51481b MDEV-10653: SHOW SLAVE STATUS Can Deadlock an Errored Slave
AKA rpl.rpl_parallel, binlog_encryption.rpl_parallel fails in
buildbot with timeout in include

A replication parallel worker thread can deadlock with another
connection running SHOW SLAVE STATUS. That is, if the replication
worker thread is in do_gco_wait() and is killed, it will already
hold the LOCK_parallel_entry, and during error reporting, try to
grab the err_lock. SHOW SLAVE STATUS, however, grabs these locks in
reverse order. It will initially grab the err_lock, and then try to
grab LOCK_parallel_entry. This leads to a deadlock when both threads
have grabbed their first lock without the second.

This patch implements the MDEV-31894 proposed fix to optimize the
workers_idle() check to compare the last in-use relay log’s
queued_count==dequeued_count for idleness. This removes the need for
workers_idle() to grab LOCK_parallel_entry, as these values are
atomically updated.

Huge thanks to Kristian Nielsen for diagnosing the problem!

Reviewed By:
============
Kristian Nielsen <knielsen@knielsen-hq.org>
Andrei Elkin <andrei.elkin@mariadb.com>
2023-12-11 07:45:23 -07:00
Kristian Nielsen
5ca63b2b8b MDEV-26632: multi source replication filters breaking GTID semantic
Add a test case that demonstrates a working setup as described in MDEV-26632.
This requires --gtid-ignore-duplicates=1 and --gtid-strict-mode=0.

In A->B->C, B filters some (but not all) events from A. C is promoted to
create A->C->B, and the current GTID position in B contains a GTID from A that
is not present in C (due to filtering). Demonstrate that B can still connect
with GTID to C, starting at the "hole" in the binlog stream on C originating
from A.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-12-11 12:04:49 +01:00
Kristian Nielsen
50ce001afd MDEV-13792: innodb.purge_thread_shutdown failed in buildbot with wrong result (sporadic)
Omit `state` when selecting processlist to verify which threads are running.
The state changes as threads are running (enter_state()), and this causes
sporadic test failures.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-12-11 12:04:39 +01:00
Kristian Nielsen
da9ffca908 MDEV-29816 rpl.rpl_parallel_29322 occasionally fails in BB
Make sure the old binlog dump thread is not still running when manipulating
binlog files; otherwise there is a small chance it will see an invalid
partial file and report an I/O error.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-12-11 12:02:58 +01:00
Marko Mäkelä
1e80601b82 MDEV-16264 fixup: Remove a useless test
Let us remove a test that frequently fails with a result difference.
This test had been added in fc279d7ea2
to cover a bug in thd_destructor_proxy(), which was replaced with
simpler logic in 5e62b6a5e0 (MDEV-16264).
2023-12-11 10:37:12 +02:00