1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.6 into 10.10

The MDEV-29693 conflict resolution is from Monty, as well as is
a bug fix where ANALYZE TABLE wrongly built histograms for
single-column PRIMARY KEY.
Also includes a fix for safe_malloc error reporting.

Other things:
- Copied main.log_slow from 10.4 to avoid mtr issue

Disabled test:
- spider/bugfix.mdev_27239 because we started to get
  +Error	1429 Unable to connect to foreign data source: localhost
  -Error	1158 Got an error reading communication packets
- main.delayed
  - Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED
    This part is disabled for now as it fails randomly with different
    warnings/errors (no corruption).
This commit is contained in:
Marko Mäkelä
2023-10-13 15:14:37 +03:00
committed by Monty
436 changed files with 13299 additions and 28179 deletions

View File

@@ -1,8 +1,8 @@
# Use settings from rpl_1slave_base.cnf
# add setting to connect the slave to the master by default
!include rpl_1slave_base.cnf
!include include/default_client.cnf
[mysqld.2]
# Override specific server settings using [mariadb-x.y] option group
# from `test.cnf` file right after including this file.
# E.g. after !include ../my.cnf, in your `test.cnf`, specify your configuration
# in option group e.g [mysqld.x], so that number `x` corresponds to the number
# in the rpl server topology.

View File

@@ -28,8 +28,8 @@ slow_log CREATE TABLE `slow_log` (
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
`rows_sent` int(11) NOT NULL,
`rows_examined` int(11) NOT NULL,
`rows_sent` bigint(20) unsigned NOT NULL,
`rows_examined` bigint(20) unsigned NOT NULL,
`db` varchar(512) NOT NULL,
`last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL,
@@ -48,15 +48,15 @@ slow_log CREATE TABLE `slow_log` (
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
`rows_sent` int(11) NOT NULL,
`rows_examined` int(11) NOT NULL,
`rows_sent` bigint(20) unsigned NOT NULL,
`rows_examined` bigint(20) unsigned NOT NULL,
`db` varchar(512) NOT NULL,
`last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL,
`server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL,
`rows_affected` int(11) NOT NULL
`rows_affected` bigint(20) unsigned NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log'
SET GLOBAL general_log = 'OFF';
SET GLOBAL slow_query_log = 'OFF';

View File

@@ -0,0 +1,48 @@
include/master-slave.inc
[connection master]
connection master;
create table t1 (a int primary key, b int) engine=innodb;
insert t1 values (1,1);
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
include/stop_slave.inc
set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
set @save_slave_trans_retries= @@global.slave_transaction_retries;
set @@global.innodb_lock_wait_timeout= 1;
set @@global.slave_transaction_retries= 0;
connection master;
update t1 set b=b+10 where a=1;
include/save_master_gtid.inc
connection slave1;
BEGIN;
SELECT * FROM t1 WHERE a=1 FOR UPDATE;
a b
1 1
connection slave;
include/start_slave.inc
include/wait_for_slave_sql_error.inc [errno=1205]
connection slave1;
ROLLBACK;
connection slave;
set @save_dbug = @@global.debug_dbug;
set @@global.debug_dbug= "+d,delay_sql_thread_after_release_run_lock";
include/start_slave.inc
set debug_sync= "now wait_for sql_thread_run_lock_released";
# Validating that the SQL thread is running..
# ..success
# Validating that Last_SQL_Errno is cleared..
# ..success
set debug_sync= "now signal sql_thread_continue";
set @@global.debug_dbug= @saved_dbug;
set debug_sync= "RESET";
# Cleanup
connection master;
drop table t1;
connection slave;
include/stop_slave.inc
set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
set @@global.slave_transaction_retries= @save_slave_trans_retries;
include/start_slave.inc
include/rpl_end.inc
# End of rpl_sql_thd_start_errno_cleared.test

View File

@@ -2,14 +2,14 @@ include/master-slave.inc
[connection master]
connection slave;
include/stop_slave.inc
set @save_par_thds= @@global.slave_parallel_threads;
set @save_strict_mode= @@global.gtid_strict_mode;
set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
change master to master_use_gtid=slave_pos;
set @@global.slave_parallel_threads= 4;
set @@global.slave_parallel_mode= optimistic;
set @@global.gtid_strict_mode=ON;
set sql_log_bin= 0;
alter table mysql.gtid_slave_pos engine=innodb;
call mtr.add_suppression("Deadlock found.*");
set sql_log_bin= 1;
set statement sql_log_bin=0 for alter table mysql.gtid_slave_pos engine=innodb;
include/start_slave.inc
connection master;
create table t1 (a int primary key, b int) engine=innodb;
@@ -27,25 +27,25 @@ xa end '1';
xa prepare '1';
xa commit '1';
include/save_master_gtid.inc
connection slave;
connection slave1;
BEGIN;
SELECT * FROM mysql.gtid_slave_pos WHERE seq_no=100 FOR UPDATE;
domain_id sub_id server_id seq_no
connection slave;
include/start_slave.inc
include/wait_for_slave_sql_error.inc [errno=1942,1213]
include/wait_for_slave_sql_error.inc [errno=1942]
include/stop_slave_io.inc
connection slave1;
ROLLBACK;
# Cleanup
connection master;
drop table t1;
connection slave;
include/stop_slave.inc
# TODO: Remove after fixing MDEV-21777
set @@global.gtid_slave_pos= "0-1-100";
set @@global.slave_parallel_threads= 0;
set @@global.gtid_strict_mode= 0;
set @@global.innodb_lock_wait_timeout= 50;
set @@global.slave_parallel_threads= @save_par_thds;
set @@global.gtid_strict_mode= @save_strict_mode;
set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
include/start_slave.inc
include/rpl_end.inc
# End of rpl_xa_prepare_gtid_fail.test

View File

@@ -0,0 +1,93 @@
#
# Ensure that when the slave restarts, the last error code displayed by
# SHOW SLAVE STATUS is cleared before Slave_SQL_Running is set.
#
# To ensure that, this test uses the debug_sync mechanism to pause an errored
# and restarting slave's SQL thread after it has set its running state to YES,
# and then ensures that Last_SQL_Errno is 0. The slave error is a forced innodb
# row lock timeout.
#
#
# References
# MDEV-31177: SHOW SLAVE STATUS Last_SQL_Errno Race Condition on Errored
# Slave Restart
#
source include/have_binlog_format_row.inc;
source include/have_innodb.inc;
source include/have_debug.inc;
source include/have_debug_sync.inc;
source include/master-slave.inc;
--connection master
create table t1 (a int primary key, b int) engine=innodb;
insert t1 values (1,1);
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
set @save_slave_trans_retries= @@global.slave_transaction_retries;
set @@global.innodb_lock_wait_timeout= 1;
set @@global.slave_transaction_retries= 0;
--connection master
update t1 set b=b+10 where a=1;
--source include/save_master_gtid.inc
--connection slave1
BEGIN;
--eval SELECT * FROM t1 WHERE a=1 FOR UPDATE
--connection slave
--source include/start_slave.inc
--let $slave_sql_errno= 1205
--source include/wait_for_slave_sql_error.inc
--connection slave1
ROLLBACK;
--connection slave
set @save_dbug = @@global.debug_dbug;
set @@global.debug_dbug= "+d,delay_sql_thread_after_release_run_lock";
--source include/start_slave.inc
set debug_sync= "now wait_for sql_thread_run_lock_released";
--let $sql_running = query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, 1)
--echo # Validating that the SQL thread is running..
if (`SELECT strcmp("$sql_running", "YES") != 0`)
{
--echo # ..failed
--echo # Slave_SQL_Running: $sql_running
--die Slave SQL thread is not running
}
--echo # ..success
--let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
--echo # Validating that Last_SQL_Errno is cleared..
if ($last_error)
{
--echo # ..failed
--echo # Last_SQL_Errno: $last_error
--die SHOW SLAVE STATUS shows the error from the last session on startup
}
--echo # ..success
set debug_sync= "now signal sql_thread_continue";
set @@global.debug_dbug= @saved_dbug;
set debug_sync= "RESET";
--echo # Cleanup
--connection master
drop table t1;
--connection slave
--source include/stop_slave.inc
set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
set @@global.slave_transaction_retries= @save_slave_trans_retries;
--source include/start_slave.inc
--source include/rpl_end.inc
--echo # End of rpl_sql_thd_start_errno_cleared.test

View File

@@ -6,8 +6,8 @@
# GTID slave state, then the slave should immediately quit in error, without
# retry.
#
# This tests validates the above behavior by simulating a deadlock on the
# GTID slave state table during the second part of XA PREPARE's commit, to
# This tests validates the above behavior by forcing a lock-wait timeout on
# the GTID slave state table during the second part of XA PREPARE's commit, to
# ensure that the appropriate error is reported and the transaction was never
# retried.
#
@@ -23,23 +23,19 @@ source include/have_innodb.inc;
--connection slave
--source include/stop_slave.inc
--let $save_par_thds= `SELECT @@global.slave_parallel_threads`
--let $save_strict_mode= `SELECT @@global.gtid_strict_mode`
--let $save_innodb_lock_wait_timeout= `SELECT @@global.innodb_lock_wait_timeout`
set @save_par_thds= @@global.slave_parallel_threads;
set @save_strict_mode= @@global.gtid_strict_mode;
set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
change master to master_use_gtid=slave_pos;
set @@global.slave_parallel_threads= 4;
set @@global.slave_parallel_mode= optimistic;
set @@global.gtid_strict_mode=ON;
set sql_log_bin= 0;
alter table mysql.gtid_slave_pos engine=innodb;
call mtr.add_suppression("Deadlock found.*");
set sql_log_bin= 1;
set statement sql_log_bin=0 for alter table mysql.gtid_slave_pos engine=innodb;
--source include/start_slave.inc
--connection master
let $datadir= `select @@datadir`;
create table t1 (a int primary key, b int) engine=innodb;
insert t1 values (1,1);
--source include/save_master_gtid.inc
@@ -64,11 +60,6 @@ xa prepare '1';
xa commit '1';
--source include/save_master_gtid.inc
--connection slave
#--eval set statement sql_log_bin=0 for insert into mysql.gtid_slave_pos values ($gtid_domain_id, 5, $gtid_server_id, $xap_seq_no)
--connection slave1
BEGIN;
--eval SELECT * FROM mysql.gtid_slave_pos WHERE seq_no=$xap_seq_no FOR UPDATE
@@ -76,9 +67,14 @@ BEGIN;
--connection slave
--source include/start_slave.inc
--let $slave_sql_errno= 1942,1213
--let $slave_sql_errno= 1942
--source include/wait_for_slave_sql_error.inc
# TODO: Remove after fixing MDEV-21777
# Stop the IO thread too, so the existing relay logs are force purged on slave
# restart, as to not re-execute the already-prepared transaction
--source include/stop_slave_io.inc
--let $retried_tx_test= query_get_value(SHOW ALL SLAVES STATUS, Retried_transactions, 1)
if ($retried_tx_initial != $retried_tx_test)
{
@@ -95,11 +91,11 @@ ROLLBACK;
drop table t1;
--connection slave
--source include/stop_slave.inc
--echo # TODO: Remove after fixing MDEV-21777
--eval set @@global.gtid_slave_pos= "$new_gtid"
--eval set @@global.slave_parallel_threads= $save_par_thds
--eval set @@global.gtid_strict_mode= $save_strict_mode
--eval set @@global.innodb_lock_wait_timeout= $save_innodb_lock_wait_timeout
set @@global.slave_parallel_threads= @save_par_thds;
set @@global.gtid_strict_mode= @save_strict_mode;
set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
--source include/start_slave.inc
--source include/rpl_end.inc