SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
use streaming mode for long poll grpc calls
chrislu9f9ef1340c64
diff --git a/unmaintained/diff_volume_servers/diff_volume_servers.go b/unmaintained/diff_volume_servers/diff_volume_servers.goindex e8361a6cf0..0188d18d42 100644--- a/unmaintained/diff_volume_servers/diff_volume_servers.go+++ b/unmaintained/diff_volume_servers/diff_volume_servers.go@@ -122,7 +122,7 @@ type needleState struct {func getVolumeFiles(v uint32, addr pb.ServerAddress) (map[types.NeedleId]needleState, int64, error) {var idxFile *bytes.Reader- err := operation.WithVolumeServerClient(addr, grpcDialOption, func(vs volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(false, addr, grpcDialOption, func(vs volume_server_pb.VolumeServerClient) error {ctx, cancel := context.WithCancel(context.Background())defer cancel()copyFileClient, err := vs.CopyFile(ctx, &volume_server_pb.CopyFileRequest{@@ -180,7 +180,7 @@ func getVolumeFiles(v uint32, addr pb.ServerAddress) (map[types.NeedleId]needleSfunc getNeedleFileId(v uint32, nid types.NeedleId, addr pb.ServerAddress) (string, error) {var id string- err := operation.WithVolumeServerClient(addr, grpcDialOption, func(vs volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(false, addr, grpcDialOption, func(vs volume_server_pb.VolumeServerClient) error {resp, err := vs.VolumeNeedleStatus(context.Background(), &volume_server_pb.VolumeNeedleStatusRequest{VolumeId: v,NeedleId: uint64(nid),diff --git a/unmaintained/load_test/load_test_meta_tail/load_test_meta_tail.go b/unmaintained/load_test/load_test_meta_tail/load_test_meta_tail.goindex 8ccad1e497..faaea9e8d0 100644--- a/unmaintained/load_test/load_test_meta_tail/load_test_meta_tail.go+++ b/unmaintained/load_test/load_test_meta_tail/load_test_meta_tail.go@@ -51,7 +51,7 @@ func main() {}func startGenerateMetadata() {- pb.WithFilerClient(pb.ServerAddress(*tailFiler), grpc.WithInsecure(), func(client filer_pb.SeaweedFilerClient) error {+ pb.WithFilerClient(false, pb.ServerAddress(*tailFiler), grpc.WithInsecure(), func(client filer_pb.SeaweedFilerClient) error {for i := 0; i < *n; i++ {name := fmt.Sprintf("file%d", i)diff --git a/unmaintained/stream_read_volume/stream_read_volume.go b/unmaintained/stream_read_volume/stream_read_volume.goindex e120b99208..bbe5abedb7 100644--- a/unmaintained/stream_read_volume/stream_read_volume.go+++ b/unmaintained/stream_read_volume/stream_read_volume.go@@ -15,9 +15,9 @@ import ()var (- volumeServer = flag.String("volumeServer", "localhost:8080", "a volume server")- volumeId = flag.Int("volumeId", -1, "a volume id to stream read")- grpcDialOption grpc.DialOption+ volumeServer = flag.String("volumeServer", "localhost:8080", "a volume server")+ volumeId = flag.Int("volumeId", -1, "a volume id to stream read")+ grpcDialOption grpc.DialOption)func main() {@@ -33,11 +33,11 @@ func main() {return nil}- err := operation.WithVolumeServerClient(pb.ServerAddress(*volumeServer), grpcDialOption, func(vs volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(true, pb.ServerAddress(*volumeServer), grpcDialOption, func(vs volume_server_pb.VolumeServerClient) error {ctx, cancel := context.WithCancel(context.Background())defer cancel()copyFileClient, err := vs.ReadAllNeedles(ctx, &volume_server_pb.ReadAllNeedlesRequest{- VolumeIds: []uint32{vid},+ VolumeIds: []uint32{vid},})if err != nil {return err@@ -61,4 +61,3 @@ func main() {}}-diff --git a/weed/command/filer_cat.go b/weed/command/filer_cat.goindex 71c3a48d60..7f613f72ba 100644--- a/weed/command/filer_cat.go+++ b/weed/command/filer_cat.go@@ -97,7 +97,7 @@ func runFilerCat(cmd *Command, args []string) bool {writer = f}- pb.WithFilerClient(filerCat.filerAddress, filerCat.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ pb.WithFilerClient(false, filerCat.filerAddress, filerCat.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.LookupDirectoryEntryRequest{Name: name,diff --git a/weed/command/filer_copy.go b/weed/command/filer_copy.goindex 8a87018288..88ae55e844 100644--- a/weed/command/filer_copy.go+++ b/weed/command/filer_copy.go@@ -172,7 +172,7 @@ func runCopy(cmd *Command, args []string) bool {}func readFilerConfiguration(grpcDialOption grpc.DialOption, filerGrpcAddress pb.ServerAddress) (masters []string, collection, replication string, dirBuckets string, maxMB uint32, cipher bool, err error) {- err = pb.WithGrpcFilerClient(filerGrpcAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ err = pb.WithGrpcFilerClient(false, filerGrpcAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})if err != nil {return fmt.Errorf("get filer %s configuration: %v", filerGrpcAddress, err)@@ -302,7 +302,7 @@ func (worker *FileCopyWorker) checkExistingFileFirst(task FileCopyTask, f *os.Fireturn}- err = pb.WithGrpcFilerClient(worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ err = pb.WithGrpcFilerClient(false, worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.LookupDirectoryEntryRequest{Directory: task.destinationUrlPath,@@ -344,7 +344,7 @@ func (worker *FileCopyWorker) uploadFileAsOne(task FileCopyTask, f *os.File) errerr = util.Retry("upload", func() error {// assign a volume- assignErr := pb.WithGrpcFilerClient(worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ assignErr := pb.WithGrpcFilerClient(false, worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.AssignVolumeRequest{Count: 1,@@ -404,7 +404,7 @@ func (worker *FileCopyWorker) uploadFileAsOne(task FileCopyTask, f *os.File) err}- if err := pb.WithGrpcFilerClient(worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ if err := pb.WithGrpcFilerClient(false, worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.CreateEntryRequest{Directory: task.destinationUrlPath,Entry: &filer_pb.Entry{@@ -461,7 +461,7 @@ func (worker *FileCopyWorker) uploadFileInChunks(task FileCopyTask, f *os.File,var assignResult *filer_pb.AssignVolumeResponsevar assignError errorerr := util.Retry("assignVolume", func() error {- return pb.WithGrpcFilerClient(worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ return pb.WithGrpcFilerClient(false, worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.AssignVolumeRequest{Count: 1,Replication: *worker.options.replication,@@ -540,7 +540,7 @@ func (worker *FileCopyWorker) uploadFileInChunks(task FileCopyTask, f *os.File,return fmt.Errorf("create manifest: %v", manifestErr)}- if err := pb.WithGrpcFilerClient(worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ if err := pb.WithGrpcFilerClient(false, worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.CreateEntryRequest{Directory: task.destinationUrlPath,Entry: &filer_pb.Entry{@@ -598,7 +598,7 @@ func (worker *FileCopyWorker) saveDataAsChunk(reader io.Reader, name string, offvar fileId, host stringvar auth security.EncodedJwt- if flushErr := pb.WithGrpcFilerClient(worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ if flushErr := pb.WithGrpcFilerClient(false, worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {ctx := context.Background()diff --git a/weed/command/filer_meta_backup.go b/weed/command/filer_meta_backup.goindex 0b8fa76c63..d52ed3349d 100644--- a/weed/command/filer_meta_backup.go+++ b/weed/command/filer_meta_backup.go@@ -222,9 +222,9 @@ func (metaBackup *FilerMetaBackupOptions) setOffset(lastWriteTime time.Time) errvar _ = filer_pb.FilerClient(&FilerMetaBackupOptions{})-func (metaBackup *FilerMetaBackupOptions) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {+func (metaBackup *FilerMetaBackupOptions) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) error {- return pb.WithFilerClient(pb.ServerAddress(*metaBackup.filerAddress), metaBackup.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ return pb.WithFilerClient(streamingMode, pb.ServerAddress(*metaBackup.filerAddress), metaBackup.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {return fn(client)})diff --git a/weed/command/filer_remote_gateway.go b/weed/command/filer_remote_gateway.goindex 9426f38412..fa02395589 100644--- a/weed/command/filer_remote_gateway.go+++ b/weed/command/filer_remote_gateway.go@@ -32,8 +32,8 @@ type RemoteGatewayOptions struct {var _ = filer_pb.FilerClient(&RemoteGatewayOptions{})-func (option *RemoteGatewayOptions) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {- return pb.WithFilerClient(pb.ServerAddress(*option.filerAddress), option.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+func (option *RemoteGatewayOptions) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) error {+ return pb.WithFilerClient(streamingMode, pb.ServerAddress(*option.filerAddress), option.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {return fn(client)})}@@ -87,7 +87,7 @@ func runFilerRemoteGateway(cmd *Command, args []string) bool {remoteGatewayOptions.bucketsDir = "/buckets"// check buckets again- remoteGatewayOptions.WithFilerClient(func(filerClient filer_pb.SeaweedFilerClient) error {+ remoteGatewayOptions.WithFilerClient(false, func(filerClient filer_pb.SeaweedFilerClient) error {resp, err := filerClient.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})if err != nil {return errdiff --git a/weed/command/filer_remote_sync.go b/weed/command/filer_remote_sync.goindex bceeb097e5..681ea35e97 100644--- a/weed/command/filer_remote_sync.go+++ b/weed/command/filer_remote_sync.go@@ -22,8 +22,8 @@ type RemoteSyncOptions struct {var _ = filer_pb.FilerClient(&RemoteSyncOptions{})-func (option *RemoteSyncOptions) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {- return pb.WithFilerClient(pb.ServerAddress(*option.filerAddress), option.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+func (option *RemoteSyncOptions) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) error {+ return pb.WithFilerClient(streamingMode, pb.ServerAddress(*option.filerAddress), option.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {return fn(client)})}diff --git a/weed/command/filer_remote_sync_dir.go b/weed/command/filer_remote_sync_dir.goindex 30782942eb..947f526bb5 100644--- a/weed/command/filer_remote_sync_dir.go+++ b/weed/command/filer_remote_sync_dir.go@@ -227,7 +227,7 @@ func shouldSendToRemote(entry *filer_pb.Entry) bool {func updateLocalEntry(filerClient filer_pb.FilerClient, dir string, entry *filer_pb.Entry, remoteEntry *filer_pb.RemoteEntry) error {remoteEntry.LastLocalSyncTsNs = time.Now().UnixNano()entry.RemoteEntry = remoteEntry- return filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return filerClient.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {_, err := client.UpdateEntry(context.Background(), &filer_pb.UpdateEntryRequest{Directory: dir,Entry: entry,diff --git a/weed/command/filer_sync.go b/weed/command/filer_sync.goindex 20755dbe57..230b24a521 100644--- a/weed/command/filer_sync.go+++ b/weed/command/filer_sync.go@@ -183,7 +183,7 @@ const (func getOffset(grpcDialOption grpc.DialOption, filer pb.ServerAddress, signaturePrefix string, signature int32) (lastOffsetTsNs int64, readErr error) {- readErr = pb.WithFilerClient(filer, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ readErr = pb.WithFilerClient(false, filer, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {syncKey := []byte(signaturePrefix + "____")util.Uint32toBytes(syncKey[len(signaturePrefix):len(signaturePrefix)+4], uint32(signature))@@ -209,7 +209,7 @@ func getOffset(grpcDialOption grpc.DialOption, filer pb.ServerAddress, signature}func setOffset(grpcDialOption grpc.DialOption, filer pb.ServerAddress, signaturePrefix string, signature int32, offsetTsNs int64) error {- return pb.WithFilerClient(filer, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ return pb.WithFilerClient(false, filer, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {syncKey := []byte(signaturePrefix + "____")util.Uint32toBytes(syncKey[len(signaturePrefix):len(signaturePrefix)+4], uint32(signature))diff --git a/weed/command/iam.go b/weed/command/iam.goindex ebe9657f24..8fb14be06c 100644--- a/weed/command/iam.go+++ b/weed/command/iam.go@@ -48,7 +48,7 @@ func (iamopt *IamOptions) startIamServer() bool {util.LoadConfiguration("security", false)grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")for {- err := pb.WithGrpcFilerClient(filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ err := pb.WithGrpcFilerClient(false, filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})if err != nil {return fmt.Errorf("get filer %s configuration: %v", filerAddress, err)diff --git a/weed/command/master_follower.go b/weed/command/master_follower.goindex 95f1c80b82..6d7aa2848d 100644--- a/weed/command/master_follower.go+++ b/weed/command/master_follower.go@@ -87,7 +87,7 @@ func startMasterFollower(masterOptions MasterOptions) {var err errorgrpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.master")for i := 0; i < 10; i++ {- err = pb.WithOneOfGrpcMasterClients(masters, grpcDialOption, func(client master_pb.SeaweedClient) error {+ err = pb.WithOneOfGrpcMasterClients(false, masters, grpcDialOption, func(client master_pb.SeaweedClient) error {resp, err := client.GetMasterConfiguration(context.Background(), &master_pb.GetMasterConfigurationRequest{})if err != nil {return fmt.Errorf("get master grpc address %v configuration: %v", masters, err)diff --git a/weed/command/mount_std.go b/weed/command/mount_std.goindex 2603260a27..ce9a998f67 100644--- a/weed/command/mount_std.go+++ b/weed/command/mount_std.go@@ -78,7 +78,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {var cipher boolvar err errorfor i := 0; i < 10; i++ {- err = pb.WithOneOfGrpcFilerClients(filerAddresses, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ err = pb.WithOneOfGrpcFilerClients(false, filerAddresses, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})if err != nil {return fmt.Errorf("get filer grpc address %v configuration: %v", filerAddresses, err)diff --git a/weed/command/msg_broker.go b/weed/command/msg_broker.goindex 61517ab399..35d59ea20a 100644--- a/weed/command/msg_broker.go+++ b/weed/command/msg_broker.go@@ -68,7 +68,7 @@ func (msgBrokerOpt *MessageBrokerOptions) startQueueServer() bool {cipher := falsefor {- err := pb.WithGrpcFilerClient(filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ err := pb.WithGrpcFilerClient(false, filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})if err != nil {return fmt.Errorf("get filer %s configuration: %v", filerAddress, err)diff --git a/weed/command/s3.go b/weed/command/s3.goindex d7cd7818db..ee726fcecb 100644--- a/weed/command/s3.go+++ b/weed/command/s3.go@@ -153,7 +153,7 @@ func (s3opt *S3Options) startS3Server() bool {var metricsIntervalSec intfor {- err := pb.WithGrpcFilerClient(filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ err := pb.WithGrpcFilerClient(false, filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})if err != nil {return fmt.Errorf("get filer %s configuration: %v", filerAddress, err)diff --git a/weed/command/upload.go b/weed/command/upload.goindex f46e70cb13..f2b0b7fe48 100644--- a/weed/command/upload.go+++ b/weed/command/upload.go@@ -130,7 +130,7 @@ func runUpload(cmd *Command, args []string) bool {}func readMasterConfiguration(grpcDialOption grpc.DialOption, masterAddress pb.ServerAddress) (replication string, err error) {- err = pb.WithMasterClient(masterAddress, grpcDialOption, func(client master_pb.SeaweedClient) error {+ err = pb.WithMasterClient(false, masterAddress, grpcDialOption, func(client master_pb.SeaweedClient) error {resp, err := client.GetMasterConfiguration(context.Background(), &master_pb.GetMasterConfigurationRequest{})if err != nil {return fmt.Errorf("get master %s configuration: %v", masterAddress, err)diff --git a/weed/command/webdav.go b/weed/command/webdav.goindex bf4609d634..319302175f 100644--- a/weed/command/webdav.go+++ b/weed/command/webdav.go@@ -85,7 +85,7 @@ func (wo *WebDavOption) startWebDav() bool {var cipher bool// connect to filerfor {- err := pb.WithGrpcFilerClient(filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ err := pb.WithGrpcFilerClient(false, filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})if err != nil {return fmt.Errorf("get filer %s configuration: %v", filerAddress, err)diff --git a/weed/filer/filer.go b/weed/filer/filer.goindex 9eabbc3376..7ca198b389 100644--- a/weed/filer/filer.go+++ b/weed/filer/filer.go@@ -79,9 +79,9 @@ func (f *Filer) AggregateFromPeers(self pb.ServerAddress) {}-func (f *Filer) ListExistingPeerUpdates() (existingNodes []*master_pb.ClusterNodeUpdate){+func (f *Filer) ListExistingPeerUpdates() (existingNodes []*master_pb.ClusterNodeUpdate) {- if grpcErr := pb.WithMasterClient(f.MasterClient.GetMaster(), f.GrpcDialOption, func(client master_pb.SeaweedClient) error {+ if grpcErr := pb.WithMasterClient(false, f.MasterClient.GetMaster(), f.GrpcDialOption, func(client master_pb.SeaweedClient) error {resp, err := client.ListClusterNodes(context.Background(), &master_pb.ListClusterNodesRequest{ClientType: cluster.FilerType,})diff --git a/weed/filer/filer_conf.go b/weed/filer/filer_conf.goindex 1229f0139d..45c368b9b5 100644--- a/weed/filer/filer_conf.go+++ b/weed/filer/filer_conf.go@@ -32,7 +32,7 @@ type FilerConf struct {func ReadFilerConf(filerGrpcAddress pb.ServerAddress, grpcDialOption grpc.DialOption, masterClient *wdclient.MasterClient) (*FilerConf, error) {var buf bytes.Buffer- if err := pb.WithGrpcFilerClient(filerGrpcAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ if err := pb.WithGrpcFilerClient(false, filerGrpcAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {if masterClient != nil {return ReadEntry(masterClient, client, DirectoryEtcSeaweedFS, FilerConfName, &buf)} else {diff --git a/weed/filer/filer_delete_entry.go b/weed/filer/filer_delete_entry.goindex cc33811aaa..bda69b15f7 100644--- a/weed/filer/filer_delete_entry.go+++ b/weed/filer/filer_delete_entry.go@@ -139,7 +139,7 @@ func (f *Filer) doDeleteEntryMetaAndData(ctx context.Context, entry *Entry, shoufunc (f *Filer) doDeleteCollection(collectionName string) (err error) {- return f.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {+ return f.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {_, err := client.CollectionDelete(context.Background(), &master_pb.CollectionDeleteRequest{Name: collectionName,})diff --git a/weed/filer/meta_aggregator.go b/weed/filer/meta_aggregator.goindex bb2c947e5d..2826681460 100644--- a/weed/filer/meta_aggregator.go+++ b/weed/filer/meta_aggregator.go@@ -72,7 +72,7 @@ func (ma *MetaAggregator) setActive(address pb.ServerAddress, isActive bool) {delete(ma.peerStatues, address)}}-func (ma *MetaAggregator) isActive(address pb.ServerAddress)(isActive bool) {+func (ma *MetaAggregator) isActive(address pb.ServerAddress) (isActive bool) {ma.peerStatuesLock.Lock()defer ma.peerStatuesLock.Unlock()_, isActive = ma.peerStatues[address]@@ -152,7 +152,7 @@ func (ma *MetaAggregator) subscribeToOneFiler(f *Filer, self pb.ServerAddress, pfor {glog.V(4).Infof("subscribing remote %s meta change: %v", peer, time.Unix(0, lastTsNs))- err := pb.WithFilerClient(peer, ma.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ err := pb.WithFilerClient(false, peer, ma.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {ctx, cancel := context.WithCancel(context.Background())defer cancel()stream, err := client.SubscribeLocalMetadata(ctx, &filer_pb.SubscribeMetadataRequest{@@ -194,7 +194,7 @@ func (ma *MetaAggregator) subscribeToOneFiler(f *Filer, self pb.ServerAddress, p}func (ma *MetaAggregator) readFilerStoreSignature(peer pb.ServerAddress) (sig int32, err error) {- err = pb.WithFilerClient(peer, ma.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ err = pb.WithFilerClient(false, peer, ma.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})if err != nil {return errdiff --git a/weed/filer/read_remote.go b/weed/filer/read_remote.goindex a3fb48ae0d..6372dac72b 100644--- a/weed/filer/read_remote.go+++ b/weed/filer/read_remote.go@@ -26,7 +26,7 @@ func MapRemoteStorageLocationPathToFullPath(localMountedDir util.FullPath, remot}func CacheRemoteObjectToLocalCluster(filerClient filer_pb.FilerClient, remoteConf *remote_pb.RemoteConf, remoteLocation *remote_pb.RemoteStorageLocation, parent util.FullPath, entry *filer_pb.Entry) error {- return filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return filerClient.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {_, err := client.CacheRemoteObjectToLocalCluster(context.Background(), &filer_pb.CacheRemoteObjectToLocalClusterRequest{Directory: string(parent),Name: entry.Name,diff --git a/weed/filer/reader_at.go b/weed/filer/reader_at.goindex 68594cb03a..b73526761f 100644--- a/weed/filer/reader_at.go+++ b/weed/filer/reader_at.go@@ -44,7 +44,7 @@ func LookupFn(filerClient filer_pb.FilerClient) wdclient.LookupFileIdFunctionTypif !found {util.Retry("lookup volume "+vid, func() error {- err = filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = filerClient.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {resp, err := client.LookupVolume(context.Background(), &filer_pb.LookupVolumeRequest{VolumeIds: []string{vid},})diff --git a/weed/filer/remote_mapping.go b/weed/filer/remote_mapping.goindex c95c4e5bdc..b0534e2cab 100644--- a/weed/filer/remote_mapping.go+++ b/weed/filer/remote_mapping.go@@ -11,7 +11,7 @@ import (func ReadMountMappings(grpcDialOption grpc.DialOption, filerAddress pb.ServerAddress) (mappings *remote_pb.RemoteStorageMapping, readErr error) {var oldContent []byte- if readErr = pb.WithFilerClient(filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ if readErr = pb.WithFilerClient(false, filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {oldContent, readErr = ReadInsideFiler(client, DirectoryEtcRemote, REMOTE_STORAGE_MOUNT_FILE)return readErr}); readErr != nil {@@ -30,7 +30,7 @@ func InsertMountMapping(filerClient filer_pb.FilerClient, dir string, remoteStor// read current mappingvar oldContent, newContent []byte- err = filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = filerClient.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {oldContent, err = ReadInsideFiler(client, DirectoryEtcRemote, REMOTE_STORAGE_MOUNT_FILE)return err})@@ -47,7 +47,7 @@ func InsertMountMapping(filerClient filer_pb.FilerClient, dir string, remoteStor}// save back- err = filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = filerClient.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {return SaveInsideFiler(client, DirectoryEtcRemote, REMOTE_STORAGE_MOUNT_FILE, newContent)})if err != nil {@@ -61,7 +61,7 @@ func DeleteMountMapping(filerClient filer_pb.FilerClient, dir string) (err error// read current mappingvar oldContent, newContent []byte- err = filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = filerClient.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {oldContent, err = ReadInsideFiler(client, DirectoryEtcRemote, REMOTE_STORAGE_MOUNT_FILE)return err})@@ -78,7 +78,7 @@ func DeleteMountMapping(filerClient filer_pb.FilerClient, dir string) (err error}// save back- err = filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = filerClient.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {return SaveInsideFiler(client, DirectoryEtcRemote, REMOTE_STORAGE_MOUNT_FILE, newContent)})if err != nil {diff --git a/weed/filer/remote_storage.go b/weed/filer/remote_storage.goindex 9d682b6988..5362ba7385 100644--- a/weed/filer/remote_storage.go+++ b/weed/filer/remote_storage.go@@ -133,7 +133,7 @@ func UnmarshalRemoteStorageMappings(oldContent []byte) (mappings *remote_pb.Remofunc ReadRemoteStorageConf(grpcDialOption grpc.DialOption, filerAddress pb.ServerAddress, storageName string) (conf *remote_pb.RemoteConf, readErr error) {var oldContent []byte- if readErr = pb.WithFilerClient(filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ if readErr = pb.WithFilerClient(false, filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {oldContent, readErr = ReadInsideFiler(client, DirectoryEtcRemote, storageName+REMOTE_STORAGE_CONF_SUFFIX)return readErr}); readErr != nil {diff --git a/weed/filesys/dir.go b/weed/filesys/dir.goindex cedcf2d76e..9d935e53c1 100644--- a/weed/filesys/dir.go+++ b/weed/filesys/dir.go@@ -201,7 +201,7 @@ func (dir *Dir) doCreateEntry(name string, mode os.FileMode, uid, gid uint32, ex}glog.V(1).Infof("create %s/%s", dirFullPath, name)- err := dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err := dir.wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {dir.wfs.mapPbIdFromLocalToFiler(request.Entry)defer dir.wfs.mapPbIdFromFilerToLocal(request.Entry)@@ -242,7 +242,7 @@ func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, errdirFullPath := dir.FullPath()- err := dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err := dir.wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {dir.wfs.mapPbIdFromLocalToFiler(newEntry)defer dir.wfs.mapPbIdFromFilerToLocal(newEntry)@@ -566,7 +566,7 @@ func (dir *Dir) saveEntry(entry *filer_pb.Entry) error {parentDir, name := util.FullPath(dir.FullPath()).DirAndName()- return dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return dir.wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {dir.wfs.mapPbIdFromLocalToFiler(entry)defer dir.wfs.mapPbIdFromFilerToLocal(entry)diff --git a/weed/filesys/dir_link.go b/weed/filesys/dir_link.goindex acdcd2de40..68f5a79e2e 100644--- a/weed/filesys/dir_link.go+++ b/weed/filesys/dir_link.go@@ -68,7 +68,7 @@ func (dir *Dir) Link(ctx context.Context, req *fuse.LinkRequest, old fs.Node) (f}// apply changes to the filer, and also apply to local metaCache- err = dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = dir.wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {dir.wfs.mapPbIdFromLocalToFiler(request.Entry)defer dir.wfs.mapPbIdFromFilerToLocal(request.Entry)@@ -121,7 +121,7 @@ func (dir *Dir) Symlink(ctx context.Context, req *fuse.SymlinkRequest) (fs.Node,Signatures: []int32{dir.wfs.signature},}- err := dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err := dir.wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {dir.wfs.mapPbIdFromLocalToFiler(request.Entry)defer dir.wfs.mapPbIdFromFilerToLocal(request.Entry)diff --git a/weed/filesys/dir_rename.go b/weed/filesys/dir_rename.goindex 1ee6922d81..d8ea3e4599 100644--- a/weed/filesys/dir_rename.go+++ b/weed/filesys/dir_rename.go@@ -22,7 +22,7 @@ func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirectorglog.V(4).Infof("dir Rename %s => %s", oldPath, newPath)// update remote filer- err := dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err := dir.wfs.WithFilerClient(true, func(client filer_pb.SeaweedFilerClient) error {ctx, cancel := context.WithCancel(context.Background())defer cancel()diff --git a/weed/filesys/file.go b/weed/filesys/file.goindex 767841f9dc..bbc5c8e21e 100644--- a/weed/filesys/file.go+++ b/weed/filesys/file.go@@ -331,7 +331,7 @@ func (file *File) addChunks(chunks []*filer_pb.FileChunk) {}func (file *File) saveEntry(entry *filer_pb.Entry) error {- return file.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return file.wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {file.wfs.mapPbIdFromLocalToFiler(entry)defer file.wfs.mapPbIdFromFilerToLocal(entry)@@ -362,7 +362,7 @@ func (file *File) getEntry() *filer_pb.Entry {}func (file *File) downloadRemoteEntry(entry *filer_pb.Entry) (*filer_pb.Entry, error) {- err := file.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err := file.wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.CacheRemoteObjectToLocalClusterRequest{Directory: file.dir.FullPath(),diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.goindex 2aa4de6da6..607b901ff9 100644--- a/weed/filesys/filehandle.go+++ b/weed/filesys/filehandle.go@@ -277,7 +277,7 @@ func (fh *FileHandle) doFlush(ctx context.Context, header fuse.Header) error {return nil}- err := fh.f.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err := fh.f.wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {entry := fh.f.getEntry()if entry == nil {diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.goindex aa4f9dacdc..127c160c46 100644--- a/weed/filesys/wfs.go+++ b/weed/filesys/wfs.go@@ -197,7 +197,7 @@ func (wfs *WFS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.if wfs.stats.lastChecked < time.Now().Unix()-20 {- err := wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err := wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.StatisticsRequest{Collection: wfs.option.Collection,diff --git a/weed/filesys/wfs_filer_client.go b/weed/filesys/wfs_filer_client.goindex cce6aa1a1e..4feef867ed 100644--- a/weed/filesys/wfs_filer_client.go+++ b/weed/filesys/wfs_filer_client.go@@ -11,7 +11,7 @@ import (var _ = filer_pb.FilerClient(&WFS{})-func (wfs *WFS) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) (err error) {+func (wfs *WFS) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) (err error) {return util.Retry("filer grpc", func() error {@@ -20,7 +20,7 @@ func (wfs *WFS) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) (errfor x := 0; x < n; x++ {filerGrpcAddress := wfs.option.FilerAddresses[i].ToGrpcAddress()- err = pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {+ err = pb.WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {client := filer_pb.NewSeaweedFilerClient(grpcConnection)return fn(client)}, filerGrpcAddress, wfs.option.GrpcDialOption)diff --git a/weed/filesys/wfs_write.go b/weed/filesys/wfs_write.goindex 61a463e88c..17489547cf 100644--- a/weed/filesys/wfs_write.go+++ b/weed/filesys/wfs_write.go@@ -19,7 +19,7 @@ func (wfs *WFS) saveDataAsChunk(fullPath util.FullPath) filer.SaveDataAsChunkFunvar fileId, host stringvar auth security.EncodedJwt- if err := wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ if err := wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {return util.Retry("assignVolume", func() error {request := &filer_pb.AssignVolumeRequest{Count: 1,diff --git a/weed/iamapi/iamapi_server.go b/weed/iamapi/iamapi_server.goindex ad1a8c4a28..fc0e6b7008 100644--- a/weed/iamapi/iamapi_server.go+++ b/weed/iamapi/iamapi_server.go@@ -76,7 +76,7 @@ func (iama *IamApiServer) registerRouter(router *mux.Router) {func (iam IamS3ApiConfigure) GetS3ApiConfiguration(s3cfg *iam_pb.S3ApiConfiguration) (err error) {var buf bytes.Buffer- err = pb.WithGrpcFilerClient(iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ err = pb.WithGrpcFilerClient(false, iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error {if err = filer.ReadEntry(iam.masterClient, client, filer.IamConfigDirecotry, filer.IamIdentityFile, &buf); err != nil {return err}@@ -98,24 +98,20 @@ func (iam IamS3ApiConfigure) PutS3ApiConfiguration(s3cfg *iam_pb.S3ApiConfiguratif err := filer.ProtoToText(&buf, s3cfg); err != nil {return fmt.Errorf("ProtoToText: %s", err)}- return pb.WithGrpcFilerClient(- iam.option.Filer,- iam.option.GrpcDialOption,- func(client filer_pb.SeaweedFilerClient) error {- err = util.Retry("saveIamIdentity", func() error {- return filer.SaveInsideFiler(client, filer.IamConfigDirecotry, filer.IamIdentityFile, buf.Bytes())- })- if err != nil {- return err- }- return nil- },- )+ return pb.WithGrpcFilerClient(false, iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ err = util.Retry("saveIamIdentity", func() error {+ return filer.SaveInsideFiler(client, filer.IamConfigDirecotry, filer.IamIdentityFile, buf.Bytes())+ })+ if err != nil {+ return err+ }+ return nil+ })}func (iam IamS3ApiConfigure) GetPolicies(policies *Policies) (err error) {var buf bytes.Buffer- err = pb.WithGrpcFilerClient(iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ err = pb.WithGrpcFilerClient(false, iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error {if err = filer.ReadEntry(iam.masterClient, client, filer.IamConfigDirecotry, filer.IamPoliciesFile, &buf); err != nil {return err}@@ -139,14 +135,10 @@ func (iam IamS3ApiConfigure) PutPolicies(policies *Policies) (err error) {if b, err = json.Marshal(policies); err != nil {return err}- return pb.WithGrpcFilerClient(- iam.option.Filer,- iam.option.GrpcDialOption,- func(client filer_pb.SeaweedFilerClient) error {- if err := filer.SaveInsideFiler(client, filer.IamConfigDirecotry, filer.IamPoliciesFile, b); err != nil {- return err- }- return nil- },- )+ return pb.WithGrpcFilerClient(false, iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ if err := filer.SaveInsideFiler(client, filer.IamConfigDirecotry, filer.IamPoliciesFile, b); err != nil {+ return err+ }+ return nil+ })}diff --git a/weed/messaging/broker/broker_append.go b/weed/messaging/broker/broker_append.goindex 9958a07524..9a31a8ac04 100644--- a/weed/messaging/broker/broker_append.go+++ b/weed/messaging/broker/broker_append.go@@ -24,7 +24,7 @@ func (broker *MessageBroker) appendToFile(targetFile string, topicConfig *messagdir, name := util.FullPath(targetFile).DirAndName()// append the chunk- if err := broker.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ if err := broker.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.AppendToEntryRequest{Directory: dir,@@ -51,7 +51,7 @@ func (broker *MessageBroker) assignAndUpload(topicConfig *messaging_pb.TopicConfvar assignResult = &operation.AssignResult{}// assign a volume location- if err := broker.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ if err := broker.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {assignErr := util.Retry("assignVolume", func() error {request := &filer_pb.AssignVolumeRequest{@@ -108,10 +108,10 @@ func (broker *MessageBroker) assignAndUpload(topicConfig *messaging_pb.TopicConfvar _ = filer_pb.FilerClient(&MessageBroker{})-func (broker *MessageBroker) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) (err error) {+func (broker *MessageBroker) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) (err error) {for _, filer := range broker.option.Filers {- if err = pb.WithFilerClient(filer, broker.grpcDialOption, fn); err != nil {+ if err = pb.WithFilerClient(streamingMode, filer, broker.grpcDialOption, fn); err != nil {if err == io.EOF {return}diff --git a/weed/messaging/broker/broker_grpc_server_discovery.go b/weed/messaging/broker/broker_grpc_server_discovery.goindex 66821d4049..5cd8edd33f 100644--- a/weed/messaging/broker/broker_grpc_server_discovery.go+++ b/weed/messaging/broker/broker_grpc_server_discovery.go@@ -34,7 +34,7 @@ func (broker *MessageBroker) FindBroker(c context.Context, request *messaging_pbtargetTopicPartition := fmt.Sprintf(TopicPartitionFmt, request.Namespace, request.Topic, request.Parition)for _, filer := range broker.option.Filers {- err := broker.withFilerClient(filer, func(client filer_pb.SeaweedFilerClient) error {+ err := broker.withFilerClient(false, filer, func(client filer_pb.SeaweedFilerClient) error {resp, err := client.LocateBroker(context.Background(), &filer_pb.LocateBrokerRequest{Resource: targetTopicPartition,})@@ -68,7 +68,7 @@ func (broker *MessageBroker) checkFilers() {found := falsefor !found {for _, filer := range broker.option.Filers {- err := broker.withFilerClient(filer, func(client filer_pb.SeaweedFilerClient) error {+ err := broker.withFilerClient(false, filer, func(client filer_pb.SeaweedFilerClient) error {resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})if err != nil {return err@@ -93,7 +93,7 @@ func (broker *MessageBroker) checkFilers() {found = falsefor !found {for _, master := range masters {- err := broker.withMasterClient(master, func(client master_pb.SeaweedClient) error {+ err := broker.withMasterClient(false, master, func(client master_pb.SeaweedClient) error {resp, err := client.ListClusterNodes(context.Background(), &master_pb.ListClusterNodesRequest{ClientType: cluster.FilerType,})diff --git a/weed/messaging/broker/broker_server.go b/weed/messaging/broker/broker_server.goindex 193c1c689d..acf2d6d340 100644--- a/weed/messaging/broker/broker_server.go+++ b/weed/messaging/broker/broker_server.go@@ -49,7 +49,7 @@ func (broker *MessageBroker) keepConnectedToOneFiler() {for {for _, filer := range broker.option.Filers {- broker.withFilerClient(filer, func(client filer_pb.SeaweedFilerClient) error {+ broker.withFilerClient(false, filer, func(client filer_pb.SeaweedFilerClient) error {ctx, cancel := context.WithCancel(context.Background())defer cancel()stream, err := client.KeepConnected(ctx)@@ -101,15 +101,15 @@ func (broker *MessageBroker) keepConnectedToOneFiler() {}-func (broker *MessageBroker) withFilerClient(filer pb.ServerAddress, fn func(filer_pb.SeaweedFilerClient) error) error {+func (broker *MessageBroker) withFilerClient(streamingMode bool, filer pb.ServerAddress, fn func(filer_pb.SeaweedFilerClient) error) error {- return pb.WithFilerClient(filer, broker.grpcDialOption, fn)+ return pb.WithFilerClient(streamingMode, filer, broker.grpcDialOption, fn)}-func (broker *MessageBroker) withMasterClient(master pb.ServerAddress, fn func(client master_pb.SeaweedClient) error) error {+func (broker *MessageBroker) withMasterClient(streamingMode bool, master pb.ServerAddress, fn func(client master_pb.SeaweedClient) error) error {- return pb.WithMasterClient(master, broker.grpcDialOption, func(client master_pb.SeaweedClient) error {+ return pb.WithMasterClient(streamingMode, master, broker.grpcDialOption, func(client master_pb.SeaweedClient) error {return fn(client)})diff --git a/weed/operation/assign_file_id.go b/weed/operation/assign_file_id.goindex f0f7581f37..b716300e2f 100644--- a/weed/operation/assign_file_id.go+++ b/weed/operation/assign_file_id.go@@ -48,7 +48,7 @@ func Assign(masterFn GetMasterFn, grpcDialOption grpc.DialOption, primaryRequestcontinue}- lastError = WithMasterServerClient(masterFn(), grpcDialOption, func(masterClient master_pb.SeaweedClient) error {+ lastError = WithMasterServerClient(false, masterFn(), grpcDialOption, func(masterClient master_pb.SeaweedClient) error {req := &master_pb.AssignRequest{Count: request.Count,@@ -105,7 +105,7 @@ func Assign(masterFn GetMasterFn, grpcDialOption grpc.DialOption, primaryRequestfunc LookupJwt(master pb.ServerAddress, grpcDialOption grpc.DialOption, fileId string) (token security.EncodedJwt) {- WithMasterServerClient(master, grpcDialOption, func(masterClient master_pb.SeaweedClient) error {+ WithMasterServerClient(false, master, grpcDialOption, func(masterClient master_pb.SeaweedClient) error {resp, grpcErr := masterClient.LookupVolume(context.Background(), &master_pb.LookupVolumeRequest{VolumeOrFileIds: []string{fileId},diff --git a/weed/operation/delete_content.go b/weed/operation/delete_content.goindex d762f51e1f..996c0b29e1 100644--- a/weed/operation/delete_content.go+++ b/weed/operation/delete_content.go@@ -123,7 +123,7 @@ func DeleteFilesWithLookupVolumeId(grpcDialOption grpc.DialOption, fileIds []str// DeleteFilesAtOneVolumeServer deletes a list of files that is on one volume server via gRpcfunc DeleteFilesAtOneVolumeServer(volumeServer pb.ServerAddress, grpcDialOption grpc.DialOption, fileIds []string, includeCookie bool) (ret []*volume_server_pb.DeleteResult, err error) {- err = WithVolumeServerClient(volumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err = WithVolumeServerClient(false, volumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {req := &volume_server_pb.BatchDeleteRequest{FileIds: fileIds,diff --git a/weed/operation/grpc_client.go b/weed/operation/grpc_client.goindex 7436822031..9b68d22862 100644--- a/weed/operation/grpc_client.go+++ b/weed/operation/grpc_client.go@@ -8,18 +8,18 @@ import ("github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb")-func WithVolumeServerClient(volumeServer pb.ServerAddress, grpcDialOption grpc.DialOption, fn func(volume_server_pb.VolumeServerClient) error) error {+func WithVolumeServerClient(streamingMode bool, volumeServer pb.ServerAddress, grpcDialOption grpc.DialOption, fn func(volume_server_pb.VolumeServerClient) error) error {- return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {+ return pb.WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {client := volume_server_pb.NewVolumeServerClient(grpcConnection)return fn(client)}, volumeServer.ToGrpcAddress(), grpcDialOption)}-func WithMasterServerClient(masterServer pb.ServerAddress, grpcDialOption grpc.DialOption, fn func(masterClient master_pb.SeaweedClient) error) error {+func WithMasterServerClient(streamingMode bool, masterServer pb.ServerAddress, grpcDialOption grpc.DialOption, fn func(masterClient master_pb.SeaweedClient) error) error {- return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {+ return pb.WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {client := master_pb.NewSeaweedClient(grpcConnection)return fn(client)}, masterServer.ToGrpcAddress(), grpcDialOption)diff --git a/weed/operation/lookup.go b/weed/operation/lookup.goindex c222dff92d..1eb5dd320e 100644--- a/weed/operation/lookup.go+++ b/weed/operation/lookup.go@@ -79,7 +79,7 @@ func LookupVolumeIds(masterFn GetMasterFn, grpcDialOption grpc.DialOption, vids//only query unknown_vids- err := WithMasterServerClient(masterFn(), grpcDialOption, func(masterClient master_pb.SeaweedClient) error {+ err := WithMasterServerClient(false, masterFn(), grpcDialOption, func(masterClient master_pb.SeaweedClient) error {req := &master_pb.LookupVolumeRequest{VolumeOrFileIds: unknown_vids,diff --git a/weed/operation/sync_volume.go b/weed/operation/sync_volume.goindex fdd22ac85c..de71a198d5 100644--- a/weed/operation/sync_volume.go+++ b/weed/operation/sync_volume.go@@ -9,7 +9,7 @@ import (func GetVolumeSyncStatus(server pb.ServerAddress, grpcDialOption grpc.DialOption, vid uint32) (resp *volume_server_pb.VolumeSyncStatusResponse, err error) {- WithVolumeServerClient(server, grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {+ WithVolumeServerClient(false, server, grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {resp, err = client.VolumeSyncStatus(context.Background(), &volume_server_pb.VolumeSyncStatusRequest{VolumeId: vid,diff --git a/weed/operation/tail_volume.go b/weed/operation/tail_volume.goindex bedeeb3b50..d3449873b7 100644--- a/weed/operation/tail_volume.go+++ b/weed/operation/tail_volume.go@@ -28,7 +28,7 @@ func TailVolume(masterFn GetMasterFn, grpcDialOption grpc.DialOption, vid needle}func TailVolumeFromSource(volumeServer pb.ServerAddress, grpcDialOption grpc.DialOption, vid needle.VolumeId, sinceNs uint64, idleTimeoutSeconds int, fn func(n *needle.Needle) error) error {- return WithVolumeServerClient(volumeServer, grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {+ return WithVolumeServerClient(true, volumeServer, grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {ctx, cancel := context.WithCancel(context.Background())defer cancel()diff --git a/weed/pb/filer_pb/filer_client.go b/weed/pb/filer_pb/filer_client.goindex 719039d884..266bdae51a 100644--- a/weed/pb/filer_pb/filer_client.go+++ b/weed/pb/filer_pb/filer_client.go@@ -20,7 +20,7 @@ var ()type FilerClient interface {- WithFilerClient(fn func(SeaweedFilerClient) error) error+ WithFilerClient(streamingMode bool, fn func(SeaweedFilerClient) error) errorAdjustedUrl(location *Location) string}@@ -28,7 +28,7 @@ func GetEntry(filerClient FilerClient, fullFilePath util.FullPath) (entry *Entrydir, name := fullFilePath.DirAndName()- err = filerClient.WithFilerClient(func(client SeaweedFilerClient) error {+ err = filerClient.WithFilerClient(false, func(client SeaweedFilerClient) error {request := &LookupDirectoryEntryRequest{Directory: dir,@@ -83,13 +83,13 @@ func ReadDirAllEntries(filerClient FilerClient, fullDirPath util.FullPath, prefi}func List(filerClient FilerClient, parentDirectoryPath, prefix string, fn EachEntryFunciton, startFrom string, inclusive bool, limit uint32) (err error) {- return filerClient.WithFilerClient(func(client SeaweedFilerClient) error {+ return filerClient.WithFilerClient(false, func(client SeaweedFilerClient) error {return doSeaweedList(client, util.FullPath(parentDirectoryPath), prefix, fn, startFrom, inclusive, limit)})}func doList(filerClient FilerClient, fullDirPath util.FullPath, prefix string, fn EachEntryFunciton, startFrom string, inclusive bool, limit uint32) (err error) {- return filerClient.WithFilerClient(func(client SeaweedFilerClient) error {+ return filerClient.WithFilerClient(false, func(client SeaweedFilerClient) error {return doSeaweedList(client, fullDirPath, prefix, fn, startFrom, inclusive, limit)})}@@ -157,7 +157,7 @@ func doSeaweedList(client SeaweedFilerClient, fullDirPath util.FullPath, prefixfunc Exists(filerClient FilerClient, parentDirectoryPath string, entryName string, isDirectory bool) (exists bool, err error) {- err = filerClient.WithFilerClient(func(client SeaweedFilerClient) error {+ err = filerClient.WithFilerClient(false, func(client SeaweedFilerClient) error {request := &LookupDirectoryEntryRequest{Directory: parentDirectoryPath,@@ -185,7 +185,7 @@ func Exists(filerClient FilerClient, parentDirectoryPath string, entryName strinfunc Touch(filerClient FilerClient, parentDirectoryPath string, entryName string, entry *Entry) (err error) {- return filerClient.WithFilerClient(func(client SeaweedFilerClient) error {+ return filerClient.WithFilerClient(false, func(client SeaweedFilerClient) error {request := &UpdateEntryRequest{Directory: parentDirectoryPath,@@ -204,7 +204,7 @@ func Touch(filerClient FilerClient, parentDirectoryPath string, entryName string}func Mkdir(filerClient FilerClient, parentDirectoryPath string, dirName string, fn func(entry *Entry)) error {- return filerClient.WithFilerClient(func(client SeaweedFilerClient) error {+ return filerClient.WithFilerClient(false, func(client SeaweedFilerClient) error {return DoMkdir(client, parentDirectoryPath, dirName, fn)})}@@ -241,7 +241,7 @@ func DoMkdir(client SeaweedFilerClient, parentDirectoryPath string, dirName stri}func MkFile(filerClient FilerClient, parentDirectoryPath string, fileName string, chunks []*FileChunk, fn func(entry *Entry)) error {- return filerClient.WithFilerClient(func(client SeaweedFilerClient) error {+ return filerClient.WithFilerClient(false, func(client SeaweedFilerClient) error {entry := &Entry{Name: fileName,@@ -276,7 +276,7 @@ func MkFile(filerClient FilerClient, parentDirectoryPath string, fileName string}func Remove(filerClient FilerClient, parentDirectoryPath, name string, isDeleteData, isRecursive, ignoreRecursiveErr, isFromOtherCluster bool, signatures []int32) error {- return filerClient.WithFilerClient(func(client SeaweedFilerClient) error {+ return filerClient.WithFilerClient(false, func(client SeaweedFilerClient) error {return DoRemove(client, parentDirectoryPath, name, isDeleteData, isRecursive, ignoreRecursiveErr, isFromOtherCluster, signatures)})}diff --git a/weed/pb/filer_pb_tail.go b/weed/pb/filer_pb_tail.goindex 9909e035b6..1db9883a4c 100644--- a/weed/pb/filer_pb_tail.go+++ b/weed/pb/filer_pb_tail.go@@ -16,7 +16,7 @@ func FollowMetadata(filerAddress ServerAddress, grpcDialOption grpc.DialOption,pathPrefix string, additionalPathPrefixes []string, lastTsNs int64, selfSignature int32,processEventFn ProcessMetadataFunc, fatalOnError bool) error {- err := WithFilerClient(filerAddress, grpcDialOption, makeFunc(clientName,+ err := WithFilerClient(true, filerAddress, grpcDialOption, makeFunc(clientName,pathPrefix, additionalPathPrefixes, &lastTsNs, selfSignature, processEventFn, fatalOnError))if err != nil {return fmt.Errorf("subscribing filer meta change: %v", err)@@ -28,7 +28,7 @@ func WithFilerClientFollowMetadata(filerClient filer_pb.FilerClient,clientName string, pathPrefix string, lastTsNs *int64, selfSignature int32,processEventFn ProcessMetadataFunc, fatalOnError bool) error {- err := filerClient.WithFilerClient(makeFunc(clientName,+ err := filerClient.WithFilerClient(true, makeFunc(clientName,pathPrefix, nil, lastTsNs, selfSignature, processEventFn, fatalOnError))if err != nil {return fmt.Errorf("subscribing filer meta change: %v", err)diff --git a/weed/pb/grpc_client_server.go b/weed/pb/grpc_client_server.goindex 08fb7fac73..532c669327 100644--- a/weed/pb/grpc_client_server.go+++ b/weed/pb/grpc_client_server.go@@ -97,7 +97,8 @@ func getOrCreateConnection(address string, opts ...grpc.DialOption) (*versionedGreturn existingConnection, nil}- grpcConnection, err := GrpcDial(context.Background(), address, opts...)+ ctx := context.Background()+ grpcConnection, err := GrpcDial(ctx, address, opts...)if err != nil {return nil, fmt.Errorf("fail to dial %s: %v", address, err)}@@ -112,28 +113,42 @@ func getOrCreateConnection(address string, opts ...grpc.DialOption) (*versionedGreturn vgc, nil}-func WithCachedGrpcClient(fn func(*grpc.ClientConn) error, address string, opts ...grpc.DialOption) error {+// WithGrpcClient In streamingMode, always use a fresh connection. Otherwise, try to reuse an existing connection.+func WithGrpcClient(streamingMode bool, fn func(*grpc.ClientConn) error, address string, opts ...grpc.DialOption) error {- vgc, err := getOrCreateConnection(address, opts...)- if err != nil {- return fmt.Errorf("getOrCreateConnection %s: %v", address, err)- }- executionErr := fn(vgc.ClientConn)- if executionErr != nil {- if strings.Contains(executionErr.Error(), "transport") ||- strings.Contains(executionErr.Error(), "connection closed") {- grpcClientsLock.Lock()- if t, ok := grpcClients[address]; ok {- if t.version == vgc.version {- vgc.Close()- delete(grpcClients, address)+ if !streamingMode {+ vgc, err := getOrCreateConnection(address, opts...)+ if err != nil {+ return fmt.Errorf("getOrCreateConnection %s: %v", address, err)+ }+ executionErr := fn(vgc.ClientConn)+ if executionErr != nil {+ if strings.Contains(executionErr.Error(), "transport") ||+ strings.Contains(executionErr.Error(), "connection closed") {+ grpcClientsLock.Lock()+ if t, ok := grpcClients[address]; ok {+ if t.version == vgc.version {+ vgc.Close()+ delete(grpcClients, address)+ }}+ grpcClientsLock.Unlock()}- grpcClientsLock.Unlock()}+ return executionErr+ } else {+ grpcConnection, err := GrpcDial(context.Background(), address, opts...)+ if err != nil {+ return fmt.Errorf("fail to dial %s: %v", address, err)+ }+ defer grpcConnection.Close()+ executionErr := fn(grpcConnection)+ if executionErr != nil {+ return executionErr+ }+ return nil}- return executionErr}func ParseServerAddress(server string, deltaPort int) (newServerAddress string, err error) {@@ -184,18 +199,18 @@ func GrpcAddressToServerAddress(grpcAddress string) (serverAddress string) {return util.JoinHostPort(host, port)}-func WithMasterClient(master ServerAddress, grpcDialOption grpc.DialOption, fn func(client master_pb.SeaweedClient) error) error {- return WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {+func WithMasterClient(streamingMode bool, master ServerAddress, grpcDialOption grpc.DialOption, fn func(client master_pb.SeaweedClient) error) error {+ return WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {client := master_pb.NewSeaweedClient(grpcConnection)return fn(client)}, master.ToGrpcAddress(), grpcDialOption)}-func WithOneOfGrpcMasterClients(masterGrpcAddresses []ServerAddress, grpcDialOption grpc.DialOption, fn func(client master_pb.SeaweedClient) error) (err error) {+func WithOneOfGrpcMasterClients(streamingMode bool, masterGrpcAddresses []ServerAddress, grpcDialOption grpc.DialOption, fn func(client master_pb.SeaweedClient) error) (err error) {for _, masterGrpcAddress := range masterGrpcAddresses {- err = WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {+ err = WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {client := master_pb.NewSeaweedClient(grpcConnection)return fn(client)}, masterGrpcAddress.ToGrpcAddress(), grpcDialOption)@@ -207,34 +222,34 @@ func WithOneOfGrpcMasterClients(masterGrpcAddresses []ServerAddress, grpcDialOptreturn err}-func WithBrokerGrpcClient(brokerGrpcAddress string, grpcDialOption grpc.DialOption, fn func(client messaging_pb.SeaweedMessagingClient) error) error {+func WithBrokerGrpcClient(streamingMode bool, brokerGrpcAddress string, grpcDialOption grpc.DialOption, fn func(client messaging_pb.SeaweedMessagingClient) error) error {- return WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {+ return WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {client := messaging_pb.NewSeaweedMessagingClient(grpcConnection)return fn(client)}, brokerGrpcAddress, grpcDialOption)}-func WithFilerClient(filer ServerAddress, grpcDialOption grpc.DialOption, fn func(client filer_pb.SeaweedFilerClient) error) error {+func WithFilerClient(streamingMode bool, filer ServerAddress, grpcDialOption grpc.DialOption, fn func(client filer_pb.SeaweedFilerClient) error) error {- return WithGrpcFilerClient(filer, grpcDialOption, fn)+ return WithGrpcFilerClient(streamingMode, filer, grpcDialOption, fn)}-func WithGrpcFilerClient(filerGrpcAddress ServerAddress, grpcDialOption grpc.DialOption, fn func(client filer_pb.SeaweedFilerClient) error) error {+func WithGrpcFilerClient(streamingMode bool, filerGrpcAddress ServerAddress, grpcDialOption grpc.DialOption, fn func(client filer_pb.SeaweedFilerClient) error) error {- return WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {+ return WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {client := filer_pb.NewSeaweedFilerClient(grpcConnection)return fn(client)}, filerGrpcAddress.ToGrpcAddress(), grpcDialOption)}-func WithOneOfGrpcFilerClients(filerAddresses []ServerAddress, grpcDialOption grpc.DialOption, fn func(client filer_pb.SeaweedFilerClient) error) (err error) {+func WithOneOfGrpcFilerClients(streamingMode bool, filerAddresses []ServerAddress, grpcDialOption grpc.DialOption, fn func(client filer_pb.SeaweedFilerClient) error) (err error) {for _, filerAddress := range filerAddresses {- err = WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {+ err = WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {client := filer_pb.NewSeaweedFilerClient(grpcConnection)return fn(client)}, filerAddress.ToGrpcAddress(), grpcDialOption)diff --git a/weed/remote_storage/track_sync_offset.go b/weed/remote_storage/track_sync_offset.goindex 439491d12e..25ac0d3407 100644--- a/weed/remote_storage/track_sync_offset.go+++ b/weed/remote_storage/track_sync_offset.go@@ -17,7 +17,7 @@ func GetSyncOffset(grpcDialOption grpc.DialOption, filer pb.ServerAddress, dir sdirHash := uint32(util.HashStringToLong(dir))- readErr = pb.WithFilerClient(filer, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ readErr = pb.WithFilerClient(false, filer, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {syncKey := []byte(SyncKeyPrefix + "____")util.Uint32toBytes(syncKey[len(SyncKeyPrefix):len(SyncKeyPrefix)+4], dirHash)@@ -46,7 +46,7 @@ func SetSyncOffset(grpcDialOption grpc.DialOption, filer pb.ServerAddress, dir sdirHash := uint32(util.HashStringToLong(dir))- return pb.WithFilerClient(filer, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ return pb.WithFilerClient(false, filer, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {syncKey := []byte(SyncKeyPrefix + "____")util.Uint32toBytes(syncKey[len(SyncKeyPrefix):len(SyncKeyPrefix)+4], dirHash)diff --git a/weed/replication/replicator.go b/weed/replication/replicator.goindex 3e100497f5..eaab2c13ea 100644--- a/weed/replication/replicator.go+++ b/weed/replication/replicator.go@@ -83,7 +83,7 @@ func (r *Replicator) Replicate(ctx context.Context, key string, message *filer_p}func ReadFilerSignature(grpcDialOption grpc.DialOption, filer pb.ServerAddress) (filerSignature int32, readErr error) {- if readErr = pb.WithFilerClient(filer, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ if readErr = pb.WithFilerClient(false, filer, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {if resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{}); err != nil {return fmt.Errorf("GetFilerConfiguration %s: %v", filer, err)} else {diff --git a/weed/replication/sink/filersink/fetch_write.go b/weed/replication/sink/filersink/fetch_write.goindex 4c536b71c4..825d2af95f 100644--- a/weed/replication/sink/filersink/fetch_write.go+++ b/weed/replication/sink/filersink/fetch_write.go@@ -70,7 +70,7 @@ func (fs *FilerSink) fetchAndWrite(sourceChunk *filer_pb.FileChunk, path string)var host stringvar auth security.EncodedJwt- if err := fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ if err := fs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {return util.Retry("assignVolume", func() error {request := &filer_pb.AssignVolumeRequest{Count: 1,@@ -131,9 +131,9 @@ func (fs *FilerSink) fetchAndWrite(sourceChunk *filer_pb.FileChunk, path string)var _ = filer_pb.FilerClient(&FilerSink{})-func (fs *FilerSink) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {+func (fs *FilerSink) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) error {- return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {+ return pb.WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {client := filer_pb.NewSeaweedFilerClient(grpcConnection)return fn(client)}, fs.grpcAddress, fs.grpcDialOption)diff --git a/weed/replication/sink/filersink/filer_sink.go b/weed/replication/sink/filersink/filer_sink.goindex d42ca63a81..c48ab2368a 100644--- a/weed/replication/sink/filersink/filer_sink.go+++ b/weed/replication/sink/filersink/filer_sink.go@@ -100,7 +100,7 @@ func (fs *FilerSink) DeleteEntry(key string, isDirectory, deleteIncludeChunks bofunc (fs *FilerSink) CreateEntry(key string, entry *filer_pb.Entry, signatures []int32) error {- return fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return fs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {dir, name := util.FullPath(key).DirAndName()@@ -156,7 +156,7 @@ func (fs *FilerSink) UpdateEntry(key string, oldEntry *filer_pb.Entry, newParent// read existing entryvar existingEntry *filer_pb.Entry- err = fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = fs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.LookupDirectoryEntryRequest{Directory: dir,@@ -211,7 +211,7 @@ func (fs *FilerSink) UpdateEntry(key string, oldEntry *filer_pb.Entry, newParent}// save updated meta data- return true, fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return true, fs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.UpdateEntryRequest{Directory: newParentPath,diff --git a/weed/replication/source/filer_source.go b/weed/replication/source/filer_source.goindex 60c33463f0..4108f3821a 100644--- a/weed/replication/source/filer_source.go+++ b/weed/replication/source/filer_source.go@@ -56,7 +56,7 @@ func (fs *FilerSource) LookupFileId(part string) (fileUrls []string, err error)vid := volumeId(part)- err = fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = fs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {resp, err := client.LookupVolume(context.Background(), &filer_pb.LookupVolumeRequest{VolumeIds: []string{vid},@@ -118,9 +118,9 @@ func (fs *FilerSource) ReadPart(fileId string) (filename string, header http.Heavar _ = filer_pb.FilerClient(&FilerSource{})-func (fs *FilerSource) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {+func (fs *FilerSource) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) error {- return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {+ return pb.WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {client := filer_pb.NewSeaweedFilerClient(grpcConnection)return fn(client)}, fs.grpcAddress, fs.grpcDialOption)diff --git a/weed/s3api/auth_credentials.go b/weed/s3api/auth_credentials.goindex 0d46ad7ca4..87d478136f 100644--- a/weed/s3api/auth_credentials.go+++ b/weed/s3api/auth_credentials.go@@ -84,7 +84,7 @@ func NewIdentityAccessManagement(option *S3ApiServerOption) *IdentityAccessManagfunc (iam *IdentityAccessManagement) loadS3ApiConfigurationFromFiler(option *S3ApiServerOption) (err error) {var content []byte- err = pb.WithFilerClient(option.Filer, option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error {+ err = pb.WithFilerClient(false, option.Filer, option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error {content, err = filer.ReadInsideFiler(client, filer.IamConfigDirecotry, filer.IamIdentityFile)return err})diff --git a/weed/s3api/filer_util.go b/weed/s3api/filer_util.goindex 888003e458..d227c609ef 100644--- a/weed/s3api/filer_util.go+++ b/weed/s3api/filer_util.go@@ -41,7 +41,7 @@ func (s3a *S3ApiServer) list(parentDirectoryPath, prefix, startFrom string, inclfunc (s3a *S3ApiServer) rm(parentDirectoryPath, entryName string, isDeleteData, isRecursive bool) error {- return s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {err := doDeleteEntry(client, parentDirectoryPath, entryName, isDeleteData, isRecursive)if err != nil {diff --git a/weed/s3api/filer_util_tags.go b/weed/s3api/filer_util_tags.goindex 75d3b37d0d..e45230165b 100644--- a/weed/s3api/filer_util_tags.go+++ b/weed/s3api/filer_util_tags.go@@ -13,7 +13,7 @@ const (func (s3a *S3ApiServer) getTags(parentDirectoryPath string, entryName string) (tags map[string]string, err error) {- err = s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {resp, err := filer_pb.LookupEntry(client, &filer_pb.LookupDirectoryEntryRequest{Directory: parentDirectoryPath,@@ -35,7 +35,7 @@ func (s3a *S3ApiServer) getTags(parentDirectoryPath string, entryName string) (tfunc (s3a *S3ApiServer) setTags(parentDirectoryPath string, entryName string, tags map[string]string) (err error) {- return s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {resp, err := filer_pb.LookupEntry(client, &filer_pb.LookupDirectoryEntryRequest{Directory: parentDirectoryPath,@@ -71,7 +71,7 @@ func (s3a *S3ApiServer) setTags(parentDirectoryPath string, entryName string, tafunc (s3a *S3ApiServer) rmTags(parentDirectoryPath string, entryName string) (err error) {- return s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {resp, err := filer_pb.LookupEntry(client, &filer_pb.LookupDirectoryEntryRequest{Directory: parentDirectoryPath,diff --git a/weed/s3api/s3api_bucket_handlers.go b/weed/s3api/s3api_bucket_handlers.goindex 247e331040..c3e50ec442 100644--- a/weed/s3api/s3api_bucket_handlers.go+++ b/weed/s3api/s3api_bucket_handlers.go@@ -83,7 +83,7 @@ func (s3a *S3ApiServer) PutBucketHandler(w http.ResponseWriter, r *http.Request)// avoid duplicated bucketserrCode := s3err.ErrNone- if err := s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ if err := s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {if resp, err := client.CollectionList(context.Background(), &filer_pb.CollectionListRequest{IncludeEcVolumes: true,IncludeNormalVolumes: true,@@ -146,7 +146,7 @@ func (s3a *S3ApiServer) DeleteBucketHandler(w http.ResponseWriter, r *http.Requereturn}- err := s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err := s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {// delete collectiondeleteCollectionRequest := &filer_pb.DeleteCollectionRequest{diff --git a/weed/s3api/s3api_handlers.go b/weed/s3api/s3api_handlers.goindex e42fb6c44f..4ace4bb21e 100644--- a/weed/s3api/s3api_handlers.go+++ b/weed/s3api/s3api_handlers.go@@ -13,9 +13,9 @@ import (var _ = filer_pb.FilerClient(&S3ApiServer{})-func (s3a *S3ApiServer) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {+func (s3a *S3ApiServer) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) error {- return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {+ return pb.WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {client := filer_pb.NewSeaweedFilerClient(grpcConnection)return fn(client)}, s3a.option.Filer.ToGrpcAddress(), s3a.option.GrpcDialOption)diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.goindex 2ac9c81026..d78332395d 100644--- a/weed/s3api/s3api_object_handlers.go+++ b/weed/s3api/s3api_object_handlers.go@@ -233,7 +233,7 @@ func (s3a *S3ApiServer) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *hif s3err.Logger != nil {auditLog = s3err.GetAccessLog(r, http.StatusNoContent, s3err.ErrNone)}- s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {// delete file entriesfor _, object := range deleteObjects.Objects {diff --git a/weed/s3api/s3api_objects_list_handlers.go b/weed/s3api/s3api_objects_list_handlers.goindex 4decb5eac3..a3b858dcb5 100644--- a/weed/s3api/s3api_objects_list_handlers.go+++ b/weed/s3api/s3api_objects_list_handlers.go@@ -146,7 +146,7 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, mvar nextMarker string// check filer- err = s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {_, isTruncated, nextMarker, doErr = s3a.doListFilerEntries(client, reqDir, prefix, maxKeys, marker, delimiter, func(dir string, entry *filer_pb.Entry) {if entry.IsDirectory {diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.goindex a0385f487f..8e6cd8451e 100644--- a/weed/server/filer_grpc_server.go+++ b/weed/server/filer_grpc_server.go@@ -327,7 +327,7 @@ func (fs *FilerServer) CollectionList(ctx context.Context, req *filer_pb.Collectglog.V(4).Infof("CollectionList %v", req)resp = &filer_pb.CollectionListResponse{}- err = fs.filer.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {+ err = fs.filer.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {masterResp, err := client.CollectionList(context.Background(), &master_pb.CollectionListRequest{IncludeNormalVolumes: req.IncludeNormalVolumes,IncludeEcVolumes: req.IncludeEcVolumes,@@ -348,7 +348,7 @@ func (fs *FilerServer) DeleteCollection(ctx context.Context, req *filer_pb.Deletglog.V(4).Infof("DeleteCollection %v", req)- err = fs.filer.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {+ err = fs.filer.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {_, err := client.CollectionDelete(context.Background(), &master_pb.CollectionDeleteRequest{Name: req.GetCollection(),})@@ -362,7 +362,7 @@ func (fs *FilerServer) Statistics(ctx context.Context, req *filer_pb.StatisticsRvar output *master_pb.StatisticsResponse- err = fs.filer.MasterClient.WithClient(func(masterClient master_pb.SeaweedClient) error {+ err = fs.filer.MasterClient.WithClient(false, func(masterClient master_pb.SeaweedClient) error {grpcResponse, grpcErr := masterClient.Statistics(context.Background(), &master_pb.StatisticsRequest{Replication: req.Replication,Collection: req.Collection,diff --git a/weed/server/filer_grpc_server_remote.go b/weed/server/filer_grpc_server_remote.goindex 7f31d8cc11..3be986023d 100644--- a/weed/server/filer_grpc_server_remote.go+++ b/weed/server/filer_grpc_server_remote.go@@ -123,7 +123,7 @@ func (fs *FilerServer) CacheRemoteObjectToLocalCluster(ctx context.Context, req// tell filer to tell volume server to download into needlesassignedServerAddress := pb.NewServerAddressWithGrpcPort(assignResult.Url, assignResult.GrpcPort)- err = operation.WithVolumeServerClient(assignedServerAddress, fs.grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err = operation.WithVolumeServerClient(false, assignedServerAddress, fs.grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, fetchAndWriteErr := volumeServerClient.FetchAndWriteNeedle(context.Background(), &volume_server_pb.FetchAndWriteNeedleRequest{VolumeId: uint32(fileId.VolumeId),NeedleId: uint64(fileId.Key),diff --git a/weed/server/filer_server.go b/weed/server/filer_server.goindex c9343a9bf6..1a5f80369c 100644--- a/weed/server/filer_server.go+++ b/weed/server/filer_server.go@@ -165,7 +165,7 @@ func (fs *FilerServer) checkWithMaster() {isConnected := falsefor !isConnected {for _, master := range fs.option.Masters {- readErr := operation.WithMasterServerClient(master, fs.grpcDialOption, func(masterClient master_pb.SeaweedClient) error {+ readErr := operation.WithMasterServerClient(false, master, fs.grpcDialOption, func(masterClient master_pb.SeaweedClient) error {resp, err := masterClient.GetMasterConfiguration(context.Background(), &master_pb.GetMasterConfigurationRequest{})if err != nil {return fmt.Errorf("get master %s configuration: %v", master, err)diff --git a/weed/server/master_grpc_server_collection.go b/weed/server/master_grpc_server_collection.goindex 55f3faf8c0..654da6b3c0 100644--- a/weed/server/master_grpc_server_collection.go+++ b/weed/server/master_grpc_server_collection.go@@ -58,7 +58,7 @@ func (ms *MasterServer) doDeleteNormalCollection(collectionName string) error {}for _, server := range collection.ListVolumeServers() {- err := operation.WithVolumeServerClient(server.ServerAddress(), ms.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(false, server.ServerAddress(), ms.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {_, deleteErr := client.DeleteCollection(context.Background(), &volume_server_pb.DeleteCollectionRequest{Collection: collectionName,})@@ -78,7 +78,7 @@ func (ms *MasterServer) doDeleteEcCollection(collectionName string) error {listOfEcServers := ms.Topo.ListEcServersByCollection(collectionName)for _, server := range listOfEcServers {- err := operation.WithVolumeServerClient(server, ms.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(false, server, ms.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {_, deleteErr := client.DeleteCollection(context.Background(), &volume_server_pb.DeleteCollectionRequest{Collection: collectionName,})diff --git a/weed/server/master_server_handlers_admin.go b/weed/server/master_server_handlers_admin.goindex 41a2b570b2..72d4e20d78 100644--- a/weed/server/master_server_handlers_admin.go+++ b/weed/server/master_server_handlers_admin.go@@ -27,7 +27,7 @@ func (ms *MasterServer) collectionDeleteHandler(w http.ResponseWriter, r *http.Rreturn}for _, server := range collection.ListVolumeServers() {- err := operation.WithVolumeServerClient(server.ServerAddress(), ms.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(false, server.ServerAddress(), ms.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {_, deleteErr := client.DeleteCollection(context.Background(), &volume_server_pb.DeleteCollectionRequest{Collection: collection.Name,})diff --git a/weed/server/volume_grpc_client_to_master.go b/weed/server/volume_grpc_client_to_master.goindex 2659307fc7..f3f99ee7b0 100644--- a/weed/server/volume_grpc_client_to_master.go+++ b/weed/server/volume_grpc_client_to_master.go@@ -26,7 +26,7 @@ func (vs *VolumeServer) GetMaster() pb.ServerAddress {func (vs *VolumeServer) checkWithMaster() (err error) {for {for _, master := range vs.SeedMasterNodes {- err = operation.WithMasterServerClient(master, vs.grpcDialOption, func(masterClient master_pb.SeaweedClient) error {+ err = operation.WithMasterServerClient(false, master, vs.grpcDialOption, func(masterClient master_pb.SeaweedClient) error {resp, err := masterClient.GetMasterConfiguration(context.Background(), &master_pb.GetMasterConfigurationRequest{})if err != nil {return fmt.Errorf("get master %s configuration: %v", master, err)diff --git a/weed/server/volume_grpc_copy.go b/weed/server/volume_grpc_copy.goindex 9d9f756ce7..52181a771e 100644--- a/weed/server/volume_grpc_copy.go+++ b/weed/server/volume_grpc_copy.go@@ -45,7 +45,7 @@ func (vs *VolumeServer) VolumeCopy(req *volume_server_pb.VolumeCopyRequest, stre// confirm size and timestampvar volFileInfoResp *volume_server_pb.ReadVolumeFileStatusResponsevar dataBaseFileName, indexBaseFileName, idxFileName, datFileName string- err := operation.WithVolumeServerClient(pb.ServerAddress(req.SourceDataNode), vs.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(true, pb.ServerAddress(req.SourceDataNode), vs.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {var err errorvolFileInfoResp, err = client.ReadVolumeFileStatus(context.Background(),&volume_server_pb.ReadVolumeFileStatusRequest{@@ -226,7 +226,7 @@ func writeToFile(client volume_server_pb.VolumeServer_CopyFileClient, fileName sif receiveErr == io.EOF {break}- if resp!=nil && resp.ModifiedTsNs != 0 {+ if resp != nil && resp.ModifiedTsNs != 0 {modifiedTsNs = resp.ModifiedTsNs}if receiveErr != nil {diff --git a/weed/server/volume_grpc_erasure_coding.go b/weed/server/volume_grpc_erasure_coding.goindex 861d352d7a..79611f4994 100644--- a/weed/server/volume_grpc_erasure_coding.go+++ b/weed/server/volume_grpc_erasure_coding.go@@ -126,7 +126,7 @@ func (vs *VolumeServer) VolumeEcShardsCopy(ctx context.Context, req *volume_servdataBaseFileName := storage.VolumeFileName(location.Directory, req.Collection, int(req.VolumeId))indexBaseFileName := storage.VolumeFileName(location.IdxDirectory, req.Collection, int(req.VolumeId))- err := operation.WithVolumeServerClient(pb.ServerAddress(req.SourceDataNode), vs.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(true, pb.ServerAddress(req.SourceDataNode), vs.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {// copy ec data slicesfor _, shardId := range req.ShardIds {diff --git a/weed/server/webdav_server.go b/weed/server/webdav_server.goindex 6c1de31542..018daed8b6 100644--- a/weed/server/webdav_server.go+++ b/weed/server/webdav_server.go@@ -120,9 +120,9 @@ func NewWebDavFileSystem(option *WebDavOption) (webdav.FileSystem, error) {var _ = filer_pb.FilerClient(&WebDavFileSystem{})-func (fs *WebDavFileSystem) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {+func (fs *WebDavFileSystem) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) error {- return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {+ return pb.WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {client := filer_pb.NewSeaweedFilerClient(grpcConnection)return fn(client)}, fs.option.Filer.ToGrpcAddress(), fs.option.GrpcDialOption)@@ -162,7 +162,7 @@ func (fs *WebDavFileSystem) Mkdir(ctx context.Context, fullDirPath string, permreturn os.ErrExist}- return fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return fs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {dir, name := util.FullPath(fullDirPath).DirAndName()request := &filer_pb.CreateEntryRequest{Directory: dir,@@ -212,7 +212,7 @@ func (fs *WebDavFileSystem) OpenFile(ctx context.Context, fullFilePath string, f}dir, name := util.FullPath(fullFilePath).DirAndName()- err = fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = fs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {if err := filer_pb.CreateEntry(client, &filer_pb.CreateEntryRequest{Directory: dir,Entry: &filer_pb.Entry{@@ -315,7 +315,7 @@ func (fs *WebDavFileSystem) Rename(ctx context.Context, oldName, newName string)oldDir, oldBaseName := util.FullPath(oldName).DirAndName()newDir, newBaseName := util.FullPath(newName).DirAndName()- return fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return fs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.AtomicRenameEntryRequest{OldDirectory: oldDir,@@ -375,7 +375,7 @@ func (f *WebDavFile) saveDataAsChunk(reader io.Reader, name string, offset int64var fileId, host stringvar auth security.EncodedJwt- if flushErr := f.fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ if flushErr := f.fs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {ctx := context.Background()@@ -477,7 +477,7 @@ func (f *WebDavFile) Write(buf []byte) (int, error) {f.entry.Chunks = manifestedChunks}- flushErr := f.fs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ flushErr := f.fs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {f.entry.Attributes.Mtime = time.Now().Unix()f.entry.Attributes.Collection = f.collectionf.entry.Attributes.Replication = f.replicationdiff --git a/weed/shell/command_cluster_ps.go b/weed/shell/command_cluster_ps.goindex 5ed1677c89..2d391de1dc 100644--- a/weed/shell/command_cluster_ps.go+++ b/weed/shell/command_cluster_ps.go@@ -36,7 +36,7 @@ func (c *commandClusterPs) Do(args []string, commandEnv *CommandEnv, writer io.Wreturn nil}- err = commandEnv.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {+ err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {resp, err := client.ListClusterNodes(context.Background(), &master_pb.ListClusterNodesRequest{ClientType: cluster.FilerType,})diff --git a/weed/shell/command_collection_delete.go b/weed/shell/command_collection_delete.goindex 8942c15da5..55c8ddf196 100644--- a/weed/shell/command_collection_delete.go+++ b/weed/shell/command_collection_delete.go@@ -53,7 +53,7 @@ func (c *commandCollectionDelete) Do(args []string, commandEnv *CommandEnv, writreturn nil}- err = commandEnv.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {+ err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {_, err = client.CollectionDelete(context.Background(), &master_pb.CollectionDeleteRequest{Name: *collectionName,})diff --git a/weed/shell/command_collection_list.go b/weed/shell/command_collection_list.goindex ba502a6b91..b2aa6d2f47 100644--- a/weed/shell/command_collection_list.go+++ b/weed/shell/command_collection_list.go@@ -62,7 +62,7 @@ func (c *commandCollectionList) Do(args []string, commandEnv *CommandEnv, writerfunc ListCollectionNames(commandEnv *CommandEnv, includeNormalVolumes, includeEcVolumes bool) (collections []string, err error) {var resp *master_pb.CollectionListResponse- err = commandEnv.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {+ err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {resp, err = client.CollectionList(context.Background(), &master_pb.CollectionListRequest{IncludeNormalVolumes: includeNormalVolumes,IncludeEcVolumes: includeEcVolumes,diff --git a/weed/shell/command_ec_common.go b/weed/shell/command_ec_common.goindex 51c8c32cd0..765c0ad894 100644--- a/weed/shell/command_ec_common.go+++ b/weed/shell/command_ec_common.go@@ -61,7 +61,7 @@ func oneServerCopyAndMountEcShardsFromSource(grpcDialOption grpc.DialOption,fmt.Printf("allocate %d.%v %s => %s\n", volumeId, shardIdsToCopy, existingLocation, targetServer.info.Id)targetAddress := pb.NewServerAddressFromDataNode(targetServer.info)- err = operation.WithVolumeServerClient(targetAddress, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err = operation.WithVolumeServerClient(false, targetAddress, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {if targetAddress != existingLocation {@@ -241,7 +241,7 @@ func sourceServerDeleteEcShards(grpcDialOption grpc.DialOption, collection strinfmt.Printf("delete %d.%v from %s\n", volumeId, toBeDeletedShardIds, sourceLocation)- return operation.WithVolumeServerClient(sourceLocation, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(false, sourceLocation, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, deleteErr := volumeServerClient.VolumeEcShardsDelete(context.Background(), &volume_server_pb.VolumeEcShardsDeleteRequest{VolumeId: uint32(volumeId),Collection: collection,@@ -256,7 +256,7 @@ func unmountEcShards(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, sfmt.Printf("unmount %d.%v from %s\n", volumeId, toBeUnmountedhardIds, sourceLocation)- return operation.WithVolumeServerClient(sourceLocation, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(false, sourceLocation, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, deleteErr := volumeServerClient.VolumeEcShardsUnmount(context.Background(), &volume_server_pb.VolumeEcShardsUnmountRequest{VolumeId: uint32(volumeId),ShardIds: toBeUnmountedhardIds,@@ -269,7 +269,7 @@ func mountEcShards(grpcDialOption grpc.DialOption, collection string, volumeId nfmt.Printf("mount %d.%v on %s\n", volumeId, toBeMountedhardIds, sourceLocation)- return operation.WithVolumeServerClient(sourceLocation, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(false, sourceLocation, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, mountErr := volumeServerClient.VolumeEcShardsMount(context.Background(), &volume_server_pb.VolumeEcShardsMountRequest{VolumeId: uint32(volumeId),Collection: collection,diff --git a/weed/shell/command_ec_decode.go b/weed/shell/command_ec_decode.goindex b2ca605c78..288fa49459 100644--- a/weed/shell/command_ec_decode.go+++ b/weed/shell/command_ec_decode.go@@ -116,7 +116,7 @@ func doEcDecode(commandEnv *CommandEnv, topoInfo *master_pb.TopologyInfo, collecfunc mountVolumeAndDeleteEcShards(grpcDialOption grpc.DialOption, collection string, targetNodeLocation pb.ServerAddress, nodeToEcIndexBits map[pb.ServerAddress]erasure_coding.ShardBits, vid needle.VolumeId) error {// mount volume- if err := operation.WithVolumeServerClient(targetNodeLocation, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ if err := operation.WithVolumeServerClient(false, targetNodeLocation, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, mountErr := volumeServerClient.VolumeMount(context.Background(), &volume_server_pb.VolumeMountRequest{VolumeId: uint32(vid),})@@ -149,7 +149,7 @@ func generateNormalVolume(grpcDialOption grpc.DialOption, vid needle.VolumeId, cfmt.Printf("generateNormalVolume from ec volume %d on %s\n", vid, sourceVolumeServer)- err := operation.WithVolumeServerClient(sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(false, sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, genErr := volumeServerClient.VolumeEcShardsToVolume(context.Background(), &volume_server_pb.VolumeEcShardsToVolumeRequest{VolumeId: uint32(vid),Collection: collection,@@ -187,7 +187,7 @@ func collectEcShards(commandEnv *CommandEnv, nodeToEcIndexBits map[pb.ServerAddrcontinue}- err = operation.WithVolumeServerClient(targetNodeLocation, commandEnv.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err = operation.WithVolumeServerClient(false, targetNodeLocation, commandEnv.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {fmt.Printf("copy %d.%v %s => %s\n", vid, needToCopyEcIndexBits.ShardIds(), loc, targetNodeLocation)@@ -223,7 +223,7 @@ func collectEcShards(commandEnv *CommandEnv, nodeToEcIndexBits map[pb.ServerAddrfunc lookupVolumeIds(commandEnv *CommandEnv, volumeIds []string) (volumeIdLocations []*master_pb.LookupVolumeResponse_VolumeIdLocation, err error) {var resp *master_pb.LookupVolumeResponse- err = commandEnv.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {+ err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {resp, err = client.LookupVolume(context.Background(), &master_pb.LookupVolumeRequest{VolumeOrFileIds: volumeIds})return err})@@ -236,7 +236,7 @@ func lookupVolumeIds(commandEnv *CommandEnv, volumeIds []string) (volumeIdLocatifunc collectTopologyInfo(commandEnv *CommandEnv) (topoInfo *master_pb.TopologyInfo, volumeSizeLimitMb uint64, err error) {var resp *master_pb.VolumeListResponse- err = commandEnv.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {+ err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {resp, err = client.VolumeList(context.Background(), &master_pb.VolumeListRequest{})return err})diff --git a/weed/shell/command_ec_encode.go b/weed/shell/command_ec_encode.goindex 6add147497..fcdee264e0 100644--- a/weed/shell/command_ec_encode.go+++ b/weed/shell/command_ec_encode.go@@ -126,7 +126,7 @@ func generateEcShards(grpcDialOption grpc.DialOption, volumeId needle.VolumeId,fmt.Printf("generateEcShards %s %d on %s ...\n", collection, volumeId, sourceVolumeServer)- err := operation.WithVolumeServerClient(sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(false, sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, genErr := volumeServerClient.VolumeEcShardsGenerate(context.Background(), &volume_server_pb.VolumeEcShardsGenerateRequest{VolumeId: uint32(volumeId),Collection: collection,diff --git a/weed/shell/command_ec_rebuild.go b/weed/shell/command_ec_rebuild.goindex 409ec43294..f5d1166d2f 100644--- a/weed/shell/command_ec_rebuild.go+++ b/weed/shell/command_ec_rebuild.go@@ -172,7 +172,7 @@ func rebuildOneEcVolume(commandEnv *CommandEnv, rebuilder *EcNode, collection stfunc generateMissingShards(grpcDialOption grpc.DialOption, collection string, volumeId needle.VolumeId, sourceLocation pb.ServerAddress) (rebuiltShardIds []uint32, err error) {- err = operation.WithVolumeServerClient(sourceLocation, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err = operation.WithVolumeServerClient(false, sourceLocation, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {resp, rebultErr := volumeServerClient.VolumeEcShardsRebuild(context.Background(), &volume_server_pb.VolumeEcShardsRebuildRequest{VolumeId: uint32(volumeId),Collection: collection,@@ -213,7 +213,7 @@ func prepareDataToRecover(commandEnv *CommandEnv, rebuilder *EcNode, collectionvar copyErr errorif applyBalancing {- copyErr = operation.WithVolumeServerClient(pb.NewServerAddressFromDataNode(rebuilder.info), commandEnv.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ copyErr = operation.WithVolumeServerClient(false, pb.NewServerAddressFromDataNode(rebuilder.info), commandEnv.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, copyErr := volumeServerClient.VolumeEcShardsCopy(context.Background(), &volume_server_pb.VolumeEcShardsCopyRequest{VolumeId: uint32(volumeId),Collection: collection,diff --git a/weed/shell/command_fs_cat.go b/weed/shell/command_fs_cat.goindex a5731240d4..17e9c65500 100644--- a/weed/shell/command_fs_cat.go+++ b/weed/shell/command_fs_cat.go@@ -41,7 +41,7 @@ func (c *commandFsCat) Do(args []string, commandEnv *CommandEnv, writer io.Writedir, name := util.FullPath(path).DirAndName()- return commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.LookupDirectoryEntryRequest{Name: name,diff --git a/weed/shell/command_fs_configure.go b/weed/shell/command_fs_configure.goindex ece805db32..73bb8e5c63 100644--- a/weed/shell/command_fs_configure.go+++ b/weed/shell/command_fs_configure.go@@ -117,7 +117,7 @@ func (c *commandFsConfigure) Do(args []string, commandEnv *CommandEnv, writer ioif *apply {- if err = commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ if err = commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {return filer.SaveInsideFiler(client, filer.DirectoryEtcSeaweedFS, filer.FilerConfName, buf2.Bytes())}); err != nil && err != filer_pb.ErrNotFound {return errdiff --git a/weed/shell/command_fs_meta_cat.go b/weed/shell/command_fs_meta_cat.goindex e0525defaf..a7de6d3ef0 100644--- a/weed/shell/command_fs_meta_cat.go+++ b/weed/shell/command_fs_meta_cat.go@@ -40,7 +40,7 @@ func (c *commandFsMetaCat) Do(args []string, commandEnv *CommandEnv, writer io.Wdir, name := util.FullPath(path).DirAndName()- return commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.LookupDirectoryEntryRequest{Name: name,diff --git a/weed/shell/command_fs_meta_load.go b/weed/shell/command_fs_meta_load.goindex 46dc07e9a0..7fe4cf8099 100644--- a/weed/shell/command_fs_meta_load.go+++ b/weed/shell/command_fs_meta_load.go@@ -48,7 +48,7 @@ func (c *commandFsMetaLoad) Do(args []string, commandEnv *CommandEnv, writer io.var dirCount, fileCount uint64- err = commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {sizeBuf := make([]byte, 4)diff --git a/weed/shell/command_fs_mkdir.go b/weed/shell/command_fs_mkdir.goindex 11b663eec4..71a35cb68d 100644--- a/weed/shell/command_fs_mkdir.go+++ b/weed/shell/command_fs_mkdir.go@@ -36,7 +36,7 @@ func (c *commandFsMkdir) Do(args []string, commandEnv *CommandEnv, writer io.Wridir, name := util.FullPath(path).DirAndName()- err = commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {_, createErr := client.CreateEntry(context.Background(), &filer_pb.CreateEntryRequest{Directory: dir,diff --git a/weed/shell/command_fs_mv.go b/weed/shell/command_fs_mv.goindex 2448c8f61d..612cdc84e9 100644--- a/weed/shell/command_fs_mv.go+++ b/weed/shell/command_fs_mv.go@@ -54,7 +54,7 @@ func (c *commandFsMv) Do(args []string, commandEnv *CommandEnv, writer io.WriterdestinationDir, destinationName := util.FullPath(destinationPath).DirAndName()- return commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {// collect destination entry infodestinationRequest := &filer_pb.LookupDirectoryEntryRequest{diff --git a/weed/shell/command_fs_rm.go b/weed/shell/command_fs_rm.goindex b383366ca9..2ce3275bba 100644--- a/weed/shell/command_fs_rm.go+++ b/weed/shell/command_fs_rm.go@@ -56,7 +56,7 @@ func (c *commandFsRm) Do(args []string, commandEnv *CommandEnv, writer io.Writerreturn fmt.Errorf("need to have arguments")}- commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {for _, entry := range entiries {targetPath, err := commandEnv.parseUrl(entry)if err != nil {diff --git a/weed/shell/command_remote_configure.go b/weed/shell/command_remote_configure.goindex 3fa905237a..c892c3443d 100644--- a/weed/shell/command_remote_configure.go+++ b/weed/shell/command_remote_configure.go@@ -184,7 +184,7 @@ func (c *commandRemoteConfigure) listExistingRemoteStorages(commandEnv *CommandEfunc (c *commandRemoteConfigure) deleteRemoteStorage(commandEnv *CommandEnv, writer io.Writer, storageName string) error {- return commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ return commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {request := &filer_pb.DeleteEntryRequest{Directory: filer.DirectoryEtcRemote,@@ -214,7 +214,7 @@ func (c *commandRemoteConfigure) saveRemoteStorage(commandEnv *CommandEnv, writereturn err}- if err = commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ if err = commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {return filer.SaveInsideFiler(client, filer.DirectoryEtcRemote, conf.Name+filer.REMOTE_STORAGE_CONF_SUFFIX, data)}); err != nil && err != filer_pb.ErrNotFound {return errdiff --git a/weed/shell/command_remote_meta_sync.go b/weed/shell/command_remote_meta_sync.goindex 277c4c2beb..e09a667614 100644--- a/weed/shell/command_remote_meta_sync.go+++ b/weed/shell/command_remote_meta_sync.go@@ -117,7 +117,7 @@ func pullMetadata(commandEnv *CommandEnv, writer io.Writer, localMountedDir utilremote := filer.MapFullPathToRemoteStorageLocation(localMountedDir, remoteMountedLocation, dirToCache)- err = commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {ctx := context.Background()err = remoteStorage.Traverse(remote, func(remoteDir, name string, isDirectory bool, remoteEntry *filer_pb.RemoteEntry) error {localDir := filer.MapRemoteStorageLocationPathToFullPath(localMountedDir, remoteMountedLocation, remoteDir)diff --git a/weed/shell/command_remote_mount.go b/weed/shell/command_remote_mount.goindex 2b57db7071..019bc93c90 100644--- a/weed/shell/command_remote_mount.go+++ b/weed/shell/command_remote_mount.go@@ -117,7 +117,7 @@ func jsonPrintln(writer io.Writer, message proto.Message) error {func syncMetadata(commandEnv *CommandEnv, writer io.Writer, dir string, nonEmpty bool, remoteConf *remote_pb.RemoteConf, remote *remote_pb.RemoteStorageLocation) error {// find existing directory, and ensure the directory is empty- err := commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err := commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {parent, name := util.FullPath(dir).DirAndName()_, lookupErr := client.LookupDirectoryEntry(context.Background(), &filer_pb.LookupDirectoryEntryRequest{Directory: parent,diff --git a/weed/shell/command_remote_uncache.go b/weed/shell/command_remote_uncache.goindex 53d043ebf3..a3433621e8 100644--- a/weed/shell/command_remote_uncache.go+++ b/weed/shell/command_remote_uncache.go@@ -105,7 +105,7 @@ func (c *commandRemoteUncache) uncacheContentData(commandEnv *CommandEnv, writerfmt.Fprintf(writer, "Uncache %+v ... ", dir.Child(entry.Name))- err := commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err := commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {_, updateErr := client.UpdateEntry(context.Background(), &filer_pb.UpdateEntryRequest{Directory: string(dir),Entry: entry,diff --git a/weed/shell/command_remote_unmount.go b/weed/shell/command_remote_unmount.goindex c947a19e65..49b07f8f12 100644--- a/weed/shell/command_remote_unmount.go+++ b/weed/shell/command_remote_unmount.go@@ -83,7 +83,7 @@ func (c *commandRemoteUnmount) Do(args []string, commandEnv *CommandEnv, writerfunc (c *commandRemoteUnmount) purgeMountedData(commandEnv *CommandEnv, dir string) error {// find existing directory, and ensure the directory is empty- err := commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err := commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {parent, name := util.FullPath(dir).DirAndName()lookupResp, lookupErr := client.LookupDirectoryEntry(context.Background(), &filer_pb.LookupDirectoryEntryRequest{Directory: parent,diff --git a/weed/shell/command_s3_bucket_create.go b/weed/shell/command_s3_bucket_create.goindex a512ffc4a9..35ecae4ee8 100644--- a/weed/shell/command_s3_bucket_create.go+++ b/weed/shell/command_s3_bucket_create.go@@ -45,7 +45,7 @@ func (c *commandS3BucketCreate) Do(args []string, commandEnv *CommandEnv, writerreturn fmt.Errorf("empty bucket name")}- err = commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})if err != nil {diff --git a/weed/shell/command_s3_bucket_delete.go b/weed/shell/command_s3_bucket_delete.goindex 26953c2492..5f8585b0b7 100644--- a/weed/shell/command_s3_bucket_delete.go+++ b/weed/shell/command_s3_bucket_delete.go@@ -52,7 +52,7 @@ func (c *commandS3BucketDelete) Do(args []string, commandEnv *CommandEnv, writer}// delete the collection directly first- err = commandEnv.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {+ err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {_, err = client.CollectionDelete(context.Background(), &master_pb.CollectionDeleteRequest{Name: *bucketName,})diff --git a/weed/shell/command_s3_bucket_list.go b/weed/shell/command_s3_bucket_list.goindex 0c4e8d18fd..a344a79a4e 100644--- a/weed/shell/command_s3_bucket_list.go+++ b/weed/shell/command_s3_bucket_list.go@@ -65,7 +65,7 @@ func (c *commandS3BucketList) Do(args []string, commandEnv *CommandEnv, writer i}func readFilerBucketsPath(filerClient filer_pb.FilerClient) (filerBucketsPath string, err error) {- err = filerClient.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ err = filerClient.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})if err != nil {diff --git a/weed/shell/command_s3_configure.go b/weed/shell/command_s3_configure.goindex 5eab2ebd04..cefb1deeb3 100644--- a/weed/shell/command_s3_configure.go+++ b/weed/shell/command_s3_configure.go@@ -48,7 +48,7 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer io}var buf bytes.Buffer- if err = commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ if err = commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {return filer.ReadEntry(commandEnv.MasterClient, client, filer.IamConfigDirecotry, filer.IamIdentityFile, &buf)}); err != nil && err != filer_pb.ErrNotFound {return err@@ -171,7 +171,7 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer ioif *apply {- if err := commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {+ if err := commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {return filer.SaveInsideFiler(client, filer.IamConfigDirecotry, filer.IamIdentityFile, buf.Bytes())}); err != nil {return errdiff --git a/weed/shell/command_volume_check_disk.go b/weed/shell/command_volume_check_disk.goindex 643cccac32..cf3bc604ac 100644--- a/weed/shell/command_volume_check_disk.go+++ b/weed/shell/command_volume_check_disk.go@@ -182,7 +182,7 @@ func (c *commandVolumeCheckDisk) doVolumeCheckDisk(minuend, subtrahend *needle_mfunc (c *commandVolumeCheckDisk) readSourceNeedleBlob(sourceVolumeServer pb.ServerAddress, volumeId uint32, needleValue needle_map.NeedleValue) (needleBlob []byte, err error) {- err = operation.WithVolumeServerClient(sourceVolumeServer, c.env.option.GrpcDialOption, func(client volume_server_pb.VolumeServerClient) error {+ err = operation.WithVolumeServerClient(false, sourceVolumeServer, c.env.option.GrpcDialOption, func(client volume_server_pb.VolumeServerClient) error {resp, err := client.ReadNeedleBlob(context.Background(), &volume_server_pb.ReadNeedleBlobRequest{VolumeId: volumeId,NeedleId: uint64(needleValue.Key),@@ -200,7 +200,7 @@ func (c *commandVolumeCheckDisk) readSourceNeedleBlob(sourceVolumeServer pb.Servfunc (c *commandVolumeCheckDisk) writeNeedleBlobToTarget(targetVolumeServer pb.ServerAddress, volumeId uint32, needleValue needle_map.NeedleValue, needleBlob []byte) error {- return operation.WithVolumeServerClient(targetVolumeServer, c.env.option.GrpcDialOption, func(client volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(false, targetVolumeServer, c.env.option.GrpcDialOption, func(client volume_server_pb.VolumeServerClient) error {_, err := client.WriteNeedleBlob(context.Background(), &volume_server_pb.WriteNeedleBlobRequest{VolumeId: volumeId,NeedleId: uint64(needleValue.Key),@@ -229,7 +229,7 @@ func (c *commandVolumeCheckDisk) readIndexDatabase(db *needle_map.MemDb, collectfunc (c *commandVolumeCheckDisk) copyVolumeIndexFile(collection string, volumeId uint32, volumeServer pb.ServerAddress, buf *bytes.Buffer, verbose bool, writer io.Writer) error {- return operation.WithVolumeServerClient(volumeServer, c.env.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(true, volumeServer, c.env.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {ext := ".idx"diff --git a/weed/shell/command_volume_configure_replication.go b/weed/shell/command_volume_configure_replication.goindex 27cba618b2..5c4c101466 100644--- a/weed/shell/command_volume_configure_replication.go+++ b/weed/shell/command_volume_configure_replication.go@@ -86,7 +86,7 @@ func (c *commandVolumeConfigureReplication) Do(args []string, commandEnv *Comman}for _, dst := range allLocations {- err := operation.WithVolumeServerClient(pb.NewServerAddressFromDataNode(dst.dataNode), commandEnv.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(false, pb.NewServerAddressFromDataNode(dst.dataNode), commandEnv.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {resp, configureErr := volumeServerClient.VolumeConfigure(context.Background(), &volume_server_pb.VolumeConfigureRequest{VolumeId: uint32(vid),Replication: replicaPlacement.String(),diff --git a/weed/shell/command_volume_fix_replication.go b/weed/shell/command_volume_fix_replication.goindex 2885ba11fa..43bf4d0f87 100644--- a/weed/shell/command_volume_fix_replication.go+++ b/weed/shell/command_volume_fix_replication.go@@ -265,7 +265,7 @@ func (c *commandVolumeFixReplication) fixOneUnderReplicatedVolume(commandEnv *Cobreak}- err := operation.WithVolumeServerClient(pb.NewServerAddressFromDataNode(dst.dataNode), commandEnv.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(false, pb.NewServerAddressFromDataNode(dst.dataNode), commandEnv.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {stream, replicateErr := volumeServerClient.VolumeCopy(context.Background(), &volume_server_pb.VolumeCopyRequest{VolumeId: replica.info.Id,SourceDataNode: string(pb.NewServerAddressFromDataNode(replica.location.dataNode)),diff --git a/weed/shell/command_volume_fsck.go b/weed/shell/command_volume_fsck.goindex a7a9813394..7a7cdee56d 100644--- a/weed/shell/command_volume_fsck.go+++ b/weed/shell/command_volume_fsck.go@@ -248,7 +248,7 @@ func (c *commandVolumeFsck) collectOneVolumeFileIds(tempFolder string, volumeIdfmt.Fprintf(writer, "collecting volume %d file ids from %s ...\n", volumeId, vinfo.server)}- return operation.WithVolumeServerClient(vinfo.server, c.env.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(false, vinfo.server, c.env.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {ext := ".idx"if vinfo.isEcVolume {diff --git a/weed/shell/command_volume_mount.go b/weed/shell/command_volume_mount.goindex 575051ffec..7b03b8dfa0 100644--- a/weed/shell/command_volume_mount.go+++ b/weed/shell/command_volume_mount.go@@ -55,7 +55,7 @@ func (c *commandVolumeMount) Do(args []string, commandEnv *CommandEnv, writer io}func mountVolume(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, sourceVolumeServer pb.ServerAddress) (err error) {- return operation.WithVolumeServerClient(sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(false, sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, mountErr := volumeServerClient.VolumeMount(context.Background(), &volume_server_pb.VolumeMountRequest{VolumeId: uint32(volumeId),})diff --git a/weed/shell/command_volume_move.go b/weed/shell/command_volume_move.goindex 796f742649..d7cc8b8cea 100644--- a/weed/shell/command_volume_move.go+++ b/weed/shell/command_volume_move.go@@ -112,7 +112,7 @@ func copyVolume(grpcDialOption grpc.DialOption, writer io.Writer, volumeId needlreturn}- clientErr := operation.WithVolumeServerClient(sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ clientErr := operation.WithVolumeServerClient(false, sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, writableErr := volumeServerClient.VolumeMarkWritable(context.Background(), &volume_server_pb.VolumeMarkWritableRequest{VolumeId: uint32(volumeId),})@@ -123,7 +123,7 @@ func copyVolume(grpcDialOption grpc.DialOption, writer io.Writer, volumeId needl}}()- err = operation.WithVolumeServerClient(sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err = operation.WithVolumeServerClient(false, sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {resp, statusErr := volumeServerClient.VolumeStatus(context.Background(), &volume_server_pb.VolumeStatusRequest{VolumeId: uint32(volumeId),})@@ -140,7 +140,7 @@ func copyVolume(grpcDialOption grpc.DialOption, writer io.Writer, volumeId needlreturn}- err = operation.WithVolumeServerClient(targetVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err = operation.WithVolumeServerClient(true, targetVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {stream, replicateErr := volumeServerClient.VolumeCopy(context.Background(), &volume_server_pb.VolumeCopyRequest{VolumeId: uint32(volumeId),SourceDataNode: string(sourceVolumeServer),@@ -173,7 +173,7 @@ func copyVolume(grpcDialOption grpc.DialOption, writer io.Writer, volumeId needlfunc tailVolume(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, sourceVolumeServer, targetVolumeServer pb.ServerAddress, lastAppendAtNs uint64, idleTimeout time.Duration) (err error) {- return operation.WithVolumeServerClient(targetVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(true, targetVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, replicateErr := volumeServerClient.VolumeTailReceiver(context.Background(), &volume_server_pb.VolumeTailReceiverRequest{VolumeId: uint32(volumeId),SinceNs: lastAppendAtNs,@@ -186,7 +186,7 @@ func tailVolume(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, source}func deleteVolume(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, sourceVolumeServer pb.ServerAddress) (err error) {- return operation.WithVolumeServerClient(sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(false, sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, deleteErr := volumeServerClient.VolumeDelete(context.Background(), &volume_server_pb.VolumeDeleteRequest{VolumeId: uint32(volumeId),})@@ -195,7 +195,7 @@ func deleteVolume(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, sour}func markVolumeWritable(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, sourceVolumeServer pb.ServerAddress, writable bool) (err error) {- return operation.WithVolumeServerClient(sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(false, sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {if writable {_, err = volumeServerClient.VolumeMarkWritable(context.Background(), &volume_server_pb.VolumeMarkWritableRequest{VolumeId: uint32(volumeId),diff --git a/weed/shell/command_volume_server_leave.go b/weed/shell/command_volume_server_leave.goindex 4daa589be9..029ef2201f 100644--- a/weed/shell/command_volume_server_leave.go+++ b/weed/shell/command_volume_server_leave.go@@ -56,7 +56,7 @@ func (c *commandVolumeServerLeave) Do(args []string, commandEnv *CommandEnv, wri}func volumeServerLeave(grpcDialOption grpc.DialOption, volumeServer pb.ServerAddress, writer io.Writer) (err error) {- return operation.WithVolumeServerClient(volumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(false, volumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, leaveErr := volumeServerClient.VolumeServerLeave(context.Background(), &volume_server_pb.VolumeServerLeaveRequest{})if leaveErr != nil {fmt.Fprintf(writer, "ask volume server %s to leave: %v\n", volumeServer, leaveErr)diff --git a/weed/shell/command_volume_tier_download.go b/weed/shell/command_volume_tier_download.goindex 57d3bf3477..a2330ab8a3 100644--- a/weed/shell/command_volume_tier_download.go+++ b/weed/shell/command_volume_tier_download.go@@ -124,7 +124,7 @@ func doVolumeTierDownload(commandEnv *CommandEnv, writer io.Writer, collection sfunc downloadDatFromRemoteTier(grpcDialOption grpc.DialOption, writer io.Writer, volumeId needle.VolumeId, collection string, targetVolumeServer pb.ServerAddress) error {- err := operation.WithVolumeServerClient(targetVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(true, targetVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {stream, downloadErr := volumeServerClient.VolumeTierMoveDatFromRemote(context.Background(), &volume_server_pb.VolumeTierMoveDatFromRemoteRequest{VolumeId: uint32(volumeId),Collection: collection,diff --git a/weed/shell/command_volume_tier_upload.go b/weed/shell/command_volume_tier_upload.goindex a22fe92a15..0df0790e6e 100644--- a/weed/shell/command_volume_tier_upload.go+++ b/weed/shell/command_volume_tier_upload.go@@ -118,7 +118,7 @@ func doVolumeTierUpload(commandEnv *CommandEnv, writer io.Writer, collection strfunc uploadDatToRemoteTier(grpcDialOption grpc.DialOption, writer io.Writer, volumeId needle.VolumeId, collection string, sourceVolumeServer pb.ServerAddress, dest string, keepLocalDatFile bool) error {- err := operation.WithVolumeServerClient(sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(true, sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {stream, copyErr := volumeServerClient.VolumeTierMoveDatToRemote(context.Background(), &volume_server_pb.VolumeTierMoveDatToRemoteRequest{VolumeId: uint32(volumeId),Collection: collection,diff --git a/weed/shell/command_volume_unmount.go b/weed/shell/command_volume_unmount.goindex d5cb9f07c6..85bec44f74 100644--- a/weed/shell/command_volume_unmount.go+++ b/weed/shell/command_volume_unmount.go@@ -55,7 +55,7 @@ func (c *commandVolumeUnmount) Do(args []string, commandEnv *CommandEnv, writer}func unmountVolume(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, sourceVolumeServer pb.ServerAddress) (err error) {- return operation.WithVolumeServerClient(sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(false, sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, unmountErr := volumeServerClient.VolumeUnmount(context.Background(), &volume_server_pb.VolumeUnmountRequest{VolumeId: uint32(volumeId),})diff --git a/weed/shell/command_volume_vacuum.go b/weed/shell/command_volume_vacuum.goindex 2e09a8c1b1..a09bf5d56e 100644--- a/weed/shell/command_volume_vacuum.go+++ b/weed/shell/command_volume_vacuum.go@@ -39,7 +39,7 @@ func (c *commandVacuum) Do(args []string, commandEnv *CommandEnv, writer io.Writreturn}- err = commandEnv.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {+ err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {_, err = client.VacuumVolume(context.Background(), &master_pb.VacuumVolumeRequest{GarbageThreshold: float32(*garbageThreshold),})diff --git a/weed/shell/commands.go b/weed/shell/commands.goindex 02c0af59e7..985f6423bc 100644--- a/weed/shell/commands.go+++ b/weed/shell/commands.go@@ -97,9 +97,9 @@ func (ce *CommandEnv) checkDirectory(path string) error {var _ = filer_pb.FilerClient(&CommandEnv{})-func (ce *CommandEnv) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {+func (ce *CommandEnv) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) error {- return pb.WithGrpcFilerClient(ce.option.FilerAddress, ce.option.GrpcDialOption, fn)+ return pb.WithGrpcFilerClient(streamingMode, ce.option.FilerAddress, ce.option.GrpcDialOption, fn)}diff --git a/weed/shell/shell_liner.go b/weed/shell/shell_liner.goindex caf8da8594..0aa65f0494 100644--- a/weed/shell/shell_liner.go+++ b/weed/shell/shell_liner.go@@ -53,7 +53,7 @@ func RunShell(options ShellOptions) {if commandEnv.option.FilerAddress == "" {var filers []pb.ServerAddress- commandEnv.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {+ commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {resp, err := client.ListClusterNodes(context.Background(), &master_pb.ListClusterNodesRequest{ClientType: cluster.FilerType,})@@ -75,7 +75,7 @@ func RunShell(options ShellOptions) {}if commandEnv.option.FilerAddress != "" {- commandEnv.WithFilerClient(func(filerClient filer_pb.SeaweedFilerClient) error {+ commandEnv.WithFilerClient(false, func(filerClient filer_pb.SeaweedFilerClient) error {resp, err := filerClient.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})if err != nil {return errdiff --git a/weed/storage/store_ec.go b/weed/storage/store_ec.goindex 0e33a8e329..70e1593a05 100644--- a/weed/storage/store_ec.go+++ b/weed/storage/store_ec.go@@ -239,7 +239,7 @@ func (s *Store) cachedLookupEcShardLocations(ecVolume *erasure_coding.EcVolume)glog.V(3).Infof("lookup and cache ec volume %d locations", ecVolume.VolumeId)- err = operation.WithMasterServerClient(s.MasterAddress, s.grpcDialOption, func(masterClient master_pb.SeaweedClient) error {+ err = operation.WithMasterServerClient(false, s.MasterAddress, s.grpcDialOption, func(masterClient master_pb.SeaweedClient) error {req := &master_pb.LookupEcVolumeRequest{VolumeId: uint32(ecVolume.VolumeId),}@@ -287,7 +287,7 @@ func (s *Store) readRemoteEcShardInterval(sourceDataNodes []pb.ServerAddress, nefunc (s *Store) doReadRemoteEcShardInterval(sourceDataNode pb.ServerAddress, needleId types.NeedleId, vid needle.VolumeId, shardId erasure_coding.ShardId, buf []byte, offset int64) (n int, is_deleted bool, err error) {- err = operation.WithVolumeServerClient(sourceDataNode, s.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {+ err = operation.WithVolumeServerClient(false, sourceDataNode, s.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {// copy data sliceshardReadClient, err := client.VolumeEcShardRead(context.Background(), &volume_server_pb.VolumeEcShardReadRequest{diff --git a/weed/storage/store_ec_delete.go b/weed/storage/store_ec_delete.goindex d40165ff5e..398771a83d 100644--- a/weed/storage/store_ec_delete.go+++ b/weed/storage/store_ec_delete.go@@ -88,7 +88,7 @@ func (s *Store) doDeleteNeedleFromRemoteEcShardServers(shardId erasure_coding.Shfunc (s *Store) doDeleteNeedleFromRemoteEcShard(sourceDataNode pb.ServerAddress, vid needle.VolumeId, collection string, version needle.Version, needleId types.NeedleId) error {- return operation.WithVolumeServerClient(sourceDataNode, s.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(false, sourceDataNode, s.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {// copy data slice_, err := client.VolumeEcBlobDelete(context.Background(), &volume_server_pb.VolumeEcBlobDeleteRequest{diff --git a/weed/storage/volume_backup.go b/weed/storage/volume_backup.goindex a8ec50cad2..67406aff62 100644--- a/weed/storage/volume_backup.go+++ b/weed/storage/volume_backup.go@@ -73,7 +73,7 @@ func (v *Volume) IncrementalBackup(volumeServer pb.ServerAddress, grpcDialOptionwriteOffset := int64(startFromOffset)- err = operation.WithVolumeServerClient(volumeServer, grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {+ err = operation.WithVolumeServerClient(false, volumeServer, grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {stream, err := client.VolumeIncrementalCopy(context.Background(), &volume_server_pb.VolumeIncrementalCopyRequest{VolumeId: uint32(v.Id),diff --git a/weed/topology/allocate_volume.go b/weed/topology/allocate_volume.goindex 83043c23fb..e1ae30c2d3 100644--- a/weed/topology/allocate_volume.go+++ b/weed/topology/allocate_volume.go@@ -15,7 +15,7 @@ type AllocateVolumeResult struct {func AllocateVolume(dn *DataNode, grpcDialOption grpc.DialOption, vid needle.VolumeId, option *VolumeGrowOption) error {- return operation.WithVolumeServerClient(dn.ServerAddress(), grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {+ return operation.WithVolumeServerClient(false, dn.ServerAddress(), grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {_, deleteErr := client.AllocateVolume(context.Background(), &volume_server_pb.AllocateVolumeRequest{VolumeId: uint32(vid),diff --git a/weed/topology/topology_vacuum.go b/weed/topology/topology_vacuum.goindex 40e3f70e78..74d70bcdbe 100644--- a/weed/topology/topology_vacuum.go+++ b/weed/topology/topology_vacuum.go@@ -22,7 +22,7 @@ func (t *Topology) batchVacuumVolumeCheck(grpcDialOption grpc.DialOption, vid neerrCount := int32(0)for index, dn := range locationlist.list {go func(index int, url pb.ServerAddress, vid needle.VolumeId) {- err := operation.WithVolumeServerClient(url, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(true, url, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {resp, err := volumeServerClient.VacuumVolumeCheck(context.Background(), &volume_server_pb.VacuumVolumeCheckRequest{VolumeId: uint32(vid),})@@ -70,7 +70,7 @@ func (t *Topology) batchVacuumVolumeCompact(grpcDialOption grpc.DialOption, vl *for index, dn := range locationlist.list {go func(index int, url pb.ServerAddress, vid needle.VolumeId) {glog.V(0).Infoln(index, "Start vacuuming", vid, "on", url)- err := operation.WithVolumeServerClient(url, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(true, url, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {stream, err := volumeServerClient.VacuumVolumeCompact(context.Background(), &volume_server_pb.VacuumVolumeCompactRequest{VolumeId: uint32(vid),Preallocate: preallocate,@@ -121,7 +121,7 @@ func (t *Topology) batchVacuumVolumeCommit(grpcDialOption grpc.DialOption, vl *VisReadOnly := falsefor _, dn := range locationlist.list {glog.V(0).Infoln("Start Committing vacuum", vid, "on", dn.Url())- err := operation.WithVolumeServerClient(dn.ServerAddress(), grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(true, dn.ServerAddress(), grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {resp, err := volumeServerClient.VacuumVolumeCommit(context.Background(), &volume_server_pb.VacuumVolumeCommitRequest{VolumeId: uint32(vid),})@@ -147,7 +147,7 @@ func (t *Topology) batchVacuumVolumeCommit(grpcDialOption grpc.DialOption, vl *Vfunc (t *Topology) batchVacuumVolumeCleanup(grpcDialOption grpc.DialOption, vl *VolumeLayout, vid needle.VolumeId, locationlist *VolumeLocationList) {for _, dn := range locationlist.list {glog.V(0).Infoln("Start cleaning up", vid, "on", dn.Url())- err := operation.WithVolumeServerClient(dn.ServerAddress(), grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {+ err := operation.WithVolumeServerClient(true, dn.ServerAddress(), grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {_, err := volumeServerClient.VacuumVolumeCleanup(context.Background(), &volume_server_pb.VacuumVolumeCleanupRequest{VolumeId: uint32(vid),})diff --git a/weed/wdclient/exclusive_locks/exclusive_locker.go b/weed/wdclient/exclusive_locks/exclusive_locker.goindex 725fa307d8..1767ee4a43 100644--- a/weed/wdclient/exclusive_locks/exclusive_locker.go+++ b/weed/wdclient/exclusive_locks/exclusive_locker.go@@ -54,7 +54,7 @@ func (l *ExclusiveLocker) RequestLock(clientName string) {// retry to get the leasefor {- if err := l.masterClient.WithClient(func(client master_pb.SeaweedClient) error {+ if err := l.masterClient.WithClient(false, func(client master_pb.SeaweedClient) error {resp, err := client.LeaseAdminToken(ctx, &master_pb.LeaseAdminTokenRequest{PreviousToken: atomic.LoadInt64(&l.token),PreviousLockTime: atomic.LoadInt64(&l.lockTsNs),@@ -82,7 +82,7 @@ func (l *ExclusiveLocker) RequestLock(clientName string) {defer cancel2()for l.isLocking {- if err := l.masterClient.WithClient(func(client master_pb.SeaweedClient) error {+ if err := l.masterClient.WithClient(false, func(client master_pb.SeaweedClient) error {resp, err := client.LeaseAdminToken(ctx2, &master_pb.LeaseAdminTokenRequest{PreviousToken: atomic.LoadInt64(&l.token),PreviousLockTime: atomic.LoadInt64(&l.lockTsNs),@@ -114,7 +114,7 @@ func (l *ExclusiveLocker) ReleaseLock() {ctx, cancel := context.WithCancel(context.Background())defer cancel()- l.masterClient.WithClient(func(client master_pb.SeaweedClient) error {+ l.masterClient.WithClient(false, func(client master_pb.SeaweedClient) error {client.ReleaseAdminToken(ctx, &master_pb.ReleaseAdminTokenRequest{PreviousToken: atomic.LoadInt64(&l.token),PreviousLockTime: atomic.LoadInt64(&l.lockTsNs),diff --git a/weed/wdclient/masterclient.go b/weed/wdclient/masterclient.goindex 727d9cd340..672b3ac494 100644--- a/weed/wdclient/masterclient.go+++ b/weed/wdclient/masterclient.go@@ -59,7 +59,7 @@ func (mc *MasterClient) FindLeaderFromOtherPeers(myMasterAddress pb.ServerAddresif master == myMasterAddress {continue}- if grpcErr := pb.WithMasterClient(master, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {+ if grpcErr := pb.WithMasterClient(false, master, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {ctx, cancel := context.WithTimeout(context.Background(), 120*time.Millisecond)defer cancel()resp, err := client.GetMasterConfiguration(ctx, &master_pb.GetMasterConfigurationRequest{})@@ -96,7 +96,7 @@ func (mc *MasterClient) tryAllMasters() {func (mc *MasterClient) tryConnectToMaster(master pb.ServerAddress) (nextHintedLeader pb.ServerAddress) {glog.V(1).Infof("%s masterClient Connecting to master %v", mc.clientType, master)- gprcErr := pb.WithMasterClient(master, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {+ gprcErr := pb.WithMasterClient(true, master, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {ctx, cancel := context.WithCancel(context.Background())defer cancel()@@ -172,12 +172,12 @@ func (mc *MasterClient) tryConnectToMaster(master pb.ServerAddress) (nextHintedLreturn}-func (mc *MasterClient) WithClient(fn func(client master_pb.SeaweedClient) error) error {+func (mc *MasterClient) WithClient(streamingMode bool, fn func(client master_pb.SeaweedClient) error) error {return util.Retry("master grpc", func() error {for mc.currentMaster == "" {time.Sleep(3 * time.Second)}- return pb.WithMasterClient(mc.currentMaster, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {+ return pb.WithMasterClient(streamingMode, mc.currentMaster, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {return fn(client)})})