satellite/metainfo: stop using sat StreamID Redundancy

We needed Redundancy insided sat StreamID when uplink was defining RS values. Now it can be removed.

Change-Id: Id37187493eaa00cf29cb0262a050d71add3deb96
This commit is contained in:
Michał Niewrzał 2021-03-26 12:56:40 +01:00 committed by Michal Niewrzal
parent c7e2570123
commit de38e2e7d8
3 changed files with 40 additions and 61 deletions

View File

@ -29,7 +29,6 @@ type StreamID struct {
Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"`
EncryptedObjectKey []byte `protobuf:"bytes,2,opt,name=encrypted_object_key,json=encryptedObjectKey,proto3" json:"encrypted_object_key,omitempty"`
Version int32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
Redundancy *pb.RedundancyScheme `protobuf:"bytes,4,opt,name=redundancy,proto3" json:"redundancy,omitempty"`
EncryptionParameters *pb.EncryptionParameters `protobuf:"bytes,12,opt,name=encryption_parameters,json=encryptionParameters,proto3" json:"encryption_parameters,omitempty"`
CreationDate time.Time `protobuf:"bytes,5,opt,name=creation_date,json=creationDate,proto3,stdtime" json:"creation_date"`
ExpirationDate time.Time `protobuf:"bytes,6,opt,name=expiration_date,json=expirationDate,proto3,stdtime" json:"expiration_date"`
@ -86,13 +85,6 @@ func (m *StreamID) GetVersion() int32 {
return 0
}
func (m *StreamID) GetRedundancy() *pb.RedundancyScheme {
if m != nil {
return m.Redundancy
}
return nil
}
func (m *StreamID) GetEncryptionParameters() *pb.EncryptionParameters {
if m != nil {
return m.EncryptionParameters
@ -222,41 +214,39 @@ func init() {
func init() { proto.RegisterFile("metainfo_sat.proto", fileDescriptor_47c60bd892d94aaf) }
var fileDescriptor_47c60bd892d94aaf = []byte{
// 566 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcd, 0x6e, 0xd3, 0x4c,
0x14, 0xfd, 0xfc, 0xb5, 0xf9, 0x9b, 0xa4, 0x4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57, 0x4b, 0xfc, 0x7c, 0x9b,
0x6a, 0x99, 0xff, 0xf3, 0xd0, 0xfd, 0x33, 0xad, 0x6e, 0x9d, 0xa4, 0x56, 0x08, 0xcf, 0xd0, 0xd0,
0x2c, 0xcf, 0xf3, 0x34, 0x04, 0x69, 0x22, 0xd3, 0xf1, 0x51, 0x01, 0xbd, 0x33, 0x08, 0x9e, 0xa0,
0x0e, 0xe3, 0x14, 0x6e, 0xaa, 0xa0, 0x94, 0x05, 0x3e, 0x43, 0x7b, 0x52, 0x08, 0x1d, 0x64, 0x0c,
0x22, 0x28, 0x7e, 0xb5, 0x38, 0xc9, 0x68, 0x31, 0x2e, 0x9c, 0xfa, 0x79, 0x3b, 0xeb, 0x5d, 0x14,
0xf8, 0x6a, 0xe9, 0x0f, 0x0b, 0x56, 0x59, 0x50, 0xfc, 0x1e, 0x1d, 0x09, 0xc9, 0x62, 0xc6, 0x49,
0x12, 0x08, 0x49, 0x41, 0x06, 0x09, 0x4b, 0x99, 0x56, 0x76, 0xd7, 0xd9, 0x99, 0x0f, 0x4f, 0x1f,
0xb5, 0x8b, 0xbe, 0xa4, 0x54, 0x82, 0x52, 0x40, 0xcf, 0x0b, 0xda, 0x9b, 0x82, 0xe5, 0x1f, 0xd6,
0xb3, 0x2d, 0x76, 0x47, 0x34, 0x7a, 0xff, 0x1c, 0x8d, 0x7b, 0x0e, 0xd4, 0xbf, 0xef, 0x40, 0x8b,
0x27, 0x9f, 0x1e, 0x2b, 0x2d, 0xe4, 0x95, 0xcb, 0x84, 0x67, 0x1e, 0x5e, 0x43, 0xf2, 0xcc, 0xe7,
0xc2, 0x49, 0x92, 0x85, 0x61, 0xd7, 0xec, 0x70, 0xf6, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x89, 0x67,
0x88, 0xd3, 0x53, 0x04, 0x00, 0x00,
// 530 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c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b, 0x41,
0xdb, 0xd4, 0xdb, 0x21, 0x29, 0xa0, 0x0f, 0x16, 0xa1, 0x23, 0xd2, 0x16, 0x92, 0xc3, 0x4d, 0x95,
0x75, 0x59, 0xd0, 0x33, 0xb2, 0xaf, 0x95, 0xc2, 0x28, 0x17, 0xb0, 0x82, 0xe2, 0xd5, 0x22, 0x92,
0xc1, 0x6c, 0x58, 0x38, 0xf5, 0xeb, 0x76, 0xb2, 0x77, 0x51, 0xe0, 0x8b, 0x79, 0xd8, 0x2f, 0x58,
0x65, 0xc1, 0xe9, 0x47, 0x72, 0xac, 0xb4, 0x48, 0x84, 0x64, 0x69, 0xa4, 0x34, 0x07, 0x1d, 0xa5,
0x22, 0x13, 0x68, 0xdc, 0x8e, 0xd7, 0x9a, 0xf6, 0x4f, 0x9f, 0x6e, 0x3f, 0xfa, 0x9a, 0x73, 0x0d,
0xc6, 0x00, 0x3f, 0x2f, 0x68, 0xef, 0x0a, 0x56, 0x78, 0x54, 0xdf, 0xdd, 0x62, 0x77, 0xac, 0xc6,
0xde, 0x7f, 0xaf, 0xc6, 0x3d, 0x01, 0x75, 0xef, 0x0b, 0x68, 0xf6, 0xfc, 0xcb, 0x33, 0x83, 0x4a,
0x5f, 0xf9, 0x42, 0x05, 0xf6, 0x10, 0x34, 0xa4, 0x40, 0x48, 0x04, 0x2d, 0x59, 0x9a, 0xc7, 0x71,
0xc7, 0xfe, 0xe1, 0xec, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x02, 0x47, 0xce, 0x91, 0x05, 0x04,
0x00, 0x00,
}

View File

@ -9,7 +9,6 @@ package satellite.metainfo;
import "encryption.proto";
import "gogo.proto";
import "google/protobuf/timestamp.proto";
import "pointerdb.proto";
import "metainfo.proto";
message StreamID {
@ -17,7 +16,6 @@ message StreamID {
bytes encrypted_object_key = 2;
int32 version = 3;
pointerdb.RedundancyScheme redundancy = 4;
encryption.EncryptionParameters encryption_parameters = 12;
google.protobuf.Timestamp creation_date = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];

View File

@ -655,8 +655,6 @@ func (endpoint *Endpoint) BeginObject(ctx context.Context, req *pb.ObjectBeginRe
return nil, err
}
// use only satellite values for Redundancy Scheme
pbRS := endpoint.defaultRS
streamID, err := uuid.New()
if err != nil {
endpoint.log.Error("internal", zap.Error(err))
@ -696,7 +694,6 @@ func (endpoint *Endpoint) BeginObject(ctx context.Context, req *pb.ObjectBeginRe
Bucket: req.Bucket,
EncryptedObjectKey: req.EncryptedPath,
Version: int32(object.Version),
Redundancy: pbRS,
CreationDate: object.CreatedAt,
ExpirationDate: req.ExpiresAt,
StreamId: streamID[:],
@ -716,7 +713,7 @@ func (endpoint *Endpoint) BeginObject(ctx context.Context, req *pb.ObjectBeginRe
EncryptedPath: req.EncryptedPath,
Version: req.Version,
StreamId: satStreamID,
RedundancyScheme: pbRS,
RedundancyScheme: endpoint.defaultRS,
}, nil
}
@ -1638,7 +1635,7 @@ func (endpoint *Endpoint) BeginSegment(ctx context.Context, req *pb.SegmentBegin
return nil, err
}
redundancy, err := eestream.NewRedundancyStrategyFromProto(streamID.Redundancy)
redundancy, err := eestream.NewRedundancyStrategyFromProto(endpoint.defaultRS)
if err != nil {
return nil, rpcstatus.Error(rpcstatus.InvalidArgument, err.Error())
}
@ -1740,16 +1737,15 @@ func (endpoint *Endpoint) CommitSegment(ctx context.Context, req *pb.SegmentComm
}
// cheap basic verification
if numResults := len(req.UploadResult); numResults < int(streamID.Redundancy.GetSuccessThreshold()) {
if numResults := len(req.UploadResult); numResults < int(endpoint.defaultRS.GetSuccessThreshold()) {
endpoint.log.Debug("the results of uploaded pieces for the segment is below the redundancy optimal threshold",
zap.Int("upload pieces results", numResults),
zap.Int32("redundancy optimal threshold", streamID.Redundancy.GetSuccessThreshold()),
zap.Int32("redundancy optimal threshold", endpoint.defaultRS.GetSuccessThreshold()),
zap.Stringer("Segment ID", req.SegmentId),
)
return nil, rpcstatus.Errorf(rpcstatus.InvalidArgument,
"the number of results of uploaded pieces (%d) is below the optimal threshold (%d)",
numResults, streamID.Redundancy.GetSuccessThreshold(),
numResults, endpoint.defaultRS.GetSuccessThreshold(),
)
}
@ -2458,7 +2454,6 @@ func (endpoint *Endpoint) objectToProto(ctx context.Context, object metabase.Obj
ExpirationDate: expires,
StreamId: object.StreamID[:],
MultipartObject: multipartObject,
Redundancy: rs,
EncryptionParameters: &pb.EncryptionParameters{
CipherSuite: pb.CipherSuite(object.Encryption.CipherSuite),
BlockSize: int64(object.Encryption.BlockSize),
@ -2596,9 +2591,6 @@ func (endpoint *Endpoint) objectEntryToProtoListItem(ctx context.Context, bucket
ExpirationDate: item.ExpiresAt,
StreamId: entry.StreamID[:],
MultipartObject: entry.FixedSegmentSize <= 0,
// TODO: defaultRS may change while the upload is pending.
// Ideally, we should remove redundancy from satStreamID.
Redundancy: endpoint.defaultRS,
EncryptionParameters: &pb.EncryptionParameters{
CipherSuite: pb.CipherSuite(entry.Encryption.CipherSuite),
BlockSize: int64(entry.Encryption.BlockSize),
@ -2756,7 +2748,6 @@ func (endpoint *Endpoint) BeginMoveObject(ctx context.Context, req *pb.ObjectBeg
Bucket: req.Bucket,
EncryptedObjectKey: req.EncryptedObjectKey,
Version: int32(metabase.DefaultVersion),
Redundancy: endpoint.defaultRS,
StreamId: result.StreamID[:],
EncryptionParameters: &pb.EncryptionParameters{
CipherSuite: pb.CipherSuite(result.EncryptionParameters.CipherSuite),