Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
114685: scexec: don't set running_status on GC job during init r=rafiss a=rafiss

The running_status is only supposed to be set while the job is running, so it was a mistake to set it when creating the job.

Not setting it also deflakes a test which relies on the running_status to know if the GC has begun (and deleting the data has completed).

fixes cockroachdb#114557
Release note: None

Co-authored-by: Rafi Shamim <[email protected]>
  • Loading branch information
craig[bot] and rafiss committed Nov 18, 2023
2 parents 44cefdf + b7c7deb commit 1473312
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 11 additions & 0 deletions pkg/sql/drop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,14 @@ func TestDropIndex(t *testing.T) {
s, sqlDB, kvDB := serverutils.StartServer(t, params)
defer s.Stopper().Stop(context.Background())

_, err := sqlDB.Exec(`SET CLUSTER SETTING sql.gc_job.wait_for_gc.interval = '1s';`)
require.NoError(t, err)

// Refresh protected timestamp cache immediately to make MVCC GC queue to
// process GC immediately.
_, err = sqlDB.Exec(`SET CLUSTER SETTING kv.protectedts.poll_interval = '1s';`)
require.NoError(t, err)

// Disable strict GC TTL enforcement because we're going to shove a zero-value
// TTL into the system with AddImmediateGCZoneConfig.
defer sqltestutils.DisableGCTTLStrictEnforcement(t, sqlDB)()
Expand All @@ -426,6 +434,9 @@ func TestDropIndex(t *testing.T) {
t.Fatal(err)
}
tableDesc := desctestutils.TestingGetPublicTableDescriptor(kvDB, keys.SystemSQLCodec, "t", "kv")
if _, err := sqltestutils.AddImmediateGCZoneConfig(sqlDB, tableDesc.GetID()); err != nil {
t.Fatal(err)
}
tests.CheckKeyCount(t, kvDB, tableDesc.TableSpan(keys.SystemSQLCodec), 3*numRows)
idx, err := catalog.MustFindIndexByName(tableDesc, "foo")
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions pkg/sql/schemachanger/scexec/gc_jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,13 @@ func createGCJobRecord(
descriptorIDs = append(descriptorIDs, details.ParentID)
}
}
runningStatus := jobs.RunningStatus("waiting for MVCC GC")
return jobs.Record{
JobID: id,
Description: "GC for " + description,
Username: userName,
DescriptorIDs: descriptorIDs,
Details: details,
Progress: jobspb.SchemaChangeGCProgress{},
RunningStatus: runningStatus,
NonCancelable: true,
}
}

0 comments on commit 1473312

Please sign in to comment.