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: use default env vars in Run() #98055

Merged

Conversation

renatolabs
Copy link
Contributor

In #97595, we added the COCKROACH_TESTING_FORCE_RELEASE_BRANCH environment variable to the list of roachprod's "default" environment variables. These variables are exported and accessible to the cockroach process when cockroach is started using c.Start(). However, nothing stops tests from invoking cockroach using c.Run("./cockroach ..."). In such cases, if a cluster had previously been created with c.Start(), the existing store would be deemed "too old" by the cockroach started with c.Run(), since that process (without the environment variable) would perform version offsetting.

To avoid these problems, we export roachprod's default environment variables to all commands run with c.Run(). The env vars available to cockroach are now consistent regardless of how the process is started, and the extra env vars should not affect unrelated commands run with c.Run.

Fixes #98025.
Fixes #98027.
Fixes #98029.
Fixes #98030.
Fixes #98031.

Epic: none

Release note: None

In cockroachdb#97595, we added the `COCKROACH_TESTING_FORCE_RELEASE_BRANCH`
environment variable to the list of roachprod's "default" environment
variables. These variables are exported and accessible to the
cockroach process when `cockroach` is started using
`c.Start()`. However, nothing stops tests from invoking cockroach
using `c.Run("./cockroach ...")`. In such cases, if a cluster had
previously been created with `c.Start()`, the existing store would be
deemed "too old" by the cockroach started with `c.Run()`, since that
process (without the environment variable) would perform version
offsetting.

To avoid these problems, we export roachprod's default environment
variables to all commands run with `c.Run()`. The env vars available
to cockroach are now consistent regardless of how the process is
started, and the extra env vars should not affect unrelated commands
run with `c.Run`.

Fixes cockroachdb#98025.
Fixes cockroachdb#98027.
Fixes cockroachdb#98029.
Fixes cockroachdb#98030.
Fixes cockroachdb#98031.

Epic: none

Release note: None
@renatolabs renatolabs requested a review from a team as a code owner March 6, 2023 15:28
@renatolabs renatolabs requested review from srosenberg and smg260 and removed request for a team March 6, 2023 15:28
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@nvanbenschoten
Copy link
Member

nvanbenschoten commented Mar 6, 2023

@renatolabs does this PR fix #98026, #98017, and #98018 as well?

@renatolabs
Copy link
Contributor Author

@renatolabs does this PR fix #98026, #98017, and #98018 as well?

While I also initially suspected that (as the timelines for the failures are suggestive), I don't think that's the case. The error message for those decommission failures are different (there's nothing about store version incompatibility). I also ran one of those decommission tests (randomized) off master with #97595 reverted and the failure persisted.

Copy link
Member

@srosenberg srosenberg 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 @renatolabs and @smg260)


pkg/roachprod/install/cluster_synced.go line 721 at r1 (raw file):

	// reveal that the sleep command is running on the cluster.
	envVars := append([]string{
		fmt.Sprintf("ROACHPROD=%s", c.roachprodEnvValue(node)), "GOTRACEBACK=crash",

We should think about separating the API for crdb vs. other commands. It would reduce the divergence wrt env.; e.g., generateStartCmd also sets COCKROACH_SKIP_ENABLING_DIAGNOSTIC_REPORTING=1 to effectively disable sentry uploads.

Copy link
Contributor Author

@renatolabs renatolabs 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 @smg260 and @srosenberg)


pkg/roachprod/install/cluster_synced.go line 721 at r1 (raw file):

Previously, srosenberg (Stan Rosenberg) wrote…

We should think about separating the API for crdb vs. other commands. It would reduce the divergence wrt env.; e.g., generateStartCmd also sets COCKROACH_SKIP_ENABLING_DIAGNOSTIC_REPORTING=1 to effectively disable sentry uploads.

Good point, and I agree. Perhaps instead of splitting the API, isolating the logic currently in generateStartCmd and reusing it on Start and Run might be good enough.

I'll defer that to a future PR to unblock the loq and inconsistency tests, but I think that change would make sense.

@renatolabs
Copy link
Contributor Author

bors r=srosenberg

@craig
Copy link
Contributor

craig bot commented Mar 6, 2023

Build failed:

@renatolabs
Copy link
Contributor Author

bors retry

@craig
Copy link
Contributor

craig bot commented Mar 6, 2023

Build succeeded:

@craig craig bot merged commit 709d765 into cockroachdb:master Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants