diff --git a/metamorphic/ops.go b/metamorphic/ops.go index ac940f5292..d6455d491d 100644 --- a/metamorphic/ops.go +++ b/metamorphic/ops.go @@ -203,6 +203,10 @@ type downloadOp struct { } func (o *downloadOp) run(t *Test, h historyRecorder) { + if t.testOpts.disableDownloads { + h.Recordf("%s // %v", o, nil) + return + } db := t.getDB(o.dbID) err := t.withRetries(func() error { return db.Download(context.Background(), o.spans) diff --git a/metamorphic/options.go b/metamorphic/options.go index 3e4377ceb0..8b1dcd0824 100644 --- a/metamorphic/options.go +++ b/metamorphic/options.go @@ -169,6 +169,9 @@ func parseOptions( return opts.useDeleteOnlyCompactionExcises } return true + case "TestOptions.disable_downloads": + opts.disableDownloads = true + return true case "TestOptions.use_jemalloc_size_classes": opts.Opts.AllocatorSizeClasses = pebble.JemallocSizeClasses return true @@ -268,6 +271,9 @@ func optionsToString(opts *TestOptions) string { if opts.useDeleteOnlyCompactionExcises { fmt.Fprintf(&buf, " use_delete_only_compaction_excises=%v\n", opts.useDeleteOnlyCompactionExcises) } + if opts.disableDownloads { + fmt.Fprintf(&buf, " disable_downloads=%v\n", opts.disableDownloads) + } if opts.Opts.AllocatorSizeClasses != nil { if fmt.Sprint(opts.Opts.AllocatorSizeClasses) != fmt.Sprint(pebble.JemallocSizeClasses) { panic(fmt.Sprintf("unexpected AllocatorSizeClasses %v", opts.Opts.AllocatorSizeClasses)) @@ -413,6 +419,8 @@ type TestOptions struct { // useDeleteOnlyCompactionExcises turns on the ability for delete-only compactions // to do excises. Note that this can be true even when useExcise is false. useDeleteOnlyCompactionExcises bool + // disableDownloads, if true, makes downloadOp a no-op. + disableDownloads bool } // InitRemoteStorageFactory initializes Opts.Experimental.RemoteStorage. @@ -861,6 +869,7 @@ func RandomOptions( opts.Experimental.EnableDeleteOnlyCompactionExcises = func() bool { return testOpts.useDeleteOnlyCompactionExcises } + testOpts.disableDownloads = rng.IntN(2) == 0 testOpts.InitRemoteStorageFactory() testOpts.Opts.EnsureDefaults() return testOpts