Repository navigation
Conversation
Pivoted Query Synthesis: pick a row of each table, evaluate random predicates on it in Java, rewrite them to be TRUE for it, and check that the query returns the row, with the evaluated values of random expressions in its SELECT list. The evaluator models VoltDB's EE semantics as probed (BIGINT integer arithmetic, DECIMAL truncation at scale 12, IEEE FLOAT, three-valued logic, LIKE without escapes) and skips what it cannot predict: errors, NULL sentinels, DECIMAL/FLOAT mixing. Known bugs avoided while --avoid-known-bugs is on: - ENG-30545: temporal comparisons draw operands from DATE or TIMESTAMP only - ENG-30546: a concatenation's right operand is a non-empty constant - ENG-30547: folded integer sums outside INTEGER's range are unpredictable - ENG-30549: folded string comparisons decided by trailing spaces are unpredictable
README: the PQS oracle, its evaluator, and the bugs found while building it (ENG-30545 to ENG-30550). run-sqlancer.sh lists every oracle in its help. TestVoltDB gains a PQS test.
A subnormal FLOAT constant in a statement that is not parameterized makes its plan fail to load, and re-running it after DDL crashes the node. The constant generator never writes one, and PQS never sends an expression of constants that folds to one.
The literal '\N' reaches VoltDB's EE as NULL. The constant generator never writes it, and PQS never sends an expression of constants equal to it.
This was referenced Nov 6, 2026
Author
|
Superseded by #51, which combines every ENG-30396 PR of this repo into one. This PR's branch is kept, and its description still has this milestone's details and lab results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Milestone 6 of ENG-30396: the PQS (Pivoted Query Synthesis) oracle, fourth and last in the plan's list of oracles ("later, as it requires an expression evaluator in the provider"). Stacked on #5 (milestone 5), which is stacked on #4 to #1; review those first.
What it adds
The other oracles compare VoltDB with itself: a query against an equivalent rewrite of it. A comparison or function that VoltDB gets wrong the same way everywhere passes them. PQS checks VoltDB against values computed outside it, so it finds a different class of bugs: eight new ones during this milestone, including a node crash.
PQS(oracle/VoltDBPivotedQuerySynthesisOracle):p,NOT porp IS NULL.The join types are TLP WHERE's: INNER, LEFT and FULL all return the pivot row. Rows are read and checked in Java, since SQLancer's tables are small. A query whose tables could produce more than 50,000 rows is skipped.
The evaluator (
oracle/VoltDBExpressionEvaluator) follows VoltDB's execution engine, as probed against a server:?.What it can't predict, it doesn't check:
An unpredictable expression is left out of the SELECT list. An unpredictable predicate skips the check.
A failure reports the query, the pivot row, and the expected and actual values.
--use-reducerworks: the reproducer first checks that every table still holds its row of the pivot row. Checked on a known bug (ENG-30502), where it reduced the case to one CREATE TABLE and one INSERT.Other changes
'\N'(ENG-30552).generateExpressionInDomaingives the SELECT list expressions whose operands come from one numeric or temporal domain, as a comparison's do.run-sqlancer.sh: the help lists every oracle. It had been stale since milestone 5.TestVoltDBExpressionEvaluator: 11 unit tests of the evaluator's semantics, with no server needed.TestVoltDB: gains a PQS test.Bugs found
Each has a minimal reproduction and is linked to ENG-30396. Each is avoided while
--avoid-known-bugsis on (the default).dt = tsis TRUE butts = dtis FALSE for2020-01-02and2020-01-02 12:00; BETWEEN is affected too. Found while checking the evaluator's semantics.v || vandCONCAT(v, v)withv = ''. Found by PQS in its first trial, on 3 of 4 threads.||is never empty.+and-of integer constants in 32 bits:2147483647 + 1is NULL, and2135068309 + 1293734779is -866164208. A folded multiplication with a BIGINT operand is typed DECIMAL, so7 / (2 * 3000000000)keeps a fraction (comment on the ticket). Found by PQS.1 / 3.0folds to 0.3333, and folded multiplication rounds where the EE truncates. Found while checking the evaluator's semantics.'a' = 'a 'is TRUE), while the EE compares exactly. Found by PQS.1.0E-309, written or folded from0.28E0 / 1.79E308) in a statement that is not parameterized makes its plan fail to load ("JSON parse failure"). Running it again after any DDL crashes the node with SIGSEGV inExecutorContext::cleanupAllExecutors. Found by PQS in the first 3-node acceptance run, where node 0 died 19 minutes in. Reproduced on one node in three statements.'\N'in ad hoc SQL becomes NULL: INSERT stores NULL, andSELECT '\N'and the folded'\' || 'N'return NULL. Found by PQS in the second 3-node acceptance run.'\N', and PQS never sends an expression of constants equal to it.ABS((b * 1) / 2)is 3.5 for BIGINTb = 7, andABS((7 / i) - d)divides 7 by 2 as 3.5 whendis DECIMAL (comment on the ticket). Found by PQS in 5- and 10-minute trials.Testing
mvn verify -DskipTestspasses: formatter, checkstyle, PMD and SpotBugs.TestVoltDBExpressionEvaluator: 13 tests pass.Trials, 1 node, 8 sites per host: each failure was one of the bugs above, worked around in the next commit before the next trial. Clean trials: 3 minutes (11,902 checks) and 10 minutes (37,609 checks).
With
--avoid-known-bugs false: PQS fails within seconds on known bugs (ENG-30500, ENG-30502, ENG-30503), as expected.Acceptance, 30 minutes each: 8 sites per host, PQS,
--use-reducer, both on 4a74fb8 (the head, fbc25cf, changes only README text):Earlier acceptance runs found bugs. Two earlier pairs each failed on 3 nodes:
TestVoltDB's new PQS test runs only withVOLTDB_AVAILABLE=trueagainst localhost:21212, like the others, so it was not run here.