Skip to content

Commit 5c5a35e

Browse files
committed
crosscluster/physical: deflake TestTenantStreamingFailback
Previously, this test would fail with a scary fingerprint mismatch violation error, but it was because one test path did not wait for the fingerprint time to get replicated. Fixes #146444 Release note: none
1 parent 075c4bc commit 5c5a35e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

pkg/crosscluster/physical/stream_ingestion_job_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,21 +199,19 @@ func TestTenantStreamingFailback(t *testing.T) {
199199
var ts1 string
200200
sqlA.QueryRow(t, "SELECT cluster_logical_timestamp()").Scan(&ts1)
201201

202+
t.Logf("waiting for g@%s", ts1)
203+
replicationtestutils.WaitUntilReplicatedTime(t,
204+
replicationtestutils.DecimalTimeToHLC(t, ts1),
205+
sqlB,
206+
jobspb.JobID(consumerGJobID))
207+
202208
// Randomize query execution to verify fast failback works for both
203209
// `COMPLETE REPLICATION TO LATEST` and `COMPLETE REPLICATION TO SYSTEM TIME`
204210
rng, _ := randutil.NewPseudoRand()
205211
if rng.Intn(2) == 0 {
206-
t.Logf("waiting for g@%s", ts1)
207-
replicationtestutils.WaitUntilReplicatedTime(t,
208-
replicationtestutils.DecimalTimeToHLC(t, ts1),
209-
sqlB,
210-
jobspb.JobID(consumerGJobID))
211-
212212
t.Logf("completing replication on g@%s", ts1)
213213
sqlB.Exec(t, fmt.Sprintf("ALTER VIRTUAL CLUSTER g COMPLETE REPLICATION TO SYSTEM TIME '%s'", ts1))
214214
} else {
215-
t.Log("waiting for initial scan on g")
216-
replicationtestutils.WaitUntilStartTimeReached(t, sqlB, jobspb.JobID(consumerGJobID))
217215
t.Log("completing replication on g to latest")
218216
sqlB.Exec(t, "ALTER VIRTUAL CLUSTER g COMPLETE REPLICATION TO LATEST")
219217
}

0 commit comments

Comments
 (0)