jobutils

package
v0.0.0-...-1dc08c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BulkOpResponseFilter

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

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

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

GetJobID gets a particular job's ID.

func GetJobProgress

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

GetJobProgress loads the Progress message associated with the job.

func GetLastJobID

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

GetLastJobID gets the most recent job's ID.

func RunJob

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

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

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

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

WaitForJob waits for the specified job ID to terminate.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL