master: enable dual-write to both seaweedfs/raft and hashicorp/raft

When using seaweedfs/raft (-raftHashicorp=false), also initialize hashicorp
raft in parallel. All state changes are written to both raft implementations,
keeping hashicorp raft in sync.

This enables seamless migration to hashicorp/raft:
- No manual steps required for existing deployments
- When ready, switch to -raftHashicorp=true and hashicorp raft already has
  all the state
- The old seaweedfs/raft can be removed in a future version

Changes:
- NewRaftServer now initializes hashicorp raft in a subdirectory
- NextVolumeId writes to both raft implementations when both exist
- SetRaftServer sets both RaftServer and HashicorpRaft in topology
- Transport manager for hashicorp raft is registered for gRPC
This commit is contained in:
chrislu committed 2025-12-18 22:28:27 -08:00
1 parent 134fd6a1ae
commit cad5b8b281
4 files changed
+101

No files matched your search

+5
View File
@@ -244,6 +244,11 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) {
raftServer.TransportManager.Register(grpcS)
} else {
protobuf.RegisterRaftServer(grpcS, raftServer)
// Also register hashicorp transport for dual-write migration
if raftServer.TransportManager != nil {
raftServer.TransportManager.Register(grpcS)
glog.V(0).Infof("Dual-write: hashicorp raft transport registered")
}
}
reflection.Register(grpcS)
glog.V(0).Infof("Start Seaweed Master %s grpc server at %s:%d", version.Version(), *masterOption.ipBind, grpcPort)