-
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
testing: runtime assertions #94986
Comments
cc @cockroachdb/test-eng |
There's been some prior internal discussion on this here: https://cockroachlabs.slack.com/archives/C023S0V4YEB/p1658242296301019. |
For 1), we do need to determine a require-style API that just works. Do you think we could just rely on
|
For 2), we already have the instrumented binary as one of the roachtest artifacts [1]. (Its path is written into There is also [2] which is related to 2). [1]
[2] #86678 |
I think so, since that also does redaction, sentry reporting, etc, which we may want if we deploy these builds to long-lived clusters and perhaps even at customer testing sites (who knows).
|
Prototype only. Touches cockroachdb#94986. Could close it if someone polished this up. Epic: none Release note: None
Here's something that I think I for one would be happy using: #95727 (Not planning to push this over the finish line but maybe someone will? And if nothing else it's food for thought). |
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions enabled by default. Performance tests (i.e., tests that export to roachperf) will be able to continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions enabled, most often due to timeouts. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions enabled by default. Performance tests (i.e., tests that export to roachperf) will be able to continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions enabled, most often due to timeouts. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions enabled by default. Performance tests (i.e., tests that export to roachperf) will be able to continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions enabled, most often due to timeouts. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
I'm probably missing something, but why do we not like |
I think it mostly does what we want. I'm not sure if it's enabled in roachtests/roachprod and for local dev builds, we should make sure it is. My main gripe with it is that I want to add assertions in performance-critical code paths, where the assertion check itself is too expensive to enable in production. For example in the MVCC iterator hot path. So we need a mechanism that will entirely compile out the assertions in production builds without any performance impact. We'll likely want three different variants:
Also, we should have some syntactic sugar for it that's terser and easier to use. Maybe something like: crash.If(1 != 1, "uh oh")
crash.Assert(1 == 1, "uh oh")
crash.AssertExpensive(computeMVCCStats(db) == ms, "recomputed stats differ from in-memory stats")
crash.AssertAlways(1 == 1, "uh oh")
crash.Now("uh oh") |
I wonder if we could piggyback off of |
On second thought, maybe we're overthinking it? Has everyone seen [1]? Rather than cook up fancy interfaces, why don't we go back to basics? E.g., does one really need to pass an error message into |
Yes, we need a message. For assertions enabled in production builds, cluster operators need a human-readable message if they hit it, and we also want them in Sentry reports. They'll frequently also contain useful context via fmt args, e.g. the specific values that violate the assertion.
We often turn on vmodule for debugging production incidents. I wouldn't want that to also arm a bunch of fatal assertions. I don't think any of this is particularly hard, someone just needs to set aside a day or two and get it done. I was hoping to do something over breather week, but got bogged down in GA blockers and test flake. |
Is there a consensus that we'd want to enable assertions in production builds? I am open to both approaches, but note that having them in production builds goes against the conventional wisdom. |
I think there are some assertions where we know the node is broken and we want to kill it to prevent further damage to the node/app/cluster. Stuff like SST checksum mismatches or consistency checker failures that would serve incorrect data to clients. Unclear if we'd consider these assertions as such though, but probably if we want to send them via Sentry (which I think we do). |
Also, many assertions would send a Sentry report in production builds, but not fatal the node. We'd want messages in those Sentry reports. |
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions enabled by default. Performance tests (indicated by the benchmark TestSpec) will continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions enabled, most often due to timeouts. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions and metamorphic constants enabled by default. Performance tests (indicated by the benchmark TestSpec) will continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions or metamorphic constants enabled, most often due to timeouts and metamorphic constant incompatibility. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions and metamorphic constants enabled by default. Performance tests (indicated by the benchmark TestSpec) will continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions or metamorphic constants enabled, most often due to timeouts and metamorphic constant incompatibility. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions and metamorphic constants enabled by default. Performance tests (indicated by the benchmark TestSpec) will continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions or metamorphic constants enabled, most often due to timeouts and metamorphic constant incompatibility. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions and metamorphic constants enabled by default. Performance tests (indicated by the benchmark TestSpec) will continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions or metamorphic constants enabled, most often due to timeouts and metamorphic constant incompatibility. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions and metamorphic constants enabled by default. Performance tests (indicated by the benchmark TestSpec) will continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions or metamorphic constants enabled, most often due to timeouts and metamorphic constant incompatibility. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions and metamorphic constants enabled by default. Performance tests (indicated by the benchmark TestSpec) will continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions or metamorphic constants enabled, most often due to timeouts and metamorphic constant incompatibility. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions and metamorphic constants enabled by default. Performance tests (indicated by the benchmark TestSpec) will continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions or metamorphic constants enabled, most often due to timeouts and metamorphic constant incompatibility. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions and metamorphic constants enabled by default. Performance tests (indicated by the benchmark TestSpec) will continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions or metamorphic constants enabled, most often due to timeouts and metamorphic constant incompatibility. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
111949: roachtest: randomly run with runtime assertions by default r=renatolabs,mikeCRL,rickystewart,herkolategan a=DarrylWong This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions enabled by default. Performance tests (indicated by the benchmark TestSpec) will be able to continue using the standard binary, without runtime assertions or metamorphic constants, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions or metamorphic constants enabled, most often due to timeouts or metamorphic constant incompatibility. Resolves #86678. Informs #94986. Epic: none Release note: None 113693: go.mod: bump Pebble to 844f0582c2eb r=RaduBerinde a=itsbilal ``` 844f0582 tool: fix tool to tolerate T in the log context 58cbdb46 internal/dsl: new package 481da041 db: add KeyStatistics.LatestKindsCount 86ec1c41 db: move size check for remote files to table stats job 424019fb db: guard against concurrent batch writes during Commit 5f131c12 db: default to zeroing fields in Batch.Reset ``` Release note: None. Epic: none Co-authored-by: Renato Costa <renato@cockroachlabs.com> Co-authored-by: DarrylWong <darryl@cockroachlabs.com> Co-authored-by: Bilal Akhtar <bilal@cockroachlabs.com>
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions and metamorphic constants enabled by default. Performance tests (indicated by the benchmark TestSpec) will continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions or metamorphic constants enabled, most often due to timeouts and metamorphic constant incompatibility. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
This changes the semantics of `t.Cockroach()` to use a binary with runtime assertions and metamorphic constants enabled by default. Performance tests (indicated by the benchmark TestSpec) will continue using the standard binary, without runtime assertions, as usual. This commit also opts-out other tests that cannot easily be run with runtime assertions or metamorphic constants enabled, most often due to timeouts and metamorphic constant incompatibility. Resolves cockroachdb#86678. Informs cockroachdb#94986. Epic: none Release note: None
Describe the problem
We don't have great guidelines/infra for runtime assertions. Some of us have, in previous jobs, worked on products that relied heavily on runtime assertions (that would be compiled out in the production builds) and have found this very useful.
Currently, there are a few issues:
require
-style API would be great, but instead you have to do something likeThat's pretty noisy and tends to pollute the code, and also it's just long so people don't type it when they should.
#94979 has some links to ideas.
Jira issue: CRDB-23260
The text was updated successfully, but these errors were encountered: