Commit graph

76677 commits

Author SHA1 Message Date
Julius Goryavsky
7b0f59da43 wsrep mtr suite: update for galera library 26.4.21 2024-12-17 09:57:29 +01:00
Daniele Sciascia
eadf96cea4 MDEV-26266 Update wsrep-lib
Update wsrep-lib to fix the issue and add the MTR test case from
the ticket.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-12-17 09:52:32 +01:00
Jan Lindström
ee2dc336d7 TODO-5067 addendum : Add test case for Galera library protocol versions
Add missing file

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-12-17 09:52:32 +01:00
Jan Lindström
28463b2824 TODO-5067 : Add test case for Galera library protocol versions
This version of test requires Galera library 26.4.21 to work.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-12-17 09:52:32 +01:00
Dave Gosselin
7c9cbe684b MDEV-35648 Update partition lc2 tests for mac
Partition tests requiring lower_case_table_names = 2 (default on macOS)
fail on mac because the product has changed over time but the tests were
not run regularly enough to observe their breakage.
2024-12-17 15:28:33 +11:00
Yuchen Pei
77c9917663
MDEV-34716 Fix mysql.servers socket max length too short
The limit of socket length on unix according to libc is 108, see
sockaddr_un::sun_path, but in the table it is a string of max length
64, which results in truncation of socket and failure to connect by
plugins using servers such as spider.
2024-12-17 10:40:57 +11:00
Andrei Elkin
bc6121819c MDEV-35098 rpl.rpl_mysqldump_gtid_slave_pos fails in buildbot
The test turns out to be senstive to @@global.gtid_cleanup_batch_size.
With a rather small default value of the latter
SELECTing from mysql.gtid_slave_pos may not be deterministic: tests
that run before may increase a pending for automitic deletion batch.

The test is refined to set its own value for the batch size which
is virtually unreachable.

Thanks to Kristian Nielsen for the analysis.
2024-12-16 19:43:41 +02:00
Lena Startseva
aa49770d79 MDEV-31005: Make working cursor-protocol
Excluded cases in main./secure_file_priv_win

Fix for v.10.5
2024-12-16 10:08:56 +00:00
Sergei Golubchik
17cb65593a MDEV-22964: archive.archive and main.mysqlbinlog_{row,stmt}_compressed)
zlib-ng results in different compression length. The compression
length isn't that important as the test output examines the uncompressed
results.

fixes for zlib-ng

backport of 75488a57f2
2024-12-16 10:04:07 +11:00
Oleg Smirnov
d98ac8511e MDEV-26247 MariaDB Server SEGV on INSERT .. SELECT
This problem occured for statements like `INSERT INTO t1 SELECT 1`,
which do not have tables in the SELECT part. In such scenarios
SELECT_LEX::insert_tables was not properly set at `setup_tables()`,
and this led to either incorrect execution or a crash

Reviewer: Oleksandr Byelkin <sanja@mariadb.com>
2024-12-14 14:04:21 +07:00
Oleg Smirnov
e640373389 Revert "MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT"
This reverts commit 49e14000ee
as it introduces regression MDEV-29935 and has to be reconsidered
in general
2024-12-14 13:08:17 +07:00
Oleksandr Byelkin
271b73770c MDEV-30263 Assertion failure in Protocol::end_statement upon HANDLER READ with invalid timestamp
Process save_in_field() return codes as in other places (<0 is real
error)
2024-12-13 16:27:14 +01:00
Alexander Barkov
d1f42fc80f MDEV-21589 AddressSanitizer: memcpy-param-overlap in Static_binary_string::q_append or String::append
Item_func_concat_ws::val_str():
- collects the result into the string "str" passed as a parameter.
- calls val_str(&tmp_buffer) to get arguments.

At some point due to heuristic it decides to swap the buffers:
- collect the result into &tmp_buffer
- call val_str(str) to get arguments

Item_func_password::val_str_ascii() returns a String pointing to its
member tmp_value[SCRAMBLED_PASSWORD_CHAR_LENGTH+1].

As a result, it's possible that both str and tmp_buffer in
Item_func_concat_ws::val_str() point to Item_func_password::tmp_value.
Then, memcmp() called on overlapping memory fragrments.

Fixing Item_func_password::val_str_ascii() to use Item::copy()
instead of Item::set().
2024-12-13 11:09:29 +01:00
Alexander Barkov
0b7fa4c267 MDEV-31219 Assertion `fixed' failed in Item_func_hybrid_field_type / Frame_positional_cursor
add_special_frame_cursors() did not check the return
value offset_func->fix_fields(). It can return an error
if the data type does not support the operator "minus".
2024-12-13 09:40:31 +01:00
Yuchen Pei
432856c473
MDEV-35571 Check for LIMIT ROWS EXAMINED exceeded in UNION ALL
When UNION ALL is used with LIMIT ROWS EXAMINED, and when the limit is
exceeded for a SELECT that is not the last in the UNION, interrupt the
execution and call end_eof on the result. This makes sure that the
results are sent, and the query result status is conclusive rather
than empty, which would cause an assertion failure.
2024-12-13 15:44:01 +11:00
Daniel Black
6dcd9de2a9 MDEV-34669: ER_NEED_REPREPARE on SELECT DEFAULT(name) FROM table1_containing_sequence
A prepared SELECT statement because of CF_REEXECUTION_FRAGILE needs to
check the table is the same definition as previously otherwise a
re-prepare of the statement can occur.

When running many 'SELECT DEFAULT(name) FROM table1_containing_sequence'
in parallel the TABLE_LIST::is_the_same_definition may be called when
m_table_ref_type is TABLE_REF_NULL because it hasn't been checked yet.

In this case populate the TABLE_LIST with the values determined by the
TABLE_SHARE and allow the execution to continue.

As a result of this, the main.ps_ddl test doesn't need to reprepare
as the defination hasn't changed. This is another case where
TABLE_LIST::is_the_same_definition is called when m_table_ref_type is
TABLE_REF_NULL, but that doesn't mean that the defination is different.
2024-12-13 08:07:00 +11:00
Alexander Barkov
ab9182470d MDEV-31366 Assertion `thd->start_time' failed in bool LOGGER::slow_log_print(THD*, const char*, size_t, ulonglong)
Fixing a wrong DBUG_ASSERT.

thd->start_time and thd->start_time_sec_part cannot be 0 at the same time.

But thd->start_time can be 0 when thd->start_time_sec_part is not 0,
e.g. after:

SET timestamp=0.99;
2024-12-12 20:32:56 +01:00
Daniel Black
7181ea5663 MDEV-33245 SIGSEGV in wsrep_check_sequence
The segfault in wsrep_check_sequence is due to a
null pointer deference on:
  db_type= thd->lex->create_info.db_type->db_type;

Where create_info.db_type is null. This occured under
a used_engine==true condition which is set in the calling
function based on create_info.used_fields==HA_CREATE_USED_ENGINE.

However the create_info.used_fields was a left over
from the parsing of the previous failed CREATE TABLE where
because of its failure, db_type wasn't populated.

This is corrected by cleaning the create_info when we start
to parse ALTER SEQUENCE statements.

Other paths to wsrep_check_sequence is via CREATE SEQUENCE
and CREATE TABLE LIKE which both initialize the create_info
correctly.
2024-12-12 07:27:38 +11:00
Daniel Black
ee287821e3 MDEV-32561: WSREP FSM failure: (postfix) - enable galera.galera_sequences
The MDEV is fixed, so enable the test case again.
2024-12-12 07:27:38 +11:00
Oleksandr Byelkin
694d91da89 MDEV-35604: SIGSEGV in filter_query_type | log_statement_ex / auditing
Take into account that filter_query_type can get empty query after
skip_set_statement run on incorrect query.
2024-12-09 09:42:26 +01:00
Kristian Nielsen
2ab10fbec2 MDEV-24959: ER_BINLOG_ROW_LOGGING_FAILED (1534: Writing one row to the row-based binary log failed)
The Write_rows_log_event originally allocated the m_rows_buf up-front, and
thus is_valid() checks that the buffer is allocated correctly. But at some
point this was changed to allocate the buffer lazily on demand. This means
that a a valid event can now have m_rows_buf==NULL. The is_valid() code was
not changed, and thus is_valid() could return false on a valid event.

This caused a bug for REPLACE INTO t() VALUES(), () which generates a
write_rows event with no after image; then the m_rows_buf was never
allocated and is_valid() incorrectly returned false, causing an error in
some other parts of the code.

Also fix a couple of missing special cases in the code for mysqlbinlog to
correctly decode (in comments) row events with missing after image.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-12-05 08:17:35 +01:00
Kristian Nielsen
b4fde50b1f MDEV-5798: Wrong errorcode for missing partition after TRUNCATE PARTITION
The partitioning error handling code was looking at
thd->lex->alter_info.partition_flags in non-alter-table cases, in which cases
the value is stale and contains whatever was set by any earlier ALTER TABLE.
This could cause the wrong error code to be generated, which then in some cases
can cause replication to break with "different errorcode" error.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-12-05 08:17:35 +01:00
Kristian Nielsen
5a3a16154f MDEV-35514: Too much mtr output from analyze: sync_with_master
Limit SHOW BINLOG/RELAYLOG EVENTS in show_rpl_debug_info.inc to 200 lines.

Reviewed-by: Daniel Black <daniel@mariadb.org>
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-12-05 08:17:35 +01:00
Kristian Nielsen
daea59a81d MDEV-31761: mariadb-binlog prints fractional timestamp part incorrectly
Fractional part < 100000 microseconds was printed without leading zeros,
causing such timestamps to be applied incorrectly in mariadb-binlog | mysql

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-12-05 08:17:35 +01:00
Jason Cu
2bf9f0d422 MDEV-32395: update_depend_map_for_order: SEGV at /mariadb-11.3.0/sql/sql_select.cc:16583
MDEV-32329 (patch) pushdown from having into where: Server crashes at sub_select

When generating an Item_equal with a Item_ref that refers to a field
outside of a subselect, remove_item_direct_ref() causes the dependency
(depended_from) on the outer select to be lost, which causes trouble
for code downstream that can no longer determine the scope of the Item.
Not calling remove_item_direct_ref() retains the Item's dependency.

Test cases from MDEV-32395 and MDEV-32329 are included.

Some fixes from other developers:

Monty:
- Fixed wrong code in Item_equal::create_pushable_equalities()
  that could cause wrong item to be used if there was no matching items.
Daniel Black:
- Added test cases from MDEV-32329
Igor Babaev:
- Provided fix for removing call to remove_item_direct_ref() in
  eliminate_item_equal()

MDEV-32395: update_depend_map_for_order: SEGV at /mariadb-11.3.0/sql/sql_select.cc:16583

Include test cases from MDEV-32329.
2024-12-04 13:22:45 +02:00
Julius Goryavsky
818c84ad45 galera mtr tests: post-fix changes to test suite 2024-12-03 15:08:37 +01:00
Teemu Ollakka
a2575a0703 MDEV-35465 Async replication stops working on Galera async replica node when parallel replication is enabled
Parallel slave failed to retry in retry_event_group() with error

    WSREP: Parallel slave worker failed at wsrep_before_command() hook

Fix wsrep transaction cleanup/restart in retry_event_group() to properly
clean up previous transaction by calling wsrep_after_statement().
Also move call to reset error after call to wsrep_after_statement()
to make sure that it remains effective.

Add a MTR test galera_as_slave_parallel_retry to reproduce the error
when the fix is not present.

Other issues which were detected when testing with sysbench:

Check if parallel slave is killed for retry before waiting for prior
commits in THD::wsrep_parallel_slave_wait_for_prior_commit(). This
is required with slave-parallel-mode=optimistic to avoid deadlock
when a slave later in commit order manages to reach prepare phase
before a lock conflict is detected.

Suppress wsrep applier specific warning for slave threads.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-12-03 15:05:32 +01:00
Daniele Sciascia
85bcc7d263 MDEV-35446 Sporadic failure of galera.galera_insert_multi
Test failed sporadically when --ps-protocol was enabled:
a transaction that was BF aborted on COMMIT would succeed
instead of reporting the expected deadlock error.
The reason for the failure was that, depending on timing,
the transaction was BF aborted while the COMMIT statement
was being prepared through a COM_STMT_PREPARE command.
In the failing cases, the transaction was BF aborted
after COM_STMT_PREPARE had already disabled the diagnostics
area of the client. Attempt to override the deadlock error
towards the end of dispatch_command() would be skipped,
resulting in a successful COMMIT even if the transaction
is aborted.
This bug affected the following MTR tests:
 - galera_insert_multi
 - galera_nopk_unicode

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-12-03 14:55:09 +01:00
Aleksey Midenkov
13f93da1f6 MDEV-33783 CREATE SERVER segfaults on wrong mysql.servers
Do basic checking of mysql.servers compatibility.
2024-12-03 13:49:43 +03:00
Aleksey Midenkov
27c25ceedb MDEV-31030 Assertion `!error' failed in ha_partition::update_row on UPDATE
Removing wrong assertion as division by zero was caused by valid
input.
2024-12-03 13:49:42 +03:00
Aleksey Midenkov
3835437eb8 MDEV-15330 Cleanup: load_data.test removed 2024-12-03 13:49:42 +03:00
Jan Lindström
8a32ae5d6d MDEV-32779 : galera_concurrent_ctas: assertion in the galera::ReplicatorSMM::finish_cert()
I could not reproduce reported assertion. However, I could
reporoduce test failure because missing wait_condition
and error in test case. Added missing wait_condition and
fixed error in test case to make test stable.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-12-03 03:19:35 +01:00
Jan Lindström
af50783fcd MDEV-35471 : Sporadic failures in the galera_pc_recovery mtr test
For some reason InnoDB was disabled at --wsrep-recover call.
Added --loose-innodb to command like to make sure InnoDB is
enabled.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-12-03 03:19:35 +01:00
Jan Lindström
bf3e16eb81 MDEV-35467 : WSREP: read_completion_condition(): shutdown while in init ()
Ignore expected warning from Galera library when connections
are shutdown.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-12-03 03:19:35 +01:00
Oleksandr Byelkin
5c86f3df33 MDEV-35522: MariaDB Audit does not detect all DCLs forms when masking password
1. skip OR REPLACE
 (to make it filter_query_type made recursive)

2. skip SET STATEMENT ... FOR before checking
statements with passwords
2024-12-02 15:44:12 +01:00
Alexander Barkov
3de412fbe8 MDEV-25593 Assertion `0' failed in Type_handler_temporal_result::Item_get_date on double EXECUTE
When binding to NULL, DEFAULT or IGNORE from an Item value, Item_param did not
change m_type_handler, so its value remained from the previous bind.
Thid led to DBUG_ASSERTs in Item_param::get_date() and
Timestamp_or_zero_datetime_native_null.

Fix:

Set Item_param::m_type_handler to &type_handler_null when
binding from an Item returning NULL.

This patch also fixes MDEV-35427.
2024-12-02 11:19:12 +01:00
Alexander Barkov
fdb6db6b47 MDEV-29462 ASAN: heap-use-after-free in Binary_string::copy on DO CONVERT
Item_char_typecast::val_str_generic() uses Item::str_value as a buffer.
Item::val_str_ascii() also used Item::str_value as a buffer.
As a result, str_value tried to copy to itself.

Fixing val_str_ascii() to use a local buffer instead of str_value.
2024-11-28 16:34:32 +04:00
Jan Lindström
f39217da0c MDEV-35473 : Sporadic failures in the galera_3nodes.galera_evs_suspect_timeout mtr test
Remove unnecessary sleep and replace it with proper wait_conditions.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-11-28 01:02:35 +01:00
Jan Lindström
e7e06b3cb7 MDEV-35481 : ER_LOCK_DEADLOCK instead of ER_NO_SUCH_TABLE in galera_var_ignore_apply_errors
Add wait_condition before select and set wsrep_sync_wait=0 to avoid
possible deadlock.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-11-28 01:02:35 +01:00
Jan Lindström
ff45fdac29 MDEV-35440 : Protocol error warning in the galera_wsrep_schema_detached test
Make sure that node_1 remains in primary view by increasing it's
weight. Add suppression on expected warnings because we kill
node_2.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2024-11-28 01:02:35 +01:00
Oleksandr Byelkin
0ea19c12fd MDEV-35507 ed25519 authentication plugin create user statement trigger plain text password in audit log
Mask also all cases of "password(PWD" in CREATE/ALTER USER and GRANT.
(minimal fix)
2024-11-27 19:45:33 +01:00
Monty
f09020b3bb Fixed bug in subselect3.inc (not notable) 2024-11-26 14:23:31 +02:00
Alexander Barkov
225c17d35c MDEV-34090 Client allows to set character set to utf32 and crashes on the next command
Disallowing character sets with mbminlen>1 in the client.
2024-11-26 13:57:55 +04:00
Alexander Barkov
425d2521ec MDEV-33472 Assertion `0' failed in Item_row::illegal_method_call on CREATE EVENT
Do not accept rows as event parameters.
2024-11-25 18:29:13 +04:00
Alexander Barkov
20eba06d9b MDEV-35489 Assertion `!ldate->neg' or unexpected result upon extracting unit from invalid value
The patch for MDEV-23687 easlier fixed this problem. Adding tests only.
2024-11-25 16:13:16 +04:00
Alexander Barkov
2e404c9850 MDEV-21029 Incorrect result for expression with the <=> operator and IS NULL
Item_func_equal erroneously derived is_null() from the parent class.
Overriding it to return false because <=> can never return NULL.
2024-11-25 10:37:02 +04:00
Alexander Barkov
3997d28f48 MDEV-16698 ASAN: heap-use-after-free in field_longstr::uncompress
This bug was earlier fixed by MDEV-16699. Adding tests only.
2024-11-22 15:46:36 +04:00
Alexander Barkov
95df7ea33a MDEV-31881 ASAN: unknown-crash in check_ulonglong (sql/sql_analyse.cc) on SELECT ... FROM ... PROCEDURE ANALYSE()
Fixing a wrong condition which made the code read 1 byte behind the buffer.
2024-11-22 14:54:08 +04:00
Alexander Barkov
39f1f30f68 MDEV-23687 Assertion `is_valid_value_slow()' failed in Datetime::Datetime upon EXTRACT under mode ZERO_DATE_TIME_CAST
Item_{date|datetime}_typecase::get_date() erroneously passed the
TIME_INTERVAL_DAY flag from the caller to args[0] which made
CAST('100000:00:00' AS DATETIME) parse '100000:00:00' as TIME
rather that DATETIME.
Suppressing this flag.
2024-11-22 12:15:03 +04:00
Daniel Black
b414eca98d Correct cursor protocol tests main.{loaddata,grant_plugin} & innodb_fts.fulltext
Cursor protocol cannot handle select... into.

Disable this on loaddata.

For the grant_plugin/innodb_fts.fulltext changed
the tests to use a temporary table rather than a
user variable.
2024-11-21 21:43:44 +11:00