Commit graph

15339 commits

Author SHA1 Message Date
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
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
Marko Mäkelä
7e34bb5ce1 MDEV-11905: Simplify encryption.innodb_encrypt_discard_import
The test was populating unnecessarily large tables and
restarting the server several times for no real reason.

Let us hope that a smaller version of the test will produce more
stable results. Occasionally, some unencrypted contents in the table t2
was revealed in the old test.
2023-12-11 10:31:49 +02:00
Marko Mäkelä
5775df0127 MDEV-20142 encryption.innodb_encrypt_temporary_tables fails
The data type of the column INFORMATION_SCHEMA.GLOBAL_STATUS.VARIABLE_VALUE
is a character string. Therefore, if we want to compare some values as
integers, we must explicitly cast them to integer type, to avoid an
awkward comparison where '10'<'9' because the first digit is smaller.
2023-12-10 13:19:21 +02:00
Julius Goryavsky
66fafdb922 MDEV-32344: IST failed with ssl-mode=VERIFY_CA
This commit fixes a bug where IST could be rejected in favor of SST
when ssl-mode=VERIFY_CA and when mariabackup is used. It also contains
a test and small code simplifications that will make it easier to find
bugs in the future.
2023-12-07 04:57:21 +01:00
Thirunarayanan Balathandayuthapani
d5fc34db4c MDEV-29092 FOREIGN_KEY_CHECKS does not prevent non-copy alter from creating invalid FK structure
Problem:
========
- InnoDB should have two keys on the same column for the self
referencing foreign key relation.

Solution:
=========
- Allow self referential foreign key relation to work with one
key.
2023-12-06 14:29:17 +05:30
Brandon Nesterenko
dc9ac9266c MDEV-32933: Skip statement and mix mode for binlog.flashback
The binlog.flashback test tries to run using the stmt and mix
binlog_format combinations (because it includes have_log_bin.inc),
yet are meaningless tests because the server starts with the
--flashback option, forcing binlog_format=row.

This patch optimizes test time by removing the stmt and mix format
combinations from running.

Reviewed By:
============
Andrei Elkin <andrei.elkin@mariadb.com>
2023-12-05 10:47:53 -07:00
Sergei Petrunia
bd23b3dc06 MDEV-32901: innodb.mdev-14846 fails in 11.0
InnoDB could return off-by-1 estimates for the involved tables.
This would cause off-by-many difference in join output cardinality
for the top-level SELECT, and so different query plan for the subquery.

The fix: Introduce mysql-test/include/innodb_stable_estimates.{inc,opt}
which disables InnoDB's background statistics collection, and use it.
2023-12-05 19:26:30 +03:00
Daniele Sciascia
5c4c1844bf MDEV-32781 galera_bf_lock_wait test failed
This test happens to fail if it runs after test
galera_inject_bf_long_wait.
And the reason is that galera_bf_lock_wait greps for message
"BF lock wait long" in the error log, and expects that grep matches
no lines. Whereas galera_inject_bf_long_wait intentionally causes the
message to appear in the log. The fix consists in using
assert_grep.inc with option assert_only_after, such that
galera_bf_lock_wait is limited to grep only those lines that appeared
in the log after it started to execute.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-05 12:25:32 +01:00
Denis Protivensky
6d9c9d92cc MDEV-32938: DDL must check if not aborted before entering TOI
Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-12-05 12:25:32 +01:00
Julius Goryavsky
dc7138cbed galera: temporarily disabling problematic tests 2023-12-05 12:25:32 +01:00
Marko Mäkelä
cd79f10211 MDEV-31441 BLOB corruption on UPDATE of PRIMARY KEY with FOREIGN KEY
row_upd_clust_rec_by_insert(): If we are resuming from a lock wait,
reset the 'disowned' flag of the BLOB pointers in 'entry' that we
copied from 'rec' on which we had invoked btr_cur_disown_inherited_fields()
before the lock wait started. In this way, the inserted record with
the updated PRIMARY KEY value will have the BLOB ownership associated
with itself, like it is supposed to be.

Note: If the lock wait had been aborted, then rollback would have
invoked btr_cur_unmark_extern_fields() and no corruption would be possible.

Reviewed by: Vladislav Lesin
Tested by: Matthias Leich
2023-11-29 18:57:57 +02:00
Marko Mäkelä
47fc64c19f MDEV-32833 InnoDB wrong error message
trx_t::commit_in_memory(): Empty the detailed_error string, so that
FOREIGN KEY error messages from an earlier transaction will not be
wrongly reused in ha_innobase::get_error_message().

Reviewed by: Thirunarayanan Balathandayuthapani
2023-11-29 10:52:25 +02:00
Kristian Nielsen
ea4bcb9d98 MDEV-32168: slave_error_param condition is never checked from the wait_for_slave_param.inc
Fix some random test failures following MDEV-32168 push.

Don't blindly set $rpl_only_running_threads in many places. Instead explicit
stop only the IO or SQL thread, as appropriate. Setting it interfered with
rpl_end.inc in some cases. Rather than clearing it afterwards, better to
not set it at all when it is not needed, removing ambiguity in the test
about the state of the replication threads.

Don't fail the test if include/stop_slave_io.inc finds an error in the IO
thread after stop. Such errors can be simply because slave stop happened in
the middle of the IO thread's initial communication with the master.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-11-28 19:10:42 +01:00
Thirunarayanan Balathandayuthapani
d9ae5820c5 MDEV-32890 LeakSanitizer errors in mem_heap_create_block_func upon query from I_S.INNODB_SYS_TABLES with LIMIT ROWS EXAMINED
- innodb_sys_tables query fails to free the object which contains
sys_tables information in case of error.
2023-11-28 13:42:08 +05:30
Monty
06f7ed4dcd MDEV-28566 Assertion `!expr->is_fixed()' failed in bool virtual_column_info::fix_session_expr(THD*)
The problem was that table->vcol_cleanup_expr() was not called in case
of error in open_table().
2023-11-27 19:08:14 +02:00
Anel Husakovic
18acf97dfd MDEV-32168: slave_error_param condition is never checked from the wait_for_slave_param.inc
- Record unrecorded tests from `rpl` suite to `engines/funcs` suite
(done by d8e448ba1b):
  1) Record test `rpl_row_until` from commit d95fa7e332
  2) Record test `rpl_slave_status` from commit a7d186a17d

- Stop only running threads for `engines/funcs.rpl_server_id1.test` that
is not the same as `rpl.rpl_server_id1.test`

- Reviewer:  <knielsen@knielsen-hq.org>
             <andrei.elkin@mariadb.com>
2023-11-27 14:12:22 +01:00
Thirunarayanan Balathandayuthapani
5bb31bc882 MDEV-22230 : Unexpected ER_ERROR_ON_RENAME upon DROP non-existing FOREIGN KEY
mysql_prepare_alter_table(): Alter table should check whether
foreign key exists when it expected to exists and
report the error in early stage

dict_foreign_parse_drop_constraints(): Don't throw error if the
foreign key constraints doesn't exist when if exists is given
in the statement.
2023-11-26 18:46:00 +05:30
Sergei Golubchik
7317aadeea perfschema.threads_mysql sporadic failures
wait a bit more thoroughly for event scheduler to be fully started
2023-11-25 10:33:31 +01:00
Sergei Golubchik
d8e448ba1b MDEV-32168 fix failing tests
followup for a7d186a17d
2023-11-25 10:33:31 +01:00
Marko Mäkelä
ead61d9bd9 MDEV-32874 Test innodb.innodb-table-online,crypt occasionally fails
Let us make the test compatible with ./mtr --repeat
and convert variable_value to integer, so that comparisons like
16>9 will work as intended, instead of being compared as '16'<'9'.
2023-11-24 14:23:52 +02:00
Denis Protivensky
e39c497c80 MDEV-22232: Fix CTAS replay & retry in case it gets BF-aborted
- Add selected tables as shared keys for CTAS certification
- Set proper security context on the replayer thread
- Disallow CTAS command retry

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2023-11-21 08:02:23 +01:00
Julius Goryavsky
671f665455 MDEV-32634: additional fix for funcs_1 mtr suite 2023-11-21 08:02:23 +01:00
Julius Goryavsky
48017f057e galera: cleanup of the lists of disabled tests 2023-11-21 08:02:23 +01:00
Thirunarayanan Balathandayuthapani
84e0c027e0 MDEV-28613 LeakSanitizer caused by I_S query using LIMIT ROWS EXAMINED
Problem:
========
- InnoDB fails to free the allocated buffer of stored cursor
when information schema query is interrupted.

Solution:
=========
- In case of error handling, information schema query should free
the allocated buffer to store the cursor.
2023-11-21 11:13:43 +05:30
Kristian Nielsen
d415f600cd MDEV-32844: THD::rli_fake/rgi_fake not cleared on new connection
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-11-20 17:33:02 +01:00
Kristian Nielsen
36680b648a MDEV-20523: rpl.create_or_replace_mix, rpl.create_or_replace_statement failed in buildbot with wrong result
Wait for the disconnect of the other connection to complete, before running
SHOW BINLOG EVENTS. Otherwise the DROP TEMPORARY TABLE that is binlogged
during disconnect may not have appeared yet depending on thread scheduling.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-11-17 19:44:11 +01:00
Kristian Nielsen
0258ad545a MDEV-32168: slave_error_param condition is never checked from the wait_for_slave_param.inc
Fix wrong change to rpl.rpl_shutdown_wait_slaves. After shutting down the
master, slaves may or may not succeed in reconnecting depending on the timing
on their reconnect relative to master restart. So don't assume all IO threads
will be running, just restart any slave that needs it.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-11-17 19:44:11 +01:00
Kristian Nielsen
7e394d0b4a MDEV-32168: slave_error_param condition is never checked from the wait_for_slave_param.inc
Fix sporadic test failure in rpl.rpl_ssl1. The test incorrectly did a STOP
SLAVE too early, which could race with the expected 'Access denied' error.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-11-17 19:44:11 +01:00
Kristian Nielsen
30ec1b3e78 MDEV-32168: slave_error_param condition is never checked from the wait_for_slave_param.inc
Fix sporadic test failures in rpl.rpl_set_statement_default_master and
rpl.rpl_slave_load_tmpdir_not_exist. A race between START and STOP
SLAVE could leave an error condition that causes test failure after
MDEV-32168.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-11-17 19:44:11 +01:00
Kristian Nielsen
17430d94d7 MDEV-32168: slave_error_param condition is never checked from the wait_for_slave_param.inc
Test rpl.show_status_stop_slave_race-7126 now fails sporadically
because it is expected to sometimes (but not always) leave an error
condition after slave stop. Fix by explicitly allowing the error
condition in this case.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-11-17 19:44:11 +01:00
Kristian Nielsen
d95fa7e332 MDEV-32168: slave_error_param condition is never checked from the wait_for_slave_param.inc
Fix a start/stop race that causes occasional test failure after more the more
strict error check of MDEV-32168.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-11-17 19:44:11 +01:00
Brandon Nesterenko
c42aadc388 MDEV-32628: Cryptic ERROR message & inconsistent behavior on incorrect SHOW BINLOG EVENTS FROM ...
Calling SHOW BINLOG EVENTS FROM <offset> with an invalid offset
writes error messages into the server log about invalid reads. The
read errors that occur from this command should only be relayed back
to the user though, and not written into the server log. This is
because they are read-only and have no impact on server operation,
and the client only need be informed to correct the parameter.

This patch fixes this by omitting binary log read errors from the
server when the invocation happens from SHOW BINLOG EVENTS.
Additionally, redundant error messages are omitted when calling the
string based read_log_event from the IO_Cache based read_log_event,
as the later already will report the error of the former.

Reviewed By:
============
Kristian Nielsen <knielsen@knielsen-hq.org>
Andrei Elkin <andrei.elkin@mariadb.com>
2023-11-17 09:43:56 -08:00
Anel Husakovic
a7d186a17d MDEV-32168: slave_error_param condition is never checked from the wait_for_slave_param.inc
- Reviewer: <knielsen@knielsen-hq.org>
            <brandon.nesterenko@mariadb.com>
            <andrei.elkin@mariadb.com>
2023-11-16 10:41:11 +01:00
Kristian Nielsen
6960dc74cd MDEV-30064: binlog.binlog_mysqlbinlog_raw_flush sometimes fails with Errcode: 2 "No such file or directory"
Increase a 1-second timeout, which is a bit too small for slow buildbot
builders.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-11-15 16:13:46 +01:00
Kristian Nielsen
de0324c146 MDEV-29402: Test sequence binlog.binlog_mdev717 binlog.binlog_mysqlbinlog_raw_flush fails
Reset the GTID sequence at the start of test so earlier run tests does not
influence the expected GTID sequence.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-11-15 13:09:03 +01:00
Kristian Nielsen
64a743fc81 MDEV-16951: binlog_encryption.rpl_checksum failed in buildbot with wrong result
Wait for the binlog checkpoint event to fix non-determinism in the testcase.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-11-15 11:40:05 +01:00
Kristian Nielsen
73a38b68dc MDEV-11018: rpl.rpl_mariadb_slave_capability fails sporadically in buildbot
The test was missing a wait_for_binlog_checkpoint.inc, making it non-deterministic

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2023-11-14 17:12:59 +01:00
Marko Mäkelä
561093701b MDEV-29180 fixup: 32-bit tests
This fixes up commit 01031f43d8
2023-11-13 09:27:01 +02:00
Aleksey Midenkov
f7552313d4 MDEV-29932 Invalid expr in cleanup_session_expr() upon INSERT DELAYED
There are two TABLE objects in each thread: first one is created in
delayed thread by Delayed_insert::open_and_lock_table(), second one is
created in connection thread by Delayed_insert::get_local_table(). It
is copied from the delayed thread table.

When the second table is copied copy-assignment operator copies
vcol_refix_list which is already filled with an item from delayed
thread. Then get_local_table() adds its own item. Thus both tables
contains the same list with two items which is wrong. Then connection
thread finishes and its item freed. Then delayed thread tries to
access it in vcol_cleanup_expr().

The fix just clears vcol_refix_list in the copied table.

Another problem is that copied table contains the same mem_root, any
allocations on it will be invalid if the original table is freed (and
that is indeterministic as it is done in another thread). Since copied
table is allocated in connection THD and lives not longer than
thd->mem_root we may assign its mem_root from thd->mem_root.

Third, it doesn't make sense to do open_and_lock_tables() on NULL
pointer.
2023-11-10 15:46:15 +03:00
Aleksey Midenkov
56e479107c MDEV-28127 EXCHANGE PARTITION with non-matching vcol expression segfault
mysql_compare_tables() treated all columns non-virtual. Now it
properly checks if the columns are virtual and matches expressions.
2023-11-10 15:46:15 +03:00
Aleksey Midenkov
ebb6f57568 MDEV-23294 Segfault or assertion upon MyISAM repair
When computing vcol expression some items use current_thd and that was
not set in MyISAM repair thread. Since all the repair threads belong
to one connection and items should not write into THD we can utilize
table THD for that.
2023-11-10 15:46:15 +03:00
Aleksey Midenkov
74883f5e2f MDEV-32082 Server crash in find_field_in_table
Attempt to resolve FOR SYSTEM_TIME expression as field for derived
table is done before derived table is fully prepared, so we fail on
assertion that table_list->table is missing.

Actually Vers_history_point::resolve_unit() is done under the call of
mysql_derived_prepare() itself (sql_derived.cc:824) and the table is
assigned later at 867.

The fix disables unit resolution for field type in FOR SYSTEM_TIME
expression as it does a little sense in any case: making historical
queries based on variable field values produces the result of multiple
time points.

fix_fields_if_needed() in resolve_units() was introduced by 46be31982a
2023-11-10 15:46:15 +03:00
Aleksey Midenkov
e53e7cd134 MDEV-20545 Assertion col.vers_sys_end() in dict_index_t::vers_history_row
Index values for row_start/row_end was wrongly calculated for inplace
ALTER for some layout of virtual fields.

Possible impact

  1. history row is not detected upon build clustered index for
     inplace ALTER which may lead to duplicate key errors on
     auto-increment and FTS index add.
  2. foreign key constraint may falsely fail.
  3. after inplace ALTER before server restart trx-based system
     versioning can cause server crash or incorrect data written upon
     UPDATE.
2023-11-10 15:46:14 +03:00
Alexander Barkov
1710b6454b MDEV-26743 InnoDB: CHAR+nopad does not work well
The patch for "MDEV-25440: Indexed CHAR ... broken with NO_PAD collations"
fixed these scenarios from MDEV-26743:
- Basic latin letter vs equal accented letter
- Two letters vs equal (but space padded) expansion

However, this scenario was still broken:
- Basic latin letter (but followed by an ignorable character)
  vs equal accented letter

Fix:
When processing for a NOPAD collation a string with trailing ignorable
characters, like:
  '<non-ignorable><ignorable><ignorable>'

the string gets virtually converted to:
  '<non-ignorable><ignorable><ignorable><space><space><space>...'

After the fix the code works differently in these two cases:
1. <space> fits into the "nchars" limit
2. <space> does not fit into the "nchars" limit

Details:

1. If "nchars" is large enough (4+ in this example),
   return weights as follows:

  '[weight-for-non-ignorable, 1 char] [weight-for-space-character, 3 chars]'

  i.e. the weight for the virtual trailing space character now indicates
  that it corresponds to total 3 characters:
  - two ignorable characters
  - one virtual trailing space character

2. If "nchars" is small (3), then the virtual trailing space character
   does not fit into the "nchar" limit, so return 0x00 as weight, e.g.:

  '[weight-for-non-ignorable, 1 char] [0x00, 2 chars]'

Adding corresponding MTR tests and unit tests.
2023-11-10 06:17:23 +04:00