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: deflake TestGCDropIndexSpanExpansion #75491

Merged
merged 1 commit into from
Jan 26, 2022
Merged
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
22 changes: 21 additions & 1 deletion pkg/ccl/backupccl/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9007,11 +9007,12 @@ func TestGCDropIndexSpanExpansion(t *testing.T) {
}})
defer tc.Stopper().Stop(ctx)
sqlRunner := sqlutils.MakeSQLRunner(tc.Conns[0])
sqlRunner.Exec(t, `SET CLUSTER SETTING kv.closed_timestamp.target_duration = '100ms'`) // speeds up the test

sqlRunner.Exec(t, `
CREATE DATABASE test; USE test;
CREATE TABLE foo (id INT PRIMARY KEY, id2 INT, id3 INT, INDEX bar (id2), INDEX baz(id3));
ALTER TABLE foo CONFIGURE ZONE USING gc.ttlseconds = '1';
ALTER INDEX foo@bar CONFIGURE ZONE USING gc.ttlseconds = '1';
INSERT INTO foo VALUES (1, 2, 3);
DROP INDEX foo@bar;
`)
Expand All @@ -9033,6 +9034,25 @@ DROP INDEX foo@bar;
// Wait for the GC to complete.
jobutils.WaitForJob(t, sqlRunner, gcJobID)

waitForTableSplit := func() {
testutils.SucceedsSoon(t, func() error {
count := 0
sqlRunner.QueryRow(t,
"SELECT count(*) "+
"FROM crdb_internal.ranges_no_leases "+
"WHERE table_name = $1 "+
"AND database_name = $2",
"foo", "test").Scan(&count)
if count == 0 {
return errors.New("waiting for table split")
}
return nil
})
}
waitForTableSplit()

// This backup should succeed since the spans being backed up have a default
// GC TTL of 25 hours.
sqlRunner.Exec(t, `BACKUP INTO LATEST IN 'nodelocal://0/foo' WITH revision_history`)
}

Expand Down