Skip to content

Commit

Permalink
Merge pull request #111806 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-22.2-110930

release-22.2: gcjob_test: add more logging to TestGCJobRetry
  • Loading branch information
rafiss authored Oct 6, 2023
2 parents 9084a71 + 27b5e09 commit ce4950d
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions pkg/sql/gcjob_test/gc_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,25 @@ SELECT job_id
FROM [SHOW JOBS]
WHERE job_type = 'SCHEMA CHANGE GC' AND description LIKE '%foo%';`,
).Scan(&jobID)
tdb.CheckQueryResultsRetry(t,
"SELECT running_status FROM crdb_internal.jobs WHERE job_id = "+jobID,
[][]string{{string(sql.RunningStatusWaitingForMVCCGC)}},
)

const expectedRunningStatus = string(sql.RunningStatusWaitingForMVCCGC)
testutils.SucceedsSoon(t, func() error {
var status, runningStatus, lastRun, nextRun, numRuns, jobErr string
tdb.QueryRow(t, fmt.Sprintf(`
SELECT status, running_status, error, last_run, next_run, num_runs
FROM crdb_internal.jobs
WHERE job_id = %s`, jobID)).Scan(&status, &runningStatus, &jobErr, &lastRun, &nextRun, &numRuns)

t.Logf(`details about SCHEMA CHANGE GC job: {status: %q, running_status: %q, error: %q, last_run: %q, next_run: %q, num_runs: %q}`,
status, runningStatus, jobErr, lastRun, nextRun, numRuns)

if runningStatus != expectedRunningStatus {
return errors.Newf(`running_status %s does not match expected status %s`,
runningStatus, expectedRunningStatus)
}

return nil
})
}

// TestGCTenant is lightweight test that tests the branching logic in Resume
Expand Down

0 comments on commit ce4950d

Please sign in to comment.