cockroach: Index | Files

package jobutils

import ""


Package Files


func BulkOpResponseFilter Uses

func BulkOpResponseFilter(allowProgressIota *chan struct{}) kvserverbase.ReplicaResponseFilter

BulkOpResponseFilter creates a blocking response filter for the responses related to bulk IO/backup/restore/import: Export, Import and AddSSTable. See discussion on RunJob for where this might be useful.

func GetJobFormatVersion Uses

func GetJobFormatVersion(
    t testing.TB, db *sqlutils.SQLRunner,
) jobspb.SchemaChangeDetailsFormatVersion

GetJobFormatVersion returns the format version of a schema change job. Will fail the test if the jobID does not reference a schema change job.

func GetJobID Uses

func GetJobID(t testing.TB, db *sqlutils.SQLRunner, offset int) int64

GetJobID gets a particular job's ID.

func GetJobProgress Uses

func GetJobProgress(t *testing.T, db *sqlutils.SQLRunner, jobID int64) *jobspb.Progress

GetJobProgress loads the Progress message associated with the job.

func GetLastJobID Uses

func GetLastJobID(t testing.TB, db *sqlutils.SQLRunner) int64

GetLastJobID gets the most recent job's ID.

func RunJob Uses

func RunJob(
    t *testing.T,
    db *sqlutils.SQLRunner,
    allowProgressIota *chan struct{},
    ops []string,
    query string,
    args ...interface{},
) (int64, error)

RunJob runs the provided job control statement, intializing, notifying and closing the chan at the passed pointer (see below for why) and returning the jobID and error result. PAUSE JOB and CANCEL JOB are racy in that it's hard to guarantee that the job is still running when executing a PAUSE or CANCEL--or that the job has even started running. To synchronize, we can install a store response filter which does a blocking receive for one of the responses used by our job (for example, Export for a BACKUP). Later, when we want to guarantee the job is in progress, we do exactly one blocking send. When this send completes, we know the job has started, as we've seen one expected response. We also know the job has not finished, because we're blocking all future responses until we close the channel, and our operation is large enough that it will generate more than one of the expected response.

func VerifyRunningSystemJob Uses

func VerifyRunningSystemJob(
    t testing.TB,
    db *sqlutils.SQLRunner,
    offset int,
    filterType jobspb.Type,
    expectedRunningStatus jobs.RunningStatus,
    expected jobs.Record,
) error

VerifyRunningSystemJob checks that job records are created as expected and is marked as running.

func VerifySystemJob Uses

func VerifySystemJob(
    t testing.TB,
    db *sqlutils.SQLRunner,
    offset int,
    filterType jobspb.Type,
    expectedStatus jobs.Status,
    expected jobs.Record,
) error

VerifySystemJob checks that job records are created as expected.

func WaitForJob Uses

func WaitForJob(t testing.TB, db *sqlutils.SQLRunner, jobID int64)

WaitForJob waits for the specified job ID to terminate.

Package jobutils imports 20 packages (graph). Updated 2020-05-29. Refresh now. Tools for package owners.