From 8c54b72af39fed529e7cc814828c65fbcd5806d4 Mon Sep 17 00:00:00 2001 From: chrislu Date: Sun, 10 Aug 2025 12:51:01 -0700 Subject: [PATCH] Add `generation` field to volume_server_pb VolumeEcShards{Copy,Generate,Rebuild,ToVolume}Request --- weed/pb/volume_server.proto | 4 ++ weed/pb/volume_server_pb/volume_server.pb.go | 60 +++++++++++++++++--- 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/weed/pb/volume_server.proto b/weed/pb/volume_server.proto index d5d2b158e..c0856634c 100644 --- a/weed/pb/volume_server.proto +++ b/weed/pb/volume_server.proto @@ -381,6 +381,7 @@ message VolumeTailReceiverResponse { message VolumeEcShardsGenerateRequest { uint32 volume_id = 1; string collection = 2; + uint32 generation = 3; // generation to create, defaults to 0 } message VolumeEcShardsGenerateResponse { } @@ -388,6 +389,7 @@ message VolumeEcShardsGenerateResponse { message VolumeEcShardsRebuildRequest { uint32 volume_id = 1; string collection = 2; + uint32 generation = 3; // generation to rebuild, defaults to 0 } message VolumeEcShardsRebuildResponse { repeated uint32 rebuilt_shard_ids = 1; @@ -402,6 +404,7 @@ message VolumeEcShardsCopyRequest { bool copy_ecj_file = 6; bool copy_vif_file = 7; uint32 disk_id = 8; // Target disk ID for storing EC shards + uint32 generation = 9; // generation to copy, defaults to 0 } message VolumeEcShardsCopyResponse { } @@ -455,6 +458,7 @@ message VolumeEcBlobDeleteResponse { message VolumeEcShardsToVolumeRequest { uint32 volume_id = 1; string collection = 2; + uint32 generation = 3; // generation to convert from, defaults to 0 } message VolumeEcShardsToVolumeResponse { } diff --git a/weed/pb/volume_server_pb/volume_server.pb.go b/weed/pb/volume_server_pb/volume_server.pb.go index decb1f767..fb92c96c7 100644 --- a/weed/pb/volume_server_pb/volume_server.pb.go +++ b/weed/pb/volume_server_pb/volume_server.pb.go @@ -2924,6 +2924,7 @@ type VolumeEcShardsGenerateRequest struct { state protoimpl.MessageState `protogen:"open.v1"` VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId,proto3" json:"volume_id,omitempty"` Collection string `protobuf:"bytes,2,opt,name=collection,proto3" json:"collection,omitempty"` + Generation uint32 `protobuf:"varint,3,opt,name=generation,proto3" json:"generation,omitempty"` // generation to create, defaults to 0 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -2972,6 +2973,13 @@ func (x *VolumeEcShardsGenerateRequest) GetCollection() string { return "" } +func (x *VolumeEcShardsGenerateRequest) GetGeneration() uint32 { + if x != nil { + return x.Generation + } + return 0 +} + type VolumeEcShardsGenerateResponse struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -3012,6 +3020,7 @@ type VolumeEcShardsRebuildRequest struct { state protoimpl.MessageState `protogen:"open.v1"` VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId,proto3" json:"volume_id,omitempty"` Collection string `protobuf:"bytes,2,opt,name=collection,proto3" json:"collection,omitempty"` + Generation uint32 `protobuf:"varint,3,opt,name=generation,proto3" json:"generation,omitempty"` // generation to rebuild, defaults to 0 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -3060,6 +3069,13 @@ func (x *VolumeEcShardsRebuildRequest) GetCollection() string { return "" } +func (x *VolumeEcShardsRebuildRequest) GetGeneration() uint32 { + if x != nil { + return x.Generation + } + return 0 +} + type VolumeEcShardsRebuildResponse struct { state protoimpl.MessageState `protogen:"open.v1"` RebuiltShardIds []uint32 `protobuf:"varint,1,rep,packed,name=rebuilt_shard_ids,json=rebuiltShardIds,proto3" json:"rebuilt_shard_ids,omitempty"` @@ -3114,6 +3130,7 @@ type VolumeEcShardsCopyRequest struct { CopyEcjFile bool `protobuf:"varint,6,opt,name=copy_ecj_file,json=copyEcjFile,proto3" json:"copy_ecj_file,omitempty"` CopyVifFile bool `protobuf:"varint,7,opt,name=copy_vif_file,json=copyVifFile,proto3" json:"copy_vif_file,omitempty"` DiskId uint32 `protobuf:"varint,8,opt,name=disk_id,json=diskId,proto3" json:"disk_id,omitempty"` // Target disk ID for storing EC shards + Generation uint32 `protobuf:"varint,9,opt,name=generation,proto3" json:"generation,omitempty"` // generation to copy, defaults to 0 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -3204,6 +3221,13 @@ func (x *VolumeEcShardsCopyRequest) GetDiskId() uint32 { return 0 } +func (x *VolumeEcShardsCopyRequest) GetGeneration() uint32 { + if x != nil { + return x.Generation + } + return 0 +} + type VolumeEcShardsCopyResponse struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -3772,6 +3796,7 @@ type VolumeEcShardsToVolumeRequest struct { state protoimpl.MessageState `protogen:"open.v1"` VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId,proto3" json:"volume_id,omitempty"` Collection string `protobuf:"bytes,2,opt,name=collection,proto3" json:"collection,omitempty"` + Generation uint32 `protobuf:"varint,3,opt,name=generation,proto3" json:"generation,omitempty"` // generation to convert from, defaults to 0 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -3820,6 +3845,13 @@ func (x *VolumeEcShardsToVolumeRequest) GetCollection() string { return "" } +func (x *VolumeEcShardsToVolumeRequest) GetGeneration() uint32 { + if x != nil { + return x.Generation + } + return 0 +} + type VolumeEcShardsToVolumeResponse struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -6314,20 +6346,26 @@ const file_volume_server_proto_rawDesc = "" + "\bsince_ns\x18\x02 \x01(\x04R\asinceNs\x120\n" + "\x14idle_timeout_seconds\x18\x03 \x01(\rR\x12idleTimeoutSeconds\x120\n" + "\x14source_volume_server\x18\x04 \x01(\tR\x12sourceVolumeServer\"\x1c\n" + - "\x1aVolumeTailReceiverResponse\"\\\n" + + "\x1aVolumeTailReceiverResponse\"|\n" + "\x1dVolumeEcShardsGenerateRequest\x12\x1b\n" + "\tvolume_id\x18\x01 \x01(\rR\bvolumeId\x12\x1e\n" + "\n" + "collection\x18\x02 \x01(\tR\n" + - "collection\" \n" + - "\x1eVolumeEcShardsGenerateResponse\"[\n" + + "collection\x12\x1e\n" + + "\n" + + "generation\x18\x03 \x01(\rR\n" + + "generation\" \n" + + "\x1eVolumeEcShardsGenerateResponse\"{\n" + "\x1cVolumeEcShardsRebuildRequest\x12\x1b\n" + "\tvolume_id\x18\x01 \x01(\rR\bvolumeId\x12\x1e\n" + "\n" + "collection\x18\x02 \x01(\tR\n" + - "collection\"K\n" + + "collection\x12\x1e\n" + + "\n" + + "generation\x18\x03 \x01(\rR\n" + + "generation\"K\n" + "\x1dVolumeEcShardsRebuildResponse\x12*\n" + - "\x11rebuilt_shard_ids\x18\x01 \x03(\rR\x0frebuiltShardIds\"\xa4\x02\n" + + "\x11rebuilt_shard_ids\x18\x01 \x03(\rR\x0frebuiltShardIds\"\xc4\x02\n" + "\x19VolumeEcShardsCopyRequest\x12\x1b\n" + "\tvolume_id\x18\x01 \x01(\rR\bvolumeId\x12\x1e\n" + "\n" + @@ -6338,7 +6376,10 @@ const file_volume_server_proto_rawDesc = "" + "\x10source_data_node\x18\x05 \x01(\tR\x0esourceDataNode\x12\"\n" + "\rcopy_ecj_file\x18\x06 \x01(\bR\vcopyEcjFile\x12\"\n" + "\rcopy_vif_file\x18\a \x01(\bR\vcopyVifFile\x12\x17\n" + - "\adisk_id\x18\b \x01(\rR\x06diskId\"\x1c\n" + + "\adisk_id\x18\b \x01(\rR\x06diskId\x12\x1e\n" + + "\n" + + "generation\x18\t \x01(\rR\n" + + "generation\"\x1c\n" + "\x1aVolumeEcShardsCopyResponse\"w\n" + "\x1bVolumeEcShardsDeleteRequest\x12\x1b\n" + "\tvolume_id\x18\x01 \x01(\rR\bvolumeId\x12\x1e\n" + @@ -6381,12 +6422,15 @@ const file_volume_server_proto_rawDesc = "" + "collection\x12\x19\n" + "\bfile_key\x18\x03 \x01(\x04R\afileKey\x12\x18\n" + "\aversion\x18\x04 \x01(\rR\aversion\"\x1c\n" + - "\x1aVolumeEcBlobDeleteResponse\"\\\n" + + "\x1aVolumeEcBlobDeleteResponse\"|\n" + "\x1dVolumeEcShardsToVolumeRequest\x12\x1b\n" + "\tvolume_id\x18\x01 \x01(\rR\bvolumeId\x12\x1e\n" + "\n" + "collection\x18\x02 \x01(\tR\n" + - "collection\" \n" + + "collection\x12\x1e\n" + + "\n" + + "generation\x18\x03 \x01(\rR\n" + + "generation\" \n" + "\x1eVolumeEcShardsToVolumeResponse\"8\n" + "\x19VolumeEcShardsInfoRequest\x12\x1b\n" + "\tvolume_id\x18\x01 \x01(\rR\bvolumeId\"a\n" +