@@ -267,8 +267,8 @@ impl Snapshot {
267267 ) -> DeltaResult < Arc < Self > > {
268268 let operation_id = operation_id. unwrap_or_default ( ) ;
269269 let reporter = engine. get_metrics_reporter ( ) ;
270- let start = Instant :: now ( ) ;
271270
271+ let start = Instant :: now ( ) ;
272272 let result =
273273 Self :: try_new_from_impl ( existing_snapshot, log_tail, engine, version, operation_id) ;
274274 let snapshot_duration = start. elapsed ( ) ;
@@ -298,15 +298,29 @@ impl Snapshot {
298298
299299 /// Implementation of snapshot creation from log segment.
300300 ///
301- /// Calls `build_table_configuration` which reports `ProtocolMetadataLoaded`.
301+ /// Reports metrics: `ProtocolMetadataLoaded`.
302302 fn try_new_from_log_segment_impl (
303303 location : Url ,
304304 log_segment : LogSegment ,
305305 engine : & dyn Engine ,
306306 operation_id : MetricId ,
307307 ) -> DeltaResult < Self > {
308+ let reporter = engine. get_metrics_reporter ( ) ;
309+
310+ let start = Instant :: now ( ) ;
311+ let ( metadata, protocol) = log_segment. read_metadata ( engine) ?;
312+ let read_metadata_duration = start. elapsed ( ) ;
313+
314+ reporter. as_ref ( ) . inspect ( |r| {
315+ r. report ( MetricEvent :: ProtocolMetadataLoaded {
316+ operation_id,
317+ duration : read_metadata_duration,
318+ } ) ;
319+ } ) ;
320+
308321 let table_configuration =
309- Self :: build_table_configuration ( & log_segment, engine, location, operation_id) ?;
322+ TableConfiguration :: try_new ( metadata, protocol, location, log_segment. end_version ) ?;
323+
310324 Ok ( Self {
311325 log_segment,
312326 table_configuration,
@@ -324,8 +338,8 @@ impl Snapshot {
324338 ) -> DeltaResult < Self > {
325339 let operation_id = operation_id. unwrap_or_default ( ) ;
326340 let reporter = engine. get_metrics_reporter ( ) ;
327- let start = Instant :: now ( ) ;
328341
342+ let start = Instant :: now ( ) ;
329343 let result =
330344 Self :: try_new_from_log_segment_impl ( location, log_segment, engine, operation_id) ;
331345 let snapshot_duration = start. elapsed ( ) ;
@@ -516,33 +530,6 @@ impl Snapshot {
516530 None => Err ( Error :: generic ( "Last commit file not found in log segment" ) ) ,
517531 }
518532 }
519-
520- /// Build table configuration from log segment.
521- ///
522- /// Reports metrics: `ProtocolMetadataLoaded`.
523- fn build_table_configuration (
524- log_segment : & LogSegment ,
525- engine : & dyn Engine ,
526- location : Url ,
527- operation_id : MetricId ,
528- ) -> DeltaResult < TableConfiguration > {
529- let start = Instant :: now ( ) ;
530- let reporter = engine. get_metrics_reporter ( ) ;
531- let ( metadata, protocol) = log_segment. read_metadata ( engine) ?;
532- let read_metadata_duration = start. elapsed ( ) ;
533-
534- reporter. as_ref ( ) . inspect ( |r| {
535- r. report ( MetricEvent :: ProtocolMetadataLoaded {
536- operation_id,
537- duration : read_metadata_duration,
538- } ) ;
539- } ) ;
540-
541- let table_configuration =
542- TableConfiguration :: try_new ( metadata, protocol, location, log_segment. end_version ) ?;
543-
544- Ok ( table_configuration)
545- }
546533}
547534
548535#[ cfg( test) ]
0 commit comments