Reduce an unoptimized-query-oracle test failure log to the simplest possible reproduction case. Use when you have unoptimized-query-oracle*.log files from a failed roachtest and need to find the minimal SQL to reproduce the bug.
Reduce an unoptimized-query-oracle test failure log to the simplest possible reproduction case.
The unoptimized-query-oracle roachtest runs a series of random SQL statements to create a random dataset, and then executes a random "Query of Interest" twice, with different optimization settings. If the two executions return different results, it indicates a bug in CockroachDB.
Use this skill when:
Ask the user where the artifacts directory is.
Find the relevant files in the artifacts directory:
params.log (the parameters from the roachtest)test.log (the log from the roachtest)failure*.log (the failure log from the roachtest)unoptimized-query-oracle*.log (the SQL statements that led to failure)unoptimized-query-oracle*.failure.log (containing
the query of interest and possibly more information about the failure)logs/1.unredacted/cockroach.log or
logs/unredacted/cockroach.log (contains the git commit)Determine the git commit from cockroach.log:
grep "binary: CockroachDB" cockroach.log
Look for the commit hash in the version string (e.g., cb94db961b8f55e3473f279d98ae90f0eeb0adcb).
Determine if runtime assertions are enabled by checking for:
"runtimeAssertionsBuild": "true" in params.logRuntime assertions enabled in test.logDetermine if metamorphic settings apply by looking for:
params.log:
"metamorphicBufferedSender": "true",
"metamorphicWriteBuffering": "true",
test.log:
metamorphically setting "kv.rangefeed.buffered_sender.enabled" to 'true'
metamorphically setting "kv.transaction.write_buffering.enabled" to 'true'
Determine environment variables from the beginning of cockroach.log:
grep -A10 "using local environment variables:" cockroach.log
Important environment variables include:
COCKROACH_INTERNAL_CHECK_CONSISTENCY_FATALCOCKROACH_INTERNAL_DISABLE_METAMORPHIC_TESTINGCOCKROACH_RANDOM_SEEDCOCKROACH_TESTING_FORCE_RELEASE_BRANCH
But there might be more important environment variables, so best to get all of
them.Determine if this is a multi-region test or single-region test by checking:
seed-multi-region in test.log indicates multi-region)\connect lines in the full SQL log
If both of these are missing, it's a single-region test.For a normal build use:
git checkout <commit-hash>
./dev build short
If runtime assertions were enabled, use a test build instead:
git checkout <commit-hash>
./dev build short -- --crdb_test
Note: Only build libgeos if the reproduction uses geospatial functions (BOX2D, geometry, geography, etc.):
./dev build libgeos
First, check that the following statements are at the top of the full SQL log file. If they are not, add them:
SET statement_timeout='1m0s';
SET sql_safe_updates = false;
If metamorphic settings were used, also add them to the top of the full SQL log