Skip to content

Commit

Permalink
fix remaining error formats
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
  • Loading branch information
BugenZhao committed Jan 22, 2024
1 parent 277016c commit d013286
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/meta/src/hummock/manager/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use risingwave_hummock_sdk::version::HummockVersion;
use risingwave_hummock_sdk::HummockVersionId;
use risingwave_pb::hummock::hummock_version_checkpoint::{PbStaleObjects, StaleObjects};
use risingwave_pb::hummock::{PbHummockVersionArchive, PbHummockVersionCheckpoint};
use thiserror_ext::AsReport;

use crate::hummock::error::Result;
use crate::hummock::manager::{read_lock, write_lock};
Expand Down Expand Up @@ -178,7 +179,8 @@ impl HummockManager {
if let Some(archive) = archive {
if let Err(e) = self.write_version_archive(&archive).await {
tracing::warn!(
"failed to write version archive {}, {e}",
error = %e.as_report(),
"failed to write version archive {}",
archive.version.as_ref().unwrap().id
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/storage/src/monitor/traced_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use risingwave_hummock_trace::{
init_collector, should_use_trace, ConcurrentId, MayTraceSpan, OperationResult, StorageType,
TraceResult, TraceSpan, TracedBytes, TracedSealCurrentEpochOptions, LOCAL_ID,
};
use thiserror_ext::AsReport;

use super::identity;
use crate::error::{StorageError, StorageResult};
Expand Down Expand Up @@ -357,7 +358,7 @@ impl<S: StateStoreIterItemStream> TracedStateStoreIter<S> {
while let Some((key, value)) = inner
.try_next()
.await
.inspect_err(|e| tracing::error!("Failed in next: {:?}", e))?
.inspect_err(|e| tracing::error!(error = %e.as_report(), "Failed in next"))?
{
self.span.may_send_iter_next();
self.span
Expand Down
1 change: 1 addition & 0 deletions src/tests/sqlsmith/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ risingwave_frontend = { workspace = true }
risingwave_pb = { workspace = true }
risingwave_sqlparser = { workspace = true }
similar = "2.4.0"
thiserror-ext = { workspace = true }
tokio = { version = "0.2", package = "madsim-tokio" }
tokio-postgres = "0.7"
tracing = "0.1"
Expand Down
25 changes: 16 additions & 9 deletions src/tests/sqlsmith/tests/frontend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use risingwave_sqlparser::ast::Statement;
use risingwave_sqlsmith::{
is_permissible_error, mview_sql_gen, parse_create_table_statements, parse_sql, sql_gen, Table,
};
use thiserror_ext::AsReport;
use tokio::runtime::Runtime;

type Result<T> = std::result::Result<T, Failed>;
Expand All @@ -48,7 +49,7 @@ async fn handle(session: Arc<SessionImpl>, stmt: Statement, sql: Arc<str>) -> Re
let result = handler::handle(session.clone(), stmt, sql, vec![])
.await
.map(|_| ())
.map_err(|e| format!("Error Reason:\n{}", e).into());
.map_err(|e| format!("Error Reason:\n{}", e.as_report()).into());
validate_result(result)
}

Expand Down Expand Up @@ -183,20 +184,26 @@ fn run_batch_query(
let mut binder = Binder::new(&session);
let bound = binder
.bind(stmt)
.map_err(|e| Failed::from(format!("Failed to bind:\nReason:\n{}", e)))?;
.map_err(|e| Failed::from(format!("Failed to bind:\nReason:\n{}", e.as_report())))?;
let mut planner = Planner::new(context);
let mut logical_plan = planner
.plan(bound)
.map_err(|e| Failed::from(format!("Failed to generate logical plan:\nReason:\n{}", e)))?;
let batch_plan = logical_plan
.gen_batch_plan()
.map_err(|e| Failed::from(format!("Failed to generate batch plan:\nReason:\n{}", e)))?;
let mut logical_plan = planner.plan(bound).map_err(|e| {
Failed::from(format!(
"Failed to generate logical plan:\nReason:\n{}",
e.as_report()
))
})?;
let batch_plan = logical_plan.gen_batch_plan().map_err(|e| {
Failed::from(format!(
"Failed to generate batch plan:\nReason:\n{}",
e.as_report()
))
})?;
logical_plan
.gen_batch_distributed_plan(batch_plan)
.map_err(|e| {
Failed::from(format!(
"Failed to generate batch distributed plan:\nReason:\n{}",
e
e.as_report()
))
})?;
Ok(())
Expand Down

0 comments on commit d013286

Please sign in to comment.