-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add check when initializing processing state #744
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ const ( | |
|
||
var errProcessingToDispersing = errors.New("blob transit to dispersing from non processing") | ||
|
||
var errProcessingMeetingPrecondition = errors.New("blob not meeting precondition to processing") | ||
|
||
// The shared blob store that the disperser is operating on. | ||
// The metadata store is backed by DynamoDB and the blob store is backed by S3. | ||
// | ||
|
@@ -90,6 +92,24 @@ func (s *SharedBlobStore) StoreBlob(ctx context.Context, blob *core.Blob, reques | |
metadataKey.BlobHash = blobHash | ||
metadataKey.MetadataHash = metadataHash | ||
|
||
refreshedMetadata, err := s.GetBlobMetadata(ctx, metadataKey) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if there is a 500 error from dynamo? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I should just check if refreshedMetadata is nil or not |
||
|
||
// the only safe condition: | ||
// err is disperser.ErrMetadataNotFound && refreshedMetadata is nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks to me there are 2 failure cases:
|
||
if err == nil && refreshedMetadata != nil { | ||
s.logger.Error("error blob not meeting precondition", "status", refreshedMetadata.BlobStatus, "metadataKey", refreshedMetadata.GetBlobKey().String()) | ||
return metadataKey, errProcessingMeetingPrecondition | ||
} else if err != nil && refreshedMetadata == nil { | ||
if !errors.Is(err, disperser.ErrMetadataNotFound) { | ||
s.logger.Error("error blob request or marshal error", "err", err) | ||
return metadataKey, errProcessingMeetingPrecondition | ||
} | ||
// else it is expected | ||
} else { | ||
s.logger.Error("error get blob status abnormality ", "err", err) | ||
return metadataKey, errProcessingMeetingPrecondition | ||
} | ||
|
||
err = s.s3Client.UploadObject(ctx, s.bucketName, blobObjectKey(blobHash), blob.Data) | ||
if err != nil { | ||
s.logger.Error("error uploading blob", "err", err) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errProcessingFailedPrecondition("blob metadata already exists....")
?