Skip to content

Commit 246e948

Browse files
committed
roachtest: teach OR roachtests to validate fingerprints
#148967 added fingerprint validation to classic restore, this is a follow up commit to also update our online restore roachtests to also perform fingerprinting. Epic: CRDB-51394 Fixes: #148966 Release note: None
1 parent ad1e2b9 commit 246e948

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

pkg/cmd/roachtest/tests/online_restore.go

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,10 @@ func registerOnlineRestorePerf(r registry.Registry) {
124124
cloud: spec.GCE,
125125
fixture: SmallFixture,
126126
},
127-
fullBackupOnly: true,
128-
timeout: 1 * time.Hour,
129-
suites: registry.Suites(registry.Nightly),
127+
fullBackupOnly: true,
128+
skipFingerprint: true,
129+
timeout: 1 * time.Hour,
130+
suites: registry.Suites(registry.Nightly),
130131
},
131132
workload: tpccRestore{
132133
opts: tpccRunOpts{waitFraction: 0, workers: 100, maxRate: 300},
@@ -163,9 +164,10 @@ func registerOnlineRestorePerf(r registry.Registry) {
163164
cloud: spec.GCE,
164165
fixture: MediumFixture,
165166
},
166-
timeout: 3 * time.Hour,
167-
suites: registry.Suites(registry.Nightly),
168-
fullBackupOnly: true,
167+
timeout: 3 * time.Hour,
168+
suites: registry.Suites(registry.Nightly),
169+
fullBackupOnly: true,
170+
skipFingerprint: true,
169171
},
170172
workload: tpccRestore{
171173
opts: tpccRunOpts{waitFraction: 0, workers: 100, maxRate: 1000},
@@ -182,9 +184,10 @@ func registerOnlineRestorePerf(r registry.Registry) {
182184
cloud: spec.GCE,
183185
fixture: MediumFixture,
184186
},
185-
timeout: 3 * time.Hour,
186-
suites: registry.Suites(registry.Nightly),
187-
fullBackupOnly: true,
187+
timeout: 3 * time.Hour,
188+
suites: registry.Suites(registry.Nightly),
189+
fullBackupOnly: true,
190+
skipFingerprint: true,
188191
},
189192
workload: tpccRestore{
190193
opts: tpccRunOpts{waitFraction: 0, workers: 100, maxRate: 1000},
@@ -202,9 +205,10 @@ func registerOnlineRestorePerf(r registry.Registry) {
202205
cloud: spec.AWS,
203206
fixture: MediumFixture,
204207
},
205-
timeout: 3 * time.Hour,
206-
suites: registry.Suites(registry.Nightly),
207-
fullBackupOnly: true,
208+
timeout: 3 * time.Hour,
209+
suites: registry.Suites(registry.Nightly),
210+
fullBackupOnly: true,
211+
skipFingerprint: true,
208212
},
209213
workload: tpccRestore{
210214
opts: tpccRunOpts{waitFraction: 0, workers: 100, maxRate: 1000},
@@ -217,10 +221,6 @@ func registerOnlineRestorePerf(r registry.Registry) {
217221
for _, runOnline := range []bool{true, false} {
218222
for _, useWorkarounds := range []bool{true, false} {
219223
for _, runWorkload := range []bool{true, false} {
220-
sp := sp
221-
runOnline := runOnline
222-
runWorkload := runWorkload
223-
useWorkarounds := useWorkarounds
224224
clusterSettings := []string{
225225
// TODO(dt): what's the right value for this? How do we tune this
226226
// on the fly automatically during the restore instead of by-hand?
@@ -248,7 +248,7 @@ func registerOnlineRestorePerf(r registry.Registry) {
248248
sp.namePrefix = "offline/"
249249
sp.skip = "used for ad hoc experiments"
250250
}
251-
if !runWorkload {
251+
if !runWorkload && sp.skipFingerprint {
252252
sp.skip = "used for ad hoc experiments"
253253
}
254254

@@ -276,6 +276,11 @@ func registerOnlineRestorePerf(r registry.Registry) {
276276
sp.skip = "online restore is only tested on development branch"
277277
}
278278

279+
// For the sake of simplicity, we only fingerprint when no active
280+
// workload is running during the download phase so that we do not
281+
// need to account for changes to the database after the restore.
282+
doFingerprint := !sp.skipFingerprint && runOnline && !runWorkload
283+
279284
sp.initTestName()
280285
r.Add(registry.TestSpec{
281286
Name: sp.testName,
@@ -299,6 +304,9 @@ func registerOnlineRestorePerf(r registry.Registry) {
299304
restoreStats := runRestore(
300305
ctx, t, c, sp, rd, runOnline, runWorkload, clusterSettings...,
301306
)
307+
if doFingerprint {
308+
rd.maybeValidateFingerprint(ctx)
309+
}
302310
if runOnline {
303311
require.NoError(t, postRestoreValidation(
304312
ctx,
@@ -731,11 +739,10 @@ func executeTestRestorePhase(
731739
}
732740
restoreStartTime := timeutil.Now()
733741
restoreCmd := rd.restoreCmd(ctx, fmt.Sprintf("DATABASE %s", sp.backup.fixture.DatabaseName()), opts)
734-
t.L().Printf("Running %s", restoreCmd)
735742
if _, err = db.ExecContext(ctx, restoreCmd); err != nil {
736743
return time.Time{}, time.Time{}, err
737744
}
738-
restoreEndTime := time.Now()
745+
restoreEndTime := timeutil.Now()
739746
if runOnline && sp.linkPhaseTimeout != 0 && sp.linkPhaseTimeout < restoreEndTime.Sub(restoreStartTime) {
740747
return restoreStartTime, restoreEndTime, errors.Newf(
741748
"link phase took too long: %s greater than timeout %s",

0 commit comments

Comments
 (0)