@@ -84,30 +84,26 @@ impl AbstractTree for Tree {
8484 let version_history_lock = self . version_history . read ( ) . expect ( "lock is poisoned" ) ;
8585 let super_version = version_history_lock. get_version_for_snapshot ( seqno) ;
8686
87- // Track the newest visible version across all sources
88- let mut best: Option < InternalValue > = super_version. active_memtable . get ( key, seqno) ;
87+ // Active memtable has the newest writes; if present, it's definitive.
88+ if let Some ( entry) = super_version. active_memtable . get ( key, seqno) {
89+ return Ok ( ignore_tombstone_value ( entry) ) ;
90+ }
8991
92+ // Sealed memtables are newer than any tables; return on first hit.
9093 if let Some ( entry) =
9194 Self :: get_internal_entry_from_sealed_memtables ( & super_version, key, seqno)
9295 {
93- match & best {
94- Some ( b) if b. key . seqno >= entry. key . seqno => { }
95- _ => best = Some ( entry) ,
96- }
96+ return Ok ( ignore_tombstone_value ( entry) ) ;
9797 }
9898
99- // Merge with the newest version found in tables
99+ // Otherwise consult tables (levels top-down, runs newest-first) and return first hit.
100100 if let Some ( entry) =
101101 self . get_internal_entry_from_tables ( & super_version. version , key, seqno) ?
102102 {
103- match & best {
104- Some ( b) if b. key . seqno >= entry. key . seqno => { }
105- _ => best = Some ( entry) ,
106- }
103+ return Ok ( ignore_tombstone_value ( entry) ) ;
107104 }
108105
109- // Apply tombstone semantics after choosing the newest version
110- Ok ( best. and_then ( ignore_tombstone_value) )
106+ Ok ( None )
111107 }
112108
113109 fn current_version ( & self ) -> Version {
@@ -479,7 +475,6 @@ impl AbstractTree for Tree {
479475 self . current_version ( ) . level ( idx) . map ( |x| x. table_count ( ) )
480476 }
481477
482- #[ expect( clippy:: significant_drop_tightening) ]
483478 fn approximate_len ( & self ) -> usize {
484479 let super_version = self
485480 . version_history
@@ -512,7 +507,6 @@ impl AbstractTree for Tree {
512507 . sum ( )
513508 }
514509
515- #[ expect( clippy:: significant_drop_tightening) ]
516510 fn get_highest_memtable_seqno ( & self ) -> Option < SeqNo > {
517511 let version = self
518512 . version_history
0 commit comments