1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00
Commit Graph

18662 Commits

Author SHA1 Message Date
Teemu Ollakka
1b146e8220 galera fix: Donor in non-Primary causes assertion in wsrep-lib
Constructed a test which makes donor to go into non-Primary configuration
before `sst_sent()` is called, causing an assertion in wsrep-lib
if the bug is present.

Updated wsrep-lib to version which contains the fix.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-12 12:25:09 +01:00
Julius Goryavsky
dd5dc92a19 galera_sequences test: post-fix after MDEV-33245 2025-02-12 12:25:09 +01:00
Julius Goryavsky
eb1811c2ce galera: disable problematic test (galera_vote_rejoin_dml) 2025-02-12 12:25:07 +01:00
Julius Goryavsky
1456d9ea0a galera: disable problematic test (MW-329) 2025-02-12 12:23:20 +01:00
Julius Goryavsky
a382b695d2 galera: disable problematic test (galera_vote_rejoin_ddl) 2025-02-12 11:30:15 +01:00
Julius Goryavsky
a7e59c8a54 galera mtr tests: remove unused .result file 2025-02-12 11:30:15 +01:00
Julius Goryavsky
96040fbd53 galera: correction for MENT-2042 test
Removed major part of test because XA transactions
are not supported in galera on 10.5 branch.
2025-02-12 11:30:15 +01:00
Julius Goryavsky
c9a6adba1e galera mtr tests: synchronization of tests between branches 2025-02-12 11:30:14 +01:00
Jan Lindström
c43d0a015f MDEV-35951 : Complete freeze during MW-329 test
Rewrite test not to use infinite procedure, it is not
necessary to test.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-12 10:52:21 +01:00
Julius Goryavsky
44e1f7238a MDEV-35941 addendum: additional corrections for mtr tests 2025-02-12 01:29:09 +01:00
Jan Lindström
3009b5439d MDEV-35941 : galera_bf_abort_lock_table fails with wait for metadata lock
Problem was missing case from wsrep_handle_mdl_conflict. Test case
was trying to confirm that LOCK TABLE thread is not BF-aborted.
However as case was missing it was BF-aborted. Test case passed
because BF-aborting takes time and used wait condition might
see expected thread status before it was BF-aborted. Test naturally
failed if BF-aborting was done early enough.

Fix is to add missing case for SQLCOM_LOCK_TABLES to
wsrep_handle_mdl_conflict.

Note that using LOCK TABLE is still not recomended on cluster
because it could cause cluster hang.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-12 01:23:41 +01:00
Sergei Petrunia
43c5d1303f MDEV-35958 Cost estimates for materialized derived tables are poor
Backport of commit 74f70c3944 to 10.11.
The new logic is disabled by default, to enable, use
optimizer_adjust_secondary_key_costs=fix_derived_table_read_cost.

== Original commit comment ==
Fixed costs in JOIN_TAB::estimate_scan_time() and HEAP

Estimate_scan_time() calculates the cost of scanning a derivied table.
The old code did not take into account that the temporary table heap table
may be converted to Aria.

  Things fixed:
  - Added checking if the temporary tables data will fit in the heap.
    If not, then calculate the cost based on the designated internal
    temporary table engine (Aria).
  - Removed MY_MAX(records, 1000) and instead trust the optimizer's
    estimate of records. This reduces the cost of temporary tables a bit
    for small tables, which caused a few changes in mtr results.
  - Fixed cost calculation for HEAP.
  - HEAP costs->row_next_find_cost was not set. This does not affect old
    costs calculation as this cost slot was not used anywhere.
    Now HEAP cost->row_next_find_cost is set, which allowed me to remove
    some duplicated computation in ha_heap::scan_time()
2025-02-10 21:14:01 +02:00
Marko Mäkelä
565a0cebd8 Merge 10.6 into 10.11 2025-02-10 14:45:18 +02:00
Alexander Barkov
b7d67ceb5f MDEV-36047 Package body variables are not allowed as FETCH targets
It was not possible to use a package body variable as a
fetch target:

CREATE PACKAGE BODY pkg AS
  vc INT := 0;
  FUNCTION f1 RETURN INT AS
    CURSOR cur IS SELECT 1 AS c FROM DUAL;
  BEGIN
    OPEN cur;
    FETCH cur INTO vc; -- this returned "Undeclared variable: vc" error.
    CLOSE cur;
    RETURN vc;
  END;
END;

FETCH assumed that all fetch targets reside of the same sp_rcontext
instance with the cursor. This patch fixes the problem.
Now a cursor and its fetch target can reside in different sp_rcontext
instances.

Details:

- Adding a helper class sp_rcontext_addr
  (a combination of Sp_rcontext_handler pointer and an offset in the rcontext)

- Adding a new class sp_fetch_target deriving from sp_rcontext_addr.
  Fetch targets in "FETCH cur INTO target1, target2 ..." are now collected
  into this structure instead of sp_variable.
  sp_variable cannot be used any more to store fetch targets,
  because it does not have a pointer to Sp_rcontext_handler
  (it only has the current rcontext offset).

- Removing members sp_instr_set members m_rcontext_handler and m_offset.
  Deriving sp_instr_set from sp_rcontext_addr instead.

- Renaming sp_instr_cfetch member  "List<sp_variable> m_varlist"
  to "List<sp_fetch_target> m_fetch_target_list".

- Fixing LEX::sp_add_cfetch() to return the pointer to the
  created sp_fetch_target instance (instead of returning bool).
  This helps to make the grammar in sql_yacc.c simpler

- Renaming LEX::sp_add_cfetch() to LEX::sp_add_instr_cfetch(),
  as `if(sp_add_cfetch())` changed its meaning to the opposite,
  to avoid automatic wrong merge from earlier versions.

- Chaning the "List<sp_variable> *vars" parameter to sp_cursor::fetch
  to have the data type "List<sp_fetch_target> *".

- Changing the data type of "List<sp_variable> &vars" in
  sp_cursor::Select_fetch_into_spvars::send_data_to_variable_list()
  to "List<sp_fetch_target> &".

- Adding THD helper methods get_rcontext() and get_variable().

- Moving the code from sql_yacc.yy into a new LEX method
  LEX::make_fetch_target().

- Simplifying the grammar in sql_yacc.yy using the new LEX method.
  Changing the data type of the bison rule sp_fetch_list from "void"
  to "List<sp_fetch_target> *".
2025-02-09 13:56:19 +04:00
Vlad Lesin
6e6fcf4d43 MDEV-34489 innodb.innodb_row_lock_time_ms fails
The test fails trying to compare (innodb/lock)_row_lock_time_avg with
some limit. We can't predict (innodb/lock)_row_lock_time_avg value,
because it's counted as the whole waiting time divided by the amount of
waits. Both waiting time and amount of waits depend on the previous
tests execution. The corresponding counters in lock_sys can't be reset
with any query. Remove (innodb/lock)_row_lock_time_avg comparision from
the test.

information_schema.global_status.innodb_row_lock_time can't be reset,
compare its difference instead of absolute value.

Reviewed by: Marko Mäkelä
2025-02-04 19:14:41 +03:00
Julius Goryavsky
d6f31ed263 Merge branch '10.5' into '10.6' 2025-02-03 10:44:13 +01:00
Jan Lindström
1f93aece3d MDEV-24485 : galera.galera_bf_kill_debug MTR failed: A long semaphore wait
Test sends a signal to debug_sync and in next command resets
debug_sync signals. There is small possibility that sended
signal is not yet handled in receiving thread and reset
will destroy it causing sync wait timeout.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-03 10:39:50 +01:00
Daniele Sciascia
10fd2c207a MDEV-35946 Assertion `thd->is_error()' failed in Sql_cmd_dml::prepare
Fix a regression that caused assertion thd->is_error() after
sync wait failures. If wsrep_sync_wait() fails make sure a appropriate
error is set. Partially revert 75dd0246f8.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-03 10:03:50 +01:00
Marko Mäkelä
75b24a002f Suppress processist_state='buffer pool load'
Sometimes, thread/innodb/thread_pool_thread may display
processlist_state='buffer pool load' instead of NULL
when the test is executed soon enough after server startup.
Let us suppress that information to avoid spurious failures.
2025-02-03 08:29:52 +02:00
Marko Mäkelä
900bbbe4a8 MDEV-33295 innodb.doublewrite occasionally fails
When the first attempt of XA ROLLBACK is expected to fail,
some recovered changes could be written back through the doublewrite
buffer. Should that happen, the next recovery attempt (after mangling
the data file t1.ibd further) could fail because no copy of the
affected pages would be available in the doublewrite buffer.
To prevent this from happening, ensure that the doublewrite buffer
will not be used and no log checkpoint occurs during the previous
failed recovery attempt.

Also, let a successful XA ROLLBACK serve the additional purpose of
freeing a BLOB page and therefore rewriting page 0, which we must then
be able to recover despite induced corruption. In the last restart step,
we will tolerate an unexpected checkpoint, because one is frequently
occurring on FreeBSD and AIX, despite our efforts to force a buffer pool
flush before each "no checkpoint" section.
2025-02-03 08:11:43 +02:00
Jan Lindström
81e5077185 MDEV-34738 : Upgrade 10.11 -> 11.4 fails when wsrep_provider_options socket.ssl_cipher is set
Problem was in Galera library where wsrep_provider socket.ssl_cipher
parameter was defined as type_bool when it should have been string
type.

Therefore, this test requires Galera library version 26.4.21 where
fix is. Here we just verify that we can upgrade ssl parameters
so that socket.cipher = AES256-SHA and we use OpenSSL.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-03 01:39:35 +01:00
Jan Lindström
a1d2dfa656 MDEV-35941 : galera_bf_abort_lock_table fails with wait for metadata lock
Test fixes only.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-03 01:13:39 +01:00
Julius Goryavsky
72f21560d5 Merge branch '10.6' into '10.11' 2025-02-02 23:17:20 +01:00
Jan Lindström
9389428380 MDEV-27861: Creating partitioned tables should not be allowed with wsrep_osu_method=TOI and wsrep_strict_ddl=ON
Problem was incorrect handling of partitioned tables,
because db_type == DB_TYPE_PARTITION_DB
wsrep_should_replicate_ddl incorrectly marked
DDL as not replicatable. However, in partitioned
tables we should check implementing storage engine
from table->file->partition_ht() if available because
if partition handler is InnoDB all DDL should be allowed
even with wsrep_strict_ddl. For other storage engines
DDL should not be allowed and error should be issued.

This is 10.6 version of the fix.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-02 14:20:06 +01:00
Julius Goryavsky
b3925982a0 MDEV-29755 post-merge for 10.6+
1) remove unnecessary restriction on changing mode;
2) adding lost wsrep_replicate_myisam_basic test.
2025-02-02 13:58:08 +01:00
Jan Lindström
0784dd32b1 MDEV-29775 : Assertion `0' failed in void Protocol::end_statement() when adding data to the MyISAM table after setting wsrep_mode=replicate_myisam
If wsrep_mode=BINLOG_ROW_FORMAT_ONLY wsrep_forced_binlog_format
can be DEFAULT (UNSPECIFIED) or ROW.

Finally, if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] or
wsrep_replicate_myisam=ON we allow wsrep_forced_binlog_format
to be [DEFAULT|ROW].

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-02 13:57:03 +01:00
Julius Goryavsky
53c693ec2f Merge branch '10.5' into '10.6' 2025-02-02 12:55:16 +01:00
Jan Lindström
22414d2ed0 MDEV-27861: Creating partitioned tables should not be allowed with wsrep_osu_method=TOI and wsrep_strict_ddl=ON
Problem was incorrect handling of partitioned tables,
because db_type == DB_TYPE_PARTITION_DB
wsrep_should_replicate_ddl incorrectly marked
DDL as not replicatable. However, in partitioned
tables we should check implementing storage engine
from table->file->partition_ht() if available because
if partition handler is InnoDB all DDL should be allowed
even with wsrep_strict_ddl. For other storage engines
DDL should not be allowed and error should be issued.

This is 10.5 version of the fix.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-02 04:54:42 +01:00
Julius Goryavsky
de216618e2 MDEV-29775 addendum: Relaxation of unnecessary restrictions
+ cosmetic corrections taken from the 10.6+ branch
of the fix (to simplify merge).
2025-02-02 04:52:33 +01:00
Jan Lindström
7d69902d83 MDEV-29775 : Assertion `0' failed in void Protocol::end_statement() when adding data to the MyISAM table after setting wsrep_mode=replicate_myisam
If wsrep_replicate_myisam=ON we allow wsrep_forced_binlog_format
to be [DEFAULT|ROW].

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-02 04:16:05 +01:00
Jan Lindström
3f5b6a9837 MDEV-35748 : Attempting to create a CONNECT engine Table results in non-InnoDB sequences in Galera cluster error
Problem was incorrect condition on wsrep_check_sequence
when ENGINE!=InnoDB.

Fix is not use DB_TYPE_XXX because it is not correct
on dynamic storage engines. Instead used storage engine
name is looked from thd->lex->m_sql_cmd->option_storage_engine_name.

For CREATE TABLE allow anyting except ENGINE=SEQUENCE.
For CREATE SEQUENCE only ENGINE=InnoDB is supported.
For ALTER TABLE if original table contains sequence information
only ENGINE=InnoDB is supported.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-02-01 16:53:39 +01:00
Brandon Nesterenko
f1276aa1bc MDEV-26652: xa transactions binlogged in wrong order
Disclaimer: This report was fixed in a previous commit with
MDEV-21117, this patch only adds a test to show the presence of
the fix.

Prior to MDEV-21117, the ordering of the handlers in a
transaction's ha_info list solely determined the order in which
the handlertons commit. The binlog is supposed to commit first,
and is normally placed first in the ha_list to do so; however,
in multi-engine 2-phase XA transactions, the binlog can be
placed second. This allowed a race-condition for other
concurrent transactions to commit and binlog before the prior
XA COMMIT would be written to binlog.

MDEV-21117 fixed this so the binlog is specially considered
to commit first, before traversing the ha_list (see
commit_one_phase_2() in sql/hander.cc for this specific change
in 6c39eaeb12).
2025-01-30 11:30:33 -07:00
Sergei Golubchik
7d657fda64 Merge branch '10.11 into 11.4 2025-01-30 12:01:11 +01:00
Sergei Golubchik
e69f8cae1a Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
Sergei Golubchik
0459517562 MDEV-35169 cleanup after the test
followup for f6e00abda0
2025-01-30 11:54:34 +01:00
Sergei Golubchik
04bd6ed44c MDEV-35368 Validation of SSL certificate fails for mariadb-backup
Just like in CONC-712, disable hostname checks for connections
over unix socket. Even for not self-signed certificates.
2025-01-29 23:56:54 +01:00
Sergei Golubchik
066e8d6aea Merge branch '10.5' into 10.6 2025-01-29 11:17:38 +01:00
Marko Mäkelä
3cfffb4de6 MDEV-35962 CREATE INDEX fails to heal a FOREIGN KEY constraint
commit_cache_norebuild(): Replace any newly added indexes in
the attached foreign key constraints.
2025-01-29 09:04:50 +02:00
Thirunarayanan Balathandayuthapani
f6e00abda0 MDEV-35169 ALTER TABLE...IMPORT TABLESPACE does not work with INDEX DESC
Problem:
=======
- Import tablespace fails to check the index fields descending
property while matching the schema given in cfg file with the
table schema.

Fix:
===
row_quiesce_write_index_fields(): Write the descending
property of the field into field fixed length field.
Since the field fixed length uses only 10 bits,
InnoDB can use 0th bit of the field fixed length
to store the descending field property.

row_import_cfg_read_index_fields(): Read the field
descending information from field fixed length.
2025-01-28 11:56:35 +05:30
Julius Goryavsky
bcb87f5ccb fix for galera_query_cache_invalidate test results 2025-01-27 23:07:23 +01:00
Julius Goryavsky
50d49493db galera: fixes for mtr test for performance schema 2025-01-27 19:05:27 +01:00
Daniele Sciascia
c43db43a7c MENT-2038 Assert WSREP(thd) fails in wsrep_restore_kill_after_commit
Fix wrong assertion: function wsrep_restore_kill_after_commit()
asserts `WSREP(thd)`, however for the caller (wsrep_after_statement())
it is enough that the THD  has an active transaction. Fixed the
assertion accordingly.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-01-27 19:05:27 +01:00
Julius Goryavsky
862d1be2e6 MDEV-25718 addendum: stabilization of test success (especially for 11.4+)
Added DEBUG_SYNC_С("ha_write_row_end") in the WSREP branch,
and added a new status to the list of pending statuses in
the mtr test.
2025-01-27 19:05:26 +01:00
Julius Goryavsky
779ae4c511 wsrep mtr tests: fix for MDEV-23081 failure
Sometimes a database can be created with --log-bin
but then the .combinations file causes a switch to
start without --log-bin causing a failure on recovery.
This commit fixes this issue.
2025-01-27 19:05:26 +01:00
Julius Goryavsky
331975c5c5 galera: disable problematic test (galera_nbo_master_non_prim_failure) 2025-01-27 19:05:26 +01:00
Julius Goryavsky
5af1f69a84 MDEV-26266 addendum: more stable test
This test must be performed on newly launched
nodes and then a restart must be performed.
2025-01-27 19:05:26 +01:00
Julius Goryavsky
0a5d6cf478 galera: disable problematic test (galera_sequences) 2025-01-27 19:05:26 +01:00
Julius Goryavsky
acf7b000ff fixes for galera_as_slave replication tests 2025-01-27 19:05:26 +01:00
Jan Lindström
e53ffdee96 MDEV-35804 : galera_ddl_fk_conflict test failed due to timeout
Test case changes only. Use better wait_conditions.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-01-27 19:05:26 +01:00
Jan Lindström
0ddaefcc76 galera fix : MW-402 galera test fails sporadically
Test was using after certification sync point when it was
intended to use before certification sync point. This
caused sporadic failures.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-01-27 19:05:26 +01:00