release mutex guard early in test

Signed-off-by: Yuchen Liang <yuchen@neon.tech>
This commit is contained in:
Yuchen Liang
2024-06-11 15:37:05 -04:00
parent f0a0515d4f
commit a5c8f94165
2 changed files with 6 additions and 4 deletions

View File

@@ -4301,9 +4301,11 @@ mod tests {
let _ = timeline.make_lsn_lease(Lsn(0x30), &ctx)?;
let gc_info = timeline.gc_info.read().unwrap();
assert!(gc_info.leases.contains_key(&Lsn(0x30)));
info!("GcCutOff: {:?}", gc_info.cutoffs);
{
let gc_info = timeline.gc_info.read().unwrap();
assert!(gc_info.leases.contains_key(&Lsn(0x30)));
info!("GcCutOff: {:?}", gc_info.cutoffs);
}
let res = tenant
.gc_iteration(
Some(TIMELINE_ID),

View File

@@ -4917,7 +4917,7 @@ impl Timeline {
// Gets the minimum LSN that holds the valid lease.
// Caveat: This value could be stale since we rely on refresh_gc_info to invalidate leases,
// so there could be leases invalidated between the refresh and here.
let min_lsn_with_valid_lease = gc_info.leases.last_key_value().map(|(lsn, _)| *lsn);
let min_lsn_with_valid_lease = gc_info.leases.first_key_value().map(|(lsn, _)| *lsn);
(
horizon_cutoff,
pitr_cutoff,