mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-01-18 22:43:41 +08:00
filer only talk to the master leader
This commit is contained in:
parent
e8d4be579d
commit
1ab8232b55
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/chrislusf/seaweedfs/weed/topology"
|
"github.com/chrislusf/seaweedfs/weed/topology"
|
||||||
"google.golang.org/grpc/peer"
|
"google.golang.org/grpc/peer"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/chrislusf/raft"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServer) error {
|
func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServer) error {
|
||||||
@ -105,7 +106,8 @@ func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeepConnected keep a stream gRPC call to the master. Used by filer to know the master is up.
|
// KeepConnected keep a stream gRPC call to the master. Used by clients to know the master is up.
|
||||||
|
// And clients gets the up-to-date list of volume locations
|
||||||
func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServer) error {
|
func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServer) error {
|
||||||
|
|
||||||
req, err := stream.Recv()
|
req, err := stream.Recv()
|
||||||
@ -113,6 +115,10 @@ func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServ
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !ms.Topo.IsLeader() {
|
||||||
|
return raft.NotLeaderError
|
||||||
|
}
|
||||||
|
|
||||||
// remember client address
|
// remember client address
|
||||||
ctx := stream.Context()
|
ctx := stream.Context()
|
||||||
// fmt.Printf("FromContext %+v\n", ctx)
|
// fmt.Printf("FromContext %+v\n", ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user