Print a more full error message, with stack trace, on GC failure.

In a CI run, I got a test failure because of this error in the log,
from the test_get_tenant_size_with_multiple_branches test:

    ERROR gc_loop{tenant_id=f1630516d4b526139836ced93be0c878}: Gc failed, retrying in 2s: No such file or directory (os error 2)

There are known race conditions between GC and timeline deletion,
which surely caused that error. But if we didn't know the cause, it
would be pretty hard to debug without a stack trace.
This commit is contained in:
Heikki Linnakangas
2022-11-18 10:18:42 +02:00
committed by Heikki Linnakangas
parent dcb79ef08f
commit 328ec1ce24

View File

@@ -71,7 +71,7 @@ async fn compaction_loop(tenant_id: TenantId) {
let mut sleep_duration = tenant.get_compaction_period();
if let Err(e) = tenant.compaction_iteration() {
sleep_duration = wait_duration;
error!("Compaction failed, retrying in {:?}: {e:#}", sleep_duration);
error!("Compaction failed, retrying in {:?}: {e:?}", sleep_duration);
}
// Sleep
@@ -120,7 +120,7 @@ async fn gc_loop(tenant_id: TenantId) {
if let Err(e) = tenant.gc_iteration(None, gc_horizon, tenant.get_pitr_interval(), false).await
{
sleep_duration = wait_duration;
error!("Gc failed, retrying in {:?}: {e:#}", sleep_duration);
error!("Gc failed, retrying in {:?}: {e:?}", sleep_duration);
}
}