mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-17 02:12:56 +00:00
Fix bug in dictinary creation
This commit is contained in:
@@ -1989,13 +1989,17 @@ impl LayeredTimeline {
|
||||
prefetched.push((key, lsn, value));
|
||||
|
||||
while let Some(y) = all_values_iter.next() {
|
||||
let (key, lsn, value) = y?;
|
||||
samples.push(Value::ser(&value)?);
|
||||
prefetched.push((key, lsn, value));
|
||||
if samples.len() == config::ZSTD_MAX_SAMPLES {
|
||||
if let Ok((key, lsn, value)) = y {
|
||||
samples.push(Value::ser(&value)?);
|
||||
prefetched.push((key, lsn, value));
|
||||
if samples.len() == config::ZSTD_MAX_SAMPLES {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let dictionary = if samples.len() >= config::ZSTD_MIN_SAMPLES {
|
||||
zstd::dict::from_samples(&samples, config::ZSTD_MAX_DICTIONARY_SIZE)?
|
||||
} else {
|
||||
|
||||
@@ -327,17 +327,18 @@ impl InMemoryLayer {
|
||||
|
||||
let mut cursor = inner.file.block_cursor();
|
||||
|
||||
// First learn dictionary */
|
||||
for (_key, vec_map) in keys.iter() {
|
||||
// First learn dictionary
|
||||
'train: for (_key, vec_map) in keys.iter() {
|
||||
// Write all page versions
|
||||
for (_lsn, pos) in vec_map.as_slice() {
|
||||
cursor.read_blob_into_buf(*pos, &mut buf)?;
|
||||
samples.push(buf.clone());
|
||||
if samples.len() == config::ZSTD_MAX_SAMPLES {
|
||||
break;
|
||||
break 'train;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let dictionary = if samples.len() >= config::ZSTD_MIN_SAMPLES {
|
||||
zstd::dict::from_samples(&samples, config::ZSTD_MAX_DICTIONARY_SIZE)?
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user