Skip to content

server: introduce Test{ClusterConnectivity,JoinVersionGate}#54072

Merged
craig[bot] merged 4 commits intocockroachdb:masterfrom
irfansharif:200904.connectivity-test
Sep 10, 2020
Merged

server: introduce Test{ClusterConnectivity,JoinVersionGate}#54072
craig[bot] merged 4 commits intocockroachdb:masterfrom
irfansharif:200904.connectivity-test

Conversation

@irfansharif
Copy link
Copy Markdown
Contributor

Re-adding a few tests that I didn't check in while working on #52526.


TestClusterConnectivity sets up an uninitialized cluster with custom join
flags (individual nodes point to specific others, constructed using
connectivity matrices). Included in the test configurations are the more
"standard" ones where every node points to n1, or where there are
bidirectional links set up between nodes. It tests various topologies
and ensures that cluster IDs are distributed throughout connected
components, and store/node IDs are allocated in the way we'd expect them
to be.

TestJoinVersionGate checks to see that improperly versioned cockroach
nodes are not able to join a cluster.

Release note: None

And no need require callers re-supply it when starting up the cluster
(we already need it when we create it). Just a drive by cleanup.

Release justification: non-production code changes
Release note: None
We pre-define a firstListener when creating a TestCluster in order to
have the address accessible to other connecting servers that want to set
up appropriate join flags. We generalize this idea to allow callers to
install Listeners on a per server basis in order to set up arbitrary
join flag "links" between nodes. We'll make use of this ability in a
future test.

Release note: None
@irfansharif irfansharif requested a review from tbg September 8, 2020 23:42
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@irfansharif irfansharif force-pushed the 200904.connectivity-test branch from 415d98e to d34e3a7 Compare September 9, 2020 03:01
@irfansharif irfansharif requested a review from knz September 9, 2020 14:21
In a future commit we'll add a test that wants to read the node ID of a
given server concurrently with it being set. This is because the test
exercises initialization code paths where we'll start a test server in
parallel with inspecting its state. If we consult the descriptor when
retrieving the nodee ID, it's a data race (there's no mutex protecting
its access, it was never needed). The rpcContext node ID container
however is an atomic value, so it's safe for concurrent access.
They're both set at the same points in the server start up codepaths, so
it's safe to swap one our for another.

Release note: None
@irfansharif irfansharif force-pushed the 200904.connectivity-test branch from d34e3a7 to d27c908 Compare September 9, 2020 15:54
@irfansharif
Copy link
Copy Markdown
Contributor Author

irfansharif commented Sep 10, 2020

(Gentle ping. This PR is not super important, but would still give me some peace of mind.)

Copy link
Copy Markdown
Contributor

@knz knz left a 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, 2 of 2 files at r2, 1 of 1 files at r3, 2 of 2 files at r4.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @irfansharif and @tbg)


pkg/base/test_server_args.go, line 53 at r2 (raw file):

	// manual control over how the join flags (`JoinAddr`) are populated, and
	// installs listeners manually to know which addresses to point to.
	Listener net.Listener

Curious: can you point me to the code responsible to close this?

(Maybe even include this pointer in the comment)


pkg/server/connectivity_test.go, line 176 at r4 (raw file):

			//
			// NB: That aside, TestCluster very much wants to live on the main
			// goroutine running the test. THat's mostly to do with its internal

nit: typo

TestClusterConnectivity sets up an uninitialized cluster with custom join
flags (individual nodes point to specific others, constructed using
connectivity matrices). Included in the test configurations are the more
"standard" ones where every node points to n1, or where there are
bidirectional links set up between nodes. It tests various topologies
and ensures that cluster IDs are distributed throughout connected
components, and store/node IDs are allocated in the way we'd expect them
to be.

TestJoinVersionGate checks to see that improperly versioned cockroach
nodes are not able to join a cluster.

Release note: None
@irfansharif irfansharif force-pushed the 200904.connectivity-test branch from d27c908 to 78b5535 Compare September 10, 2020 17:16
Copy link
Copy Markdown
Contributor Author

@irfansharif irfansharif left a comment

Choose a reason for hiding this comment

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

Thanks for looking Rafa!

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @knz and @tbg)


pkg/base/test_server_args.go, line 53 at r2 (raw file):

Previously, knz (kena) wrote…

Curious: can you point me to the code responsible to close this?

(Maybe even include this pointer in the comment)

It's here: https://github.com/irfansharif/cockroach/blob/d27c908602763fe7edbfe09ba129b69e7c66d70a/pkg/server/connectivity_test.go#L135-L138

Was included in the follow-on commit. It's accessible when jumping to usages now, so I'll skip the comment.


pkg/server/connectivity_test.go, line 176 at r4 (raw file):

Previously, knz (kena) wrote…

nit: typo

Done.

@tbg
Copy link
Copy Markdown
Member

tbg commented Sep 10, 2020 via email

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Sep 10, 2020

Build succeeded:

@craig craig bot merged commit 8547a97 into cockroachdb:master Sep 10, 2020
@irfansharif irfansharif deleted the 200904.connectivity-test branch September 10, 2020 19:05
@irfansharif
Copy link
Copy Markdown
Contributor Author

image

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.

4 participants