* Prevent split-brain: Persistent ClusterID and Join Validation - Persist ClusterId in Raft store to survive restarts. - Validate ClusterId on Raft command application (piggybacked on MaxVolumeId). - Prevent masters with conflicting ClusterIds from joining/operating together. - Update Telemetry to report the persistent ClusterId. * Refine ClusterID validation based on feedback - Improved error message in cluster_commands.go. - Added ClusterId mismatch check in RaftServer.Recovery. * Handle Raft errors and support Hashicorp Raft for ClusterId - Check for errors when persisting ClusterId in legacy Raft. - Implement ClusterId generation and persistence for Hashicorp Raft leader changes. - Ensure consistent error logging. * Refactor ClusterId validation - Centralize ClusterId mismatch check in Topology.SetClusterId. - Simplify MaxVolumeIdCommand.Apply and RaftServer.Recovery to rely on SetClusterId. * Fix goroutine leak and add timeout - Handle channel closure in Hashicorp Raft leader listener. - Add timeout to Raft Apply call to prevent blocking. * Fix deadlock in legacy Raft listener - Wrap ClusterId generation/persistence in a goroutine to avoid blocking the Raft event loop (deadlock). * Rename ClusterId to SystemId - Renamed ClusterId to SystemId across the codebase (protobuf, topology, server, telemetry). - Regenerated telemetry.pb.go with new field. * Rename SystemId to TopologyId - Rename to SystemId was intermediate step. - Final name is TopologyId for the persistent cluster identifier. - Updated protobuf, topology, raft server, master server, and telemetry. * Optimize Hashicorp Raft listener - Integrated TopologyId generation into existing monitorLeaderLoop. - Removed extra goroutine in master_server.go. * Fix optimistic TopologyId update - Removed premature local state update of TopologyId in master_server.go and raft_hashicorp.go. - State is now solely updated via the Raft state machine Apply/Restore methods after consensus. * Add explicit log for recovered TopologyId - Added glog.V(0) info log in RaftServer.Recovery to print the recovered TopologyId on startup. * Add Raft barrier to prevent TopologyId race condition - Implement ensureTopologyId helper method - Send no-op MaxVolumeIdCommand to sync Raft log before checking TopologyId - Ensures persisted TopologyId is recovered before generating new one - Prevents race where generation happens during log replay * Serialize TopologyId generation with mutex - Add topologyIdGenLock mutex to MasterServer struct - Wrap ensureTopologyId method with lock to prevent concurrent generation - Fixes race where event listener and manual leadership check both generate IDs - Second caller waits for first to complete and sees the generated ID * Add TopologyId recovery logging to Apply method - Change log level from V(1) to V(0) for visibility - Log 'Recovered TopologyId' when applying from Raft log - Ensures recovery is visible whether from snapshot or log replay - Matches Recovery() method logging for consistency * Fix Raft barrier timing issue - Add 100ms delay after barrier command to ensure log application completes - Add debug logging to track barrier execution and TopologyId state - Return early if barrier command fails - Prevents TopologyId generation before old logs are fully applied * ensure leader * address comments * address comments * redundant * clean up * double check * refactoring * comment
314 lines
9.8 KiB
Go
314 lines
9.8 KiB
Go
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// versions:
|
|
// protoc-gen-go v1.36.6
|
|
// protoc v6.33.1
|
|
// source: telemetry/proto/telemetry.proto
|
|
|
|
package proto
|
|
|
|
import (
|
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
|
reflect "reflect"
|
|
sync "sync"
|
|
unsafe "unsafe"
|
|
)
|
|
|
|
const (
|
|
// Verify that this generated code is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
|
)
|
|
|
|
// TelemetryData represents cluster-level telemetry information
|
|
type TelemetryData struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
// Unique cluster identifier (generated in-memory)
|
|
TopologyId string `protobuf:"bytes,1,opt,name=topology_id,json=topologyId,proto3" json:"topology_id,omitempty"`
|
|
// SeaweedFS version
|
|
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
|
|
// Operating system (e.g., "linux/amd64")
|
|
Os string `protobuf:"bytes,3,opt,name=os,proto3" json:"os,omitempty"`
|
|
// Number of volume servers in the cluster
|
|
VolumeServerCount int32 `protobuf:"varint,6,opt,name=volume_server_count,json=volumeServerCount,proto3" json:"volume_server_count,omitempty"`
|
|
// Total disk usage across all volume servers (in bytes)
|
|
TotalDiskBytes uint64 `protobuf:"varint,7,opt,name=total_disk_bytes,json=totalDiskBytes,proto3" json:"total_disk_bytes,omitempty"`
|
|
// Total number of volumes in the cluster
|
|
TotalVolumeCount int32 `protobuf:"varint,8,opt,name=total_volume_count,json=totalVolumeCount,proto3" json:"total_volume_count,omitempty"`
|
|
// Number of filer servers in the cluster
|
|
FilerCount int32 `protobuf:"varint,9,opt,name=filer_count,json=filerCount,proto3" json:"filer_count,omitempty"`
|
|
// Number of broker servers in the cluster
|
|
BrokerCount int32 `protobuf:"varint,10,opt,name=broker_count,json=brokerCount,proto3" json:"broker_count,omitempty"`
|
|
// Unix timestamp when the data was collected
|
|
Timestamp int64 `protobuf:"varint,11,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *TelemetryData) Reset() {
|
|
*x = TelemetryData{}
|
|
mi := &file_telemetry_proto_telemetry_proto_msgTypes[0]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *TelemetryData) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*TelemetryData) ProtoMessage() {}
|
|
|
|
func (x *TelemetryData) ProtoReflect() protoreflect.Message {
|
|
mi := &file_telemetry_proto_telemetry_proto_msgTypes[0]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use TelemetryData.ProtoReflect.Descriptor instead.
|
|
func (*TelemetryData) Descriptor() ([]byte, []int) {
|
|
return file_telemetry_proto_telemetry_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
func (x *TelemetryData) GetTopologyId() string {
|
|
if x != nil {
|
|
return x.TopologyId
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *TelemetryData) GetVersion() string {
|
|
if x != nil {
|
|
return x.Version
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *TelemetryData) GetOs() string {
|
|
if x != nil {
|
|
return x.Os
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *TelemetryData) GetVolumeServerCount() int32 {
|
|
if x != nil {
|
|
return x.VolumeServerCount
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *TelemetryData) GetTotalDiskBytes() uint64 {
|
|
if x != nil {
|
|
return x.TotalDiskBytes
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *TelemetryData) GetTotalVolumeCount() int32 {
|
|
if x != nil {
|
|
return x.TotalVolumeCount
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *TelemetryData) GetFilerCount() int32 {
|
|
if x != nil {
|
|
return x.FilerCount
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *TelemetryData) GetBrokerCount() int32 {
|
|
if x != nil {
|
|
return x.BrokerCount
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *TelemetryData) GetTimestamp() int64 {
|
|
if x != nil {
|
|
return x.Timestamp
|
|
}
|
|
return 0
|
|
}
|
|
|
|
// TelemetryRequest is sent from SeaweedFS clusters to the telemetry server
|
|
type TelemetryRequest struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Data *TelemetryData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *TelemetryRequest) Reset() {
|
|
*x = TelemetryRequest{}
|
|
mi := &file_telemetry_proto_telemetry_proto_msgTypes[1]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *TelemetryRequest) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*TelemetryRequest) ProtoMessage() {}
|
|
|
|
func (x *TelemetryRequest) ProtoReflect() protoreflect.Message {
|
|
mi := &file_telemetry_proto_telemetry_proto_msgTypes[1]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use TelemetryRequest.ProtoReflect.Descriptor instead.
|
|
func (*TelemetryRequest) Descriptor() ([]byte, []int) {
|
|
return file_telemetry_proto_telemetry_proto_rawDescGZIP(), []int{1}
|
|
}
|
|
|
|
func (x *TelemetryRequest) GetData() *TelemetryData {
|
|
if x != nil {
|
|
return x.Data
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// TelemetryResponse is returned by the telemetry server
|
|
type TelemetryResponse struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
|
|
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *TelemetryResponse) Reset() {
|
|
*x = TelemetryResponse{}
|
|
mi := &file_telemetry_proto_telemetry_proto_msgTypes[2]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *TelemetryResponse) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*TelemetryResponse) ProtoMessage() {}
|
|
|
|
func (x *TelemetryResponse) ProtoReflect() protoreflect.Message {
|
|
mi := &file_telemetry_proto_telemetry_proto_msgTypes[2]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use TelemetryResponse.ProtoReflect.Descriptor instead.
|
|
func (*TelemetryResponse) Descriptor() ([]byte, []int) {
|
|
return file_telemetry_proto_telemetry_proto_rawDescGZIP(), []int{2}
|
|
}
|
|
|
|
func (x *TelemetryResponse) GetSuccess() bool {
|
|
if x != nil {
|
|
return x.Success
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (x *TelemetryResponse) GetMessage() string {
|
|
if x != nil {
|
|
return x.Message
|
|
}
|
|
return ""
|
|
}
|
|
|
|
var File_telemetry_proto_telemetry_proto protoreflect.FileDescriptor
|
|
|
|
const file_telemetry_proto_telemetry_proto_rawDesc = "" +
|
|
"\n" +
|
|
"\x1ftelemetry/proto/telemetry.proto\x12\ttelemetry\"\xd0\x02\n" +
|
|
"\rTelemetryData\x12\x1f\n" +
|
|
"\vtopology_id\x18\x01 \x01(\tR\n" +
|
|
"topologyId\x12\x18\n" +
|
|
"\aversion\x18\x02 \x01(\tR\aversion\x12\x0e\n" +
|
|
"\x02os\x18\x03 \x01(\tR\x02os\x12.\n" +
|
|
"\x13volume_server_count\x18\x06 \x01(\x05R\x11volumeServerCount\x12(\n" +
|
|
"\x10total_disk_bytes\x18\a \x01(\x04R\x0etotalDiskBytes\x12,\n" +
|
|
"\x12total_volume_count\x18\b \x01(\x05R\x10totalVolumeCount\x12\x1f\n" +
|
|
"\vfiler_count\x18\t \x01(\x05R\n" +
|
|
"filerCount\x12!\n" +
|
|
"\fbroker_count\x18\n" +
|
|
" \x01(\x05R\vbrokerCount\x12\x1c\n" +
|
|
"\ttimestamp\x18\v \x01(\x03R\ttimestampJ\x04\b\x04\x10\x05J\x04\b\x05\x10\x06\"@\n" +
|
|
"\x10TelemetryRequest\x12,\n" +
|
|
"\x04data\x18\x01 \x01(\v2\x18.telemetry.TelemetryDataR\x04data\"G\n" +
|
|
"\x11TelemetryResponse\x12\x18\n" +
|
|
"\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" +
|
|
"\amessage\x18\x02 \x01(\tR\amessageB0Z.github.com/seaweedfs/seaweedfs/telemetry/protob\x06proto3"
|
|
|
|
var (
|
|
file_telemetry_proto_telemetry_proto_rawDescOnce sync.Once
|
|
file_telemetry_proto_telemetry_proto_rawDescData []byte
|
|
)
|
|
|
|
func file_telemetry_proto_telemetry_proto_rawDescGZIP() []byte {
|
|
file_telemetry_proto_telemetry_proto_rawDescOnce.Do(func() {
|
|
file_telemetry_proto_telemetry_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_telemetry_proto_telemetry_proto_rawDesc), len(file_telemetry_proto_telemetry_proto_rawDesc)))
|
|
})
|
|
return file_telemetry_proto_telemetry_proto_rawDescData
|
|
}
|
|
|
|
var file_telemetry_proto_telemetry_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
|
var file_telemetry_proto_telemetry_proto_goTypes = []any{
|
|
(*TelemetryData)(nil), // 0: telemetry.TelemetryData
|
|
(*TelemetryRequest)(nil), // 1: telemetry.TelemetryRequest
|
|
(*TelemetryResponse)(nil), // 2: telemetry.TelemetryResponse
|
|
}
|
|
var file_telemetry_proto_telemetry_proto_depIdxs = []int32{
|
|
0, // 0: telemetry.TelemetryRequest.data:type_name -> telemetry.TelemetryData
|
|
1, // [1:1] is the sub-list for method output_type
|
|
1, // [1:1] is the sub-list for method input_type
|
|
1, // [1:1] is the sub-list for extension type_name
|
|
1, // [1:1] is the sub-list for extension extendee
|
|
0, // [0:1] is the sub-list for field type_name
|
|
}
|
|
|
|
func init() { file_telemetry_proto_telemetry_proto_init() }
|
|
func file_telemetry_proto_telemetry_proto_init() {
|
|
if File_telemetry_proto_telemetry_proto != nil {
|
|
return
|
|
}
|
|
type x struct{}
|
|
out := protoimpl.TypeBuilder{
|
|
File: protoimpl.DescBuilder{
|
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_telemetry_proto_telemetry_proto_rawDesc), len(file_telemetry_proto_telemetry_proto_rawDesc)),
|
|
NumEnums: 0,
|
|
NumMessages: 3,
|
|
NumExtensions: 0,
|
|
NumServices: 0,
|
|
},
|
|
GoTypes: file_telemetry_proto_telemetry_proto_goTypes,
|
|
DependencyIndexes: file_telemetry_proto_telemetry_proto_depIdxs,
|
|
MessageInfos: file_telemetry_proto_telemetry_proto_msgTypes,
|
|
}.Build()
|
|
File_telemetry_proto_telemetry_proto = out.File
|
|
file_telemetry_proto_telemetry_proto_goTypes = nil
|
|
file_telemetry_proto_telemetry_proto_depIdxs = nil
|
|
}
|