fix: etcd session discoverer cannot recover from ErrCompacted (#36568)

issue: #36554

Signed-off-by: chyezh <chyezh@outlook.com>
pull/36523/head
Zhen Ye 2024-09-28 10:51:14 +08:00 committed by GitHub
parent ffc12fb5c4
commit bd7910632a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 4 deletions

View File

@ -95,6 +95,7 @@ func (sw *sessionDiscoverer) watch(ctx context.Context, cb func(VersionedState)
// handleETCDEvent handles the etcd event.
func (sw *sessionDiscoverer) handleETCDEvent(resp clientv3.WatchResponse) error {
if resp.Err() != nil {
sw.logger.Warn("etcd watch failed with error", zap.Error(resp.Err()))
return resp.Err()
}
@ -123,10 +124,6 @@ func (sw *sessionDiscoverer) handleETCDEvent(resp clientv3.WatchResponse) error
// initDiscover initializes the discoverer if needed.
func (sw *sessionDiscoverer) initDiscover(ctx context.Context) error {
if sw.revision > 0 {
return nil
}
resp, err := sw.etcdCli.Get(ctx, sw.prefix, clientv3.WithPrefix(), clientv3.WithSerializable())
if err != nil {
return err