Skip to content

ENG-30396: string, bitwise, number, time and mask functions, and what lab build #46 found (milestone 31) - #30

Closed
jwiebema1 wants to merge 7 commits into
ENG-30396-sqlancer-m30from
ENG-30396-sqlancer-m31
Closed

jwiebema1 wants to merge 7 commits into
ENG-30396-sqlancer-m30from
ENG-30396-sqlancer-m31

Conversation

@jwiebema1

Copy link
Copy Markdown

Milestone 31 of ENG-30396 (tracked in ENG-30581, epic ENG-30580 "SQL Housekeeping"): the first coverage gap that milestone 30's measurement found, the engine's string, bitwise, number, time and mask functions; and what lab build #46 found in this milestone and the ones before it. Stacked on #29 (milestone 30), which is stacked on #28 to #1; review those first.

Why

Milestone 30's coverage run found about 2,300 engine lines that no run reached, most of them in stringfunctions.h, bitwisefunctions.h, datefunctions.h and numericfunctions.h: the expression generator never wrote those functions.

What it changes

The functions

  • The expression generator writes 31 more functions: LEFT, RIGHT, REPEAT, REPLACE, SPACE, CONCAT, OVERLAY, CHAR, HEX, BIN, OCTET_LENGTH, POSITION, REGEXP_POSITION, BITAND, BITOR, BITXOR, BITNOT, BIT_SHIFT_LEFT, BIT_SHIFT_RIGHT, SIGN, ROUND, STR, FORMAT_CURRENCY, DATEDIFF, TIME_WINDOW, FROM_UNIXTIME, FORMAT_TIMESTAMP, MASK_TEXT, MASK_INNER, MASK_OUTER and MASK_PARTIAL.
    • Bitwise operands are BIGINT (CAST(x AS BIGINT)). ROUND, STR and FORMAT_CURRENCY get the FLOAT or DECIMAL they are documented to take.
    • The errors they raise by design are expected: the bitwise functions on INT64_MIN, TIME_WINDOW out of range.
  • PQS evaluates 19 of them in Java, so the queries it builds can use them.

What lab build #46 found

  • XDCR. Before a reused database name drops its old tables, the provider waits for each cluster to apply what it has queued for the other (ENG-30630). It read the DR queues at once. Those statistics count only flushed DR buffers, and VoltDB flushes once a second, so the last second's rows were not waited for: they reached a dropped table and paused the DR stream for good. The wait now starts 1.5 s in, and a wait that runs out is logged.
  • PERMS. The read-only and read-write users' connections are plain JDBC, which does not retry a query that another thread's DDL made stale ("planned against a catalog version which does not match"). The security run's DDL made two such queries fail for the whole 120 s window. They are now retried for up to 60 s, then skipped.
  • Node failures. A surviving node crashed when another was killed during a catalog update (ENG-30663 below), and the cluster was lost. The script now holds DDL (the provider's --ddl-hold, as around a shrink) from 3 s before each kill until the node logs "Node rejoin completed".
  • Bug reproductions. On the lab agents, ENG-30595's crashed server had not exited after 300 s, so the reproduction was reported CHANGED. A lost connection with a crash in the server's output now counts as a crash.
  • New reproductions: ENG-30655, ENG-30656 and ENG-30658 (SQL), and ENG-30663 (a script, -- manual: as it is a race).
  • The README: the functions, the node-failure DDL hold, and the bug tables.

Bugs found

Ticket Issue Workaround while --avoid-known-bugs is true
ENG-30655 A procedure created AS a query with TIME_WINDOW(..., END) blocks every later DDL, its own DROP included ("unexpected token: END"). TIME_WINDOW's option is START.
ENG-30656 ROUND, STR and FORMAT_CURRENCY fail on a DECIMAL of 2^63 or more: "Type DECIMAL with value ... can't be cast as BIGINT". Expected error.
ENG-30658 FORMAT_TIMESTAMP(TO_TIMESTAMP(unit, n)) and FORMAT_TIMESTAMP(FROM_UNIXTIME(n)) fail on a NULL n: "Type BIGINT can't be cast as TIMESTAMP or DATE". FORMAT_TIMESTAMP's argument is a TIMESTAMP column or constant.
ENG-30663 Server crash, cluster lost. A node is killed while catalog updates are in flight (the same trigger as ENG-30612), and a surviving node dies. In the lab (#46): "Unexpected: @UpdateCore's prepared catalog is null during non-replay case". Locally: an engine abort, "getStats() called with selector 0, and an invalid locator ... that does not correspond to a table". In #49 both survivors segfaulted in the engine after DDL during the node's rejoin. Blocker for V16.1.0. DDL held from 3 s before each kill until the node has rejoined.

Coverage (the same runs as milestone 30, master bf8602e3)

Milestone 30 Milestone 31
Engine lines 59.0% 62.6% (25,267 of 40,347)
stringfunctions.h 146 of 1,102 741 of 1,102
bitwisefunctions.h 0 of 261 129 of 261
datefunctions.h 668 of 1,755 1,227 of 1,755
numericfunctions.h 203 of 384 289 of 384
Java lines 38.5% 38.7%

Testing

  • Lab build ENG-30396: the HTTP export target's modes, form by POST/PUT/GET, signed, and CSV batches (milestone 47) #46 (this milestone before the fixes above): XDCR, security, kill and the reproductions failed, as described above; export, resize, upgrade and crash passed.
  • Lab build ENG-30396: STREAMSNAP checks streaming snapshots (milestone 51) #50 ran this milestone with milestone 32 on top (fork a86d159, the PR above this one), 45 minutes per run with all twenty-two oracles: every run passed. Kill: 8 kills and 8 rejoins, 53,569 queries. Security, export, resize (9 grows, 8 shrinks), XDCR (474 databases compared after convergence), upgrade (3 of 3 nodes) and crash (4 crashes, 4 recoveries) passed, and the reproductions (75 still broken).
  • Local trials (macOS, master): XDCR with the lab's seed, 15 minutes, 199 databases compared after convergence; security, 15 minutes, 292 allowed and 325 refused statements; 3 nodes k=1 with a node killed every 60 s and the DDL hold, 6 kills and 6 rejoins. All passed.
  • mvn verify (formatter, TestVoltDBExpressionEvaluator) passes.

…r, time and mask functions the coverage run found unexercised, and PQS models 19 of them (milestone 31)

New: LEFT, RIGHT, REPEAT, REPLACE, SPACE, CONCAT, OVERLAY, CHAR, HEX, BIN, OCTET_LENGTH, POSITION, REGEXP_POSITION,
BITAND, BITOR, BITXOR, BITNOT, BIT_SHIFT_LEFT, BIT_SHIFT_RIGHT, SIGN, ROUND, STR, FORMAT_CURRENCY, DATEDIFF,
TIME_WINDOW, FROM_UNIXTIME, FORMAT_TIMESTAMP and MASK_TEXT, MASK_INNER, MASK_OUTER, MASK_PARTIAL. Bitwise operands are
BIGINT (CAST(x AS BIGINT)); ROUND, STR and FORMAT_CURRENCY get the FLOAT or DECIMAL they are documented to take.
Found ENG-30655 (TIME_WINDOW(..., END) in a procedure blocks all later DDL); TIME_WINDOW's option is START while
avoiding known bugs. Reproduction voltdb/repros/ENG-30655.sql.
… ENG-30656 (ROUND, STR and FORMAT_CURRENCY on a DECIMAL of 2^63 or more) and its reproduction
…ME of a NULL); FORMAT_TIMESTAMP's argument is a TIMESTAMP column or constant while avoiding known bugs; reproduction
… after a flush; PERMS retries a query made stale by another thread's DDL; run-repros counts a crash whose server has not exited

- VoltDBProvider.awaitDrApplied: LASTQUEUEDDRID counts only flushed DR buffers (flushed every 1 s by default), so
  rows written in the last second were not waited for, reached a dropped table and paused the DR stream for good
  (ENG-30630). It now starts 1.5 s in, and a wait that runs out is logged.
- VoltDBPermissionOracle: the users' plain JDBC connections did not retry "planned against a catalog version which
  does not match"; queries are retried for up to 60 s, then skipped.
- run-repros.sh: on the lab's agents ENG-30595's crashed server had not exited after 300 s, so the reproduction was
  reported CHANGED; a lost connection with a crash in the server's logs now counts as a crash.
… during a catalog update); DDL held around each kill; reproduction

- run-sqlancer.sh: with --kill-interval the provider gets --ddl-hold, and the script creates the file 3 s before each
  kill and deletes it once the survivors have handled the failure, so no catalog update is in flight when a node
  dies (ENG-30612, ENG-30663). The provider ignores it with --avoid-known-bugs false.
- voltdb/repros/ENG-30663.sh: 3 nodes k=1, DDL clients in a loop, a node killed every 8 s and rejoined; exit 0 when a
  survivor crashes. Manual: a race (1 of 3 local runs).
- README: the hold in Node failures, and ENG-30663's row.
Lab build #49's kill run (with the hold released 5 s after the kill): DDL ran while node 0 rejoined, and as the rejoin
finished both survivors crashed in the engine (SIGSEGV in PersistentTable::index and in __dynamic_cast), leaving node 0
alone to stop on partition detection. The hold now lasts until the node logs "Node rejoin completed" (up to 120 s
after the rejoin's "Server completed initialization"); the README describes it after the steps of a node failure.
…clients, which reproduced at the 2nd kill (1 of 2 runs)
@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-m31 branch November 25, 2026 13:44
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