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
Support Green GC #13926
Support Green GC #13926
Conversation
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
/rebuild |
@@ -331,6 +331,18 @@ func (s *mockTikvGrpcServer) RawBatchScan(context.Context, *kvrpcpb.RawBatchScan | |||
func (s *mockTikvGrpcServer) UnsafeDestroyRange(context.Context, *kvrpcpb.UnsafeDestroyRangeRequest) (*kvrpcpb.UnsafeDestroyRangeResponse, error) { | |||
return nil, errors.New("unreachable") | |||
} | |||
func (s *mockTikvGrpcServer) RegisterLockObserver(context.Context, *kvrpcpb.RegisterLockObserverRequest) (*kvrpcpb.RegisterLockObserverResponse, 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.
Prefer to compound the service interface into mockTikvGrpcServer
struct directly avoid these boilerplate code.
e.g
type mockTikvGrpcServer struct {TiKVService}
and remove all unreachable
methods.
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.
I think it's not very proper to do it in this PR.
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
@MyonKeminta, please update your pull request. |
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
/run-unit-test |
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
store/tikv/gcworker/gc_worker.go
Outdated
|
||
err = w.removeLockObservers(ctx, safePoint, stores) | ||
if err != nil { | ||
return errors.Trace(err) |
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.
If remove observer fails, we can still omit the traditional way?
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.
Sounds good
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.
It already is because removeLockObserver never returns error... I've removed the return value
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
for _, lock := range locks { | ||
if loc.Contains(lock.Key) { | ||
locksInRegion = append(locksInRegion, lock) | ||
} |
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.
should we break if it doesn't contain key?
func (s *mergeLockScanner) GetSucceededStores() map[uint64]interface{} { | ||
stores := make(map[uint64]interface{}) | ||
for _, receiver := range s.receivers { | ||
if receiver.Err == nil { |
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.
If receiver has error, I think we should treat it just as an 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.
Did you mean returning an error? Here our solution is, for unsuccessful stores, GetSucceededStores doesn't return it and it will be scanned in next retry. The error is just logged.
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
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.
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. But I think it needs more comments.
/merge |
/run-all-tests |
What problem does this PR solve?
This PR implements Green GC, which changed the procedure of resolvelocks phase of GC, and allows TiKV to scan locks without getting each region's snapshot.
By default this feature is not enabled, and the configuration is hidden. Before enabling it, there should be more stability tests. There's also a known issue that it will cause too much memory.
What is changed and how it works?
The main changes are on TiKV side. TiDB just invokes the new APIs. Please refer to tikv/tikv#6138 for details.
Check List
Tests
Code changes
Side effects
Related changes
tidb-ansible
repositoryRelease note