diff --git a/pageserver/src/tenant/timeline/handle.rs b/pageserver/src/tenant/timeline/handle.rs index 3263697eb7..77e496acff 100644 --- a/pageserver/src/tenant/timeline/handle.rs +++ b/pageserver/src/tenant/timeline/handle.rs @@ -634,39 +634,13 @@ mod tests { // // fill the cache // - assert_eq!( - (Arc::strong_count(&shard0), Arc::weak_count(&shard0)), - (2, 1), - "strong: shard0, mgr; weak: myself" - ); - let handle: Handle<_> = cache .get(timeline_id, ShardSelector::Page(key), &mgr) .await .expect("we have the timeline"); - let handle_inner_weak = Arc::downgrade(&handle.timeline); assert!(Weak::ptr_eq(&handle.myself, &shard0.myself)); - // assert_eq!( - // ( - // Weak::strong_count(&handle_inner_weak), - // Weak::weak_count(&handle_inner_weak) - // ), - // (2, 2), - // "strong: handle, per_timeline_state, weak: handle_inner_weak, cache" - // ); assert_eq!(cache.map.len(), 1); - - // assert_eq!( - // (Arc::strong_count(&shard0), Arc::weak_count(&shard0)), - // (3, 1), - // "strong: handleinner(per_timeline_state), shard0, mgr; weak: myself" - // ); drop(handle); - // assert_eq!( - // (Arc::strong_count(&shard0), Arc::weak_count(&shard0)), - // (3, 1), - // "strong: handleinner(per_timeline_state), shard0, mgr; weak: myself" - // ); // // demonstrate that Handle holds up gate closure @@ -691,21 +665,11 @@ mod tests { // SHUTDOWN shard0.per_timeline_state.shutdown().await; // keeping handle alive across shutdown - // assert_eq!( - // 1, - // Weak::strong_count(&handle_inner_weak), - // "through local var handle" - // ); assert_eq!( cache.map.len(), 1, "this is an implementation detail but worth pointing out: we can't clear the cache from shutdown(), it's cleared on first access after" ); - // assert_eq!( - // (Arc::strong_count(&shard0), Arc::weak_count(&shard0)), - // (3, 1), - // "strong: handleinner(via handle), shard0, mgr; weak: myself" - // ); // this handle is perfectly usable handle.getpage(); @@ -729,16 +693,6 @@ mod tests { } drop(handle); - // assert_eq!( - // 0, - // Weak::strong_count(&handle_inner_weak), - // "the HandleInner destructor already ran" - // ); - // assert_eq!( - // (Arc::strong_count(&shard0), Arc::weak_count(&shard0)), - // (2, 1), - // "strong: shard0, mgr; weak: myself" - // ); // closing gate succeeds after dropping handle tokio::select! { @@ -757,10 +711,8 @@ mod tests { assert_eq!(cache.map.len(), 0); // ensure all refs to shard0 are gone and we're not leaking anything - let myself = Weak::clone(&shard0.myself); drop(shard0); drop(mgr); - // assert_eq!(Weak::strong_count(&myself), 0); } #[tokio::test] @@ -1002,12 +954,8 @@ mod tests { used_handles.push(Arc::downgrade(&handle.timeline)); } - // No handles exist, thus gates are closed and don't require shutdown - // assert!(used_handles - // .iter() - // .all(|weak| Weak::strong_count(weak) == 0)); - - // ... thus the gate should close immediately, even without shutdown + // No handles exist, thus gates are closed and don't require shutdown. + // Thus the gate should close immediately, even without shutdown. tokio::select! { _ = shard0.gate.close() => { } _ = tokio::time::sleep(FOREVER) => {