mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
lock on append metadata operation
This commit is contained in:
parent
61c42f9991
commit
f193942adc
|
@ -3,6 +3,7 @@ package weed_server
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/seaweedfs/seaweedfs/weed/cluster"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -240,8 +241,12 @@ func (fs *FilerServer) cleanupChunks(fullpath string, existingEntry *filer.Entry
|
||||||
func (fs *FilerServer) AppendToEntry(ctx context.Context, req *filer_pb.AppendToEntryRequest) (*filer_pb.AppendToEntryResponse, error) {
|
func (fs *FilerServer) AppendToEntry(ctx context.Context, req *filer_pb.AppendToEntryRequest) (*filer_pb.AppendToEntryResponse, error) {
|
||||||
|
|
||||||
glog.V(4).Infof("AppendToEntry %v", req)
|
glog.V(4).Infof("AppendToEntry %v", req)
|
||||||
|
|
||||||
fullpath := util.NewFullPath(req.Directory, req.EntryName)
|
fullpath := util.NewFullPath(req.Directory, req.EntryName)
|
||||||
|
|
||||||
|
lockClient := cluster.NewLockClient(fs.grpcDialOption)
|
||||||
|
lock := lockClient.NewLock(fs.option.Host, string(fullpath))
|
||||||
|
defer lock.Unlock()
|
||||||
|
|
||||||
var offset int64 = 0
|
var offset int64 = 0
|
||||||
entry, err := fs.filer.FindEntry(ctx, fullpath)
|
entry, err := fs.filer.FindEntry(ctx, fullpath)
|
||||||
if err == filer_pb.ErrNotFound {
|
if err == filer_pb.ErrNotFound {
|
||||||
|
|
Loading…
Reference in a new issue