Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backupccl,spanconfig,kvserver: ExportRequest noops on ephemeral ranges #75451

Merged
merged 1 commit into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/ccl/backupccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ go_library(
"//pkg/sql/catalog/descidgen",
"//pkg/sql/catalog/descpb",
"//pkg/sql/catalog/descs",
"//pkg/sql/catalog/desctestutils",
"//pkg/sql/catalog/multiregion",
"//pkg/sql/catalog/resolver",
"//pkg/sql/catalog/schemadesc",
Expand Down Expand Up @@ -103,6 +104,9 @@ go_library(
"//pkg/sql/types",
"//pkg/storage",
"//pkg/testutils",
"//pkg/testutils/serverutils",
"//pkg/testutils/sqlutils",
"//pkg/testutils/testcluster",
"//pkg/util",
"//pkg/util/admission",
"//pkg/util/contextutil",
Expand All @@ -123,6 +127,8 @@ go_library(
"//pkg/util/timeutil",
"//pkg/util/tracing",
"//pkg/util/uuid",
"//pkg/workload/bank",
"//pkg/workload/workloadsql",
"@com_github_cockroachdb_errors//:errors",
"@com_github_cockroachdb_logtags//:logtags",
"@com_github_gogo_protobuf//jsonpb",
Expand All @@ -148,7 +154,6 @@ go_test(
"bench_test.go",
"create_scheduled_backup_test.go",
"full_cluster_backup_restore_test.go",
"helpers_test.go",
"insert_missing_public_schema_namespace_entry_restore_test.go",
"key_rewriter_test.go",
"main_test.go",
Expand Down Expand Up @@ -247,7 +252,6 @@ go_test(
"//pkg/util/timeutil",
"//pkg/util/uuid",
"//pkg/workload/bank",
"//pkg/workload/workloadsql",
"@com_github_aws_aws_sdk_go//aws/credentials",
"@com_github_cockroachdb_cockroach_go_v2//crdb",
"@com_github_cockroachdb_datadriven//:datadriven",
Expand Down
6 changes: 3 additions & 3 deletions pkg/ccl/backupccl/backup_cloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestCloudBackupRestoreS3(t *testing.T) {
const numAccounts = 1000

ctx := context.Background()
tc, _, _, cleanupFn := BackupRestoreTestSetup(t, 1, numAccounts, InitManualReplication)
tc, _, _, cleanupFn := backupRestoreTestSetup(t, 1, numAccounts, InitManualReplication)
defer cleanupFn()
prefix := fmt.Sprintf("TestBackupRestoreS3-%d", timeutil.Now().UnixNano())
uri := url.URL{Scheme: "s3", Host: bucket, Path: prefix}
Expand All @@ -89,7 +89,7 @@ func TestCloudBackupRestoreGoogleCloudStorage(t *testing.T) {
const numAccounts = 1000

ctx := context.Background()
tc, _, _, cleanupFn := BackupRestoreTestSetup(t, 1, numAccounts, InitManualReplication)
tc, _, _, cleanupFn := backupRestoreTestSetup(t, 1, numAccounts, InitManualReplication)
defer cleanupFn()
prefix := fmt.Sprintf("TestBackupRestoreGoogleCloudStorage-%d", timeutil.Now().UnixNano())
uri := url.URL{Scheme: "gs", Host: bucket, Path: prefix}
Expand Down Expand Up @@ -120,7 +120,7 @@ func TestCloudBackupRestoreAzure(t *testing.T) {
const numAccounts = 1000

ctx := context.Background()
tc, _, _, cleanupFn := BackupRestoreTestSetup(t, 1, numAccounts, InitManualReplication)
tc, _, _, cleanupFn := backupRestoreTestSetup(t, 1, numAccounts, InitManualReplication)
defer cleanupFn()
prefix := fmt.Sprintf("TestBackupRestoreAzure-%d", timeutil.Now().UnixNano())
uri := url.URL{Scheme: "azure", Host: bucket, Path: prefix}
Expand Down
12 changes: 11 additions & 1 deletion pkg/ccl/backupccl/backup_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,17 @@ func runBackupProcessor(
if errors.HasType(exportRequestErr, (*contextutil.TimeoutError)(nil)) {
return errors.Wrap(exportRequestErr, "export request timeout")
}
// BatchTimestampBeforeGCError is returned if the ExportRequest
// attempts to read below the range's GC threshold.
if batchTimestampBeforeGCError, ok := pErr.GetDetail().(*roachpb.BatchTimestampBeforeGCError); ok {
// If the range we are exporting is marked to be excluded from
// backup, it is safe to ignore the error. It is likely that the
// table has been configured with a low GC TTL, and so the data
// the backup is targeting has already been gc'ed.
if batchTimestampBeforeGCError.DataExcludedFromBackup {
continue
}
}
return errors.Wrapf(exportRequestErr, "exporting %s", span.span)
}

Expand Down Expand Up @@ -633,7 +644,6 @@ func makeSSTSink(
// prior to the error.
incrementSize := int64(32 << 20)
maxSize := smallFileBuffer.Get(s.conf.settings)
log.Infof(ctx, "this is the max size we are using %d", (maxSize / (1024 * 1024)))
for {
if s.queueCap >= maxSize {
break
Expand Down
6 changes: 3 additions & 3 deletions pkg/ccl/backupccl/backup_rand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ database_name = 'rand' AND schema_name = 'public'`)
// Now that we've created our random tables, backup and restore the whole DB
// and compare all table descriptors for equality.

dbBackup := LocalFoo + "wholedb"
tablesBackup := LocalFoo + "alltables"
dbBackup := localFoo + "wholedb"
tablesBackup := localFoo + "alltables"
dbBackups := []string{dbBackup, tablesBackup}

if err := verifyBackupRestoreStatementResult(
Expand Down Expand Up @@ -136,7 +136,7 @@ database_name = 'rand' AND schema_name = 'public'`)

for i, combo := range tableNameCombos {
sqlDB.Exec(t, "DROP DATABASE IF EXISTS restoredb; CREATE DATABASE restoredb")
backupTarget := fmt.Sprintf("%s%d", LocalFoo, i)
backupTarget := fmt.Sprintf("%s%d", localFoo, i)
if len(combo) == 0 {
continue
}
Expand Down
Loading