Skip to content

Commit e474790

Browse files
authored
Print more details on errors to log
Fixes #661
1 parent 2c99e24 commit e474790

File tree

7 files changed

+11
-13
lines changed

7 files changed

+11
-13
lines changed

pageserver/src/bin/pageserver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ fn start_pageserver(conf: &'static PageServerConf) -> Result<()> {
479479

480480
match daemonize.start() {
481481
Ok(_) => info!("Success, daemonized"),
482-
Err(e) => error!("Error, {}", e),
482+
Err(e) => error!("could not daemonize: {:#}", e),
483483
}
484484
}
485485

pageserver/src/layered_repository.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ impl LayeredRepository {
501501
error!("timeline size calculation diverged, incremental doesn't match non incremental. incremental={} non_incremental={}", incremental, non_incremental);
502502
}
503503
}
504-
Err(e) => error!("failed to calculate non incremental timeline size: {}", e),
504+
Err(e) => error!("failed to calculate non incremental timeline size: {:#}", e),
505505
}
506506
}
507507

pageserver/src/page_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ pub fn thread_main(
194194
let local_auth = auth.clone();
195195
thread::spawn(move || {
196196
if let Err(err) = page_service_conn_main(conf, local_auth, socket, auth_type) {
197-
error!("error: {}", err);
197+
error!("page server thread exiting with error: {:#}", err);
198198
}
199199
});
200200
}

pageserver/src/relish_storage/storage_uploader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async fn upload_loop_step<P, S: 'static + RelishStorage<RelishStoragePath = P>>(
9090

9191
if let Err(e) = upload_relish(relish_storage, page_server_workdir, &relish_local_path).await {
9292
log::error!(
93-
"Failed to upload relish '{}' for timeline {}, reason: {}",
93+
"Failed to upload relish '{}' for timeline {}, reason: {:#}",
9494
relish_local_path.display(),
9595
relish_timeline_id,
9696
e

pageserver/src/restore_local_repo.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::fs::File;
1111
use std::io::Read;
1212
use std::path::Path;
1313

14-
use anyhow::Result;
14+
use anyhow::{bail, Result};
1515
use bytes::{Buf, Bytes};
1616

1717
use crate::relish::*;
@@ -173,8 +173,7 @@ fn import_relfile(
173173
break;
174174
}
175175
_ => {
176-
error!("error reading file: {:?} ({})", path, e);
177-
break;
176+
bail!("error reading file {}: {:#}", path.display(), e);
178177
}
179178
},
180179
};
@@ -268,8 +267,7 @@ fn import_slru_file(timeline: &dyn Timeline, lsn: Lsn, slru: SlruKind, path: &Pa
268267
break;
269268
}
270269
_ => {
271-
error!("error reading file: {:?} ({})", path, e);
272-
break;
270+
bail!("error reading file {}: {:#}", path.display(), e);
273271
}
274272
},
275273
};

pageserver/src/walreceiver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::restore_local_repo;
1010
use crate::tenant_mgr;
1111
use crate::waldecoder::*;
1212
use crate::PageServerConf;
13-
use anyhow::{Error, Result};
13+
use anyhow::{bail, Error, Result};
1414
use lazy_static::lazy_static;
1515
use log::*;
1616
use postgres::fallible_iterator::FallibleIterator;
@@ -158,7 +158,7 @@ fn walreceiver_main(
158158
let mut startpoint = last_rec_lsn;
159159

160160
if startpoint == Lsn(0) {
161-
error!("No previous WAL position");
161+
bail!("No previous WAL position");
162162
}
163163

164164
// There might be some padding after the last full record, skip it.

pageserver/src/walredo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ impl PostgresRedoManager {
420420
);
421421

422422
if let Err(e) = apply_result {
423-
error!("could not apply WAL records: {}", e);
423+
error!("could not apply WAL records: {:#}", e);
424424
result = Err(WalRedoError::IoError(e));
425425
} else {
426426
let img = apply_result.unwrap();
@@ -458,7 +458,7 @@ impl PostgresRedoProcess {
458458
if datadir.exists() {
459459
info!("directory {:?} exists, removing", &datadir);
460460
if let Err(e) = fs::remove_dir_all(&datadir) {
461-
error!("could not remove old wal-redo-datadir: {:?}", e);
461+
error!("could not remove old wal-redo-datadir: {:#}", e);
462462
}
463463
}
464464
info!("running initdb in {:?}", datadir.display());

0 commit comments

Comments
 (0)