diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2022-05-30 21:38:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-30 21:38:31 -0700 |
| commit | ca01ce05249c336ed380d9f77efbee68213b8a37 (patch) | |
| tree | 2241d21d85b966d4957bae06ea09cdc4ad6bb534 /weed/server/filer_server.go | |
| parent | 8902fa6ff653aa40249d2d6da49a9227b63415bb (diff) | |
| parent | 6adc42147f972d2adc223e119c0f97094b3f0bec (diff) | |
| download | seaweedfs-ca01ce05249c336ed380d9f77efbee68213b8a37.tar.xz seaweedfs-ca01ce05249c336ed380d9f77efbee68213b8a37.zip | |
Merge pull request #3122 from chrislusf/filer-sync-with-peers
Filer bootstrap from peers
Diffstat (limited to 'weed/server/filer_server.go')
| -rw-r--r-- | weed/server/filer_server.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/weed/server/filer_server.go b/weed/server/filer_server.go index 82b15084d..d2c1d67f5 100644 --- a/weed/server/filer_server.go +++ b/weed/server/filer_server.go @@ -151,7 +151,7 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) // TODO deprecated, will be be removed after 2020-12-31 // replaced by https://github.com/chrislusf/seaweedfs/wiki/Path-Specific-Configuration // fs.filer.FsyncBuckets = v.GetStringSlice("filer.options.buckets_fsync") - fs.filer.LoadConfiguration(v) + isFresh := fs.filer.LoadConfiguration(v) notification.LoadConfiguration(v, "notification.") @@ -164,7 +164,15 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) readonlyMux.HandleFunc("/", fs.readonlyFilerHandler) } - fs.filer.AggregateFromPeers(option.Host) + existingNodes := fs.filer.ListExistingPeerUpdates() + startFromTime := time.Now().Add(-filer.LogFlushInterval) + if isFresh { + glog.V(0).Infof("%s bootstrap from peers %+v", option.Host, existingNodes) + if err := fs.filer.MaybeBootstrapFromPeers(option.Host, existingNodes, startFromTime); err == nil { + glog.Fatalf("%s bootstrap from %+v", option.Host, existingNodes) + } + } + fs.filer.AggregateFromPeers(option.Host, existingNodes, startFromTime) fs.filer.LoadBuckets() |
