Print more details on errors to log

Fixes https://github.com/zenithdb/zenith/issues/661
This commit is contained in:
Heikki Linnakangas
2021-10-01 17:57:41 +03:00
committed by GitHub
parent 2c99e2461a
commit e474790400
7 changed files with 11 additions and 13 deletions

View File

@@ -479,7 +479,7 @@ fn start_pageserver(conf: &'static PageServerConf) -> Result<()> {
match daemonize.start() {
Ok(_) => info!("Success, daemonized"),
Err(e) => error!("Error, {}", e),
Err(e) => error!("could not daemonize: {:#}", e),
}
}

View File

@@ -501,7 +501,7 @@ impl LayeredRepository {
error!("timeline size calculation diverged, incremental doesn't match non incremental. incremental={} non_incremental={}", incremental, non_incremental);
}
}
Err(e) => error!("failed to calculate non incremental timeline size: {}", e),
Err(e) => error!("failed to calculate non incremental timeline size: {:#}", e),
}
}

View File

@@ -194,7 +194,7 @@ pub fn thread_main(
let local_auth = auth.clone();
thread::spawn(move || {
if let Err(err) = page_service_conn_main(conf, local_auth, socket, auth_type) {
error!("error: {}", err);
error!("page server thread exiting with error: {:#}", err);
}
});
}

View File

@@ -90,7 +90,7 @@ async fn upload_loop_step<P, S: 'static + RelishStorage<RelishStoragePath = P>>(
if let Err(e) = upload_relish(relish_storage, page_server_workdir, &relish_local_path).await {
log::error!(
"Failed to upload relish '{}' for timeline {}, reason: {}",
"Failed to upload relish '{}' for timeline {}, reason: {:#}",
relish_local_path.display(),
relish_timeline_id,
e

View File

@@ -11,7 +11,7 @@ use std::fs::File;
use std::io::Read;
use std::path::Path;
use anyhow::Result;
use anyhow::{bail, Result};
use bytes::{Buf, Bytes};
use crate::relish::*;
@@ -173,8 +173,7 @@ fn import_relfile(
break;
}
_ => {
error!("error reading file: {:?} ({})", path, e);
break;
bail!("error reading file {}: {:#}", path.display(), e);
}
},
};
@@ -268,8 +267,7 @@ fn import_slru_file(timeline: &dyn Timeline, lsn: Lsn, slru: SlruKind, path: &Pa
break;
}
_ => {
error!("error reading file: {:?} ({})", path, e);
break;
bail!("error reading file {}: {:#}", path.display(), e);
}
},
};

View File

@@ -10,7 +10,7 @@ use crate::restore_local_repo;
use crate::tenant_mgr;
use crate::waldecoder::*;
use crate::PageServerConf;
use anyhow::{Error, Result};
use anyhow::{bail, Error, Result};
use lazy_static::lazy_static;
use log::*;
use postgres::fallible_iterator::FallibleIterator;
@@ -158,7 +158,7 @@ fn walreceiver_main(
let mut startpoint = last_rec_lsn;
if startpoint == Lsn(0) {
error!("No previous WAL position");
bail!("No previous WAL position");
}
// There might be some padding after the last full record, skip it.

View File

@@ -420,7 +420,7 @@ impl PostgresRedoManager {
);
if let Err(e) = apply_result {
error!("could not apply WAL records: {}", e);
error!("could not apply WAL records: {:#}", e);
result = Err(WalRedoError::IoError(e));
} else {
let img = apply_result.unwrap();
@@ -458,7 +458,7 @@ impl PostgresRedoProcess {
if datadir.exists() {
info!("directory {:?} exists, removing", &datadir);
if let Err(e) = fs::remove_dir_all(&datadir) {
error!("could not remove old wal-redo-datadir: {:?}", e);
error!("could not remove old wal-redo-datadir: {:#}", e);
}
}
info!("running initdb in {:?}", datadir.display());