diff --git a/mini-lsm-mvcc/src/compact.rs b/mini-lsm-mvcc/src/compact.rs index cc52c63f..56362961 100644 --- a/mini-lsm-mvcc/src/compact.rs +++ b/mini-lsm-mvcc/src/compact.rs @@ -249,7 +249,7 @@ impl LsmStorageInner { upper_ssts.push(snapshot.sstables.get(id).unwrap().clone()); } let upper_iter = SstConcatIterator::create_and_seek_to_first(upper_ssts)?; - let mut lower_ssts = Vec::with_capacity(upper_level_sst_ids.len()); + let mut lower_ssts = Vec::with_capacity(lower_level_sst_ids.len()); for id in lower_level_sst_ids.iter() { lower_ssts.push(snapshot.sstables.get(id).unwrap().clone()); } @@ -267,7 +267,7 @@ impl LsmStorageInner { )?)); } let upper_iter = MergeIterator::create(upper_iters); - let mut lower_ssts = Vec::with_capacity(upper_level_sst_ids.len()); + let mut lower_ssts = Vec::with_capacity(lower_level_sst_ids.len()); for id in lower_level_sst_ids.iter() { lower_ssts.push(snapshot.sstables.get(id).unwrap().clone()); } diff --git a/mini-lsm-mvcc/src/lsm_storage.rs b/mini-lsm-mvcc/src/lsm_storage.rs index 25786dfd..ad7022cc 100644 --- a/mini-lsm-mvcc/src/lsm_storage.rs +++ b/mini-lsm-mvcc/src/lsm_storage.rs @@ -513,7 +513,7 @@ impl LsmStorageInner { let l0_iter = MergeIterator::create(l0_iters); let mut level_iters = Vec::with_capacity(snapshot.levels.len()); for (_, level_sst_ids) in &snapshot.levels { - let mut level_ssts = Vec::with_capacity(snapshot.levels[0].1.len()); + let mut level_ssts = Vec::with_capacity(level_sst_ids.len()); for table in level_sst_ids { let table = snapshot.sstables[table].clone(); if keep_table(key, &table) { diff --git a/mini-lsm/src/compact.rs b/mini-lsm/src/compact.rs index f095a197..fd4ec75f 100644 --- a/mini-lsm/src/compact.rs +++ b/mini-lsm/src/compact.rs @@ -203,7 +203,7 @@ impl LsmStorageInner { upper_ssts.push(snapshot.sstables.get(id).unwrap().clone()); } let upper_iter = SstConcatIterator::create_and_seek_to_first(upper_ssts)?; - let mut lower_ssts = Vec::with_capacity(upper_level_sst_ids.len()); + let mut lower_ssts = Vec::with_capacity(lower_level_sst_ids.len()); for id in lower_level_sst_ids.iter() { lower_ssts.push(snapshot.sstables.get(id).unwrap().clone()); } @@ -221,7 +221,7 @@ impl LsmStorageInner { )?)); } let upper_iter = MergeIterator::create(upper_iters); - let mut lower_ssts = Vec::with_capacity(upper_level_sst_ids.len()); + let mut lower_ssts = Vec::with_capacity(lower_level_sst_ids.len()); for id in lower_level_sst_ids.iter() { lower_ssts.push(snapshot.sstables.get(id).unwrap().clone()); } diff --git a/mini-lsm/src/lsm_storage.rs b/mini-lsm/src/lsm_storage.rs index 0ee8497a..7b59122a 100644 --- a/mini-lsm/src/lsm_storage.rs +++ b/mini-lsm/src/lsm_storage.rs @@ -503,7 +503,7 @@ impl LsmStorageInner { let l0_iter = MergeIterator::create(l0_iters); let mut level_iters = Vec::with_capacity(snapshot.levels.len()); for (_, level_sst_ids) in &snapshot.levels { - let mut level_ssts = Vec::with_capacity(snapshot.levels[0].1.len()); + let mut level_ssts = Vec::with_capacity(level_sst_ids.len()); for table in level_sst_ids { let table = snapshot.sstables[table].clone(); if keep_table(key, &table) {