use sync.Once to avoid to send drop cutover sentry table to mysql twice#755
use sync.Once to avoid to send drop cutover sentry table to mysql twice#755MOON-CLJ wants to merge 8 commits intogithub:masterfrom
Conversation
shlomi-noach
left a comment
There was a problem hiding this comment.
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。 |
|
"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. |
shlomi-noach
left a comment
There was a problem hiding this comment.
This look good to me.
|
Thank you @timvaillancourt 👑 |
|
Thank you @timvaillancourt |
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。