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: compile cockroach-short with --crdb_test and use in sqlsmith #86625

Merged
merged 1 commit into from
Aug 25, 2022

Conversation

yuzefovich
Copy link
Member

This commit adds another step to the nightly roachtest invocation to
compile cockroach-short binary with --crdb_test build tag. Then it
also adds plumbing throughout the roachtest infrastructure to expose
that newly-compiled binary which is now used in 50% cases in the sqlsmith
roachtest.

Fixes: #83186.

Release justification: testing-only change.

Release note: None

@yuzefovich yuzefovich requested review from rickystewart and a team August 23, 2022 00:40
@yuzefovich yuzefovich requested review from a team as code owners August 23, 2022 00:40
@yuzefovich yuzefovich requested review from smg260 and removed request for a team August 23, 2022 00:40
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@yuzefovich
Copy link
Member Author

I'm not quite sure how to test the whole pipeline as well as whether this is the right approach, so I'm open to any suggestions.

@srosenberg srosenberg requested review from renatolabs and removed request for smg260 August 23, 2022 00:51
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.

Looks good modulo the naming asymmetry. Thanks for sending this PR! I am excited to see what else we might find by running other tests with assertions enabled.

Reviewed all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @renatolabs, @rickystewart, and @yuzefovich)


build/teamcity/cockroach/nightlies/roachtest_compile_bits.sh line 8 at r1 (raw file):

      //pkg/cmd/cockroach //pkg/cmd/workload //pkg/cmd/roachtest \
      //c-deps:libgeos
bazel build --config crosslinux --config ci -c opt //pkg/cmd/cockroach-short --crdb_test

Could we maybe call it something else to denote that this type of binary is compiled with runtime assertions? E.g., cockroach-short-ea (ea for "enable assertions"); cockroach-short-crdb_test seems somewhat redundant :)

Also, it would be nice to keep the symmetry between cockroach (cockroach-ea) and cockroach-short (cockroach-short-ea). At some point, we might want to use cockroach-short without assertions, for some of the tests. (None of the tests explicitly use the Console; I think it's mainly a convenience feature in case you'd like to attach to it while a long-running tests is executing, but I am not entirely sure.) @tbg is our anthropologist, so I'll let him chime in :)

@yuzefovich yuzefovich force-pushed the sqlsmith-crdb-test branch 2 times, most recently from 5796d7d to 1628a15 Compare August 23, 2022 14:43
Copy link
Member Author

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

TFTRs!

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


build/teamcity/cockroach/nightlies/roachtest_compile_bits.sh line 8 at r1 (raw file):

Previously, srosenberg (Stan Rosenberg) wrote…

Could we maybe call it something else to denote that this type of binary is compiled with runtime assertions? E.g., cockroach-short-ea (ea for "enable assertions"); cockroach-short-crdb_test seems somewhat redundant :)

Also, it would be nice to keep the symmetry between cockroach (cockroach-ea) and cockroach-short (cockroach-short-ea). At some point, we might want to use cockroach-short without assertions, for some of the tests. (None of the tests explicitly use the Console; I think it's mainly a convenience feature in case you'd like to attach to it while a long-running tests is executing, but I am not entirely sure.) @tbg is our anthropologist, so I'll let him chime in :)

Renamed. I didn't find a way to do that by asking the bazel directly to store the compiled binary at a different name - is there a way? Maybe @rickystewart knows.

Copy link
Contributor

@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.

This looks good! A suggestion: could move the code you added to sqlsmith.go to a place where it can be reused by other tests, e.g.:

c.MaybeUseTestBuild(t, 0.5)

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @renatolabs, @rickystewart, @srosenberg, @tbg, and @yuzefovich)


pkg/cmd/roachtest/tests/sqlsmith.go line 102 at r1 (raw file):

			c.Put(ctx, t.Cockroach(), "./cockroach")
		} else {
			t.Status("using cockroach-short binary compiled with --crdb_test build tag")

Could we check if a cockroach-short binary is present as well? When roachtest is called without the cockroach-short option, this message will be misleading, as we'll be using the standard cockroach binary. We could let cockroachShortbe empty if the flag is not passed and check for its value here.

@rickystewart
Copy link
Collaborator

I didn't find a way to do that by asking the bazel directly to store the compiled binary at a different name - is there a way? Maybe @rickystewart knows.

Nah, the binary name is determined by the BUILD files, you can't adjust it on the command line. As you copy it out of the sandbox, rename it to whatever you want at that point.

This commit adds another step to the nightly roachtest invocation to
compile `cockroach-short` binary with `--crdb_test` build tag. Then it
also adds plumbing throughout the roachtest infrastructure to expose
that newly-compiled binary which is now used in 50% cases in the sqlsmith
roachtest.

Release justification: testing-only change.

Release note: None
Copy link
Member Author

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

Extracted a helper for reuse.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @renatolabs, @rickystewart, @srosenberg, and @tbg)


pkg/cmd/roachtest/tests/sqlsmith.go line 102 at r1 (raw file):

Previously, renatolabs (Renato Costa) wrote…

Could we check if a cockroach-short binary is present as well? When roachtest is called without the cockroach-short option, this message will be misleading, as we'll be using the standard cockroach binary. We could let cockroachShortbe empty if the flag is not passed and check for its value here.

Good point, done.

Copy link
Contributor

@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.

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @renatolabs, @rickystewart, @srosenberg, and @tbg)

@yuzefovich
Copy link
Member Author

TFTRs!

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 23, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 23, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 23, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 23, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 24, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 24, 2022

Build failed:

@yuzefovich
Copy link
Member Author

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 25, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 25, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 25, 2022

Build succeeded:

@craig craig bot merged commit eaa7eaf into cockroachdb:master Aug 25, 2022
@yuzefovich yuzefovich deleted the sqlsmith-crdb-test branch August 25, 2022 14:07
srosenberg added a commit to srosenberg/cockroach that referenced this pull request Aug 26, 2022
Fixes a regression introduced by
cockroachdb#86625.

Release justification: fix roachtest nightly (on master)
Release note: None
craig bot pushed a commit that referenced this pull request Aug 26, 2022
86834: sql/opt: add session setting to disable stats forecast use in optimizer r=rytaft a=michae2

Add a new session setting, `optimizer_use_forecasts`, which can be used
to disable forecast usage in the optimizer. Forecasts will still be
generated in the stats cache (this will be controlled by a different
setting).

Assists: #86350

Release justification: Low-risk update to new functionality.

Release note (sql change): This commit adds a new session setting,
`optimizer_use_forecasts`, which can be set to false to disable usage of
statistics forecasts when optimizing a query.

86920: roachprod{,-stress}: let roachprod-stress use roachprod library r=srosenberg a=healthy-pod

This patch migrates roachprod-stress from using the roachprod
binary to using the roachprod library.

Release justification: Non-production code changes
Release note: None

86954: util/mon: remove nameWithPointer to reduce allocations r=yuzefovich a=yuzefovich

This field was added in order to help us track down some of the memory
leaks which we have already found, and the field didn't turn out to be
that useful. When it was introduced, the implications on the increase in
allocations were unknown, and now I don't think the field is worth it.

```
name                                           old time/op    new time/op    delta
FlowSetup/vectorize=true/distribute=true-24       168µs ± 5%     164µs ± 4%  -2.33%  (p=0.007 n=19+20)
FlowSetup/vectorize=true/distribute=false-24      167µs ± 6%     164µs ± 6%    ~     (p=0.060 n=20+20)
FlowSetup/vectorize=false/distribute=true-24      163µs ± 4%     161µs ± 7%    ~     (p=0.057 n=19+20)
FlowSetup/vectorize=false/distribute=false-24     161µs ± 6%     159µs ± 5%    ~     (p=0.309 n=19+20)

name                                           old alloc/op   new alloc/op   delta
FlowSetup/vectorize=true/distribute=true-24      19.6kB ± 8%    19.0kB ± 8%  -2.62%  (p=0.001 n=19+18)
FlowSetup/vectorize=true/distribute=false-24     18.2kB ± 1%    17.7kB ± 1%  -2.56%  (p=0.000 n=17+16)
FlowSetup/vectorize=false/distribute=true-24     25.8kB ± 2%    25.4kB ± 0%  -1.44%  (p=0.000 n=16+16)
FlowSetup/vectorize=false/distribute=false-24    24.7kB ± 0%    24.4kB ± 1%  -1.36%  (p=0.000 n=16+16)

name                                           old allocs/op  new allocs/op  delta
FlowSetup/vectorize=true/distribute=true-24         218 ± 2%       205 ± 3%  -5.64%  (p=0.000 n=19+19)
FlowSetup/vectorize=true/distribute=false-24        208 ± 1%       197 ± 3%  -5.63%  (p=0.000 n=19+19)
FlowSetup/vectorize=false/distribute=true-24        206 ± 0%       197 ± 0%  -4.40%  (p=0.000 n=16+16)
FlowSetup/vectorize=false/distribute=false-24       197 ± 0%       188 ± 0%  -4.54%  (p=0.000 n=16+16)
```

Release justification: low-risk cleanup.

Release note: None

86956: roachtest: fix unintended exit when --cockroach-short is passed r=srosenberg a=srosenberg

Fixes a regression introduced by
#86625.

Release justification: fix roachtest nightly (on master)
Release note: None

Co-authored-by: Michael Erickson <[email protected]>
Co-authored-by: healthy-pod <[email protected]>
Co-authored-by: Yahor Yuzefovich <[email protected]>
Co-authored-by: Stan Rosenberg <[email protected]>
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.

sqlsmith: add a configuration that runs with the crdb_test build
5 participants