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

Require specifying ports when using multiple nodes #145

Merged
merged 2 commits into from Sep 8, 2022

Conversation

RichardJCai
Copy link
Contributor

Previously it was using hardcoded ports, to allow parallel runs we want to be able to specify nodes.

It is on the user to make sure when a node is specified, that port cannot be stolen away during a node restart.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@RichardJCai RichardJCai force-pushed the specify_ports branch 4 times, most recently from 2e3aa8c to becfd4b Compare September 6, 2022 18:49
fmt.Sprintf("--listen-addr=localhost:%d", 26257+i),
fmt.Sprintf("--http-addr=localhost:%d", 8080+i),
fmt.Sprintf("--listen-addr=localhost:%d", serverArgs.httpPorts[i]),
fmt.Sprintf("--http-addr=localhost:%d", 0),
Copy link
Contributor

Choose a reason for hiding this comment

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

for this to be backwards compatible, i think we want it so still default to 26257/8080 if no port is specified

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated it for 26257 listenaddr but I don't think we actually use the HTTP addr in this case, I think it should be okay to just update it use 0 unless we find that we really need to set it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a diff parameter to allow people to specify HTTP port as well.

testserver/testserver.go Outdated Show resolved Hide resolved
Copy link
Contributor

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

this looks fine, just small nits

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss, @RichardJCai, and @ZhouXing19)


testserver/testserver.go line 218 at r3 (raw file):

	storeOnDisk            bool    // to save database in disk
	storeMemSize           float64 // the proportion of available memory allocated to test server
	httpPort               int

do we still need httpPort in addition to httpPorts?


testserver/testserver.go line 484 at r3 (raw file):

	hostPort := serverArgs.listenAddrPorts[0]
	for i, port := range serverArgs.listenAddrPorts {
		portArgsStr[i] = fmt.Sprint(port)

nit: seems like it would be more readable if this was portArgsStr[i] = fmt.Sprintf("localhost:%d", port)

then below change to joinArg := fmt.Sprintf("--join=%s", strings.Join(portArgsStr, ","))


testserver/testserver_test.go line 474 at r3 (raw file):

	defer func() {
		if err := exec.Command("rm", "-rf", "./temp_binaries").Run(); err != nil {
			t.Log(err)

is it better to keep failing loudly here?

Copy link
Contributor Author

@RichardJCai RichardJCai 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 @rafiss, @RichardJCai, and @ZhouXing19)


testserver/testserver.go line 218 at r3 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

do we still need httpPort in addition to httpPorts?

Was just being lazy keeping this around for backwards compat, updated it such that ExposeConsoleOpt just sets httpPorts[0] to port for backwards compat.


testserver/testserver.go line 484 at r3 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

nit: seems like it would be more readable if this was portArgsStr[i] = fmt.Sprintf("localhost:%d", port)

then below change to joinArg := fmt.Sprintf("--join=%s", strings.Join(portArgsStr, ","))

Yeah sounds good

Copy link
Contributor Author

@RichardJCai RichardJCai 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 @rafiss and @ZhouXing19)


testserver/testserver_test.go line 474 at r3 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

is it better to keep failing loudly here?

Done

Copy link
Contributor

@rafiss rafiss 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 r4, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss and @ZhouXing19)

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