@@ -334,11 +334,11 @@ func restore(
334334 defer introducedSpanFrontier .Release ()
335335
336336 targetSize := targetRestoreSpanSize .Get (& execCtx .ExecCfg ().Settings .SV )
337- if details .ExperimentalOnline {
337+ if details .OnlineImpl () {
338338 targetSize = targetOnlineRestoreSpanSize .Get (& execCtx .ExecCfg ().Settings .SV )
339339 }
340340 maxFileCount := maxFileCount .Get (& execCtx .ExecCfg ().Settings .SV )
341- if details .ExperimentalOnline {
341+ if details .OnlineImpl () {
342342 // Online Restore does not need to limit the number of files per restore
343343 // span entry as the files are never opened when processing the span. The
344344 // span is only used to create split points.
@@ -433,7 +433,7 @@ func restore(
433433 }
434434
435435 progCh := make (chan * execinfrapb.RemoteProducerMetadata_BulkProcessorProgress )
436- if ! details .ExperimentalOnline {
436+ if ! details .OnlineImpl () {
437437 // Online restore tracks progress by pinging requestFinishedCh instead
438438 generativeCheckpointLoop := func (ctx context.Context ) error {
439439 defer close (requestFinishedCh )
@@ -479,7 +479,7 @@ func restore(
479479 }
480480
481481 resumeClusterVersion := execCtx .ExecCfg ().Settings .Version .ActiveVersion (restoreCtx ).Version
482- if clusterversion .V24_3 .Version ().LessEq (resumeClusterVersion ) && ! details .ExperimentalOnline {
482+ if clusterversion .V24_3 .Version ().LessEq (resumeClusterVersion ) && ! details .OnlineImpl () {
483483 tasks = append (tasks , countCompletedProcLoop )
484484 }
485485
@@ -506,7 +506,7 @@ func restore(
506506 tasks = append (tasks , tracingAggLoop )
507507
508508 runRestore := func (ctx context.Context ) error {
509- if details .ExperimentalOnline {
509+ if details .OnlineImpl () {
510510 log .Warningf (ctx , "EXPERIMENTAL ONLINE RESTORE being used" )
511511 approxRows , approxDataSize , err := sendAddRemoteSSTs (
512512 ctx ,
@@ -997,7 +997,7 @@ func createImportingDescriptors(
997997 }
998998
999999 if backedUpDescriptorWithInProgressImportInto (desc ) {
1000- if details .ExperimentalOnline && ! epochBasedInProgressImport (desc ) {
1000+ if details .OnlineImpl () && ! epochBasedInProgressImport (desc ) {
10011001 return nil , nil , nil , errors .Newf ("table %s (id %d) in restoring backup has an in-progress import, but online restore cannot be run on a table with an in progress import" , desc .GetName (), desc .GetID ())
10021002 }
10031003 } else {
@@ -1048,19 +1048,19 @@ func createImportingDescriptors(
10481048
10491049 // We get the spans of the restoring tables _as they appear in the backup_,
10501050 // that is, in the 'old' keyspace, before we reassign the table IDs.
1051- preRestoreSpans , err := spansForAllRestoreTableIndexes (backupCodec , preRestoreTables , nil , details .SchemaOnly , details .ExperimentalOnline )
1051+ preRestoreSpans , err := spansForAllRestoreTableIndexes (backupCodec , preRestoreTables , nil , details .SchemaOnly , details .OnlineImpl () )
10521052 if err != nil {
10531053 return nil , nil , nil , err
10541054 }
1055- postRestoreSpans , err := spansForAllRestoreTableIndexes (backupCodec , postRestoreTables , nil , details .SchemaOnly , details .ExperimentalOnline )
1055+ postRestoreSpans , err := spansForAllRestoreTableIndexes (backupCodec , postRestoreTables , nil , details .SchemaOnly , details .OnlineImpl () )
10561056 if err != nil {
10571057 return nil , nil , nil , err
10581058 }
10591059 var verifySpans []roachpb.Span
10601060 if details .VerifyData {
10611061 // verifySpans contains the spans that should be read and checksum'd during a
10621062 // verify_backup_table_data RESTORE
1063- verifySpans , err = spansForAllRestoreTableIndexes (backupCodec , postRestoreTables , nil , false , details .ExperimentalOnline )
1063+ verifySpans , err = spansForAllRestoreTableIndexes (backupCodec , postRestoreTables , nil , false , details .OnlineImpl () )
10641064 if err != nil {
10651065 return nil , nil , nil , err
10661066 }
@@ -1769,7 +1769,7 @@ func (r *restoreResumer) doResume(ctx context.Context, execCtx interface{}) erro
17691769 if err := p .ExecCfg ().JobRegistry .CheckPausepoint ("restore.before_do_download_files" ); err != nil {
17701770 return err
17711771 }
1772- return r .doDownloadFiles (ctx , p )
1772+ return r .doDownloadFiles (ctx , p , details . DownloadSpans )
17731773 }
17741774
17751775 if err := p .ExecCfg ().JobRegistry .CheckPausepoint ("restore.before_load_descriptors_from_backup" ); err != nil {
@@ -1866,9 +1866,6 @@ func (r *restoreResumer) doResume(ctx context.Context, execCtx interface{}) erro
18661866 return err
18671867 }
18681868 }
1869- if err := r .maybeWriteDownloadJob (ctx , p .ExecCfg (), preData , mainData ); err != nil {
1870- return err
1871- }
18721869 emitRestoreJobEvent (ctx , p , jobs .StateSucceeded , r .job )
18731870 return nil
18741871 }
@@ -1897,6 +1894,10 @@ func (r *restoreResumer) doResume(ctx context.Context, execCtx interface{}) erro
18971894
18981895 var resTotal roachpb.RowCount
18991896
1897+ // TODO(msbutler): add a progress field to skip running a restore flow if it
1898+ // has already complete. This ensures we skip the link phase if we resume an
1899+ // online restore job that blocks on the download job.
1900+
19001901 if ! preData .isEmpty () {
19011902 res , err := restoreWithRetry (
19021903 ctx ,
@@ -1981,6 +1982,15 @@ func (r *restoreResumer) doResume(ctx context.Context, execCtx interface{}) erro
19811982 if err := insertStats (ctx , r .job , p .ExecCfg (), remappedStats ); err != nil {
19821983 return errors .Wrap (err , "inserting table statistics" )
19831984 }
1985+ if details .ExperimentalCopy {
1986+ downloadSpans , err := getDownloadSpans (p .ExecCfg ().Codec , preData , mainData )
1987+ if err != nil {
1988+ return err
1989+ }
1990+ if err := r .doDownloadFiles (ctx , p , downloadSpans ); err != nil {
1991+ return err
1992+ }
1993+ }
19841994
19851995 publishDescriptors := func (ctx context.Context , txn descs.Txn ) (err error ) {
19861996 return r .publishDescriptors (
@@ -2058,7 +2068,7 @@ func (r *restoreResumer) doResume(ctx context.Context, execCtx interface{}) erro
20582068 if err := r .execCfg .ProtectedTimestampManager .Unprotect (ctx , r .job ); err != nil {
20592069 log .Errorf (ctx , "failed to release protected timestamp: %v" , err )
20602070 }
2061- if ! details .ExperimentalOnline {
2071+ if ! details .OnlineImpl () {
20622072 r .notifyStatsRefresherOfNewTables ()
20632073 }
20642074
@@ -2169,7 +2179,7 @@ func (r *restoreResumer) ReportResults(ctx context.Context, resultsCh chan<- tre
21692179 return ctx .Err ()
21702180 case resultsCh <- func () tree.Datums {
21712181 details := r .job .Details ().(jobspb.RestoreDetails )
2172- if details .ExperimentalOnline {
2182+ if details .OnlineImpl () {
21732183 return tree.Datums {
21742184 tree .NewDInt (tree .DInt (r .job .ID ())),
21752185 tree .NewDInt (tree .DInt (len (details .TableDescs ))),
@@ -2440,7 +2450,7 @@ func (r *restoreResumer) publishDescriptors(
24402450 return err
24412451 }
24422452
2443- if details .ExperimentalOnline && epochBasedInProgressImport (desc ) {
2453+ if details .OnlineImpl () && epochBasedInProgressImport (desc ) {
24442454 if err := createImportRollbackJob (ctx ,
24452455 r .execCfg .JobRegistry , txn , r .job .Payload ().UsernameProto .Decode (), mutTable ,
24462456 ); err != nil {
@@ -2481,7 +2491,7 @@ func (r *restoreResumer) publishDescriptors(
24812491 b := txn .KV ().NewBatch ()
24822492 if err := all .ForEachDescriptor (func (desc catalog.Descriptor ) error {
24832493 d := desc .(catalog.MutableDescriptor )
2484- if details .ExperimentalOnline && epochBasedInProgressImport (desc ) {
2494+ if details .OnlineImpl () && epochBasedInProgressImport (desc ) {
24852495 log .Infof (ctx , "table %q (%d) with in-progress IMPORT remaining offline" , desc .GetName (), desc .GetID ())
24862496 } else {
24872497 d .SetPublic ()
@@ -2520,7 +2530,7 @@ func (r *restoreResumer) publishDescriptors(
25202530 details .SchemaDescs = newSchemas
25212531 details .DatabaseDescs = newDBs
25222532 details .FunctionDescs = newFunctions
2523- if details .ExperimentalOnline {
2533+ if details .OnlineImpl () {
25242534 details .PostDownloadTableAutoStatsSettings = tableAutoStatsSettings
25252535 }
25262536 if err := r .job .WithTxn (txn ).SetDetails (ctx , details ); err != nil {
0 commit comments