Skip to content

Commit

Permalink
fix table info decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
yito88 committed Nov 16, 2023
1 parent 5c96acd commit a865827
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/sstable_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ impl SstableManager {
let mut reader = BufReader::with_capacity(READ_BUFFER_SIZE, file);

while let Some(table_info) = self.read_table_info(&mut reader)? {
debug!("load table info for ID: {}", table_info.id);
let mut tables = self.tables.write().unwrap();
match tables.get_mut(table_info.level) {
Some(tables) => {
Expand All @@ -194,9 +195,12 @@ impl SstableManager {
reader: &mut BufReader<File>,
) -> Result<Option<TableInfo>, std::io::Error> {
match self.read_data(reader)? {
Some(bytes) => bincode::deserialize(&bytes).map_err(|_| {
std::io::Error::new(ErrorKind::Other, "failed to deserialize bloom elements")
}),
Some(bytes) => {
let table_info = bincode::deserialize(&bytes).map_err(|_| {
std::io::Error::new(ErrorKind::Other, "failed to deserialize the table info")
})?;
Ok(Some(table_info))
}
None => Ok(None),
}
}
Expand Down

0 comments on commit a865827

Please sign in to comment.