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

fix(store/file): wait for q4 to be written before returning #3865

Merged

Conversation

walldiss
Copy link
Member

@walldiss walldiss commented Oct 21, 2024

TLDR: It was possible to return with error before reading from channel. Which could lead to leak of q4 writing go-routine.

Fixed a race condition when writing/removing the Q4 file. The main go-routine wasn’t waiting for the Q4 write to finish, causing the file to be removed before the write completed. This could leave unpredictable data on disk after the removal. These changes ensure the write operation finishes before any removal is attempted.

@walldiss walldiss added area:storage kind:fix Attached to bug-fixing PRs labels Oct 21, 2024
@walldiss walldiss self-assigned this Oct 21, 2024
@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2024

Codecov Report

Attention: Patch coverage is 30.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 45.06%. Comparing base (2469e7a) to head (0491bb2).
Report is 349 commits behind head on main.

Files with missing lines Patch % Lines
store/file/ods_q4.go 30.00% 5 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3865      +/-   ##
==========================================
+ Coverage   44.83%   45.06%   +0.22%     
==========================================
  Files         265      314      +49     
  Lines       14620    21804    +7184     
==========================================
+ Hits         6555     9825    +3270     
- Misses       7313    10955    +3642     
- Partials      752     1024     +272     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@cristaloleg cristaloleg left a comment

Choose a reason for hiding this comment

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

SGTM

@walldiss walldiss merged commit 78b0ff3 into celestiaorg:main Oct 22, 2024
32 checks passed
@walldiss walldiss deleted the wait-for-q4-write-before-returning branch October 22, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:storage kind:fix Attached to bug-fixing PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants