diff options
| author | chrislu <chris.lu@gmail.com> | 2024-06-14 11:42:05 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2024-06-14 11:42:05 -0700 |
| commit | 32dbb6a2ceb86a44d7879bdb506ab759d59f056b (patch) | |
| tree | 94c1d9cd5c086b437c4df2847b1a42b6432b535b /weed/server | |
| parent | 70b31e3a28b8169289bb9c55052355a3daacfd12 (diff) | |
| parent | 8aae82dd71735df1cd915a47a9b9d453d393adf6 (diff) | |
| download | seaweedfs-32dbb6a2ceb86a44d7879bdb506ab759d59f056b.tar.xz seaweedfs-32dbb6a2ceb86a44d7879bdb506ab759d59f056b.zip | |
Merge branch 'master' into mq
Diffstat (limited to 'weed/server')
| -rw-r--r-- | weed/server/filer_server.go | 4 | ||||
| -rw-r--r-- | weed/server/master_server.go | 4 | ||||
| -rw-r--r-- | weed/server/master_server_handlers_admin.go | 4 | ||||
| -rw-r--r-- | weed/server/volume_grpc_admin.go | 6 | ||||
| -rw-r--r-- | weed/server/volume_grpc_client_to_master.go | 2 | ||||
| -rw-r--r-- | weed/server/volume_grpc_copy.go | 6 | ||||
| -rw-r--r-- | weed/server/volume_server_handlers_read.go | 3 |
7 files changed, 15 insertions, 14 deletions
diff --git a/weed/server/filer_server.go b/weed/server/filer_server.go index 795cd3ccc..0b7254c0d 100644 --- a/weed/server/filer_server.go +++ b/weed/server/filer_server.go @@ -160,7 +160,7 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) fs.checkWithMaster() go stats.LoopPushingMetric("filer", string(fs.option.Host), fs.metricsAddress, fs.metricsIntervalSec) - go fs.filer.KeepMasterClientConnected() + go fs.filer.KeepMasterClientConnected(context.Background()) if !util.LoadConfiguration("filer", false) { v.SetDefault("leveldb2.enabled", true) @@ -196,7 +196,7 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) readonlyMux.HandleFunc("/", fs.readonlyFilerHandler) } - existingNodes := fs.filer.ListExistingPeerUpdates() + existingNodes := fs.filer.ListExistingPeerUpdates(context.Background()) startFromTime := time.Now().Add(-filer.LogFlushInterval) if option.JoinExistingFiler { startFromTime = time.Time{} diff --git a/weed/server/master_server.go b/weed/server/master_server.go index 580cdfed2..3499a2e13 100644 --- a/weed/server/master_server.go +++ b/weed/server/master_server.go @@ -292,12 +292,12 @@ func (ms *MasterServer) startAdminScripts() { reg, _ := regexp.Compile(`'.*?'|".*?"|\S+`) - go commandEnv.MasterClient.KeepConnectedToMaster() + go commandEnv.MasterClient.KeepConnectedToMaster(context.Background()) go func() { for { time.Sleep(time.Duration(sleepMinutes) * time.Minute) - if ms.Topo.IsLeader() && ms.MasterClient.GetMaster() != "" { + if ms.Topo.IsLeader() && ms.MasterClient.GetMaster(context.Background()) != "" { shellOptions.FilerAddress = ms.GetOneFiler(cluster.FilerGroupName(*shellOptions.FilerGroup)) if shellOptions.FilerAddress == "" { continue diff --git a/weed/server/master_server_handlers_admin.go b/weed/server/master_server_handlers_admin.go index 0d7131340..f40b819af 100644 --- a/weed/server/master_server_handlers_admin.go +++ b/weed/server/master_server_handlers_admin.go @@ -124,13 +124,13 @@ func (ms *MasterServer) redirectHandler(w http.ResponseWriter, r *http.Request) func (ms *MasterServer) submitFromMasterServerHandler(w http.ResponseWriter, r *http.Request) { if ms.Topo.IsLeader() { - submitForClientHandler(w, r, func() pb.ServerAddress { return ms.option.Master }, ms.grpcDialOption) + submitForClientHandler(w, r, func(ctx context.Context) pb.ServerAddress { return ms.option.Master }, ms.grpcDialOption) } else { masterUrl, err := ms.Topo.Leader() if err != nil { writeJsonError(w, r, http.StatusInternalServerError, err) } else { - submitForClientHandler(w, r, func() pb.ServerAddress { return masterUrl }, ms.grpcDialOption) + submitForClientHandler(w, r, func(ctx context.Context) pb.ServerAddress { return masterUrl }, ms.grpcDialOption) } } } diff --git a/weed/server/volume_grpc_admin.go b/weed/server/volume_grpc_admin.go index abd39b582..00a285406 100644 --- a/weed/server/volume_grpc_admin.go +++ b/weed/server/volume_grpc_admin.go @@ -181,7 +181,7 @@ func (vs *VolumeServer) VolumeMarkReadonly(ctx context.Context, req *volume_serv } func (vs *VolumeServer) notifyMasterVolumeReadonly(v *storage.Volume, isReadOnly bool) error { - if grpcErr := pb.WithMasterClient(false, vs.GetMaster(), vs.grpcDialOption, false, func(client master_pb.SeaweedClient) error { + if grpcErr := pb.WithMasterClient(false, vs.GetMaster(context.Background()), vs.grpcDialOption, false, func(client master_pb.SeaweedClient) error { _, err := client.VolumeMarkReadonly(context.Background(), &master_pb.VolumeMarkReadonlyRequest{ Ip: vs.store.Ip, Port: uint32(vs.store.Port), @@ -197,8 +197,8 @@ func (vs *VolumeServer) notifyMasterVolumeReadonly(v *storage.Volume, isReadOnly } return nil }); grpcErr != nil { - glog.V(0).Infof("connect to %s: %v", vs.GetMaster(), grpcErr) - return fmt.Errorf("grpc VolumeMarkReadonly with master %s: %v", vs.GetMaster(), grpcErr) + glog.V(0).Infof("connect to %s: %v", vs.GetMaster(context.Background()), grpcErr) + return fmt.Errorf("grpc VolumeMarkReadonly with master %s: %v", vs.GetMaster(context.Background()), grpcErr) } return nil } diff --git a/weed/server/volume_grpc_client_to_master.go b/weed/server/volume_grpc_client_to_master.go index d2aa61a17..81bb87613 100644 --- a/weed/server/volume_grpc_client_to_master.go +++ b/weed/server/volume_grpc_client_to_master.go @@ -21,7 +21,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/util" ) -func (vs *VolumeServer) GetMaster() pb.ServerAddress { +func (vs *VolumeServer) GetMaster(ctx context.Context) pb.ServerAddress { return vs.currentMaster } diff --git a/weed/server/volume_grpc_copy.go b/weed/server/volume_grpc_copy.go index 51b61b225..6548b7c56 100644 --- a/weed/server/volume_grpc_copy.go +++ b/weed/server/volume_grpc_copy.go @@ -84,17 +84,17 @@ func (vs *VolumeServer) VolumeCopy(req *volume_server_pb.VolumeCopyRequest, stre }() var preallocateSize int64 - if grpcErr := pb.WithMasterClient(false, vs.GetMaster(), vs.grpcDialOption, false, func(client master_pb.SeaweedClient) error { + if grpcErr := pb.WithMasterClient(false, vs.GetMaster(context.Background()), vs.grpcDialOption, false, 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", vs.GetMaster(), err) + return fmt.Errorf("get master %s configuration: %v", vs.GetMaster(context.Background()), err) } if resp.VolumePreallocate { preallocateSize = int64(resp.VolumeSizeLimitMB) * (1 << 20) } return nil }); grpcErr != nil { - glog.V(0).Infof("connect to %s: %v", vs.GetMaster(), grpcErr) + glog.V(0).Infof("connect to %s: %v", vs.GetMaster(context.Background()), grpcErr) } if preallocateSize > 0 && !hasRemoteDatFile { diff --git a/weed/server/volume_server_handlers_read.go b/weed/server/volume_server_handlers_read.go index 08e536811..cc364513b 100644 --- a/weed/server/volume_server_handlers_read.go +++ b/weed/server/volume_server_handlers_read.go @@ -2,6 +2,7 @@ package weed_server import ( "bytes" + "context" "encoding/json" "errors" "fmt" @@ -291,7 +292,7 @@ func (vs *VolumeServer) tryHandleChunkedFile(n *needle.Needle, fileName string, w.Header().Set("X-File-Store", "chunked") - chunkedFileReader := operation.NewChunkedFileReader(chunkManifest.Chunks, vs.GetMaster(), vs.grpcDialOption) + chunkedFileReader := operation.NewChunkedFileReader(chunkManifest.Chunks, vs.GetMaster(context.Background()), vs.grpcDialOption) defer chunkedFileReader.Close() rs := conditionallyCropImages(chunkedFileReader, ext, r) |
