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

jobs: clean running jobs with no mutations left #41172

Merged
merged 1 commit into from
Oct 2, 2019

Conversation

spaskob
Copy link
Contributor

@spaskob spaskob commented Sep 27, 2019

Failures can leave jobs in orphaned state where no work needs
to be done but they are left in system.jobs table. We detect
and delete such jobs if they are too old.

Touches #40563.

Release justification: This commit is safe for 19.2 because
this is a fairly low risk change since it only affects jobs that
have no mutations left and that are >24h old.

Release note: None.

@spaskob spaskob requested a review from dt September 27, 2019 20:28
@cockroach-teamcity
Copy link
Member

This change is Reviewable

return false, nil
}
for _, id := range payload.DescriptorIDs {
txn := r.db.NewTxn(ctx, "get_table_and_db_descrs")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we usually use r.db.Txn() and pass a closure, which also means you don't need to do your own retries.

@spaskob spaskob changed the title jobs: WIP clean running jobs with no mutations left jobs: clean running jobs with no mutations left Sep 30, 2019
@spaskob spaskob force-pushed the orphan-jobs branch 2 times, most recently from c099cd2 to 20a766c Compare September 30, 2019 21:16
Copy link
Contributor Author

@spaskob spaskob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @dt)


pkg/jobs/registry.go, line 375 at r1 (raw file):

Previously, dt (David Taylor) wrote…

we usually use r.db.Txn() and pass a closure, which also means you don't need to do your own retries.

Done.

if err != nil {
return err
}
if len(td.GetMutations()) != 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can just assign the bool to the if condition instead of using an if, right?

Also, this seems like the name vs definition is inverted, no?

Failures can leave jobs in orphaned state where no work needs
to be done but they are left in `system.jobs` table. We detect
and delete such jobs if they are too old.

Touches cockroachdb#40563.

Release justification: This commit is safe for 19.2 because
this is a fairly low risk change since it only affects jobs that
have no mutations left and that are >24h old.

Release note: None.
@spaskob
Copy link
Contributor Author

spaskob commented Oct 2, 2019

bors r+

craig bot pushed a commit that referenced this pull request Oct 2, 2019
41172: jobs: clean running jobs with no mutations left r=spaskob a=spaskob

Failures can leave jobs in orphaned state where no work needs
to be done but they are left in `system.jobs` table. We detect
and delete such jobs if they are too old.

Touches #40563.

Release justification: This commit is safe for 19.2 because
this is a fairly low risk change since it only affects jobs that
have no mutations left and that are >24h old.

Release note: None.

Co-authored-by: spaskob <spas@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Oct 2, 2019

Build succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants