Skip to content

ENG-30789: the SQLCMD oracle: queries through sqlcmd as well as JDBC (milestone 58) - #53

Open
jwiebema1 wants to merge 2 commits into
mainfrom
ENG-30789-sqlancer-sqlcmd
Open

jwiebema1 wants to merge 2 commits into
mainfrom
ENG-30789-sqlancer-sqlcmd

Conversation

@jwiebema1

Copy link
Copy Markdown

Adds the SQLCMD oracle. It tests the rebuilt sqlcmd (ENG-30789, internal ENG-30789-sqlcmd-rebuilt) against JDBC and against the sqlcmd it replaces.

With --sqlcmd name=path[,name=path...], each check generates a query (as DIFF does) and runs it:

  • through JDBC;
  • through each sqlcmd, as --output-format=csv --output-skip-metadata --query=..., against the same cluster.

Each csv field is read back as its column's type, from the JDBC metadata, and every sqlcmd must print JDBC's rows. With two or more sqlcmds, their csv text is also compared as written. A text difference is counted and logged to logs/voltdb/sqlcmd-differences.log but doesn't fail the run, since the rebuilt sqlcmd changes some output on purpose.

voltdb/run-sqlancer.sh --voltdb ~/voltdb --oracle NOREC,TLP_WHERE,SQLCMD \
    -- --sqlcmd old=$HOME/voltdb/bin/sqlcmd,new=$HOME/sqlcmd-new/bin/sqlcmd

SQLCMD is opt-in: without --sqlcmd it does nothing, and it is not added to the nightly job's oracles.

Results

These runs used the 16.1.0-SNAPSHOT sqlcmd of master 133b68bb54 ("old") and the rebuilt sqlcmd of 09e0680bdf ("new"). The new sqlcmd's changed volt-server classes were compiled over that master build.

Run Old: queries matching JDBC New: queries matching JDBC Same csv text
1 node, SQLCMD only, 5 min, 4 threads 907 of 907 894 of 894 894 of 894
3 nodes, k=1, a kill every 300 s, NOREC/TLP_WHERE/PQS/SQLCMD, 20 min (PASS) 2,551 of 2,551 2,411 of 2,411 2,411 of 2,411

Bugs found

Both are in VoltTableUtil.toCSVWriter, which the old and new sqlcmd share and which also writes CSV snapshots.

  • ENG-30895: csv writes every BOOLEAN as an empty field, TRUE, FALSE and NULL alike.
  • ENG-30896: csv writes a TIMESTAMP before 1970 whose microseconds are not whole milliseconds as the next millisecond, a minus sign and the microseconds: 01:42:38.818363 as 01:42:38.819-637, and 1969-12-31 23:59:59.999999 as 1970-01-01 00:00:00.000-01.

While --avoid-known-bugs is true, the oracle allows for both and counts them at exit. Each has a script reproduction in voltdb/repros/, and both report BROKEN on master.

Checks

  • TestVoltDBSqlcmdOracle, the csv parser: 5 of 5 pass.
  • mvn verify -DskipTests passes with JDK 17. With JDK 21, SpotBugs 4.7.3 can't read the class files and crashes, unrelated to this change.

…(milestone 58)

With --sqlcmd name=path[,name=path...], SQLCMD runs a generated query
through JDBC and through each sqlcmd (--output-format=csv
--output-skip-metadata --query) against the same cluster, reads each csv
field back as its column's type and checks that every sqlcmd prints
JDBC's rows. With two or more sqlcmds it also compares their csv text,
counting and logging differences (logs/voltdb/sqlcmd-differences.log)
without failing, so an old sqlcmd can be compared with the rebuilt one
of ENG-30789.

It found two bugs in the csv writer (VoltTableUtil.toCSVWriter) that the
16.1.0-SNAPSHOT sqlcmd and the rebuilt one share: ENG-30895, every
BOOLEAN is an empty field, and ENG-30896, a TIMESTAMP before 1970 whose
microseconds are not whole milliseconds is written as the next
millisecond, a minus sign and the microseconds. While --avoid-known-bugs
is true the oracle folds both in and counts them. voltdb/repros has a
script reproduction of each.
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