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

roachtest: add groups to task manager #135831

Merged
merged 4 commits into from
Dec 13, 2024

Conversation

herkolategan
Copy link
Collaborator

@herkolategan herkolategan commented Nov 20, 2024

Previously, a new API for managing tasks were introduced (see #133263). However, this did not address roachtests that want to manage groups. In an effort to replace errgroup, and monitor.Go for task management, this change introduces a group provider in the task manager.

A group adds the ability to wait on a subset of tasks to finish before proceeding. The task handler will still report returned errors or panics to the test framework.

Informs: #118214

Epic: None
Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@herkolategan herkolategan force-pushed the hbl/roachtest-task-groups branch 2 times, most recently from 73c9af6 to 50f6ae1 Compare November 21, 2024 12:59

select {
case <-done:
case <-time.After(30 * time.Second):
Copy link
Collaborator Author

@herkolategan herkolategan Nov 22, 2024

Choose a reason for hiding this comment

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

I'm curious if this is good practice to have a timeout in a test, or rather wait indefinitely and let a "global test timeout" happen (if something broke the test)?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure how stress/race interacts with time, but it does feel like this would break under that.

@herkolategan herkolategan force-pushed the hbl/roachtest-task-groups branch 2 times, most recently from b42d5ca to 52d7f3d Compare November 22, 2024 16:25
@herkolategan herkolategan marked this pull request as ready for review November 25, 2024 18:33
@herkolategan herkolategan requested a review from a team as a code owner November 25, 2024 18:33
@herkolategan herkolategan requested review from nameisbhaskar and vidit-bhat and removed request for a team November 25, 2024 18:33
@herkolategan herkolategan force-pushed the hbl/roachtest-task-groups branch 3 times, most recently from 50f5e59 to 326c125 Compare November 27, 2024 13:43
Copy link
Contributor

@DarrylWong DarrylWong left a comment

Choose a reason for hiding this comment

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

Sorry for the slow review!

<-m.CompletedEvents()
}

select {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this be better suited as a WaitWithTimeout method instead? Although I took a very brief peek at monitor.wait and errgroup.wait usages and I only found two places that would use it. I'm guessing you'd have a better idea of how common this pattern is used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I opted to remove the timeouts. A part of me does not like that a failure will then present as a package timeout, but I think as you mentioned adding a timeout here will probably mess with stress / race. In general there is no issue here as long as the tests are passing, but a failure won't be as obvious.


select {
case <-done:
case <-time.After(30 * time.Second):
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure how stress/race interacts with time, but it does feel like this would break under that.

Previously, a new API for managing tasks were introduced (see cockroachdb#133263). However,
this did not address roachtests that want to manage groups. In an effort to replace
`errgroup`, and possibly using `monitor.Go` for task management this change
introduces a group provider in the task manager.

A group adds the ability to wait on a subset of tasks to finish before
proceeding. The task handler will still report returned errors or panics to the
test framework.

Informs: cockroachdb#118214

Epic: None
Release note: None
This change groups the default options used by tasks and groups into a function
that can be shared when creating new groups or tasks via the mixedversion test
helper. The mixedversion helper now also implements `GroupProvider` to enable
grouping tasks.

Informs: cockroachdb#118214

Epic: None
Release note: None
This change groups the default options used by tasks and groups into a function
that can be shared when creating new groups or tasks via the test framework. The
`Test` interface now implements `GroupProvider` as well to enable grouping
tasks.

Informs: cockroachdb#118214

Epic: None
Release note: None
Previously, a roachtest would need to use wait groups in order to wait on tasks.
The new `GroupProvider` interface now allows tests to manage groups of tasks via
the framework instead of manually.

Informs: cockroachdb#118214

Epic: None
Release note: None
@herkolategan herkolategan force-pushed the hbl/roachtest-task-groups branch from 326c125 to 9b40ff3 Compare December 11, 2024 13:15
@herkolategan
Copy link
Collaborator Author

Running a roachtest TC job with tests that has some t.Go calls in it for confirmation.

Copy link
Contributor

@DarrylWong DarrylWong left a comment

Choose a reason for hiding this comment

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

LGTM assuming the test run looks okay.

@herkolategan
Copy link
Collaborator Author

TFTR!

bors r=DarrylWong

@craig craig bot merged commit ada0ea7 into cockroachdb:master Dec 13, 2024
22 checks passed
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