Skip to content

Commit

Permalink
DB::repair breaks the table for checkpoints (#1463)
Browse files Browse the repository at this point in the history
  • Loading branch information
xgreenx authored Oct 30, 2023
1 parent 0ecc88b commit b02f16f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:
env:
CARGO_TERM_COLOR: always
RUST_VERSION: 1.72.0
NIGHTLY_RUST_VERSION: nightly-2023-08-28
NIGHTLY_RUST_VERSION: nightly-2023-10-29
RUSTFLAGS: -D warnings
REGISTRY: ghcr.io
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
Expand Down
4 changes: 3 additions & 1 deletion crates/fuel-core/src/service/adapters/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ use fuel_core_storage::{
use fuel_core_types::{
blockchain::{
block::CompressedBlock,
primitives::{self,},
primitives::{
self,
},
},
fuel_tx,
fuel_tx::Receipt,
Expand Down
21 changes: 15 additions & 6 deletions crates/fuel-core/src/state/rocks_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,10 @@ impl RocksDb {
columns: Vec<Column>,
capacity: Option<usize>,
) -> DatabaseResult<RocksDb> {
let cf_descriptors: Vec<_> = columns
let cf_descriptors = columns
.clone()
.into_iter()
.map(|i| ColumnFamilyDescriptor::new(RocksDb::col_name(i), Self::cf_opts(i)))
.collect();
.map(|i| ColumnFamilyDescriptor::new(RocksDb::col_name(i), Self::cf_opts(i)));

let mut opts = Options::default();
opts.create_if_missing(true);
Expand All @@ -77,8 +76,6 @@ impl RocksDb {
opts.set_row_cache(&cache);
}

DB::repair(&opts, &path).map_err(|e| DatabaseError::Other(e.into()))?;

let db = match DB::open_cf_descriptors(&opts, &path, cf_descriptors) {
Err(_) => {
// setup cfs
Expand All @@ -91,7 +88,19 @@ impl RocksDb {
}
Ok(db)
}
err => err,
Err(err) => {
tracing::error!("Couldn't open the database with an error: {}. \nTrying to repair the database", err);
DB::repair(&opts, &path)
.map_err(|e| DatabaseError::Other(e.into()))?;

let cf_descriptors = columns.clone().into_iter().map(|i| {
ColumnFamilyDescriptor::new(
RocksDb::col_name(i),
Self::cf_opts(i),
)
});
DB::open_cf_descriptors(&opts, &path, cf_descriptors)
}
}
}
ok => ok,
Expand Down
4 changes: 3 additions & 1 deletion crates/services/p2p/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ use libp2p::{
Keypair,
},
mplex,
noise::{self,},
noise::{
self,
},
tcp::{
tokio::Transport as TokioTcpTransport,
Config as TcpConfig,
Expand Down

0 comments on commit b02f16f

Please sign in to comment.