mirror of
https://github.com/MariaDB/server.git
synced 2025-04-21 22:55:35 +02:00
Merge 10.6 to 10.11
This commit is contained in:
commit
383ee364dc
14 changed files with 448 additions and 12 deletions
mysql-test/suite
innodb
r
t
rpl
sql
storage/innobase
|
@ -0,0 +1,2 @@
|
|||
91a92
|
||||
> ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
|
|
@ -82,3 +82,11 @@ f29(10), f30(10), f31(10), f32(10),
|
|||
f33(10)))
|
||||
ENGINE=InnoDB;
|
||||
ERROR 42000: Too many key parts specified; max 32 parts allowed
|
||||
#
|
||||
# MDEV-31161 Assertion failures upon adding a too long key
|
||||
# to table with COMPRESSED row format
|
||||
#
|
||||
CREATE TABLE t1(pk INT PRIMARY KEY, f1 INT, f2 TEXT)ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
|
||||
INSERT INTO t1 (pk) VALUES (1);
|
||||
ALTER TABLE t1 ADD KEY (f1), ADD KEY (f2(1000));
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -85,3 +85,19 @@ CREATE TABLE t1(f1 char(200), f2 char(200), f3 char(200),
|
|||
f29(10), f30(10), f31(10), f32(10),
|
||||
f33(10)))
|
||||
ENGINE=InnoDB;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-31161 Assertion failures upon adding a too long key
|
||||
--echo # to table with COMPRESSED row format
|
||||
--echo #
|
||||
--let $page_size= `SELECT @@GLOBAL.innodb_page_size`
|
||||
CREATE TABLE t1(pk INT PRIMARY KEY, f1 INT, f2 TEXT)ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
|
||||
INSERT INTO t1 (pk) VALUES (1);
|
||||
let $error_code = 0;
|
||||
if ($page_size == 4096) {
|
||||
let $error_code = ER_TOO_BIG_ROWSIZE;
|
||||
}
|
||||
|
||||
--error $error_code
|
||||
ALTER TABLE t1 ADD KEY (f1), ADD KEY (f2(1000));
|
||||
DROP TABLE t1;
|
||||
|
|
143
mysql-test/suite/rpl/r/rpl_mdev33798.result
Normal file
143
mysql-test/suite/rpl/r/rpl_mdev33798.result
Normal file
|
@ -0,0 +1,143 @@
|
|||
include/rpl_init.inc [topology=1->2,1->3]
|
||||
connect server_2b,127.0.0.1,root,,,$SERVER_MYPORT_2;
|
||||
connection server_2;
|
||||
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
|
||||
SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode;
|
||||
SET @old_timeout= @@GLOBAL.lock_wait_timeout;
|
||||
SET @old_innodb_timeout= @@GLOBAL.innodb_lock_wait_timeout;
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL slave_parallel_threads=5;
|
||||
set global slave_parallel_mode= aggressive;
|
||||
SET GLOBAL lock_wait_timeout= 86400;
|
||||
SET GLOBAL innodb_lock_wait_timeout= 86400;
|
||||
SET STATEMENT sql_log_bin=0 FOR ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
||||
include/start_slave.inc
|
||||
connection server_1;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (6, 0), (7, 0), (8, 0);
|
||||
connection server_2;
|
||||
include/stop_slave.inc
|
||||
connection server_2b;
|
||||
BEGIN;
|
||||
SELECT * FROM t1 WHERE a=1 FOR UPDATE;
|
||||
a b
|
||||
1 0
|
||||
SELECT * FROM t1 WHERE a=5 FOR UPDATE;
|
||||
a b
|
||||
5 0
|
||||
connection server_1;
|
||||
SET SESSION gtid_domain_id= 1;
|
||||
BEGIN;
|
||||
UPDATE t1 SET b=1 WHERE a=1;
|
||||
UPDATE t1 SET b=1 WHERE a=7;
|
||||
COMMIT;
|
||||
UPDATE t1 SET b=2 WHERE a=3;
|
||||
SET SESSION gtid_domain_id=2;
|
||||
BEGIN;
|
||||
UPDATE t1 SET b=3 WHERE a=5;
|
||||
UPDATE t1 SET b=3 WHERE a=3;
|
||||
COMMIT;
|
||||
UPDATE t1 SET b=4 WHERE a=7;
|
||||
SET SESSION gtid_domain_id= 0;
|
||||
include/save_master_gtid.inc
|
||||
connection server_2;
|
||||
include/start_slave.inc
|
||||
connection server_2b;
|
||||
ROLLBACK;
|
||||
connection server_2;
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT a, (
|
||||
(a=1 AND b=1) OR
|
||||
(a=3 AND (b=2 OR b=3)) OR
|
||||
(a=5 AND b=3) OR
|
||||
(a=7 AND (b=1 OR b=4)) OR
|
||||
((a MOD 2)=0 AND b=0)) AS `ok`
|
||||
FROM t1
|
||||
ORDER BY a;
|
||||
a ok
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
5 1
|
||||
6 1
|
||||
7 1
|
||||
8 1
|
||||
connection server_3;
|
||||
include/sync_with_master_gtid.inc
|
||||
include/stop_slave.inc
|
||||
connection server_2;
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER 'm2' to master_port=MYPORT_3 , master_host='127.0.0.1', master_user='root', master_use_gtid=slave_pos;
|
||||
connection server_1;
|
||||
SET SESSION gtid_domain_id= 1;
|
||||
BEGIN;
|
||||
UPDATE t1 SET b=11 WHERE a=1;
|
||||
UPDATE t1 SET b=11 WHERE a=7;
|
||||
COMMIT;
|
||||
UPDATE t1 SET b=12 WHERE a=3;
|
||||
SET SESSION gtid_domain_id= 1;
|
||||
connection server_3;
|
||||
SET SESSION gtid_domain_id=3;
|
||||
BEGIN;
|
||||
UPDATE t1 SET b=13 WHERE a=5;
|
||||
UPDATE t1 SET b=13 WHERE a=3;
|
||||
COMMIT;
|
||||
UPDATE t1 SET b=14 WHERE a=7;
|
||||
include/save_master_gtid.inc
|
||||
connection server_2b;
|
||||
BEGIN;
|
||||
SELECT * FROM t1 WHERE a=1 FOR UPDATE;
|
||||
a b
|
||||
1 1
|
||||
SELECT * FROM t1 WHERE a=5 FOR UPDATE;
|
||||
a b
|
||||
5 3
|
||||
START ALL SLAVES;
|
||||
Warnings:
|
||||
Note 1937 SLAVE 'm2' started
|
||||
Note 1937 SLAVE '' started
|
||||
connection server_2b;
|
||||
ROLLBACK;
|
||||
connection server_1;
|
||||
include/save_master_gtid.inc
|
||||
connection server_2;
|
||||
include/sync_with_master_gtid.inc
|
||||
connection server_3;
|
||||
include/save_master_gtid.inc
|
||||
connection server_2;
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT a, (
|
||||
(a=1 AND b=11) OR
|
||||
(a=3 AND (b=12 OR b=13)) OR
|
||||
(a=5 AND b=13) OR
|
||||
(a=7 AND (b=11 OR b=14)) OR
|
||||
((a MOD 2)=0 AND b=0)) AS `ok`
|
||||
FROM t1
|
||||
ORDER BY a;
|
||||
a ok
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
5 1
|
||||
6 1
|
||||
7 1
|
||||
8 1
|
||||
SET default_master_connection = 'm2';
|
||||
include/stop_slave.inc
|
||||
RESET SLAVE 'm2' ALL;
|
||||
SET default_master_connection = '';
|
||||
connection server_3;
|
||||
include/start_slave.inc
|
||||
disconnect server_2b;
|
||||
connection server_1;
|
||||
DROP TABLE t1;
|
||||
connection server_2;
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
|
||||
set global slave_parallel_mode= @old_parallel_mode;
|
||||
SET GLOBAL lock_wait_timeout= @old_timeout;
|
||||
SET GLOBAL innodb_lock_wait_timeout= @old_innodb_timeout;
|
||||
include/start_slave.inc
|
||||
include/rpl_end.inc
|
|
@ -6,6 +6,8 @@ connection master;
|
|||
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
||||
connection slave;
|
||||
include/stop_slave.inc
|
||||
SET @old_transaction_retries = @@GLOBAL.slave_transaction_retries;
|
||||
SET @@global.slave_transaction_retries = 1000;
|
||||
SET @old_parallel_threads = @@GLOBAL.slave_parallel_threads;
|
||||
SET @old_slave_domain_parallel_threads = @@GLOBAL.slave_domain_parallel_threads;
|
||||
SET @@global.slave_parallel_threads = 5;
|
||||
|
@ -45,6 +47,7 @@ include/stop_slave.inc
|
|||
SET @@global.slave_parallel_mode = @old_parallel_mode;
|
||||
SET @@global.slave_parallel_threads = @old_parallel_threads;
|
||||
SET @@global.slave_domain_parallel_threads = @old_slave_domain_parallel_threads;
|
||||
SET @@global.slave_transaction_retries = @old_transaction_retries;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
|
|
17
mysql-test/suite/rpl/t/rpl_mdev33798.cnf
Normal file
17
mysql-test/suite/rpl/t/rpl_mdev33798.cnf
Normal file
|
@ -0,0 +1,17 @@
|
|||
!include suite/rpl/my.cnf
|
||||
|
||||
[mysqld.1]
|
||||
log-slave-updates
|
||||
loose-innodb
|
||||
|
||||
[mysqld.2]
|
||||
log-slave-updates
|
||||
loose-innodb
|
||||
|
||||
[mysqld.3]
|
||||
log-slave-updates
|
||||
loose-innodb
|
||||
|
||||
[ENV]
|
||||
SERVER_MYPORT_3= @mysqld.3.port
|
||||
SERVER_MYSOCK_3= @mysqld.3.socket
|
182
mysql-test/suite/rpl/t/rpl_mdev33798.test
Normal file
182
mysql-test/suite/rpl/t/rpl_mdev33798.test
Normal file
|
@ -0,0 +1,182 @@
|
|||
--source include/have_innodb.inc
|
||||
--source include/have_log_bin.inc
|
||||
--let $rpl_topology=1->2,1->3
|
||||
--source include/rpl_init.inc
|
||||
--connect (server_2b,127.0.0.1,root,,,$SERVER_MYPORT_2)
|
||||
|
||||
--connection server_2
|
||||
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
|
||||
SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode;
|
||||
SET @old_timeout= @@GLOBAL.lock_wait_timeout;
|
||||
SET @old_innodb_timeout= @@GLOBAL.innodb_lock_wait_timeout;
|
||||
--source include/stop_slave.inc
|
||||
SET GLOBAL slave_parallel_threads=5;
|
||||
set global slave_parallel_mode= aggressive;
|
||||
# High timeout so we get replication sync error and test failure if the
|
||||
# conflict handling is insufficient and lock wait timeout occurs.
|
||||
SET GLOBAL lock_wait_timeout= 86400;
|
||||
SET GLOBAL innodb_lock_wait_timeout= 86400;
|
||||
SET STATEMENT sql_log_bin=0 FOR ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
||||
--source include/start_slave.inc
|
||||
|
||||
--connection server_1
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (6, 0), (7, 0), (8, 0);
|
||||
--save_master_pos
|
||||
|
||||
--connection server_2
|
||||
--sync_with_master
|
||||
--source include/stop_slave.inc
|
||||
|
||||
# Test the following scenario:
|
||||
#
|
||||
# Transactions T1, T2 in domain 1, U1, U2 in domain 2.
|
||||
# Wait cycle T1->U2->U1->T2->T1 as follows:
|
||||
# T1 row lock wait on U2
|
||||
# U2 wait_for_prior_commit on U1
|
||||
# U1 row lock wait on T2
|
||||
# T2 wait_for_prior_commit on T1
|
||||
#
|
||||
# Test that the wait cycle is broken correctly with deadlock kill.
|
||||
|
||||
--connection server_2b
|
||||
# Temporarily block T1 and U1.
|
||||
BEGIN;
|
||||
SELECT * FROM t1 WHERE a=1 FOR UPDATE;
|
||||
SELECT * FROM t1 WHERE a=5 FOR UPDATE;
|
||||
|
||||
--connection server_1
|
||||
|
||||
SET SESSION gtid_domain_id= 1;
|
||||
# T1 in domain 1
|
||||
BEGIN;
|
||||
UPDATE t1 SET b=1 WHERE a=1;
|
||||
UPDATE t1 SET b=1 WHERE a=7;
|
||||
COMMIT;
|
||||
# T2 in domain 1
|
||||
UPDATE t1 SET b=2 WHERE a=3;
|
||||
|
||||
SET SESSION gtid_domain_id=2;
|
||||
# U1 in domain 2
|
||||
BEGIN;
|
||||
UPDATE t1 SET b=3 WHERE a=5;
|
||||
UPDATE t1 SET b=3 WHERE a=3;
|
||||
COMMIT;
|
||||
# U2 in domain 2
|
||||
UPDATE t1 SET b=4 WHERE a=7;
|
||||
SET SESSION gtid_domain_id= 0;
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection server_2
|
||||
--source include/start_slave.inc
|
||||
# Wait until T2, U2 are holding the row locks.
|
||||
--let $wait_condition= SELECT COUNT(*)=2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE state LIKE '%Waiting for prior transaction to commit%'
|
||||
--source include/wait_condition.inc
|
||||
|
||||
# Then let T1, U1 continue to conflict on the row locks, and check that
|
||||
# replication correctly handles the conflict.
|
||||
--connection server_2b
|
||||
ROLLBACK;
|
||||
|
||||
--connection server_2
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
# Allow either domain to "win" on the conflicting updates.
|
||||
SELECT a, (
|
||||
(a=1 AND b=1) OR
|
||||
(a=3 AND (b=2 OR b=3)) OR
|
||||
(a=5 AND b=3) OR
|
||||
(a=7 AND (b=1 OR b=4)) OR
|
||||
((a MOD 2)=0 AND b=0)) AS `ok`
|
||||
FROM t1
|
||||
ORDER BY a;
|
||||
|
||||
# Now try the same thing with multi-source replication.
|
||||
|
||||
# Make server_3 a second master
|
||||
--connection server_3
|
||||
--source include/sync_with_master_gtid.inc
|
||||
--source include/stop_slave.inc
|
||||
|
||||
--connection server_2
|
||||
--source include/stop_slave.inc
|
||||
--replace_result $SERVER_MYPORT_3 MYPORT_3
|
||||
eval CHANGE MASTER 'm2' to master_port=$SERVER_MYPORT_3 , master_host='127.0.0.1', master_user='root', master_use_gtid=slave_pos;
|
||||
|
||||
--connection server_1
|
||||
|
||||
SET SESSION gtid_domain_id= 1;
|
||||
# T1 in domain 1
|
||||
BEGIN;
|
||||
UPDATE t1 SET b=11 WHERE a=1;
|
||||
UPDATE t1 SET b=11 WHERE a=7;
|
||||
COMMIT;
|
||||
# T2 in domain 1
|
||||
UPDATE t1 SET b=12 WHERE a=3;
|
||||
SET SESSION gtid_domain_id= 1;
|
||||
|
||||
--connection server_3
|
||||
SET SESSION gtid_domain_id=3;
|
||||
# U1 in domain 3
|
||||
BEGIN;
|
||||
UPDATE t1 SET b=13 WHERE a=5;
|
||||
UPDATE t1 SET b=13 WHERE a=3;
|
||||
COMMIT;
|
||||
# U2 in domain 3
|
||||
UPDATE t1 SET b=14 WHERE a=7;
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection server_2b
|
||||
# Temporarily block T1 and U1.
|
||||
BEGIN;
|
||||
SELECT * FROM t1 WHERE a=1 FOR UPDATE;
|
||||
SELECT * FROM t1 WHERE a=5 FOR UPDATE;
|
||||
|
||||
START ALL SLAVES;
|
||||
# Wait until T2, U2 are holding the row locks.
|
||||
--let $wait_condition= SELECT COUNT(*)=2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE state LIKE '%Waiting for prior transaction to commit%'
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--connection server_2b
|
||||
ROLLBACK;
|
||||
|
||||
--connection server_1
|
||||
--source include/save_master_gtid.inc
|
||||
--connection server_2
|
||||
--source include/sync_with_master_gtid.inc
|
||||
--connection server_3
|
||||
--source include/save_master_gtid.inc
|
||||
--connection server_2
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
SELECT a, (
|
||||
(a=1 AND b=11) OR
|
||||
(a=3 AND (b=12 OR b=13)) OR
|
||||
(a=5 AND b=13) OR
|
||||
(a=7 AND (b=11 OR b=14)) OR
|
||||
((a MOD 2)=0 AND b=0)) AS `ok`
|
||||
FROM t1
|
||||
ORDER BY a;
|
||||
|
||||
SET default_master_connection = 'm2';
|
||||
--source include/stop_slave.inc
|
||||
RESET SLAVE 'm2' ALL;
|
||||
SET default_master_connection = '';
|
||||
|
||||
--connection server_3
|
||||
--source include/start_slave.inc
|
||||
|
||||
# Cleanup
|
||||
|
||||
--disconnect server_2b
|
||||
--connection server_1
|
||||
DROP TABLE t1;
|
||||
--connection server_2
|
||||
--source include/stop_slave.inc
|
||||
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
|
||||
set global slave_parallel_mode= @old_parallel_mode;
|
||||
SET GLOBAL lock_wait_timeout= @old_timeout;
|
||||
SET GLOBAL innodb_lock_wait_timeout= @old_innodb_timeout;
|
||||
--source include/start_slave.inc
|
||||
|
||||
--source include/rpl_end.inc
|
|
@ -22,6 +22,12 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
|||
--connection slave
|
||||
--sync_with_master
|
||||
--source include/stop_slave.inc
|
||||
# This test runs huge number of transactions independently in parallel that
|
||||
# all conflict on a single row. This requires a large number of retries, as a
|
||||
# transaction can repeatedly conflict/deadlock with a large number of other
|
||||
# transactions (in a different domain) one by one.
|
||||
SET @old_transaction_retries = @@GLOBAL.slave_transaction_retries;
|
||||
SET @@global.slave_transaction_retries = 1000;
|
||||
SET @old_parallel_threads = @@GLOBAL.slave_parallel_threads;
|
||||
SET @old_slave_domain_parallel_threads = @@GLOBAL.slave_domain_parallel_threads;
|
||||
SET @@global.slave_parallel_threads = 5;
|
||||
|
@ -161,6 +167,7 @@ SET @@global.slave_parallel_mode = 'optimistic';
|
|||
SET @@global.slave_parallel_mode = @old_parallel_mode;
|
||||
SET @@global.slave_parallel_threads = @old_parallel_threads;
|
||||
SET @@global.slave_domain_parallel_threads = @old_slave_domain_parallel_threads;
|
||||
SET @@global.slave_transaction_retries = @old_transaction_retries;
|
||||
--source include/start_slave.inc
|
||||
|
||||
--connection master
|
||||
|
|
|
@ -4404,6 +4404,9 @@ int Xid_apply_log_event::do_apply_event(rpl_group_info *rgi)
|
|||
thd->wsrep_affected_rows= 0;
|
||||
#endif
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
bool record_gtid_delayed_for_xa= false;
|
||||
#endif
|
||||
if (rgi->gtid_pending)
|
||||
{
|
||||
sub_id= rgi->gtid_sub_id;
|
||||
|
@ -4422,6 +4425,10 @@ int Xid_apply_log_event::do_apply_event(rpl_group_info *rgi)
|
|||
return 1;
|
||||
});
|
||||
}
|
||||
#ifndef DBUG_OFF
|
||||
else
|
||||
record_gtid_delayed_for_xa= true;
|
||||
#endif
|
||||
}
|
||||
|
||||
general_log_print(thd, COM_QUERY, get_query());
|
||||
|
@ -4431,6 +4438,22 @@ int Xid_apply_log_event::do_apply_event(rpl_group_info *rgi)
|
|||
{
|
||||
DBUG_ASSERT(!thd->transaction->xid_state.is_explicit_XA());
|
||||
|
||||
DBUG_ASSERT(record_gtid_delayed_for_xa);
|
||||
if (thd->rgi_slave->is_parallel_exec)
|
||||
{
|
||||
/*
|
||||
With XA, since the transaction is prepared/committed without updating
|
||||
the GTID pos (MDEV-32020...), we need here to clear any pending
|
||||
deadlock kill.
|
||||
|
||||
Otherwise if the kill happened after the prepare/commit completed, it
|
||||
might end up killing the subsequent GTID position update, causing the
|
||||
slave to fail with error.
|
||||
*/
|
||||
wait_for_pending_deadlock_kill(thd, thd->rgi_slave);
|
||||
thd->reset_killed();
|
||||
}
|
||||
|
||||
if ((err= do_record_gtid(thd, rgi, false, &hton, true)))
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ handle_queued_pos_update(THD *thd, rpl_parallel_thread::queued_event *qev)
|
|||
asynchronously, we need to be sure they will be completed before starting a
|
||||
new transaction. Otherwise the new transaction might suffer a spurious kill.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
wait_for_pending_deadlock_kill(THD *thd, rpl_group_info *rgi)
|
||||
{
|
||||
PSI_stage_info old_stage;
|
||||
|
|
|
@ -518,6 +518,7 @@ struct rpl_parallel {
|
|||
extern struct rpl_parallel_thread_pool global_rpl_thread_pool;
|
||||
|
||||
|
||||
extern void wait_for_pending_deadlock_kill(THD *thd, rpl_group_info *rgi);
|
||||
extern int rpl_parallel_resize_pool_if_no_slaves(void);
|
||||
extern int rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool);
|
||||
extern int rpl_parallel_inactivate_pool(rpl_parallel_thread_pool *pool);
|
||||
|
|
|
@ -5384,14 +5384,38 @@ thd_rpl_deadlock_check(MYSQL_THD thd, MYSQL_THD other_thd)
|
|||
return 0;
|
||||
if (!rgi->is_parallel_exec)
|
||||
return 0;
|
||||
if (rgi->rli != other_rgi->rli)
|
||||
return 0;
|
||||
if (!rgi->gtid_sub_id || !other_rgi->gtid_sub_id)
|
||||
return 0;
|
||||
if (rgi->current_gtid.domain_id != other_rgi->current_gtid.domain_id)
|
||||
return 0;
|
||||
if (rgi->gtid_sub_id > other_rgi->gtid_sub_id)
|
||||
return 0;
|
||||
if (rgi->rli == other_rgi->rli &&
|
||||
rgi->current_gtid.domain_id == other_rgi->current_gtid.domain_id)
|
||||
{
|
||||
/*
|
||||
Within the same master connection and domain, we can compare transaction
|
||||
order on the GTID sub_id, and rollback the later transaction to allow the
|
||||
earlier transaction to commit first.
|
||||
*/
|
||||
if (!rgi->gtid_sub_id || !other_rgi->gtid_sub_id ||
|
||||
rgi->gtid_sub_id > other_rgi->gtid_sub_id)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
Lock conflicts between different master connections or domains should
|
||||
usually not occur, but could still happen if user is running some
|
||||
special setup that tolerates conflicting updates (or in case of user
|
||||
error). We do not have a pre-defined ordering of transactions in this
|
||||
case, but we still need to handle conflicts in _some_ way to avoid
|
||||
undetected deadlocks and hangs.
|
||||
|
||||
We do this by rolling back and retrying any transaction that is being
|
||||
_optimistically_ applied. This can be overly conservative in some cases,
|
||||
but should be fine as conflicts between different master connections /
|
||||
domains are not common. And it ensures that we won't end up in a
|
||||
deadlock and hang due to a transaction doing wait_for_prior_commit while
|
||||
holding locks that block something in another master connection.
|
||||
*/
|
||||
if (other_rgi->speculation != rpl_group_info::SPECULATE_OPTIMISTIC)
|
||||
return 0;
|
||||
}
|
||||
if (rgi->finish_event_group_called || other_rgi->finish_event_group_called)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -2877,7 +2877,15 @@ ignore_unfixed:
|
|||
in buf_page_t::read_complete() or
|
||||
buf_pool_t::corrupted_evict(), or
|
||||
after buf_zip_decompress() in this function. */
|
||||
block->page.lock.s_lock();
|
||||
if (rw_latch != RW_NO_LATCH) {
|
||||
block->page.lock.s_lock();
|
||||
} else if (!block->page.lock.s_lock_try()) {
|
||||
/* For RW_NO_LATCH, we should not try to acquire S or X
|
||||
latch directly as we could be violating the latching
|
||||
order resulting in deadlock. Instead we try latching the
|
||||
page and retry in case of a failure. */
|
||||
goto wait_for_read;
|
||||
}
|
||||
state = block->page.state();
|
||||
ut_ad(state < buf_page_t::READ_FIX
|
||||
|| state >= buf_page_t::WRITE_FIX);
|
||||
|
@ -2885,15 +2893,15 @@ ignore_unfixed:
|
|||
block->page.lock.s_unlock();
|
||||
|
||||
if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) {
|
||||
block->page.unfix();
|
||||
if (UNIV_UNLIKELY(id == page_id)) {
|
||||
/* The page read was completed, and
|
||||
another thread marked the page as free
|
||||
while we were waiting. */
|
||||
goto ignore_unfixed;
|
||||
goto ignore_block;
|
||||
}
|
||||
|
||||
ut_ad(id == page_id_t{~0ULL});
|
||||
block->page.unfix();
|
||||
|
||||
if (++retries < BUF_PAGE_READ_MAX_RETRIES) {
|
||||
goto loop;
|
||||
|
@ -2932,6 +2940,7 @@ free_unfixed_block:
|
|||
if (UNIV_UNLIKELY(!block->page.frame)) {
|
||||
if (!block->page.lock.x_lock_try()) {
|
||||
wait_for_unzip:
|
||||
wait_for_read:
|
||||
/* The page is being read or written, or
|
||||
another thread is executing buf_zip_decompress()
|
||||
in buf_page_get_low() on it. */
|
||||
|
|
|
@ -7453,6 +7453,7 @@ error_handled:
|
|||
row_mysql_lock_data_dictionary(ctx->trx);
|
||||
} else {
|
||||
row_merge_drop_indexes(ctx->trx, user_table, true);
|
||||
user_table->indexes.start->online_log = nullptr;
|
||||
ctx->trx->commit();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue