Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

print error info for Database error in the sp-blockchain::Error type. #14248

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

atenjin
Copy link
Contributor

@atenjin atenjin commented May 29, 2023

In our project, when running the node, we meet the error:

2023-05-29 12:38:18 | 2023-05-29 04:38:17.993  WARN tokio-runtime-worker sc_service::client::client: Block import error: Database

Then the following blocks can not sync.
Look deep into the code, I know the error appear in the deep level of database, for example now we are using the rocksdb, so this error comes from the rockesdb.

However in the error log, the database error is dropped in the sp-runtime::Error type.

And I think the error type sp-database::DatabaseError already impl Debug trait, so I think this error info can show in the sp-runtime::Error also.

/// The error type for database operations.
#[derive(Debug)]
pub struct DatabaseError(pub Box<dyn std::error::Error + Send + Sync + 'static>);

In this pr, I plan to let this error info can contain the Database error info

#[error("Database")]
DatabaseError(#[from] sp_database::error::DatabaseError),
#[error("Failed to get header for hash {0}")]

@bkchr bkchr added A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels May 31, 2023
@bkchr bkchr requested a review from a team May 31, 2023 12:49
@michalkucharczyk michalkucharczyk requested a review from a team May 31, 2023 14:28
@michalkucharczyk michalkucharczyk added the D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit label May 31, 2023
Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

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

👍

@bkchr bkchr merged commit ed8dde3 into paritytech:master Jun 1, 2023
@koushiro koushiro deleted the fix/database-errorinfo branch June 2, 2023 03:22
nathanwhit pushed a commit to nathanwhit/substrate that referenced this pull request Jul 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants