Skip to content
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

Keep encoded blob result until blob reaches terminal state #750

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ian-shim
Copy link
Contributor

@ian-shim ian-shim commented Sep 6, 2024

Why are these changes needed?

Currently, the encoded blob result is removed once blob state transitions from PROCESSING to DISPERSING.
However, a blob can be fetched for encoding and then be transitioned to DISPERSING state before the encoding request is complete because the mutex is released and allows the blob to be returned as part of a batch.
This can cause an issue where the blob is successfully confirmed, but the remaining encoding result causes the blob to be dispersed again. The encoded blob state management needs to be enforced more tightly.
This PR does not remove the encoded result when it's returned as part of the batch. Instead, it keeps it until the blob reaches a terminal state so that it can be properly dedup'd from the concurrent encoding requests.

Checks

  • I've made sure the lint is passing in this PR.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@ian-shim ian-shim force-pushed the keep-encoded-res-until-terminal branch 3 times, most recently from a876418 to 1618080 Compare September 6, 2024 08:51
@ian-shim ian-shim marked this pull request as ready for review September 6, 2024 09:00
@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the chance of memory leak, when it falls into the last else statement part. CAn we just remove it regardless of the "if" condition

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in addition to that. the memory load on the batcher for 600sec batch interval would be 10MB/s*600 = 6GB. It looks manageable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sg, removing regardless of the if condition seems benign

@ian-shim ian-shim force-pushed the keep-encoded-res-until-terminal branch from 1618080 to d51fa10 Compare September 10, 2024 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants