File tree Expand file tree Collapse file tree 4 files changed +46
-6
lines changed Expand file tree Collapse file tree 4 files changed +46
-6
lines changed Original file line number Diff line number Diff line change 1
- # Unreleased
1
+ # 0.33
2
2
3
3
## Breaking Changes
4
4
5
- * the backtrace crate has been made optional, which cuts
6
- several seconds off compilation time, but may cause
5
+ * # 1125 the backtrace crate has been made optional, which
6
+ cuts several seconds off compilation time, but may cause
7
7
breakage if you interacted with the backtrace field
8
8
of corruption-related errors.
9
9
10
+ ## Bug Fixes
11
+
12
+ * #1128 ` Tree::pop_min ` and ` Tree::pop_max ` had a bug where
13
+ they were not atomic.
14
+
10
15
# 0.32.1
11
16
12
17
## New Features
Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " sled"
3
- version = " 0.32.1 "
3
+ version = " 0.33.0 "
4
4
authors = [
" Tyler Neely <[email protected] >" ]
5
5
description = " a modern embedded database"
6
6
license = " MIT/Apache-2.0"
Original file line number Diff line number Diff line change @@ -1315,7 +1315,7 @@ impl Tree {
1315
1315
& first. 0 ,
1316
1316
Some ( & first. 1 ) ,
1317
1317
None ,
1318
- )
1318
+ ) ?
1319
1319
. is_ok ( )
1320
1320
{
1321
1321
return Ok ( Some ( first) ) ;
@@ -1362,7 +1362,7 @@ impl Tree {
1362
1362
& first. 0 ,
1363
1363
Some ( & first. 1 ) ,
1364
1364
None ,
1365
- )
1365
+ ) ?
1366
1366
. is_ok ( )
1367
1367
{
1368
1368
return Ok ( Some ( first) ) ;
Original file line number Diff line number Diff line change @@ -87,6 +87,41 @@ fn test_varied_compression_ratios() {
87
87
let _ = std:: fs:: remove_dir_all ( "compression_db_test" ) ;
88
88
}
89
89
90
+ #[ test]
91
+ #[ cfg( not( miri) ) ] // can't create threads
92
+ fn concurrent_tree_pops ( ) -> sled:: Result < ( ) > {
93
+ use std:: thread;
94
+
95
+ let db = sled:: open ( "db" ) ?;
96
+
97
+ // Insert values 0..5
98
+ for x in 0u32 ..5 {
99
+ db. insert ( x. to_be_bytes ( ) , & [ ] ) ?;
100
+ }
101
+
102
+ let mut threads = vec ! [ ] ;
103
+
104
+ // Pop 5 values using multiple threads
105
+ for _ in 0 ..5 {
106
+ let db = db. clone ( ) ;
107
+ threads. push ( thread:: spawn ( move || {
108
+ db. pop_min ( ) . unwrap ( ) . unwrap ( ) ;
109
+ } ) ) ;
110
+ }
111
+
112
+ for thread in threads. into_iter ( ) {
113
+ thread. join ( ) . unwrap ( ) ;
114
+ }
115
+
116
+ assert ! (
117
+ db. is_empty( ) ,
118
+ "elements left in database: {:?}" ,
119
+ db. iter( ) . collect:: <Vec <_>>( )
120
+ ) ;
121
+
122
+ Ok ( ( ) )
123
+ }
124
+
90
125
#[ test]
91
126
#[ cfg( not( miri) ) ] // can't create threads
92
127
fn concurrent_tree_ops ( ) {
You can’t perform that action at this time.
0 commit comments