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 10, 2024
1 parent a0191b8 commit d51fa10
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions disperser/batcher/batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ func (b *Batcher) updateConfirmationInfo(
} else {
updateConfirmationInfoErr = fmt.Errorf("HandleSingleBatch: trying to update confirmation info for blob in status other than confirmed or insufficient signatures: %s", status.String())
}
b.EncodingStreamer.RemoveEncodedBlob(metadata)
if updateConfirmationInfoErr != nil {
b.logger.Error("HandleSingleBatch: error updating blob confirmed metadata", "err", updateConfirmationInfoErr)
blobsToRetry = append(blobsToRetry, batchData.blobs[blobIndex])
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 d51fa10

Please sign in to comment.