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

Only reset session on error in process, override transcode with pledge #58

Closed

Conversation

mkitti
Copy link
Member

@mkitti mkitti commented Jun 2, 2024

This is another approach to making transcode save the frame content size.

Previously via #4, the compression session was reset via startproc. The
only reason I can glean to reset the session would be if process errored.

Now startproc only resets the buffers, but does not reset the stream.
The compression context is only reset if an error occurs during process.

After these changes we can now call ZSTD_CCtx_setPledgedSrcSize from transcode
in order to encode the decompressed size in the frame header.

Copy link

codecov bot commented Jun 2, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 35.56%. Comparing base (1915ffb) to head (874e49c).

Files Patch % Lines
src/compression.jl 75.00% 2 Missing ⚠️
src/libzstd.jl 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #58      +/-   ##
==========================================
- Coverage   36.96%   35.56%   -1.41%     
==========================================
  Files           5        5              
  Lines         560      568       +8     
==========================================
- Hits          207      202       -5     
- Misses        353      366      +13     

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

@mkitti mkitti marked this pull request as ready for review June 2, 2024 06:11
@nhz2
Copy link
Member

nhz2 commented Sep 3, 2024

Good, the new test_roundtrip_seekstart is catching the bug in this PR.

It is best practice for startproc to always fully reset the state of the codec.

@nhz2 nhz2 closed this Sep 3, 2024
@mkitti
Copy link
Member Author

mkitti commented Sep 4, 2024

We should figure out how to pledge the size from a transcode call to the normal ZstdCompressor since we know the entire buffer size. Perhaps we should add a pledged size field to ZstdCompressor to enable this so that we can pledge the size in startproc afte we reset the stream.

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