@@ -525,25 +525,24 @@ impl TableState {
525
525
& mut self ,
526
526
conn : & mut PgConnection ,
527
527
elapsed : Duration ,
528
- first_batch : bool ,
529
528
) -> Result < ( ) , StoreError > {
530
529
use copy_table_state as cts;
531
530
532
531
// This conversion will become a problem if a copy takes longer than
533
532
// 300B years
534
533
self . duration_ms += i64:: try_from ( elapsed. as_millis ( ) ) . unwrap_or ( 0 ) ;
535
534
536
- if first_batch {
537
- // Reset started_at so that finished_at - started_at is an
538
- // accurate indication of how long we worked on a table.
539
- update (
540
- cts:: table
541
- . filter ( cts:: dst. eq ( self . dst_site . id ) )
542
- . filter ( cts:: entity_type. eq ( self . batch . dst . object . as_str ( ) ) ) ,
543
- )
544
- . set ( cts :: started_at . eq ( sql ( "now()" ) ) )
545
- . execute ( conn ) ? ;
546
- }
535
+ // Reset started_at so that finished_at - started_at is an accurate
536
+ // indication of how long we worked on a table if we haven't worked
537
+ // on the table yet .
538
+ update (
539
+ cts:: table
540
+ . filter ( cts:: dst. eq ( self . dst_site . id ) )
541
+ . filter ( cts:: entity_type. eq ( self . batch . dst . object . as_str ( ) ) )
542
+ . filter ( cts :: duration_ms . eq ( 0 ) ) ,
543
+ )
544
+ . set ( cts :: started_at . eq ( sql ( "now()" ) ) )
545
+ . execute ( conn ) ? ;
547
546
let values = (
548
547
cts:: next_vid. eq ( self . batch . next_vid ) ,
549
548
cts:: batch_size. eq ( self . batch . batch_size . size ) ,
@@ -591,11 +590,9 @@ impl TableState {
591
590
}
592
591
593
592
fn copy_batch ( & mut self , conn : & mut PgConnection ) -> Result < Status , StoreError > {
594
- let first_batch = self . batch . next_vid == 0 ;
595
-
596
593
let duration = self . batch . run ( conn) ?;
597
594
598
- self . record_progress ( conn, duration, first_batch ) ?;
595
+ self . record_progress ( conn, duration) ?;
599
596
600
597
if self . finished ( ) {
601
598
self . record_finished ( conn) ?;
0 commit comments