GeezerVison is showing github.com — Use parking_lot's Mutex in BlobSet, so TxState is the same size on ma… · clockworklabs/SpacetimeDB@8932a5a
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: crates/table/src/tiered/blob_set.rs +4-8Lines changed: 4 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | use super::metrics::{CacheTier, EvictionDirection, ObjectType}; |
2 | | -use std::{ |
3 | | - num::NonZeroUsize, |
4 | | - ops::Deref, |
5 | | - sync::{Arc, Mutex}, |
6 | | -}; |
| 2 | +use std::{num::NonZeroUsize, ops::Deref, sync::Arc}; |
7 | 3 |
|
8 | | -use parking_lot::RwLock; |
| 4 | +use parking_lot::{Mutex, RwLock}; |
9 | 5 | use spacetimedb_data_structures::{ |
10 | 6 | map::{hash_map, IntMap}, |
11 | 7 | small_map::SmallHashMap, |
@@ -120,7 +116,7 @@ impl BlobSet { |
120 | 116 | return Ok(bytes_freed); |
121 | 117 | } |
122 | 118 |
|
123 | | - let mut candidates = self.evictable.lock().unwrap(); |
| 119 | + let mut candidates = self.evictable.lock(); |
124 | 120 | self.resident.evictable_blobs(&mut candidates); |
125 | 121 | for candidate in candidates.drain(..) { |
126 | 122 | let maybe_resident = self.entries.read().get(&candidate.key).and_then(|entry| match entry { |
@@ -546,7 +542,7 @@ impl BlobSet { |
546 | 542 | impl MemoryUsage for BlobSet { |
547 | 543 | fn heap_usage(&self) -> usize { |
548 | 544 | // Cache and backing store are counted by `TieredDatabaseStorage`. |
549 | | - let scratch = self.evictable.lock().unwrap().capacity() * size_of::<BlobEvictionCandidate>(); |
| 545 | + let scratch = self.evictable.lock().capacity() * size_of::<BlobEvictionCandidate>(); |
550 | 546 |
|
551 | 547 | self.entries.read().heap_usage() + scratch |
552 | 548 | } |
|