Skip to content

Commit

Permalink
keep encoded blob result until terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-shim committed Sep 6, 2024
1 parent a0191b8 commit 1618080
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 2 additions & 0 deletions disperser/batcher/batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,12 @@ func (b *Batcher) updateConfirmationInfo(

if status == disperser.Confirmed {
if _, updateConfirmationInfoErr = b.Queue.MarkBlobConfirmed(ctx, metadata, confirmationInfo); updateConfirmationInfoErr == nil {
b.EncodingStreamer.RemoveEncodedBlob(metadata)
b.Metrics.UpdateCompletedBlob(int(metadata.RequestMetadata.BlobSize), disperser.Confirmed)
}
} else if status == disperser.InsufficientSignatures {
if _, updateConfirmationInfoErr = b.Queue.MarkBlobInsufficientSignatures(ctx, metadata, confirmationInfo); updateConfirmationInfoErr == nil {
b.EncodingStreamer.RemoveEncodedBlob(metadata)
b.Metrics.UpdateCompletedBlob(int(metadata.RequestMetadata.BlobSize), disperser.InsufficientSignatures)
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions disperser/batcher/batcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ func TestBlobRetry(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, disperser.Dispersing, meta.BlobStatus)
encodedResult, err = components.encodingStreamer.EncodedBlobstore.GetEncodingResult(blobKey, 0)
assert.ErrorContains(t, err, "no such key")
assert.Nil(t, encodedResult)
assert.NoError(t, err)
assert.NotNil(t, encodedResult)

err = components.encodingStreamer.RequestEncoding(ctx, out)
assert.NoError(t, err)
Expand Down
2 changes: 0 additions & 2 deletions disperser/batcher/encoding_streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,6 @@ func (e *EncodingStreamer) transitionBlobToDispersing(ctx context.Context, metad
e.logger.Error("error marking blob as dispersing", "err", err, "blobKey", blobKey.String())
return err
}
// remove encoded blob from storage so we don't disperse it again
e.RemoveEncodedBlob(metadata)
return nil
}

Expand Down
8 changes: 4 additions & 4 deletions disperser/batcher/encoding_streamer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,11 +655,11 @@ func TestGetBatch(t *testing.T) {
assert.Equal(t, disperser.Dispersing, metadata2.BlobStatus)
assert.Nil(t, err)
res, err := encodingStreamer.EncodedBlobstore.GetEncodingResult(metadataKey1, core.QuorumID(0))
assert.Nil(t, res)
assert.ErrorContains(t, err, "GetEncodedBlob: no such key")
assert.NoError(t, err)
assert.NotNil(t, res)
res, err = encodingStreamer.EncodedBlobstore.GetEncodingResult(metadataKey1, core.QuorumID(1))
assert.Nil(t, res)
assert.ErrorContains(t, err, "GetEncodedBlob: no such key")
assert.NoError(t, err)
assert.NotNil(t, res)
res, err = encodingStreamer.EncodedBlobstore.GetEncodingResult(metadataKey2, core.QuorumID(0))
assert.Nil(t, res)
assert.ErrorContains(t, err, "GetEncodedBlob: no such key")
Expand Down

0 comments on commit 1618080

Please sign in to comment.