mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-19 21:56:54 +00:00
feat(ec): add encode_ts_ns to EC shard metadata and the shard read RPC
EcShardConfig and VolumeEcShardReadRequest gain an int64 encode_ts_ns (encode time in unix nanos). It rides in .vif and the read request so a read can be scoped to the encode run that produced the index.
This commit is contained in:
@@ -478,6 +478,8 @@ message VolumeEcShardReadRequest {
|
||||
int64 offset = 3;
|
||||
int64 size = 4;
|
||||
uint64 file_key = 5;
|
||||
reserved 6;
|
||||
int64 encode_ts_ns = 7; // caller's expected encode time; the server rejects a shard from a different encode run
|
||||
}
|
||||
message VolumeEcShardReadResponse {
|
||||
bytes data = 1;
|
||||
@@ -580,6 +582,7 @@ message VolumeInfo {
|
||||
message EcShardConfig {
|
||||
uint32 data_shards = 1; // Number of data shards (e.g., 10)
|
||||
uint32 parity_shards = 2; // Number of parity shards (e.g., 4)
|
||||
int64 encode_ts_ns = 3; // encode time (unix nanos); a read served from a shard of a different encode run is rejected
|
||||
}
|
||||
|
||||
// EcBitrotProtection is the entire content of a bitrot checksum sidecar
|
||||
|
||||
@@ -3895,6 +3895,7 @@ type VolumeEcShardReadRequest struct {
|
||||
Offset int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
|
||||
Size int64 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"`
|
||||
FileKey uint64 `protobuf:"varint,5,opt,name=file_key,json=fileKey,proto3" json:"file_key,omitempty"`
|
||||
EncodeTsNs int64 `protobuf:"varint,7,opt,name=encode_ts_ns,json=encodeTsNs,proto3" json:"encode_ts_ns,omitempty"` // caller's expected encode time; the server rejects a shard from a different encode run
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -3964,6 +3965,13 @@ func (x *VolumeEcShardReadRequest) GetFileKey() uint64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *VolumeEcShardReadRequest) GetEncodeTsNs() int64 {
|
||||
if x != nil {
|
||||
return x.EncodeTsNs
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type VolumeEcShardReadResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
|
||||
@@ -4946,6 +4954,7 @@ type EcShardConfig struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
DataShards uint32 `protobuf:"varint,1,opt,name=data_shards,json=dataShards,proto3" json:"data_shards,omitempty"` // Number of data shards (e.g., 10)
|
||||
ParityShards uint32 `protobuf:"varint,2,opt,name=parity_shards,json=parityShards,proto3" json:"parity_shards,omitempty"` // Number of parity shards (e.g., 4)
|
||||
EncodeTsNs int64 `protobuf:"varint,3,opt,name=encode_ts_ns,json=encodeTsNs,proto3" json:"encode_ts_ns,omitempty"` // encode time (unix nanos); a read served from a shard of a different encode run is rejected
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -4994,6 +5003,13 @@ func (x *EcShardConfig) GetParityShards() uint32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *EcShardConfig) GetEncodeTsNs() int64 {
|
||||
if x != nil {
|
||||
return x.EncodeTsNs
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// EcBitrotProtection is the entire content of a bitrot checksum sidecar
|
||||
// (<base>.ecsum for the legacy generation, <base>.ecsum.v<N> for vacuum
|
||||
// generation N). On disk it is wrapped in a fixed header carrying a CRC32C
|
||||
@@ -7247,13 +7263,15 @@ const file_volume_server_proto_rawDesc = "" +
|
||||
"\x1cVolumeEcShardsUnmountRequest\x12\x1b\n" +
|
||||
"\tvolume_id\x18\x01 \x01(\rR\bvolumeId\x12\x1b\n" +
|
||||
"\tshard_ids\x18\x03 \x03(\rR\bshardIds\"\x1f\n" +
|
||||
"\x1dVolumeEcShardsUnmountResponse\"\x99\x01\n" +
|
||||
"\x1dVolumeEcShardsUnmountResponse\"\xc1\x01\n" +
|
||||
"\x18VolumeEcShardReadRequest\x12\x1b\n" +
|
||||
"\tvolume_id\x18\x01 \x01(\rR\bvolumeId\x12\x19\n" +
|
||||
"\bshard_id\x18\x02 \x01(\rR\ashardId\x12\x16\n" +
|
||||
"\x06offset\x18\x03 \x01(\x03R\x06offset\x12\x12\n" +
|
||||
"\x04size\x18\x04 \x01(\x03R\x04size\x12\x19\n" +
|
||||
"\bfile_key\x18\x05 \x01(\x04R\afileKey\"N\n" +
|
||||
"\bfile_key\x18\x05 \x01(\x04R\afileKey\x12 \n" +
|
||||
"\fencode_ts_ns\x18\a \x01(\x03R\n" +
|
||||
"encodeTsNsJ\x04\b\x06\x10\a\"N\n" +
|
||||
"\x19VolumeEcShardReadResponse\x12\x12\n" +
|
||||
"\x04data\x18\x01 \x01(\fR\x04data\x12\x1d\n" +
|
||||
"\n" +
|
||||
@@ -7346,11 +7364,13 @@ const file_volume_server_proto_rawDesc = "" +
|
||||
"\rdat_file_size\x18\x05 \x01(\x03R\vdatFileSize\x12\"\n" +
|
||||
"\rexpire_at_sec\x18\x06 \x01(\x04R\vexpireAtSec\x12\x1b\n" +
|
||||
"\tread_only\x18\a \x01(\bR\breadOnly\x12G\n" +
|
||||
"\x0fec_shard_config\x18\b \x01(\v2\x1f.volume_server_pb.EcShardConfigR\recShardConfig\"U\n" +
|
||||
"\x0fec_shard_config\x18\b \x01(\v2\x1f.volume_server_pb.EcShardConfigR\recShardConfig\"w\n" +
|
||||
"\rEcShardConfig\x12\x1f\n" +
|
||||
"\vdata_shards\x18\x01 \x01(\rR\n" +
|
||||
"dataShards\x12#\n" +
|
||||
"\rparity_shards\x18\x02 \x01(\rR\fparityShards\"\xbc\x02\n" +
|
||||
"\rparity_shards\x18\x02 \x01(\rR\fparityShards\x12 \n" +
|
||||
"\fencode_ts_ns\x18\x03 \x01(\x03R\n" +
|
||||
"encodeTsNs\"\xbc\x02\n" +
|
||||
"\x12EcBitrotProtection\x12A\n" +
|
||||
"\talgorithm\x18\x01 \x01(\x0e2#.volume_server_pb.ChecksumAlgorithmR\talgorithm\x12\x1d\n" +
|
||||
"\n" +
|
||||
|
||||
Reference in New Issue
Block a user