diff --git a/src/sqlancer/voltdb/README.md b/src/sqlancer/voltdb/README.md index d5cb2365b..ded220808 100644 --- a/src/sqlancer/voltdb/README.md +++ b/src/sqlancer/voltdb/README.md @@ -4,13 +4,14 @@ A SQLancer provider for [VoltDB](https://www.voltactivedata.com/), developed for VoltDB schemas, both replicated and partitioned tables, fills them with single-row inserts, upserts, updates and deletes, and runs SQLancer's oracles against them through the VoltDB JDBC driver. -**Status: milestone 12.** The provider creates schemas and data and runs these logic-bug oracles: NoREC (the default, +**Status: milestone 13.** The provider creates schemas and data and runs these logic-bug oracles: NoREC (the default, milestone 2), TLP WHERE (milestone 3), TLP DISTINCT, TLP HAVING and TLP AGGREGATE (milestone 5), PQS (milestone 6), and PARAMS, literals against JDBC parameters (milestone 8). Since milestone 9 each database's rows are also updated, upserted and deleted before the oracles run. Since milestone 10 each database also has materialized views, which the VIEWS oracle checks. Since milestone 11 expressions also use CASE, COALESCE, MOD, FLOOR, CEILING, CHAR_LENGTH, SUBSTRING, UPPER, LOWER and TRIM, and the LIMIT oracle checks LIMIT and OFFSET. Since milestone 12 the run script -can kill and rejoin nodes while SQLancer runs (`--kill-interval`), which the nightly job's 3-node run does. +can kill and rejoin nodes while SQLancer runs (`--kill-interval`), which the nightly job's 3-node run does. Since +milestone 13 the nightly job also runs a third cluster shape: 3 nodes with k=2 and 2 sites per host. `SMOKE`, from milestone 1, only reads every table and checks that the queries succeed. `voltdb/run-sqlancer.sh` (milestone 4) starts a cluster, runs SQLancer against it and saves the results. A nightly lab job (milestone 7) runs it against master's kit; @@ -119,10 +120,12 @@ handle the errors a node failure causes: | Error | What it means | What the provider does | | --- | --- | --- | | `Transaction dropped due to change in mastership. It is possible the transaction was committed` | The statement was in flight when a partition's leader moved; it may have committed. | Skips the statement, check or database (IgnoreMeException), since it cannot know. | -| `Transaction being restarted due to fault recovery or shutdown` | The same for a read, aborted by the failure. | The same. | +| `Transaction being restarted due to fault recovery or shutdown`, `Transaction Interrupted`, `transaction completion is in progress` | The same for a transaction the failure aborted or caught completing. | The same. | | `OPS request hit sixty second timeout before all responses were received` | A system request, such as the JDBC metadata calls that read the schema, waited on the dead node. | The same. | | `The errors for @VerifyCatalogAndWriteJar from host N: Host N failed, connection lost` | A DDL statement's catalog update was waiting on the dead node. | The same. | -| `Can't do catalog update(@AdHoc) while node rejoin is in progress`, `... while catalog update transaction is in progress` | VoltDB rejects DDL until the rejoin is done, or until a catalog update the failure interrupted is cleaned up. | Retries the statement, like a concurrent schema change, for up to `--retry-seconds`. VoltDB rejects it before running it. | +| `object name already exists` | A DDL statement that a failure interrupted committed after all, so a later CREATE of the same name collides with a table or index the provider never saw. | Skips, as above. Without `--node-failures` this fails the run, as it would be a provider bug. | +| `Catalog has been updated. The planner is outdated.`, `... was no longer live`, `Ad Hoc Planner task queue is full` | The statement was planned while a catalog update, frequent around a rejoin, replaced the planner, or the planner was busy. VoltDB rejects it before running it. | Retries it, with or without `--node-failures`, like a concurrent schema change. | +| `Can't do catalog update(@AdHoc) while ...`: a node rejoin, leader promotion or transaction repair, or a catalog update transaction, is in progress | VoltDB's catalog update blocker (`VoltZK`) refuses DDL until the failure is handled and the rejoin is done. | Retries the statement, like a concurrent schema change, for up to `--retry-seconds`. VoltDB rejects it before running it. | Without `--node-failures`, these errors fail the run as before. The OPS timeout makes each failure cost up to a minute of the threads that read the schema at the time, so a run with failures checks fewer queries. @@ -137,14 +140,21 @@ system test (`matrix-systemtest/master`, on the nights the rotation in `internal The job fetches this repository at the commit in its `SQLANCER_REF` parameter. That commit is pinned in the Jenkinsfile, so a change here reaches the nightly run only when the Jenkinsfile is changed to name it. It then builds SQLancer with -the kit's runtime JDK and makes two runs, one after the other, every node on the agent: +the kit's runtime JDK and makes three runs, one after the other, every node on the agent: | Run (triagedb name) | Cluster | Oracles | Time | | --- | --- | --- | --- | | `sqlancer-3n-k1-kill300` | 3 nodes, k=1, 8 sites per host; a node is killed and rejoined every 5 minutes | all nine (NoREC, TLP WHERE, DISTINCT, HAVING, AGGREGATE, PQS, PARAMS, VIEWS, LIMIT) | 45 minutes | | `sqlancer-1n-k0` | 1 node, 8 sites per host | the same | 45 minutes | +| `sqlancer-3n-k2-s2` | 3 nodes, k=2, 2 sites per host: every partition on every node, and 2 partitions in all | the same | 45 minutes | -Both runs use `--use-reducer`. The first run's seed is the UTC time as `yyyymmddHHMM`, and the second's is one more. +The shapes differ in what the planner and the execution engine do. With one node and 8 sites, a multi-partition query +gathers 8 partitions' results in one process. With 3 nodes, k=1, the partitions' leaders are spread over the nodes and +each has one replica, and node failures move them. With k=2 and 2 sites per host, every node holds every partition, so +there are only 2 partitions and every write is replicated twice. The whole job takes about 2 hours 20 minutes. + +Every run uses `--use-reducer`. The first run's seed is the UTC time as `yyyymmddHHMM`, and each next run's is one +more. `--avoid-known-bugs` stays on, so a failure is a new bug, or a known one in a new form. Each run is one row in the triagedb, with the seed in its run arguments. A failing row's reason is the oracle's account @@ -156,8 +166,8 @@ To repeat a failure on your machine, take the seed and oracles from the bundle's them against the same build. The reproduction in `reproductions/` is usually quicker: run its statements on an empty server. -The job's parameters change a manual run: `CLUSTERS` (runs as `nodes:kfactor[:kill]`, where kill is the seconds -between node failures, default `3:1:300 1:0`), `DURATION` (seconds +The job's parameters change a manual run: `CLUSTERS` (runs as `nodes:kfactor[:kill[:sites]]`, where kill is the +seconds between node failures and sites the sites per host, default `3:1:300 1:0 3:2:0:2`), `DURATION` (seconds per run, default 2700), `ORACLES`, `SEED`, `EXTRA_ARGS` (provider options) and `SQLANCER_REF`. A run of the job alone needs a kit: give `releasedir`, for example `releases/one-offs/16.1.0-SNAPSHOT-master/`. diff --git a/src/sqlancer/voltdb/VoltDBErrors.java b/src/sqlancer/voltdb/VoltDBErrors.java index c14890d9a..d5a02ff4f 100644 --- a/src/sqlancer/voltdb/VoltDBErrors.java +++ b/src/sqlancer/voltdb/VoltDBErrors.java @@ -17,9 +17,14 @@ public final class VoltDBErrors { */ private static final String[] RETRYABLE = { "while another one is in progress", "was planned against a catalog version which does not match", - // the same while a node fails or rejoins (run-sqlancer.sh --kill-interval): VoltDB rejects DDL until the - // failed catalog update is cleaned up and the rejoin is done - "while catalog update transaction is in progress", "while node rejoin is in progress" }; + // the same, raised by the planner itself once a catalog update has replaced it (PlannerTool.planSql), and + // for DDL planned against a configuration that is no longer live; and the ad hoc planner's queue being + // full. txnid2 (TxnId2Utils) retries the same rejections. + "The planner is outdated", "was no longer live", "Ad Hoc Planner task queue is full", + // the same while a node fails or rejoins (run-sqlancer.sh --kill-interval): VoltZK's catalog update + // blocker refuses DDL, before it starts, while a rejoin, leader promotion, transaction repair or an + // interrupted catalog update is in progress ("Can't do catalog update(@AdHoc) while ...") + "Can't do catalog update(@AdHoc) while" }; /** * Errors a node failure causes while nodes are killed and rejoined during the run (--node-failures). A statement in @@ -28,8 +33,13 @@ public final class VoltDBErrors { */ private static final String[] NODE_FAILURE = { "Transaction dropped due to change in mastership", "OPS request hit sixty second timeout", "Transaction being restarted due to fault recovery", + // a transaction a failure interrupted, or whose completion it caught (txnid2 lists both as transient) + "Transaction Interrupted", "transaction completion is in progress", // a catalog update (DDL) whose verification step was waiting on the dead node - "failed, connection lost" }; + "failed, connection lost", + // a DDL statement that one of the errors above interrupted can still commit after its client was told it + // failed, so a later CREATE of the same name collides with an object the provider never saw + "object name already exists" }; private VoltDBErrors() { } diff --git a/voltdb/run-sqlancer.sh b/voltdb/run-sqlancer.sh index ca1088336..ed6c09c88 100755 --- a/voltdb/run-sqlancer.sh +++ b/voltdb/run-sqlancer.sh @@ -159,12 +159,20 @@ stop_cluster() { if grep -q "Server completed initialization" "$cluster/node0/voltdbroot/log/volt.log" 2>/dev/null; then "$voltdb_home/bin/voltadmin" shutdown --force -H "localhost:$(admin_port 0)" >>"$results/run.log" 2>&1 fi - # only processes started for this run carry its directory on their command line + # only processes started for this run carry its directory on their command line, and their PIDs are recorded for _ in $(seq 1 30); do pgrep -f "$cluster/" >/dev/null || break sleep 1 done pkill -f "$cluster/" 2>/dev/null + for f in "$cluster"/node*.pid; do + [ -e "$f" ] && is_server "$(cat "$f")" && kill -9 "$(cat "$f")" 2>/dev/null + done +} + +# is_server PID: whether PID is a running VoltDB server (and not another process that reused the PID) +is_server() { + ps -ww -o command= -p "$1" 2>/dev/null | grep -q "org.voltdb.VoltDB" } trap 'stop_cluster' EXIT @@ -226,11 +234,13 @@ cluster_started=true # start_node I LOG: starts node I, or restarts it after a failure, which rejoins it to the running cluster start_node() { # in the foreground under nohup: "voltdb start --background" allows one server per user (a shared PID file). - # In a subshell, so that the server is not one of this script's jobs and its kill -9 is not reported. + # In a subshell, so that the server is not one of this script's jobs and its kill -9 is not reported. The + # launcher execs the server's JVM, so the PID it starts with is the server's, which node.pid records. (nohup "$voltdb_home/bin/voltdb" start -D "$cluster/node$1" -c "$nodes" -H "localhost:$(internal_port 0)" \ --client="$(client_port $1)" --admin="$(admin_port $1)" --internal="$(internal_port $1)" \ --zookeeper="$(port $1 3)" --replication="$(port $1 4)" --metrics="$(port $1 5)" \ - >"$2" 2>&1 &) + >"$2" 2>&1 & + echo $! >"$cluster/node$1.pid") } for ((i = 0; i < nodes; i++)); do start_node $i "$cluster/start$i.log" @@ -305,8 +315,10 @@ chaos_loop() { done i=$((1 + RANDOM % (nodes - 1))) n=$((n + 1)) - pid=$(pgrep -f -- "voltdbroot $cluster/node$i( |\$)" | head -1) - if [ -z "$pid" ]; then + # the PID start_node recorded; a pattern match on the command line is not reliable, as the server's command + # line carries a long classpath before its voltdbroot directory + pid=$(cat "$cluster/node$i.pid" 2>/dev/null) + if [ -z "$pid" ] || ! is_server "$pid"; then echo "$(date '+%H:%M:%S') kill $n: node$i is not running" >>"$results/chaos.log" return 1 fi @@ -314,7 +326,7 @@ chaos_loop() { t0=$(date +%s) echo "$(date '+%H:%M:%S') kill $n: node$i (pid $pid)" >>"$results/chaos.log" while port_in_use "$(client_port $i)"; do sleep 1; done - # the server is "java ... voltdbroot "; the survivors must notice the failure before it comes back + # the survivors must notice the failure before the node comes back sleep 5 if ! rejoin_node "$i" "$n"; then echo "$(date '+%H:%M:%S') rejoin $n: node$i did not rejoin within 600 s" >>"$results/chaos.log"