@@ -336,19 +336,13 @@ where
336
336
memtable
337
337
. read ( )
338
338
. fetch_entries_to ( begin, end, max_size, & mut ents_idx) ?;
339
- println ! (
340
- "[fetch_entries_to_aio] (stage1) time cost: {:?} us" ,
341
- start. elapsed( ) . as_micros( )
342
- ) ;
339
+
343
340
344
341
let bytes = self . pipe_log . async_read_bytes ( & mut ents_idx) . unwrap ( ) ;
345
342
parse_entries_from_bytes :: < M > ( bytes, & mut ents_idx, vec) ;
346
343
347
344
ENGINE_READ_ENTRY_COUNT_HISTOGRAM . observe ( ents_idx. len ( ) as f64 ) ;
348
- println ! (
349
- "[fetch_entries_to_aio] (end) time cost: {:?} us" ,
350
- start. elapsed( ) . as_micros( )
351
- ) ;
345
+
352
346
return Ok ( ents_idx. len ( ) ) ;
353
347
}
354
348
@@ -846,66 +840,24 @@ mod tests {
846
840
assert_eq ! ( d, & data) ;
847
841
} ) ;
848
842
}
849
-
850
- // Recover the engine.
851
- let engine = engine. reopen ( ) ;
852
843
for i in 10 ..20 {
853
844
let rid = i;
854
845
let index = i;
855
- engine. scan_entries ( rid, index, index + 2 , |_, q, d| {
846
+ engine. scan_entries_aio ( rid, index, index + 2 , |_, q, d| {
856
847
assert_eq ! ( q, LogQueue :: Append ) ;
857
848
assert_eq ! ( d, & data) ;
858
849
} ) ;
859
850
}
860
- }
861
- }
862
851
863
- #[ test]
864
- fn test_async_read ( ) {
865
- let normal_batch_size = 10 ;
866
- let compressed_batch_size = 5120 ;
867
- for & entry_size in & [ normal_batch_size] {
868
- if entry_size == normal_batch_size {
869
- println ! ( "[normal_batch_size]" ) ;
870
- } else if entry_size == compressed_batch_size {
871
- println ! ( "[compressed_batch_size]" ) ;
872
- }
873
- let dir = tempfile:: Builder :: new ( )
874
- . prefix ( "test_get_entry" )
875
- . tempdir ( )
876
- . unwrap ( ) ;
877
- let cfg = Config {
878
- dir : dir. path ( ) . to_str ( ) . unwrap ( ) . to_owned ( ) ,
879
- target_file_size : ReadableSize :: gb ( 1 ) ,
880
- ..Default :: default ( )
881
- } ;
882
-
883
- let engine =
884
- RaftLogEngine :: open_with_file_system ( cfg. clone ( ) , Arc :: new ( DefaultFileSystem ) )
885
- . unwrap ( ) ;
886
-
887
- assert_eq ! ( engine. path( ) , dir. path( ) . to_str( ) . unwrap( ) ) ;
888
- let data = vec ! [ b'x' ; entry_size] ;
889
- for i in 10 ..1010 {
890
- for rid in 10 ..15 {
891
- let index = i;
892
- engine. append ( rid, index, index + 1 , Some ( & data) ) ;
893
- }
894
- }
895
- for i in 10 ..15 {
852
+ // Recover the engine.
853
+ let engine = engine. reopen ( ) ;
854
+ for i in 10 ..20 {
896
855
let rid = i;
897
- let index = 10 ;
898
- println ! ( "[PREAD]" ) ;
899
- engine. scan_entries ( rid, index, index + 1000 , |_, q, d| {
900
- assert_eq ! ( q, LogQueue :: Append ) ;
901
- assert_eq ! ( d, & data) ;
902
- } ) ;
903
- println ! ( "[AIO]" ) ;
904
- engine. scan_entries_aio ( rid, index, index + 1000 , |_, q, d| {
856
+ let index = i;
857
+ engine. scan_entries ( rid, index, index + 2 , |_, q, d| {
905
858
assert_eq ! ( q, LogQueue :: Append ) ;
906
859
assert_eq ! ( d, & data) ;
907
860
} ) ;
908
- println ! ( "====================================================================================" ) ;
909
861
}
910
862
}
911
863
}
0 commit comments