From e17e6ed542e4c33464777ad0e9bd5ad4f5becdf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E6=98=8C=E6=9E=97?= Date: Wed, 29 Jun 2022 23:31:04 +0800 Subject: [PATCH 1/2] Avoid synchronizing from scratch due to err --- weed/filer/meta_aggregator.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/weed/filer/meta_aggregator.go b/weed/filer/meta_aggregator.go index fb96ee01b..d81645a85 100644 --- a/weed/filer/meta_aggregator.go +++ b/weed/filer/meta_aggregator.go @@ -100,7 +100,8 @@ func (ma *MetaAggregator) loopSubscribeToOnefiler(f *Filer, self pb.ServerAddres } if err != nil { glog.V(0).Infof("subscribing remote %s meta change: %v", peer, err) - } else if lastTsNs < nextLastTsNs { + } + if lastTsNs < nextLastTsNs { lastTsNs = nextLastTsNs } time.Sleep(1733 * time.Millisecond) From 2b5b37231b460936c6c67de7f27f33ecddd6c5ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E6=98=8C=E6=9E=97?= Date: Wed, 29 Jun 2022 23:55:59 +0800 Subject: [PATCH 2/2] Make sure that onChangeEvent is called successfully before updating lastTsNs --- weed/filer/meta_aggregator.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/weed/filer/meta_aggregator.go b/weed/filer/meta_aggregator.go index d81645a85..1a805bde3 100644 --- a/weed/filer/meta_aggregator.go +++ b/weed/filer/meta_aggregator.go @@ -211,10 +211,9 @@ func (ma *MetaAggregator) doSubscribeToOneFiler(f *Filer, self pb.ServerAddress, if err := processEventFn(resp); err != nil { return fmt.Errorf("process %v: %v", resp, err) } - lastTsNs = resp.TsNs f.onMetadataChangeEvent(resp) - + lastTsNs = resp.TsNs } }) return lastTsNs, err