-
Notifications
You must be signed in to change notification settings - Fork 66
restore: update and restore GCLifeTime once when parallel #220
Conversation
Seems that it's another solution of #218. Should I borrow the code and integration test and revert context-related code? @kennytm @amyangfei |
🤔 Oh I thought you've found another test case which isn't fixed by #218. An advantage of the |
I'll learn |
@leoppro found a bug in my atomic integer code.
We think there should be a mutex, so I'll add three variable: a mutex for set GC time, a atomic integer as job counter(or a mutex for reset GC time), original GC time. I still prefer using global variable, since lightning can only deal with one TiDB, and three variables are about "lock for TiDB setting, TiDB running jobs, TiDB setting" accrodingly, global variable won't pollute a lot. Another way is using context like #218, assign three-variable-struct to context in I'd like to learn your suggestions. |
@lance6716 use a struct, related variables should be placed close to each other. |
Merge branch 'master' into fix-gc-life-time Discussion see #220
/run-all-tests |
PTAL @kennytm @amyangfei |
PTAL @leoppro |
Co-Authored-By: amyangfei <amyangfei@gmail.com>
Co-Authored-By: amyangfei <amyangfei@gmail.com>
Co-Authored-By: amyangfei <amyangfei@gmail.com>
/run-all-tests |
/run-all-tests |
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.
Rest LGTM
/run-all-tests |
Co-Authored-By: kennytm <kennytm@gmail.com>
/run-all-tests |
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.
Rest LGTM
/run-all-tests @leoppro PTAL |
Ping @leoppro |
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.
LGTM
* restore: update and restore GCLifeTime once when parallel * Update lightning/restore/restore.go Co-Authored-By: amyangfei <amyangfei@gmail.com> * Update lightning/restore/restore.go Co-Authored-By: amyangfei <amyangfei@gmail.com> * Update lightning/restore/restore.go Co-Authored-By: amyangfei <amyangfei@gmail.com> * restore: fix bug in reviewing * restore: call ObtainGCLifeTime closer to use * restore: improve readabiilty * restore: reduce struct copy and pointer deref * restore: fix bug in reviewing * Update lightning/restore/restore.go Co-Authored-By: kennytm <kennytm@gmail.com> * restore: improve readability * restore: refine mock expectation order * restore: adjust detail
* restore: update and restore GCLifeTime once when parallel * Update lightning/restore/restore.go Co-Authored-By: amyangfei <amyangfei@gmail.com> * Update lightning/restore/restore.go Co-Authored-By: amyangfei <amyangfei@gmail.com> * Update lightning/restore/restore.go Co-Authored-By: amyangfei <amyangfei@gmail.com> * restore: fix bug in reviewing * restore: call ObtainGCLifeTime closer to use * restore: improve readabiilty * restore: reduce struct copy and pointer deref * restore: fix bug in reviewing * Update lightning/restore/restore.go Co-Authored-By: kennytm <kennytm@gmail.com> * restore: improve readability * restore: refine mock expectation order * restore: adjust detail
…)" This reverts commit 9f36067.
* restore: update and restore GCLifeTime once when parallel * Update lightning/restore/restore.go Co-Authored-By: amyangfei <amyangfei@gmail.com> * Update lightning/restore/restore.go Co-Authored-By: amyangfei <amyangfei@gmail.com> * Update lightning/restore/restore.go Co-Authored-By: amyangfei <amyangfei@gmail.com> * restore: fix bug in reviewing * restore: call ObtainGCLifeTime closer to use * restore: improve readabiilty * restore: reduce struct copy and pointer deref * restore: fix bug in reviewing * Update lightning/restore/restore.go Co-Authored-By: kennytm <kennytm@gmail.com> * restore: improve readability * restore: refine mock expectation order * restore: adjust detail
* restore: update and restore GCLifeTime once when parallel (#220)
What problem does this PR solve?
DoChecksum doesn't prepare for parallel case
What is changed and how it works?
There may be multiple
DoChecksum
running, setting and resettingGC Life Time
should not be done when there's unfinishedDoChecksum
tasks.Lightning have
restoreTables
runs simultaneously, so we use this logicUsing variable to count running checksum jobs. Before a remote chechsum call starting, lock, increase this counter, check if it just rised from zero then backup original value and call set
GC Life Time
logic, unlock.After a remote chechsum finishing, lock, decrease this counter, check if it just drop to zero then call resetting
GC Life Time
logic, unlock.The lock, counter, original value are pointed to same per location in one
restoreTables
.Check List
Tests
Side effects
Related changes