-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: rationalize cluster destruction #35585
roachtest: rationalize cluster destruction #35585
Conversation
fd540ee
to
f8ac32d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
friendly ping
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @petermattis)
Bob do you want to be my pal here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1, 1 of 1 files at r2.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andreimatei and @petermattis)
pkg/cmd/roachtest/cluster.go, line 255 at r1 (raw file):
select { case <-done: case <-time.After(5 * time.Minute):
Should this be done by calling context.WithTimeout
on the Context
passed into destroyAllClusters
?
pkg/cmd/roachtest/cluster.go, line 680 at r1 (raw file):
// destroyed is used to coordinate between different goroutines that want to // destroy a cluster. destroyed chan struct{}
Maybe change the type here to <-chan struct{}
since the only useful thing to do here is to select
or close()
?
pkg/cmd/roachtest/cluster.go, line 695 at r1 (raw file):
return false } c.destroyState.mu.destroying = true
It seems odd that a should
function would mutate the state of the cluster
; the name sounds idempotent. Maybe rename it to beginDestroy
or something and document that this function is a one-shot.
pkg/cmd/roachtest/cluster.go, line 1072 at r1 (raw file):
// destroyInner implements the logic for Destroy but without closing c.l. func (c *cluster) destroyInner(ctx context.Context) {
The name of this method is confusing w.r.t. doDestroy
. Can the main Destroy
method defer to a single doDestroy()
that has a parameter that controls whether or not to close the associated logger?
f8ac32d
to
9fd25f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @bobvawter and @petermattis)
pkg/cmd/roachtest/cluster.go, line 255 at r1 (raw file):
Previously, bobvawter (Bob Vawter) wrote…
Should this be done by calling
context.WithTimeout
on theContext
passed intodestroyAllClusters
?
done
pkg/cmd/roachtest/cluster.go, line 680 at r1 (raw file):
Previously, bobvawter (Bob Vawter) wrote…
Maybe change the type here to
<-chan struct{}
since the only useful thing to do here is toselect
orclose()
?
well you can't close a receive-only channel. Morally this reference (which is the only reference to this chan) is used both for receiving and for sending (i.e. closing).
pkg/cmd/roachtest/cluster.go, line 695 at r1 (raw file):
Previously, bobvawter (Bob Vawter) wrote…
It seems odd that a
should
function would mutate the state of thecluster
; the name sounds idempotent. Maybe rename it tobeginDestroy
or something and document that this function is a one-shot.
see now
pkg/cmd/roachtest/cluster.go, line 1072 at r1 (raw file):
Previously, bobvawter (Bob Vawter) wrote…
The name of this method is confusing w.r.t.
doDestroy
. Can the mainDestroy
method defer to a singledoDestroy()
that has a parameter that controls whether or not to close the associated logger?
I don't know what I was drinking when I wrote this. See now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r3, 1 of 1 files at r4.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @andreimatei and @petermattis)
pkg/cmd/roachtest/cluster.go, line 1166 at r3 (raw file):
c.destroyState.mu.Lock() close(c.destroyState.mu.destroyed) ch := c.destroyState.mu.destroyed
Move assignment of ch one line up and call close(ch)
?
9fd25f0
to
786ee72
Compare
Cluster destruction can be initiated from two places: tests finishing and a signal being received. Some synchronization is required for handling races on this destruction. This patch makes this synchronization nicer. Before this patch, the case where a signal was received and then a test finishes was handled OK, but the reverse I think was not. This patch also kills a global containing a list of all the clusters and encapsulates it in a nicer clusterRegistry. Release note: None
To be used in the future where I want to get rid of subtests by flattening everything and thus producing tests with longer names, at which point I'll somehow truncate the names of their clusters to the length limit allowed by GCE and so it'll be more likely to end with duplicates if nobody's watching. Release note: None
786ee72
to
7c1ac1c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFTR!
bors r+
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @bobvawter and @petermattis)
pkg/cmd/roachtest/cluster.go, line 1166 at r3 (raw file):
Previously, bobvawter (Bob Vawter) wrote…
Move assignment of ch one line up and call
close(ch)
?
done
Build failed (retrying...) |
Build failed (retrying...) |
35585: roachtest: rationalize cluster destruction r=andreimatei a=andreimatei Cluster destruction can be initiated from two places: tests finishing and a signal being received. Some synchronization is required for handling races on this destruction. This patch makes this synchronization nicer. Before this patch, the case where a signal was received and then a test finishes was handled OK, but the reverse I think was not. This patch also kills a global containing a list of all the clusters and encapsulates it in a nicer clusterRegistry. Release note: None 36967: exec: add cancellation check to operators r=yuzefovich a=yuzefovich We introduce a CancelChecker operator that wraps all other operators and performs a cancellation check on every batch. Also, sorter and hash joiner do additional checks themselves since they can spend a lot of time in certain phases of execution. Release note: None Co-authored-by: Andrei Matei <[email protected]> Co-authored-by: Yahor Yuzefovich <[email protected]>
Build succeeded |
Cluster destruction can be initiated from two places: tests finishing
and a signal being received. Some synchronization is required for
handling races on this destruction. This patch makes this
synchronization nicer. Before this patch, the case where a signal was
received and then a test finishes was handled OK, but the reverse I
think was not.
This patch also kills a global containing a list of all the clusters and
encapsulates it in a nicer clusterRegistry.
Release note: None