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

sequencer: Improve visibility of long-running background tasks #981

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

bobvawter
Copy link
Contributor

@bobvawter bobvawter commented Aug 29, 2024

This change corrects a context-break, where callbacks executed by the key scheduler were executed using a context from the scheduler's workgroup. In cases where the lease loop recycles and the target database is executing slowly, the old queries were not guaranteed to have been canceled when the next iteration of the loop starts.

This commit depends on cockroachdb/field-eng-powertools#4


This change is Reviewable

@bobvawter bobvawter marked this pull request as ready for review August 29, 2024 12:00
Copy link
Member

@BramGruneir BramGruneir left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @bobvawter, @Jeremyyang920, @MattWhelan, and @sravotto)


internal/sequencer/sequtil/lease_group.go line 72 at r1 (raw file):

						// Shut down the nested stopper.
						entry.Debugf("stopping; waiting for %d tasks to complete", sub.Len())
						sub.Stop(time.Minute)

Should this be configurable? Even if hidden?

This change corrects a context-break, where callbacks executed by the key
scheduler were executed using a context from the scheduler's workgroup. In
cases where the lease loop recycles and the target database is executing
slowly, the old queries were not guaranteed to have been canceled when
the next iteration of the loop starts.

Replicator will now exit if a stuck task is detected by the lease loop since
there is no other way to guarantee that the task would not continue at some
arbitrary point in the future.

This commit depends on cockroachdb/field-eng-powertools#4
@bobvawter
Copy link
Contributor Author

@BramGruneir PTAL; I think we should fail definitely in this situation.

Copy link
Member

@BramGruneir BramGruneir left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 6 of 6 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @bobvawter, @Jeremyyang920, @MattWhelan, and @sravotto)

@bobvawter bobvawter added this pull request to the merge queue Aug 29, 2024
Merged via the queue into master with commit 644ad7c Aug 29, 2024
50 of 52 checks passed
@bobvawter bobvawter deleted the bob_track_tasks branch August 29, 2024 18:55
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.

2 participants