From 558037e684584f64944b07d9e27a5d9067c80b7f Mon Sep 17 00:00:00 2001 From: David <8039876+AmoebaProtozoa@users.noreply.github.com> Date: Mon, 29 May 2023 11:52:41 +0800 Subject: [PATCH] fix watch keyspace (#6528) close tikv/pd#6527 Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com> --- server/keyspace_service.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/keyspace_service.go b/server/keyspace_service.go index 4069987510d..8336b988ece 100644 --- a/server/keyspace_service.go +++ b/server/keyspace_service.go @@ -74,7 +74,7 @@ func (s *KeyspaceServer) WatchKeyspaces(request *keyspacepb.WatchKeyspacesReques } ctx, cancel := context.WithCancel(s.Context()) defer cancel() - startKey := path.Join(s.rootPath, endpoint.KeyspaceMetaPrefix()) + startKey := path.Join(s.rootPath, endpoint.KeyspaceMetaPrefix()) + "/" keyspaces := make([]*keyspacepb.KeyspaceMeta, 0) putFn := func(kv *mvccpb.KeyValue) error { @@ -106,7 +106,7 @@ func (s *KeyspaceServer) WatchKeyspaces(request *keyspacepb.WatchKeyspacesReques putFn, deleteFn, postEventFn, - clientv3.WithPrefix(), + clientv3.WithRange(clientv3.GetPrefixRangeEnd(startKey)), ) s.serverLoopWg.Add(1) go watcher.StartWatchLoop()