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: missing descIDs in job payload should not prevent jobs from GC #45353

Merged
merged 1 commit into from Feb 26, 2020

Conversation

spaskob
Copy link
Contributor

@spaskob spaskob commented Feb 24, 2020

Touches https://github.com/cockroachlabs/support/issues/365.

Release note (bug fix): When considering if a job should be orphaned we
use to take the conservative approach when a descriptor ID pointing to
non-existent descriptor was found. This causes jobs to hang forever and
be garbage collected. We now disregard these IDs when considering if a
job has still work to do.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@pbardea pbardea left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

DescriptorIDs: []sqlbase.ID{descriptorID},
DescriptorIDs: []sqlbase.ID{
descriptorID,
sqlbase.ID(0), // invalid id to test handling of missing descriptors.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be replaced with sqlbase.InvalidID

if err == sqlbase.ErrDescriptorNotFound {
// Treat missing table descriptors as no longer relevant for the
// job payload. See
// https://github.com/cockroachlabs/support/issues/365.
Copy link
Contributor

Choose a reason for hiding this comment

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

May be beneficial to make a public issue for this and link that.

@@ -476,6 +476,12 @@ func (r *Registry) isOrphaned(ctx context.Context, payload *jobspb.Payload) (boo
pendingMutations = hasAnyMutations || hasDropJob
return nil
}); err != nil {
if err == sqlbase.ErrDescriptorNotFound {
Copy link
Contributor

Choose a reason for hiding this comment

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

errors.Is(err, sqlbase.ErrDescriptorNotFound) may be more resilient in case the error gets wrapped in the future.

@@ -476,6 +476,12 @@ func (r *Registry) isOrphaned(ctx context.Context, payload *jobspb.Payload) (boo
pendingMutations = hasAnyMutations || hasDropJob
return nil
}); err != nil {
if err == sqlbase.ErrDescriptorNotFound {
Copy link
Contributor

Choose a reason for hiding this comment

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

errors.Is(err, sqlbase.ErrDescriptorNotFound) may be more resilient in case the error gets wrapped in the future.

@spaskob spaskob force-pushed the job-gc branch 2 times, most recently from 71ed912 to b362c5b Compare February 25, 2020 16:52
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 @pbardea)


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

Previously, pbardea (Paul Bardea) wrote…

errors.Is(err, sqlbase.ErrDescriptorNotFound) may be more resilient in case the error gets wrapped in the future.

Done.


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

Previously, pbardea (Paul Bardea) wrote…

May be beneficial to make a public issue for this and link that.

Done.


pkg/jobs/registry_test.go, line 270 at r1 (raw file):

Previously, pbardea (Paul Bardea) wrote…

I think this can be replaced with sqlbase.InvalidID

Done.

…ng GCed

Touches https://github.com/cockroachlabs/support/issues/365.
Touches cockroachdb#45399.

Release note (bug fix): When considering if a job should be orphaned we
use to take the conservative approach when a descriptor ID pointing to
non-existent descriptor was found. This causes jobs to hang forever and
be garbage collected. We now disregard these IDs when considering if a
job has still work to do.
@spaskob
Copy link
Contributor Author

spaskob commented Feb 26, 2020

bors r+

@craig
Copy link
Contributor

craig bot commented Feb 26, 2020

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.

None yet

3 participants