From c130d016b416f709280b62194badbde9357e1216 Mon Sep 17 00:00:00 2001 From: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com> Date: Sun, 28 May 2023 18:52:15 +0800 Subject: [PATCH] fix watch keyspace 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()