Repository navigation
Conversation
Each database creates up to --max-num-views views right after its tables, so VoltDB keeps them up to date through every insert, upsert, update and delete. VIEWS compares a view with its defining query computed from the table (ORDER BY 1 keeps the view rewriter away) and with the query as written, which the rewriter may answer from the view. Its trials found ENG-30582 (the rewriter fails on duplicate aggregates and aggregates of expressions), ENG-30583 (a view's WHERE clause blocks later DDL) and ENG-30584 (a deleted group's SUM stays 0, not NULL); each is avoided while --avoid-known-bugs is on.
Lab build #10 crashed its 1-node server: an UPDATE of an indexed column failed when it overflowed a view's DECIMAL SUM, but left the row out of the index, and the next UPDATE of the row hit "Failed to remove tuple from index (during update)" (ENG-30588; BIGINT sums do the same). While --avoid-known-bugs is on, a view sums TINYINT, SMALLINT and INTEGER columns only, which VoltDB sums as BIGINT.
A local trial's UPDATE left two FLOATs, -32767.000000000004 and -32766.999999999996, that GROUP BY rightly kept as two rows. The oracle rounded both to 12 digits before removing the partitions' duplicates, so the partitions had one row. Rounding is for HAVING's FLOAT SUMs; DISTINCT has no aggregates, so it now keeps FLOATs exact.
This was referenced Nov 7, 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 10 of ENG-30396 (tracked in ENG-30581, epic ENG-30580 "SQL Housekeeping"): the VIEWS oracle, materialized views against their defining queries. Stacked on #9 (milestone 9), which is stacked on #8 to #1; review those first.
The nightly job runs VIEWS once VoltDB/internal#6350 and VoltDB/pro#7095 merge. They pin this branch's head and add VIEWS to the default oracles.
Why
VoltDB keeps a materialized view up to date incrementally, as rows are inserted, updated and deleted, rather than computing it again. Its planner also answers matching GROUP BY queries on the table from the view: the view rewriter,
MVQueryRewriter. Neither path was tested by the other oracles. This oracle found three new bugs in a few minutes, one of which gives wrong results to ordinary queries, and the first lab run found a fourth that crashes the server.What it adds
gen/VoltDBViewGenerator: a view of one table.COUNT(*)and up to three more ofCOUNT,SUM,MINandMAX, with no MIN or MAX of BOOLEAN (ENG-30493).--avoid-known-bugsis on, SUM is only of NOT NULL TINYINT, SMALLINT and INTEGER columns (ENG-30584, ENG-30588).--avoid-known-bugsis false (ENG-30583).--max-num-views(default 2), right after its tables and before any rows. VoltDB can't create some views on a table that holds data, and a view made first is maintained through every insert, upsert, update and delete that follows.oracle/VoltDBViewOracle,VIEWS: it picks a view. Half the time it first runs one more INSERT, UPDATE or DELETE on the view's table. It then compares three results, as multisets:SELECT * FROM v;ORDER BY 1, which the rewriter skips, so it is computed from the table;The view and the query as written must both match the query computed from the table. A failure reports the three queries and the differing rows, and
--use-reducerworks.Other changes:
README: a VIEWS section, the status line, the option, the expected errors, and the milestone 10 bugs.
Bugs found
All are new, under ENG-30580, and avoided while
--avoid-known-bugsis on.SUM, as it should, but the row is left out of the index on that column. Lookups by the key miss it, and the next UPDATE of the row crashes the node: "Failed to remove tuple from index (during update)". A failed DELETE, or a failed UPDATE of other columns, leaves the index intact. Found by lab build #10's 1-node run.SUM. Ordinary queries the rewriter answers from the view return 0 too, such asSELECT g, SUM(x) FROM t GROUP BY g, so it reaches applications that never read the view.Collectors.toMapwithout a merge function inMVQueryRewriter.getViewColumnMaps. An aggregate of an expression,SUM(x + 0)orMIN(ABS(c)), gives a ClassCastException. The other oracles hit it at once.12.5E0blocks every later DDL in the database until the view is dropped. A predicate an index could serve (LIKE, or a TIMESTAMP BETWEEN) blocks an index on that column (two comments on the ticket).Testing
mvn verify -DskipTestspasses: formatter, checkstyle, PMD and SpotBugs.Local trials:
--use-reducer, at bd45615: 1 node, 45,114 checks, PASS; 3 nodes with k=1, 28,126 checks, PASS. Views are created in the trial databases.Lab:
matrix-systemtest-apprunner-sqlancerbuild ENG-30396: SQLancer VoltDB provider, milestone 13: more cluster shapes #13 on jenkins-st:Setup:
SQLANCER_REF286e488 and all eight oracles given as parameters, which is the same as this branch's defaults.Kit: releases/one-offs/16.1.0-SNAPSHOT-ENG-30396-sqlancer-nightly/2.
Agent: an
apprunner-lxd6agent (Ubuntu 22.04), JDK 25.Runs: 45 minutes each,
--use-reducer.sqlancer-3n-k1sqlancer-1n-k0Build ENG-30396: SQLancer VoltDB provider, milestone 10: materialized views and the VIEWS oracle #10, at bd45615, found ENG-30588 (its 1-node server crashed); builds ENG-30396: SQLancer VoltDB provider, milestone 11: functions, CASE and the LIMIT oracle #11 and ENG-30396: SQLancer VoltDB provider, milestone 12: node failures during a run #12 were stopped or failed at checkout before any run.