18
18
use std:: {
19
19
fs,
20
20
path:: { Path , PathBuf } ,
21
- sync:: Arc ,
21
+ sync:: {
22
+ atomic:: { AtomicU64 , Ordering } ,
23
+ Arc ,
24
+ } ,
22
25
} ;
23
26
24
27
use log:: warn;
@@ -42,11 +45,11 @@ pub struct MappedFileQueue {
42
45
// pub(crate) mapped_files: Vec<LocalMappedFile>,
43
46
pub ( crate ) allocate_mapped_file_service : Option < AllocateMappedFileService > ,
44
47
45
- pub ( crate ) flushed_where : Arc < parking_lot :: Mutex < u64 > > ,
48
+ pub ( crate ) flushed_where : Arc < AtomicU64 > ,
46
49
47
- pub ( crate ) committed_where : Arc < parking_lot :: Mutex < u64 > > ,
50
+ pub ( crate ) committed_where : Arc < AtomicU64 > ,
48
51
49
- pub ( crate ) store_timestamp : Arc < parking_lot :: Mutex < u64 > > ,
52
+ pub ( crate ) store_timestamp : Arc < AtomicU64 > ,
50
53
}
51
54
52
55
/*impl Swappable for MappedFileQueue {
@@ -75,9 +78,9 @@ impl MappedFileQueue {
75
78
mapped_file_size,
76
79
mapped_files : Vec :: new ( ) ,
77
80
allocate_mapped_file_service,
78
- flushed_where : Arc :: new ( parking_lot :: Mutex :: new ( 0 ) ) ,
79
- committed_where : Arc :: new ( parking_lot :: Mutex :: new ( 0 ) ) ,
80
- store_timestamp : Arc :: new ( parking_lot :: Mutex :: new ( 0 ) ) ,
81
+ flushed_where : Arc :: new ( AtomicU64 :: new ( 0 ) ) ,
82
+ committed_where : Arc :: new ( AtomicU64 :: new ( 0 ) ) ,
83
+ store_timestamp : Arc :: new ( AtomicU64 :: new ( 0 ) ) ,
81
84
}
82
85
}
83
86
@@ -225,11 +228,13 @@ impl MappedFileQueue {
225
228
}
226
229
227
230
pub fn set_flushed_where ( & mut self , flushed_where : i64 ) {
228
- * self . flushed_where . lock ( ) = flushed_where as u64 ;
231
+ self . flushed_where
232
+ . store ( flushed_where as u64 , Ordering :: SeqCst ) ;
229
233
}
230
234
231
235
pub fn set_committed_where ( & mut self , committed_where : i64 ) {
232
- * self . committed_where . lock ( ) = committed_where as u64 ;
236
+ self . committed_where
237
+ . store ( committed_where as u64 , Ordering :: SeqCst ) ;
233
238
}
234
239
235
240
pub fn truncate_dirty_files ( & mut self , offset : i64 ) { }
0 commit comments