Skip to content

Commit

Permalink
consider mvcc iterator in compaction test
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Chi <iskyzh@gmail.com>
  • Loading branch information
skyzh committed Jan 30, 2024
1 parent 770400d commit 21c61a2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mini-lsm/src/tests/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,11 @@ pub fn check_compaction_ratio(storage: Arc<MiniLsm>) {
};
level_size.push(size);
}
let extra_iterators = if TS_ENABLED {
1 /* txn local iterator for OCC */
} else {
0
};
let num_iters = storage
.scan(Bound::Unbounded, Bound::Unbounded)
.unwrap()
Expand Down Expand Up @@ -326,7 +331,7 @@ pub fn check_compaction_ratio(storage: Arc<MiniLsm>) {
);
}
assert!(
num_iters <= l0_sst_num + num_memtables + max_levels,
num_iters <= l0_sst_num + num_memtables + max_levels + extra_iterators,
"we found {num_iters} iterators in your implementation, (l0_sst_num={l0_sst_num}, num_memtables={num_memtables}, max_levels={max_levels}) did you use concat iterators?"
);
}
Expand Down Expand Up @@ -354,7 +359,7 @@ pub fn check_compaction_ratio(storage: Arc<MiniLsm>) {
);
}
assert!(
num_iters <= l0_sst_num + num_memtables + max_levels,
num_iters <= l0_sst_num + num_memtables + max_levels + extra_iterators,
"we found {num_iters} iterators in your implementation, (l0_sst_num={l0_sst_num}, num_memtables={num_memtables}, max_levels={max_levels}) did you use concat iterators?"
);
}
Expand Down Expand Up @@ -396,7 +401,7 @@ pub fn check_compaction_ratio(storage: Arc<MiniLsm>) {
sum_size += this_size;
}
assert!(
num_iters <= num_memtables + num_tiers,
num_iters <= num_memtables + num_tiers + extra_iterators,
"we found {num_iters} iterators in your implementation, (num_memtables={num_memtables}, num_tiers={num_tiers}) did you use concat iterators?"
);
}
Expand Down

0 comments on commit 21c61a2

Please sign in to comment.