Skip to content

feat(engine): SpillCompression::Zstd behind spill-compression feature (STN-7 #2341) - #4416

Merged
oferchen merged 1 commit into
masterfrom
feature/stn-7-compression
May 18, 2026
Merged

oferchen merged 1 commit into
masterfrom
feature/stn-7-compression

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • New spill-compression Cargo feature on the engine crate (off by default) now pulls in zstd 0.13 as an optional dependency and exposes the SpillCompression::Zstd { level } variant.
  • SpillableReorderBuffer gained a with_compression(...) builder; the default codec stays SpillCompression::None, so the historical raw payload format is preserved when the feature is off.
  • On-disk spill records now carry a single leading tag byte (0x00 raw, 0x01 zstd) before the existing [u32 LE len][payload] framing so the reader can dispatch unambiguously.
  • New typed error SpillError::UnsupportedCompression(u8) is returned when a default build encounters a zstd-tagged record (e.g. a spill file written by a feature-on build), instead of feeding garbage to the item codec.
  • Constructing SpillCompression::Zstd without the feature is a compile error - the existing #[cfg(feature = "spill-compression")] gate on the enum variant is the "fail fast at construction" guarantee.

Test plan

  • cargo fmt --all clean
  • compression_none_writes_uncompressed_tag verifies the leading tag byte is 0x00 under the default policy and the round-trip preserves values.
  • compression_zstd_writes_compressed_tag (feature on only) verifies the tag byte is 0x01 and the zstd round-trip recovers the original values.
  • compression_zstd_tag_without_feature_returns_unsupported (feature off only) injects a 0x01 tag into a spill file and confirms the reader surfaces SpillError::UnsupportedCompression(0x01).
  • Existing spill tests (ENOSPC, temp-dir vanish, partial write, directory-backed round trip) continue to exercise the same paths through the new tag-prefixed framing.

Closes #2341.

@github-actions github-actions Bot added the enhancement New feature or request label May 18, 2026
@oferchen
oferchen force-pushed the feature/stn-7-compression branch 3 times, most recently from 6e8a18e to 9e91d04 Compare May 18, 2026 01:27
@oferchen
oferchen force-pushed the feature/stn-7-compression branch from 9e91d04 to 5d715a8 Compare May 18, 2026 01:29
@oferchen
oferchen merged commit 65bb729 into master May 18, 2026
4 of 9 checks passed
@oferchen
oferchen deleted the feature/stn-7-compression branch May 18, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant