Skip to content

Commit

Permalink
fix(cubestore): Handle corrupted upstream metastore
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov committed Dec 31, 2020
1 parent 213747d commit d547677
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions rust/cubestore/src/metastore/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,9 +1459,14 @@ impl RocksMetaStore {
.await?;
for log_file in logs_to_batch.iter() {
let path_to_log = remote_fs.local_file(log_file).await?;
let batch = WriteBatchContainer::read_from_file(&path_to_log).await?;
let db = meta_store.db.write().await;
db.write(batch.write_batch())?;
let batch = WriteBatchContainer::read_from_file(&path_to_log).await;
if let Ok(batch) = batch {
let db = meta_store.db.write().await;
db.write(batch.write_batch())?;
} else if let Err(e) = batch {
error!("Corrupted metastore WAL file. Discarding: {:?} {}", log_file, e);
break;
}
}

return Ok(meta_store);
Expand Down

0 comments on commit d547677

Please sign in to comment.