Skip to content

Only start SQL thread temporarily to WaitForPosition if needed#10103

Closed
mattlord wants to merge 2 commits intomainfrom
wait_for_source_fixes
Closed

Only start SQL thread temporarily to WaitForPosition if needed#10103
mattlord wants to merge 2 commits intomainfrom
wait_for_source_fixes

Conversation

@mattlord
Copy link
Copy Markdown
Member

@mattlord mattlord commented Apr 15, 2022

Description

It #9512 we blindly attempted to start the replication SQL_Thread(s) when waiting for a given replication position. The problem with this, however, is that if the SQL_Thread is running but the IO_Thread is not then the tablet repair does not try and start replication on a replica tablet. So in certain states such as when initializing a shard, replication may end up in a non-healthy state and never be repaired.

This changes the behavior so that:

  1. We only attempt to start the SQL_Thread if it's not already healthy
  2. We use START SLAVE SQL_THREAD UNTIL SQL_AFTER_GTIDS instead of START SLAVE SQL_THREAD so that the SQL_Thread will be stopped once we reach the desired position. This will allow the tablet repair to repair the replica when needed.

Related Issue(s)

Checklist

  • "Backport me!" label has been added if this change should be backported
  • Tests are not required
  • Documentation is not required

It will then be stopped again after we've reached the desired position.

This was the table repair will function normally and start replication
again if it's a replica table and the IO and SQL threads are stopped.

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord mattlord requested review from a team and removed request for a team April 15, 2022 23:09
@mattlord mattlord changed the title Only start SQL thread to WaitForPosition if it's not already started Only start SQL thread to WaitForPosition if it's not already started and have it stop after catching up Apr 15, 2022
@mattlord mattlord changed the title Only start SQL thread to WaitForPosition if it's not already started and have it stop after catching up Only start SQL thread temporarily to WaitForPosition if needed Apr 15, 2022
@mattlord
Copy link
Copy Markdown
Member Author

Moved here: #10104

@mattlord mattlord closed this Apr 15, 2022
@mattlord mattlord deleted the wait_for_source_fixes branch April 29, 2022 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants