File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
object-store/src/layers/lru_cache Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 14
14
15
15
use std:: ops:: Range ;
16
16
use std:: sync:: Arc ;
17
+ use std:: time:: Instant ;
17
18
18
19
use bytes:: Bytes ;
20
+ use common_telemetry:: trace;
19
21
use object_store:: ObjectStore ;
20
22
use parquet:: basic:: ColumnOrder ;
21
23
use parquet:: file:: metadata:: { FileMetaData , ParquetMetaData , RowGroupMetaData } ;
@@ -100,7 +102,10 @@ pub async fn fetch_byte_ranges(
100
102
object_store : ObjectStore ,
101
103
ranges : & [ Range < u64 > ] ,
102
104
) -> object_store:: Result < Vec < Bytes > > {
103
- Ok ( object_store
105
+ let total_size = ranges. iter ( ) . map ( |r| r. end - r. start ) . sum :: < u64 > ( ) ;
106
+ let start = Instant :: now ( ) ;
107
+
108
+ let result = object_store
104
109
. reader_with ( file_path)
105
110
. concurrent ( FETCH_PARALLELISM )
106
111
. gap ( MERGE_GAP )
@@ -109,5 +114,14 @@ pub async fn fetch_byte_ranges(
109
114
. await ?
110
115
. into_iter ( )
111
116
. map ( |buf| buf. to_bytes ( ) )
112
- . collect :: < Vec < _ > > ( ) )
117
+ . collect :: < Vec < _ > > ( ) ;
118
+
119
+ trace ! (
120
+ "Fetch {} bytes from '{}' in object store, cost: {:?}" ,
121
+ total_size,
122
+ file_path,
123
+ start. elapsed( )
124
+ ) ;
125
+
126
+ Ok ( result)
113
127
}
Original file line number Diff line number Diff line change 14
14
15
15
use std:: sync:: Arc ;
16
16
17
- use common_telemetry:: debug;
17
+ use common_telemetry:: { debug, trace } ;
18
18
use futures:: { FutureExt , TryStreamExt } ;
19
19
use moka:: future:: Cache ;
20
20
use moka:: notification:: ListenerFuture ;
@@ -290,6 +290,11 @@ impl<C: Access> ReadCache<C> {
290
290
let ( _, reader) = inner. read ( path, args) . await ?;
291
291
let result = self . try_write_cache :: < I > ( reader, read_key) . await ;
292
292
293
+ trace ! (
294
+ "Read cache miss for key '{}' and fetch file '{}' from object store" ,
295
+ read_key, path,
296
+ ) ;
297
+
293
298
match result {
294
299
Ok ( read_bytes) => {
295
300
OBJECT_STORE_LRU_CACHE_ENTRIES . inc ( ) ;
You can’t perform that action at this time.
0 commit comments