-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
do gc parallel #5832
do gc parallel #5832
Conversation
Any test? |
err error | ||
} | ||
|
||
func getNextGCTask(store tikv.Storage, bo *tikv.Backoffer, safePoint uint64, lastKey kv.Key) (*gcTask, error) { |
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.
s/getNextGCTask/genNextGCTask
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.
ok
|
||
log.Infof("[gc worker] %s start gc, safePoint: %v.", identifier, safePoint) | ||
startTime := time.Now() | ||
func doGCForOneRange(ctx goctx.Context, store tikv.Storage, task *gcTask, identifier string) *gcResult { |
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.
Seems you should use a range as the input args from the function name.
} | ||
} | ||
|
||
func doGCTask(ctx goctx.Context, store tikv.Storage, identifier string, resChan chan *gcResult, task *gcTask) { |
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 function should wait on a task queue and handle task one by one util receive nil.
}() | ||
|
||
var key []byte | ||
gcResultChan := make(chan *gcResult, gcDefaultGCConcurrency) |
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.
gcTaskQueue := make(chan gcTask, gcDefaultGCConcurrency)
gcTaskCh := make(chan gcTask, 1024)
for i = 0; i < gcDefaultGCConcurrency; i++ {
go runGcTaskWorker(gcTaskQueue, gcResultCh)
}
var key []byte
for {
task, err := genNextGCTask(...)
if err != nil {...}
if task == nil {
send N nil to gcTaskQueue, notify all workers to quit
break;
}
gcTaskQueue <- task
...receive task results if have
}
reveive task results util N nil
Duplicate with #5850 |
as title says