-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Turbopack: remove value compression dictionary #82338
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,10 +144,6 @@ impl MetaEntry { | |
| self.sst_data.key_compression_dictionary_length | ||
| } | ||
|
|
||
| pub fn value_compression_dictionary_length(&self) -> u16 { | ||
| self.sst_data.value_compression_dictionary_length | ||
| } | ||
|
|
||
| pub fn block_count(&self) -> u16 { | ||
| self.sst_data.block_count | ||
| } | ||
|
|
@@ -222,7 +218,6 @@ impl MetaFile { | |
| sst_data: StaticSortedFileMetaData { | ||
| sequence_number: file.read_u32::<BE>()?, | ||
| key_compression_dictionary_length: file.read_u16::<BE>()?, | ||
| value_compression_dictionary_length: file.read_u16::<BE>()?, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Meta file reading skips the View Details📝 Patch Detailsdiff --git a/turbopack/crates/turbo-persistence/src/meta_file.rs b/turbopack/crates/turbo-persistence/src/meta_file.rs
index 3c0f1b3aa7..3ac01098f1 100644
--- a/turbopack/crates/turbo-persistence/src/meta_file.rs
+++ b/turbopack/crates/turbo-persistence/src/meta_file.rs
@@ -218,7 +218,12 @@ impl MetaFile {
sst_data: StaticSortedFileMetaData {
sequence_number: file.read_u32::<BE>()?,
key_compression_dictionary_length: file.read_u16::<BE>()?,
- block_count: file.read_u16::<BE>()?,
+ // Read and discard the obsolete value_compression_dictionary_length field
+ // for backward compatibility with existing meta files
+ block_count: {
+ let _unused_value_compression_dictionary_length = file.read_u16::<BE>()?;
+ file.read_u16::<BE>()?
+ },
},
family,
min_hash: file.read_u64::<BE>()?,
AnalysisThe code removes reading of the
When reading existing meta files, the new code will interpret the RecommendationEither implement a versioned meta file format that can handle both old and new formats, or add migration logic to read and skip the |
||
| block_count: file.read_u16::<BE>()?, | ||
| }, | ||
| family, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Collector::is_full()method usestotal_value_sizein its calculation but thesorted()method doesn't return it, creating inconsistent behavior between fullness detection and data usage.View Details
📝 Patch Details
Analysis
The
Collectorstruct maintains bothtotal_key_sizeandtotal_value_size(lines 15-16) and uses both in theis_full()method (lines 38-39) to determine when the collector should be flushed. However, thesorted()method (line 99) only returnstotal_key_size, nottotal_value_size.This creates an inconsistency where the collector decides it's "full" based on both key and value sizes, but the calling code only receives the key size. This could lead to situations where the collector reports being full due to large values, but the caller receives a small key size and makes incorrect decisions about file splitting or resource allocation.
Recommendation
If value compression dictionary support is being removed completely, update the
is_full()method to only considertotal_key_sizein the threshold check. Change line 38-39 to:self.total_key_size > DATA_THRESHOLD_PER_INITIAL_FILE >> SIZE_SHIFT. Alternatively, if value sizes are still relevant, update thesorted()method to return both sizes.