-
Notifications
You must be signed in to change notification settings - Fork 713
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dependency replication] Fixing an illegal mem ref bug caused by larg…
…e trxs Summary: Dependency replication uses table map events to find dependencies. The coordinator assumes that the table map event is always available because in steady state the worker doesn't destroy events of the transaction till it's committed. This assumption is not true however, the worker will destroy buffered transactions after it hits a max threshold. To fix this, we track the number of events per trx in the coordinator and make it a sync trx when it reaches the threshold. A sync trx is executed in isolation and hence doesn't do any dependency calculation. Test Plan: Wrote an mtr test that fails in valgrind without the fix Reviewers: herman, mung, arahut Reviewed By: arahut Subscribers: butterflybot, ritwikyadav, vinaybhat, [email protected] Differential Revision: https://phabricator.intern.facebook.com/D16568788 Tasks: T48227365, T48086252, T47967598 Signature: 16568788:1565196684:2efe4d14ceea1ef7f8054619d7a6445977ce863a
- Loading branch information
1 parent
0f17345
commit 2520fda
Showing
7 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
mysql-test/suite/rpl_mts/r/rpl_dep_exceed_worker_queue_size.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
include/master-slave.inc | ||
Warnings: | ||
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. | ||
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. | ||
[connection master] | ||
create table t1(a int) engine = innodb; | ||
include/sync_slave_sql_with_master.inc | ||
include/stop_slave.inc | ||
insert into t1 values(1), (2), (3), (4), (5); | ||
set @@global.debug = '+d,dep_wait_for_last_row_prepare'; | ||
set @@global.debug = '+d,slave_worker_queue_size'; | ||
set @@global.debug = '+d,after_clear_current_group_events'; | ||
include/start_slave.inc | ||
set debug_sync = "now wait_for clear.reached"; | ||
set debug_sync = "now wait_for prepare.reached"; | ||
set @@global.debug = '-d,dep_wait_for_last_row_prepare'; | ||
set @@global.debug = '-d,after_clear_current_group_events'; | ||
set @@global.debug = '-d,slave_worker_queue_size'; | ||
set debug_sync= 'now signal prepare.done'; | ||
set debug_sync= 'now signal clear.done'; | ||
drop table t1; | ||
include/sync_slave_sql_with_master.inc | ||
include/rpl_end.inc |
2 changes: 2 additions & 0 deletions
2
mysql-test/suite/rpl_mts/t/rpl_dep_exceed_worker_queue_size-master.opt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--gtid_mode=ON --enforce_gtid_consistency --log_slave_updates | ||
--binlog_rows_event_max_rows=1 |
2 changes: 2 additions & 0 deletions
2
mysql-test/suite/rpl_mts/t/rpl_dep_exceed_worker_queue_size-slave.opt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--gtid_mode=ON --enforce_gtid_consistency --log_slave_updates | ||
--slave_parallel_workers=8 |
44 changes: 44 additions & 0 deletions
44
mysql-test/suite/rpl_mts/t/rpl_dep_exceed_worker_queue_size.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
source include/master-slave.inc; | ||
source include/have_mts_dependency_replication.inc; | ||
source include/have_debug.inc; | ||
|
||
connection master; | ||
create table t1(a int) engine = innodb; | ||
source include/sync_slave_sql_with_master.inc; | ||
|
||
connection slave; | ||
# Stop the slave | ||
source include/stop_slave.inc; | ||
|
||
connection master; | ||
# Execute a multi-insert trx, this will generate 5 row events tied to the same | ||
# table map event (because binlog_rows_event_max_rows=1 in master.opt) | ||
insert into t1 values(1), (2), (3), (4), (5); | ||
|
||
connection slave; | ||
# This will wait just before preparing the last row event in coordinator thread | ||
set @@global.debug = '+d,dep_wait_for_last_row_prepare'; | ||
# This will initialize the max queue size to 5, which we're guaranteed to exceed | ||
set @@global.debug = '+d,slave_worker_queue_size'; | ||
# Wait for worker queue to be cleared | ||
set @@global.debug = '+d,after_clear_current_group_events'; | ||
|
||
source include/start_slave.inc; | ||
|
||
# Wait till the worker thread has cleared the queue | ||
set debug_sync = "now wait_for clear.reached"; | ||
# Wait till we're just about to prepare the last row event in the coordinator | ||
set debug_sync = "now wait_for prepare.reached"; | ||
|
||
# Now continue both threads | ||
set @@global.debug = '-d,dep_wait_for_last_row_prepare'; | ||
set @@global.debug = '-d,after_clear_current_group_events'; | ||
set @@global.debug = '-d,slave_worker_queue_size'; | ||
set debug_sync= 'now signal prepare.done'; | ||
set debug_sync= 'now signal clear.done'; | ||
|
||
connection master; | ||
drop table t1; | ||
source include/sync_slave_sql_with_master.inc; | ||
|
||
source include/rpl_end.inc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters