File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -920,10 +920,16 @@ impl Tree {
920
920
921
921
let file_name = dirent. file_name ( ) ;
922
922
923
+ // https://en.wikipedia.org/wiki/.DS_Store
923
924
if file_name == ".DS_Store" {
924
925
continue ;
925
926
}
926
927
928
+ // https://en.wikipedia.org/wiki/AppleSingle_and_AppleDouble_formats
929
+ if file_name. to_string_lossy ( ) . starts_with ( "._" ) {
930
+ continue ;
931
+ }
932
+
927
933
let segment_file_name = file_name. to_str ( ) . ok_or_else ( || {
928
934
log:: error!( "invalid segment file name {file_name:?}" ) ;
929
935
crate :: Error :: Unrecoverable
Original file line number Diff line number Diff line change
1
+ use lsm_tree:: { AbstractTree , Config } ;
2
+ use test_log:: test;
3
+
4
+ #[ test]
5
+ fn recovery_mac_underscore_file ( ) -> lsm_tree:: Result < ( ) > {
6
+ let folder = tempfile:: tempdir ( ) ?. into_path ( ) ;
7
+
8
+ {
9
+ let tree = Config :: new ( & folder) . open ( ) ?;
10
+ tree. insert ( "a" , "a" , 0 ) ;
11
+ tree. flush_active_memtable ( 0 ) ?;
12
+ assert_eq ! ( 1 , tree. segment_count( ) ) ;
13
+ }
14
+
15
+ let ds_store = folder. join ( "segments" ) . join ( "._0" ) ;
16
+ std:: fs:: File :: create ( & ds_store) ?;
17
+ assert ! ( ds_store. try_exists( ) ?) ;
18
+
19
+ {
20
+ let tree = Config :: new ( & folder) . open ( ) ?;
21
+ assert_eq ! ( 1 , tree. segment_count( ) ) ;
22
+ }
23
+ assert ! ( ds_store. try_exists( ) ?) ;
24
+
25
+ Ok ( ( ) )
26
+ }
You can’t perform that action at this time.
0 commit comments