diff options
| author | hilimd <68371223+hilimd@users.noreply.github.com> | 2020-09-25 09:45:56 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-25 09:45:56 +0800 |
| commit | 76e24a5660a2192603b7d6d84aef1924ab95cb94 (patch) | |
| tree | 72e1b320c3487aa5f6cb3cd5fc849bfd94108ec8 /weed/server | |
| parent | 48c578410fea2128f81356250b2cd9d56074d878 (diff) | |
| parent | 043b0631369bec00b33eb53cdf2cdef3eced006c (diff) | |
| download | seaweedfs-76e24a5660a2192603b7d6d84aef1924ab95cb94.tar.xz seaweedfs-76e24a5660a2192603b7d6d84aef1924ab95cb94.zip | |
Merge pull request #20 from chrislusf/master
sync
Diffstat (limited to 'weed/server')
| -rw-r--r-- | weed/server/filer_grpc_server.go | 39 | ||||
| -rw-r--r-- | weed/server/filer_server.go | 2 | ||||
| -rw-r--r-- | weed/server/volume_server.go | 2 |
3 files changed, 24 insertions, 19 deletions
diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.go index 41dcedba5..ecd23413f 100644 --- a/weed/server/filer_grpc_server.go +++ b/weed/server/filer_grpc_server.go @@ -37,6 +37,8 @@ func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer_pb.L Attributes: filer.EntryAttributeToPb(entry), Chunks: entry.Chunks, Extended: entry.Extended, + HardLinkId: entry.HardLinkId, + HardLinkCounter: entry.HardLinkCounter, }, }, nil } @@ -80,6 +82,8 @@ func (fs *FilerServer) ListEntries(req *filer_pb.ListEntriesRequest, stream file Chunks: entry.Chunks, Attributes: filer.EntryAttributeToPb(entry), Extended: entry.Extended, + HardLinkId: entry.HardLinkId, + HardLinkCounter: entry.HardLinkCounter, }, }); err != nil { return err @@ -154,17 +158,13 @@ func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntr return &filer_pb.CreateEntryResponse{}, fmt.Errorf("CreateEntry cleanupChunks %s %s: %v", req.Directory, req.Entry.Name, err2) } - if req.Entry.Attributes == nil { - glog.V(3).Infof("CreateEntry %s: nil attributes", filepath.Join(req.Directory, req.Entry.Name)) - resp.Error = fmt.Sprintf("can not create entry with empty attributes") - return - } - createErr := fs.filer.CreateEntry(ctx, &filer.Entry{ FullPath: util.JoinPath(req.Directory, req.Entry.Name), Attr: filer.PbToEntryAttribute(req.Entry.Attributes), Chunks: chunks, Extended: req.Entry.Extended, + HardLinkId: filer.HardLinkId(req.Entry.HardLinkId), + HardLinkCounter: req.Entry.HardLinkCounter, }, req.OExcl, req.IsFromOtherCluster, req.Signatures) if createErr == nil { @@ -197,6 +197,8 @@ func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntr Attr: entry.Attr, Extended: req.Entry.Extended, Chunks: chunks, + HardLinkId: filer.HardLinkId(req.Entry.HardLinkId), + HardLinkCounter: req.Entry.HardLinkCounter, } glog.V(3).Infof("updating %s: %+v, chunks %d: %v => %+v, chunks %d: %v, extended: %v => %v", @@ -225,12 +227,13 @@ func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntr if err = fs.filer.UpdateEntry(ctx, entry, newEntry); err == nil { fs.filer.DeleteChunks(garbage) + + fs.filer.NotifyUpdateEvent(ctx, entry, newEntry, true, req.IsFromOtherCluster, req.Signatures) + } else { glog.V(3).Infof("UpdateEntry %s: %v", filepath.Join(req.Directory, req.Entry.Name), err) } - fs.filer.NotifyUpdateEvent(ctx, entry, newEntry, true, req.IsFromOtherCluster, req.Signatures) - return &filer_pb.UpdateEntryResponse{}, err } @@ -250,15 +253,17 @@ func (fs *FilerServer) cleanupChunks(existingEntry *filer.Entry, newEntry *filer chunks, coveredChunks := filer.CompactFileChunks(fs.lookupFileId, nonManifestChunks) garbage = append(garbage, coveredChunks...) - chunks, err = filer.MaybeManifestize(fs.saveAsChunk( - newEntry.Attributes.Replication, - newEntry.Attributes.Collection, - "", - needle.SecondsToTTL(newEntry.Attributes.TtlSec), - false), chunks) - if err != nil { - // not good, but should be ok - glog.V(0).Infof("MaybeManifestize: %v", err) + if newEntry.Attributes != nil { + chunks, err = filer.MaybeManifestize(fs.saveAsChunk( + newEntry.Attributes.Replication, + newEntry.Attributes.Collection, + "", + needle.SecondsToTTL(newEntry.Attributes.TtlSec), + false), chunks) + if err != nil { + // not good, but should be ok + glog.V(0).Infof("MaybeManifestize: %v", err) + } } chunks = append(chunks, manifestChunks...) diff --git a/weed/server/filer_server.go b/weed/server/filer_server.go index 4d6d424dc..ec0a4fb3e 100644 --- a/weed/server/filer_server.go +++ b/weed/server/filer_server.go @@ -157,7 +157,7 @@ func (fs *FilerServer) maybeStartMetrics() { } } - go stats.LoopPushingMetric("filer", stats.SourceName(fs.option.Port), stats.FilerGather, fs.metricsAddress, fs.metricsIntervalSec) + go stats.LoopPushingMetric("filer", stats.SourceName(fs.option.Port), fs.metricsAddress, fs.metricsIntervalSec) } func readFilerConfiguration(grpcDialOption grpc.DialOption, masterAddress string) (metricsAddress string, metricsIntervalSec int, err error) { diff --git a/weed/server/volume_server.go b/weed/server/volume_server.go index 5e9ec1369..83df32fdd 100644 --- a/weed/server/volume_server.go +++ b/weed/server/volume_server.go @@ -97,7 +97,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string, } go vs.heartbeat() - go stats.LoopPushingMetric("volumeServer", fmt.Sprintf("%s:%d", ip, port), stats.VolumeServerGather, vs.metricsAddress, vs.metricsIntervalSec) + go stats.LoopPushingMetric("volumeServer", fmt.Sprintf("%s:%d", ip, port), vs.metricsAddress, vs.metricsIntervalSec) return vs } |
