Skip to content

ENG-30396: SQLancer VoltDB provider, milestone 8: the PARAMS oracle - #8

Closed
jwiebema1 wants to merge 1 commit into
ENG-30396-sqlancer-m7from
ENG-30396-sqlancer-m8
Closed

jwiebema1 wants to merge 1 commit into
ENG-30396-sqlancer-m7from
ENG-30396-sqlancer-m8

Conversation

@jwiebema1

@jwiebema1 jwiebema1 commented Nov 6, 2026 •

Copy link
Copy Markdown

Milestone 8 of ENG-30396: the PARAMS oracle, literals against JDBC parameters. Stacked on #7 (milestone 7), which is stacked on #6 to #1; review those first.

The nightly job runs PARAMS once VoltDB/internal#6347 and VoltDB/pro#7093 merge. They add it to the default oracles and pin this branch's head.

Why this oracle

VoltDB turns an ad hoc statement's literals into parameters itself ("auto-parameterization"), or plans the statement with its literals inline when it cannot. Statements with JDBC parameters, and every stored procedure statement, take the second path. Most of the bugs found in milestones 6 and 7 were in that literal handling: ENG-30551, ENG-30552, ENG-30560 and ENG-30562. PARAMS runs each query both ways and requires the same rows.

What it adds

PARAMS (oracle/VoltDBParameterOracle):

  1. The query. It generates one of two kinds:

    • a SELECT of columns and a few expressions with a WHERE clause;
    • a GROUP BY query with aggregates and maybe WHERE and HAVING clauses.

    Joins are TLP WHERE's. GROUP BY queries make no FULL JOINs (ENG-30531), since a parameter can change the plan.

  2. The parameters. Each constant becomes a parameter with probability 3/4, written as:

    • ? when the other operand of its comparison, arithmetic, LIKE, BETWEEN or IN is a column whose type holds the value. VoltDB gives such a parameter the column's type, and rejects a value that doesn't fit.
    • CAST(? AS T) otherwise, where T is the literal's own type. VoltDB can't type a bare parameter with no column beside it, and types one inside ABS as FLOAT.

    Values are bound with typed setters. A TIMESTAMP is bound as its UTC instant, which is how VoltDB reads a TIMESTAMP literal.

  3. What stays a literal:

    • BOOLEAN constants (ENG-30494) and typed NULLs.
    • While --avoid-known-bugs is on, the operands of an expression of constants alone, which the planner folds (ENG-30547, ENG-30548).
  4. The check. Both queries must return the same rows, as a multiset, compared as TLP compares them. An expected error in either query skips the check; an unexpected one fails it. A failure reports both queries and the parameters' values and types, and --use-reducer works.

Other changes:

  • VoltDBExpressionEvaluator.isConstant is package-private, and Binary gains getBytes.
  • run-sqlancer.sh's help lists PARAMS.
  • README: a PARAMS section, the status line, the milestone 8 bug table, and the new test.
  • TestVoltDBParameterOracle: 2 unit tests of how parameters are typed, with no server needed.

Bugs found

Each has a minimal reproduction and is linked to ENG-30396. Each is avoided while --avoid-known-bugs is on.

Ticket What Workaround in PARAMS
ENG-30571 (Major, new) The JDBC driver counts every ? in a prepared statement as a parameter, including one inside a string literal: (query + ";").split("\\?") in JDBC4Statement. So INSERT ... VALUES (?, 'what?') fails: "Incorrect number of parameters passed". All 4 failed databases of the first trial. A string holding ? is always a parameter.
ENG-30572 (Major, new, wrong rows) In HAVING, two aggregates that differ only in their parameters take the first one's value: HAVING MAX(k + ?) < MAX(k + ?) with 1 and 2 returns no groups. They stay apart in the SELECT list and with literals. All 4 failed databases of the second trial. Constants in HAVING's aggregates stay literals.
ENG-30560 (milestone 7, widened; summary updated) It isn't about DATE constants. Every statement VoltDB doesn't auto-parameterize reads a DECIMAL literal as FLOAT and fails to plan CAST(1.5 AS DECIMAL) or 0.1 + 0.2. That covers every prepared statement with parameters and every stored procedure: CREATE PROCEDURE p AS SELECT CAST(1.5 AS DECIMAL) ... fails. All 7 failed databases of the first 10-minute trials. DECIMAL constants are always parameters.
ENG-30534 (milestone 5, comment) Wider than filed. In a GROUP BY statement that isn't auto-parameterized, MAX('00') beside MAX(x'00') returns the byte 0x00; in the other order the query fails with a cast error. VARBINARY constants are always parameters.
ENG-30551 (milestone 6, the node crash) Hit again: an expression of FLOAT constants that folds to a subnormal value fails to load its plan, and every PARAMS query is a statement where this happens. A query is skipped when one of its expressions of constants can't be predicted by the PQS evaluator.

A query that would have to keep a DECIMAL, VARBINARY or ?-holding constant as a literal is skipped.

Testing

  • mvn verify -DskipTests passes: formatter, checkstyle, PMD and SpotBugs.

  • Unit tests: TestVoltDBExpressionEvaluator (13), TestVoltDBConstantGenerator (2) and TestVoltDBParameterOracle (2) pass.

  • Local trials, PARAMS alone:

    • 3 minutes: each failure was one of the bugs above, avoided before the next trial. The last trial passed with 9,326 checks.
    • With --avoid-known-bugs false: fails within a minute, as expected.
    • 10 minutes with --use-reducer, at 929fbd8: 1 node, 34,417 checks, PASS; 3 nodes with k=1, 21,643 checks, PASS.
  • Lab: matrix-systemtest-apprunner-sqlancer build ENG-30396: SQLancer VoltDB provider, milestone 8: the PARAMS oracle #8 on jenkins-st:

  • Setup: milestone 7's pipeline, with this change's settings given as parameters: SQLANCER_REF 929fbd8 and ORACLES with PARAMS. That is the same as these defaults.

  • Kit: releases/one-offs/16.1.0-SNAPSHOT-ENG-30396-sqlancer-nightly/2.

  • Agent: an apprunner-lxd6 agent (Ubuntu 22.04), JDK 25.

  • Runs: 45 minutes each, all seven oracles, --use-reducer.

    Run Seed Checks Result
    sqlancer-3n-k1 202611061440 228,195 PASS, no FATAL lines, no node down
    sqlancer-1n-k0 202611061441 371,824 PASS, no FATAL lines

Runs each query with its constants as literals and again with some of
them as PreparedStatement parameters, and requires the same rows. Its
trials found ENG-30571 (the JDBC driver counts a ? in a string literal)
and ENG-30572 (HAVING aggregates that differ only in their parameters
are merged), widened ENG-30560 and ENG-30534, and hit ENG-30551; each
is avoided while --avoid-known-bugs is on.
@jwiebema1

Copy link
Copy Markdown
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.

@jwiebema1 jwiebema1 closed this Nov 18, 2026
@jwiebema1
jwiebema1 deleted the ENG-30396-sqlancer-m8 branch November 25, 2026 13:45
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.

1 participant