diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-02-18 17:07:02 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-02-18 17:07:02 -0800 |
| commit | 776f49746930ef3eabf8361886161f18ca3e2c8c (patch) | |
| tree | cc3e84a9527ca3b947e9bb349c20f0aada9437d0 | |
| parent | e1992c83deeff50d5ddbd385dccac46e941fafcb (diff) | |
| download | seaweedfs-776f49746930ef3eabf8361886161f18ca3e2c8c.tar.xz seaweedfs-776f49746930ef3eabf8361886161f18ca3e2c8c.zip | |
filer: fs.configure should try to read from entry.content also
related to https://github.com/chrislusf/seaweedfs/issues/1792
| -rw-r--r-- | weed/filer/filer_conf.go | 16 | ||||
| -rw-r--r-- | weed/filer/filer_on_meta_event.go | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/weed/filer/filer_conf.go b/weed/filer/filer_conf.go index b4f0e5890..8e549f5ad 100644 --- a/weed/filer/filer_conf.go +++ b/weed/filer/filer_conf.go @@ -46,17 +46,19 @@ func (fc *FilerConf) loadFromFiler(filer *Filer) (err error) { return fc.LoadFromBytes(entry.Content) } - return fc.loadFromChunks(filer, entry.Chunks) + return fc.loadFromChunks(filer, entry.Content, entry.Chunks) } -func (fc *FilerConf) loadFromChunks(filer *Filer, chunks []*filer_pb.FileChunk) (err error) { - data, err := filer.readEntry(chunks) - if err != nil { - glog.Errorf("read filer conf content: %v", err) - return +func (fc *FilerConf) loadFromChunks(filer *Filer, content []byte, chunks []*filer_pb.FileChunk) (err error) { + if len(content) == 0 { + content, err = filer.readEntry(chunks) + if err != nil { + glog.Errorf("read filer conf content: %v", err) + return + } } - return fc.LoadFromBytes(data) + return fc.LoadFromBytes(content) } func (fc *FilerConf) LoadFromBytes(data []byte) (err error) { diff --git a/weed/filer/filer_on_meta_event.go b/weed/filer/filer_on_meta_event.go index d93a7e9e3..295a5039e 100644 --- a/weed/filer/filer_on_meta_event.go +++ b/weed/filer/filer_on_meta_event.go @@ -40,7 +40,7 @@ func (f *Filer) readEntry(chunks []*filer_pb.FileChunk) ([]byte, error) { func (f *Filer) reloadFilerConfiguration(entry *filer_pb.Entry) { fc := NewFilerConf() - err := fc.loadFromChunks(f, entry.Chunks) + err := fc.loadFromChunks(f, entry.Content, entry.Chunks) if err != nil { glog.Errorf("read filer conf chunks: %v", err) return |
