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

roachtest: codify longer ttl external storage buckets #110288

Merged
merged 1 commit into from
Sep 14, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ export TESTS="${TESTS:-costfuzz/workload-replay}"
export ROACHTEST_BUCKET="${ROACHTEST_BUCKET:-cockroach-nightly-private}"
export GCE_PROJECT="e2e-infra-381422"
export BACKUP_TESTING_BUCKET="cockroach-backup-testing-private"

# TODO(msbutler): use a different bucket once it is created. Sadly, I don't have the permissions
# currently to create a new bucket in this gce project.
export BACKUP_TESTING_BUCKET_LONG_TTL="cockroach-backup-testing-private"
export COCKROACH_SKIP_ENABLING_DIAGNOSTIC_REPORTING=1
export COCKROACH_NO_EXAMPLE_DATABASE=1
export COCKROACH_AUTO_BALLAST=false

BAZEL_SUPPORT_EXTRA_DOCKER_ARGS="-e LITERAL_ARTIFACTS_DIR=$root/artifacts -e BUILD_VCS_NUMBER -e CLOUD=gce -e TESTS -e COUNT -e GITHUB_API_TOKEN -e GITHUB_ORG -e GITHUB_REPO -e GOOGLE_EPHEMERAL_CREDENTIALS -e ROACHTEST_PRIVATE -e ROACHTEST_BUCKET -e SLACK_TOKEN -e TC_BUILDTYPE_ID -e TC_BUILD_BRANCH -e TC_BUILD_ID -e TC_SERVER_URL -e COCKROACH_DEV_LICENSE -e BACKUP_TESTING_BUCKET -e SFUSER -e SFPASSWORD -e COCKROACH_SKIP_ENABLING_DIAGNOSTIC_REPORTING -e COCKROACH_NO_EXAMPLE_DATABASE -e COCKROACH_AUTO_BALLAST -e GCE_PROJECT" \
BAZEL_SUPPORT_EXTRA_DOCKER_ARGS="-e LITERAL_ARTIFACTS_DIR=$root/artifacts -e BUILD_VCS_NUMBER -e CLOUD=gce -e TESTS -e COUNT -e GITHUB_API_TOKEN -e GITHUB_ORG -e GITHUB_REPO -e GOOGLE_EPHEMERAL_CREDENTIALS -e ROACHTEST_PRIVATE -e ROACHTEST_BUCKET -e SLACK_TOKEN -e TC_BUILDTYPE_ID -e TC_BUILD_BRANCH -e TC_BUILD_ID -e TC_SERVER_URL -e COCKROACH_DEV_LICENSE -e BACKUP_TESTING_BUCKET -e BACKUP_TESTING_BUCKET_LONG_TTL -e SFUSER -e SFPASSWORD -e COCKROACH_SKIP_ENABLING_DIAGNOSTIC_REPORTING -e COCKROACH_NO_EXAMPLE_DATABASE -e COCKROACH_AUTO_BALLAST -e GCE_PROJECT" \
run_bazel build/teamcity/internal/cockroach/nightlies/private_roachtest_impl.sh
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/cluster_to_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ func (rd *replicationDriver) backupAfterFingerprintMismatch(
if rd.c.Spec().Cloud == spec.AWS {
prefix = "s3"
}
collection := fmt.Sprintf("%s://%s/c2c-fingerprint-mismatch/%s/%s/%s?AUTH=implicit", prefix, testutils.BackupTestingBucket(), rd.rs.name, rd.c.Name(), tenantName)
collection := fmt.Sprintf("%s://%s/c2c-fingerprint-mismatch/%s/%s/%s?AUTH=implicit", prefix, testutils.BackupTestingBucketLongTTL(), rd.rs.name, rd.c.Name(), tenantName)
fullBackupQuery := fmt.Sprintf("BACKUP INTO '%s' AS OF SYSTEM TIME '%s' with revision_history", collection, startTime.AsOfSystemTime())
_, err := conn.ExecContext(ctx, fullBackupQuery)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/disagg_rebalance.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func registerDisaggRebalance(r registry.Registry) {
t.Skip("disagg-rebalance is only configured to run on AWS")
}
c.Put(ctx, t.Cockroach(), "./cockroach")
s3dir := fmt.Sprintf("s3://%s/disagg-rebalance/%s?AUTH=implicit", testutils.BackupTestingBucket(), c.Name())
s3dir := fmt.Sprintf("s3://%s/disagg-rebalance/%s?AUTH=implicit", testutils.BackupTestingBucketLongTTL(), c.Name())
startOpts := option.DefaultStartOptsNoBackups()
startOpts.RoachprodOpts.ExtraArgs = append(startOpts.RoachprodOpts.ExtraArgs, fmt.Sprintf("--experimental-shared-storage=%s", s3dir))
c.Start(ctx, t.L(), startOpts, install.MakeClusterSettings(), c.Range(1, 3))
Expand Down
8 changes: 2 additions & 6 deletions pkg/cmd/roachtest/tests/mixed_version_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -946,11 +946,7 @@ func (bc *backupCollection) uri() string {
// global namespace represented by the BACKUP_TESTING_BUCKET
// bucket. The nonce allows multiple people (or TeamCity builds) to
// be running this test without interfering with one another.
gcsBackupTestingBucket := os.Getenv("BACKUP_TESTING_BUCKET")
if gcsBackupTestingBucket == "" {
gcsBackupTestingBucket = "cockroachdb-backup-testing"
}
return fmt.Sprintf("gs://"+gcsBackupTestingBucket+"/mixed-version/%s_%s?AUTH=implicit", bc.name, bc.nonce)
return fmt.Sprintf("gs://%s/mixed-version/%s_%s?AUTH=implicit", testutils.BackupTestingBucketLongTTL(), bc.name, bc.nonce)
}

func (bc *backupCollection) encryptionOption() *encryptionPassphrase {
Expand Down Expand Up @@ -2141,7 +2137,7 @@ func registerBackupMixedVersion(r registry.Registry) {
RequiresLicense: true,
Run: func(ctx context.Context, t test.Test, c cluster.Cluster) {
if c.Spec().Cloud != spec.GCE && !c.IsLocal() {
t.Skip("uses gs://cockroachdb-backup-testing; see https://github.com/cockroachdb/cockroach/issues/105968")
t.Skip("uses gs://cockroachdb-backup-testing-long-ttl; see https://github.com/cockroachdb/cockroach/issues/105968")
}

roachNodes := c.Range(1, c.Spec().NodeCount-1)
Expand Down
29 changes: 23 additions & 6 deletions pkg/testutils/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,35 @@ package testutils
import "os"

const (
defaultBackupBucket = "cockroachdb-backup-testing"
backupTestingBucketEnvVar = "BACKUP_TESTING_BUCKET"
defaultBackupBucket = "cockroachdb-backup-testing"
longTTLBackupTestingBucket = "cockroachdb-backup-testing-long-ttl"
backupTestingBucketEnvVar = "BACKUP_TESTING_BUCKET"
backupTestingBucketLongTTLEnvVar = "BACKUP_TESTING_BUCKET_LONG_TTL"
)

// BackupTestingBucket returns the name of the GCS bucket that should
// be used in a test run. Most times, this will be the regular public
// bucket. In private test runs, the name of the bucket is passed
// through an environment variable.
// BackupTestingBucket returns the name of the external storage bucket that
// should be used in a test run. Most times, this will be the regular public
// bucket. In private test runs, the name of the bucket is passed through an
// environment variable.
func BackupTestingBucket() string {
if bucket := os.Getenv(backupTestingBucketEnvVar); bucket != "" {
return bucket
}

return defaultBackupBucket
}

// BackupTestingBucketLongTTL returns the name of the external storage bucket
// that should be used in a test run where the bucket's content may inform a
// debugging investigation. At the time of this comment, the ttl for the s3 and
// gcs buckets is 20 days.
//
// In private test runs, the name of the bucket is passed through an environment
// variable.
func BackupTestingBucketLongTTL() string {
if bucket := os.Getenv(backupTestingBucketLongTTLEnvVar); bucket != "" {
return bucket
}

return longTTLBackupTestingBucket
}