storage_scrubber: fix faulty assertion when no timelines (#9345)

When there are no timelines in remote storage, the storage scrubber
would incorrectly trip an assertion with "Must be set if results are
present", referring to the last processed tenant ID. When there are no
timelines we don't expect there to be a tenant ID either.

The assertion was introduced in 37aa6fd.

Only apply the assertion when any timelines are present.
This commit is contained in:
Erik Grinaker
2024-10-10 14:09:53 +01:00
committed by GitHub
parent c2623ffef4
commit 9dd80b9b4c

View File

@@ -317,9 +317,8 @@ pub async fn scan_pageserver_metadata(
tenant_timeline_results.push((ttid, data));
}
let tenant_id = tenant_id.expect("Must be set if results are present");
if !tenant_timeline_results.is_empty() {
let tenant_id = tenant_id.expect("Must be set if results are present");
analyze_tenant(
&remote_client,
tenant_id,