reduce locking on get_rooted_entries (#16304)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							b242f82696
						
					
				
				
					commit
					7a997759fa
				
			| @@ -685,9 +685,11 @@ impl<T: 'static + Clone + IsCached + ZeroLamport> AccountsIndex<T> { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     pub fn get_rooted_entries(&self, slice: SlotSlice<T>, max: Option<Slot>) -> SlotList<T> { |     pub fn get_rooted_entries(&self, slice: SlotSlice<T>, max: Option<Slot>) -> SlotList<T> { | ||||||
|  |         let max = max.unwrap_or(Slot::MAX); | ||||||
|  |         let lock = &self.roots_tracker.read().unwrap().roots; | ||||||
|         slice |         slice | ||||||
|             .iter() |             .iter() | ||||||
|             .filter(|(slot, _)| self.is_root(*slot) && max.map_or(true, |max| *slot <= max)) |             .filter(|(slot, _)| *slot <= max && lock.contains(slot)) | ||||||
|             .cloned() |             .cloned() | ||||||
|             .collect() |             .collect() | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user