Skip to content

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.

better way to detect a master isLeader

Chris Lu7a493bbefa8a
diff --git a/weed/topology/topology.go b/weed/topology/topology.go
index 4242bfa05e..ff23be1ffa 100644
--- a/weed/topology/topology.go
+++ b/weed/topology/topology.go
@@ -50,6 +50,9 @@ func NewTopology(id string, seq sequence.Sequencer, volumeSizeLimit uint64, puls
}
func (t *Topology) IsLeader() bool {
+ if t.RaftServer!=nil {
+ return t.RaftServer.State() == raft.Leader
+ }
if leader, e := t.Leader(); e == nil {
return leader == t.RaftServer.Name()
}