Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #1039 #1030: add shared-mode lock in query ReadMigrationRangeValues to avoid losing data #1040

Closed
wants to merge 0 commits into from

Conversation

wangzihuacool
Copy link
Contributor

related #1039 #1030 ..
This PR is to avoid losing data when gh-ost in MySQL with semi-sync replication enabled.

Reason
In mysql with a semi-sync slave, transactions may be in uncommitted state with 'Waiting for semi-sync ACK from slave' wait, though its related binlog event has already been handled and discarded by gh-ost BinlogStreamer. If gh-ost ReadMigrationRangeValues executes before the transactions finnally committed, the uncommitted rows is lost.

Fix
Add a shared mode lock in the query of ReadMigrationRangeValues. If min/max value of the uniquekey was changed by another transaction that has not yet committed, query just waits until that transaction ends and then uses the latest values.
Thus ReadMigrationRangeValues returns the accurate value.

Thank you !

@dikang123
Copy link

so quick,nubility!

@shaohk
Copy link
Contributor

shaohk commented Nov 15, 2021

#1054
No need to use lock.
And add a heartbeat between the addDMLEventsListener and ReadMigrationRangeValues to fix this bug.

@Fanduzi
Copy link
Contributor

Fanduzi commented Jan 6, 2022

Any progress?

@timvaillancourt
Copy link
Collaborator

@Fanduzi the core issue was probably resolved in another PR. Please test and let me know

I'll leave this open in case this locking is still needed. For now I've avoided it because the impact of the lock is hard to quantify

@Fanduzi
Copy link
Contributor

Fanduzi commented Jul 7, 2022

@Fanduzi the core issue was probably resolved in another PR. Please test and let me know

I'll leave this open in case this locking is still needed. For now I've avoided it because the impact of the lock is hard to quantify

In my opinion, this lock is no longer needed. #1141 solves the problem perfectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants