Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB::repair breaks the table for checkpoints #1463

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member

@Voxelot Voxelot Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add some logging here so we know if the database is about to go into repair mode?

.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
Loading