Skip to content

Commit c7b506f

Browse files
committed
restore: fast fail unsupported online restore with range keys
Fixes #150385 Release note: none
1 parent 02f8de2 commit c7b506f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pkg/backup/restore_job.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ func rewriteBackupSpanKey(
175175
return newKey, nil
176176
}
177177

178+
var permanentRestoreError = errors.New("permanent restore error")
179+
180+
func shouldFastFailRestore(err error) bool {
181+
return errors.Is(err, permanentRestoreError) ||
182+
pebble.IsCorruptionError(err) && errors.Is(err, backupFileReadError)
183+
}
184+
178185
// restoreWithRetry attempts to run restore with retry logic and logs retries
179186
// accordingly.
180187
func restoreWithRetry(
@@ -217,9 +224,10 @@ func restoreWithRetry(
217224
return roachpb.RowCount{}, jobs.MarkPauseRequestError(errors.UnwrapAll(err))
218225
}
219226

220-
if pebble.IsCorruptionError(err) && errors.Is(err, backupFileReadError) {
227+
if shouldFastFailRestore(err) {
221228
return roachpb.RowCount{}, jobs.MarkAsPermanentJobError(err)
222229
}
230+
223231
// If we are draining, it is unlikely we can start a
224232
// new DistSQL flow. Exit with a retryable error so
225233
// that another node can pick up the job.

pkg/backup/restore_online.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ func sendAddRemoteSSTWorker(
310310
}
311311
currentLayer = file.Layer
312312
if file.HasRangeKeys {
313-
return errors.Newf("online restore of range keys not supported")
313+
return errors.Wrapf(permanentRestoreError, "online restore of range keys not supported")
314314
}
315315
if err := assertCommonPrefix(file.BackupFileEntrySpan, entry.ElidedPrefix); err != nil {
316316
return err

0 commit comments

Comments
 (0)