check compaction converge for simple leveled

Signed-off-by: Alex Chi Z <iskyzh@gmail.com>
This commit is contained in:
Alex Chi Z
2024-01-17 16:23:58 +08:00
parent 6649111660
commit e622bee18a
6 changed files with 15 additions and 7 deletions

View File

@@ -24,7 +24,7 @@ impl BlockBuilder {
fn estimated_size(&self) -> usize {
SIZEOF_U16 /* number of key-value pairs in the block */ + self.offsets.len() * SIZEOF_U16 /* offsets */ + self.data.len()
/* key-value pairs */
// key-value pairs
}
/// Adds a key-value pair to the block. Returns false when the block is full.

View File

@@ -33,7 +33,8 @@ impl BlockMeta {
// The size of actual key
estimated_size += meta.first_key.len();
}
// Reserve the space to improve performance, especially when the size of incoming data is large
// Reserve the space to improve performance, especially when the size of incoming data is
// large
buf.reserve(estimated_size);
let original_len = buf.len();
for meta in block_meta {