-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
use sync.Once to avoid to send drop cutover sentry table to mysql twice #755
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What we actually want to do is to protect two different pieces of code; one within the applier transaction, the other in this DropAtomicCutOverSentryTableIfExists()
function. And we don't want to serialize them, but instead only run them once. I suggest using a Once.
i am not sure how to use https://golang.org/pkg/sync/#Once to ensure the following three places which cause drop table? 1, CreateAtomicCutOverSentryTable Line 827 in 49262c5
2, drop cut over table Line 845 in 49262c5
3, defer clean sentry table Line 613 in 49262c5
even more, atomicCutOver will retry some times。although will sleep 1s between retry,two call to goroutine AtomicCutOverMagicLock is not serialize,because atomicCutOver don't wait AtomicCutOverMagicLock to be finished。 |
@MOON-CLJ the way I see it, there's these two places: Lines 862 to 865 in b38814f
Line 613 in b38814f
which are racing. You are absolutely right that the entire cut-over operation can retry. We can create a |
"These do not retry per cut-over." yeah, you're right。 sorry, my mistake。i am confused, because in pr #745 i mv defer clean sentry table Line 613 in 49262c5
the last one cut-over Line 823 in 1635183
and the next one cut-over Line 819 in 1635183
yes, let me try。 |
@shlomi-noach updated |
@shlomi-noach we have test this pr in hundreds of clusters in our production env for more than 3 months。consider go forward to merge? |
@shlomi-noach ping |
Sorry for the delay. It takes a context switch to dive into this PR again; I'd need to clear my desk for this. I assume this will be delayed for a bit longer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This look good to me.
Thank you @timvaillancourt 👑 |
Thank you @timvaillancourt |
This reverts commit 0e2d33a.
This reverts commit 0e2d33a.
ref: #745 (comment)
this pr is another way to deal with issue: #737
use mutex to skip the second drop table。
@shlomi-noach pls review, thx in advance。