Skip to content

Update SQLancer to ClickHouse/sqlancer PR #4 (client-v2 driver, 25 oracles) - #108660

Merged
alexey-milovidov merged 12 commits into
masterfrom
sqlancer-update-pr4-driver-oracles
Jun 30, 2026
Merged

alexey-milovidov merged 12 commits into
masterfrom
sqlancer-update-pr4-driver-oracles

Conversation

@fm4v

@fm4v fm4v commented Jun 26, 2026 •

Copy link
Copy Markdown
Member

Updates and re-enables the SQLancer CI job, which had been orphaned since PR #105199 ("Remove SQLancer from CI", 2026-05-18) deleted its references from the master/pull_request workflows — the job definition was left in job_configs.py but ran nowhere.

This brings the job up to date with the ClickHouse/sqlancer provider after PR #4 (merged into main @ a62ea509ee53862b5dd37f452e8c2edce8038951): the wrong-result oracle suite (94 curated oracles), recursive type system, and the com.clickhouse:client-v2 RowBinary transport replacing clickhouse-jdbc.

Docker image (ci/docker/sqlancer-test/Dockerfile)

  • Bump the cloned sqlancer commit 308cb3b7… → a62ea509…, rebuilding the jar against the client-v2 driver.
  • The new pom.xml targets Java 25, which Ubuntu 22.04 default-jdk/maven cannot build, so install Temurin JDK 25 (Adoptium) and Maven 3.9.9 and add -Djacoco.skip=true. JAVA_HOME is set via an arch-independent symlink so the image builds for both arm and amd (platforms=arm_amd).

Job script (ci/jobs/sqlancer_job.sh)

  • Apply the provider's server-side config overrides from .claude/clickhouse-config/ (logger → warning, remove the heavy system.*_log tables, and pin async_insert=0 / alter_sync=2 / mutations_sync=2) by starting the server from a directory containing config.d/. With the binary's embedded config (users_config == config.xml), <profiles> overrides in config.d/ reach the default profile — verified empirically.
  • Replace the per-oracle loop with a single combined run bounded by one wall-clock timeout, matching the upstream run-sqlancer.sh --oracles all reference. The oracle list is derived from the provider's own ALL_ORACLES so it stays in sync with the pinned image (fail-closed if it cannot be parsed).

Workflow (ci/workflows/nightly_sqlancer.py + generated .github/workflows/nightly_sqlancer.yml)

  • New dedicated scheduled NightlySQLancer workflow (mirrors NightlyJepsen): builds amd_debug and runs SQLancer nightly on master, with its own report/CIDB and workflow_dispatch. Keeps the correctness fuzzer isolated from other workflows' reports/alerts.

Validation

  • CI Dockers Build (amd) and (arm) both pass — the image (JDK 25 + Maven + client-v2) builds for both architectures.
  • Local end-to-end smoke against clickhouse/clickhouse-server:head: server starts with the configs applied, the client-v2 driver connects, and the full 94-oracle run executes (~5k queries across 78 databases). This caught and fixed three invocation bugs (provider-arg ordering, stale oracle list, --random-session-settings/SEMR incompatibility).

Related: ClickHouse/sqlancer#4
Related: #105199

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Version info

  • Merged into: 26.7.1.312 (included in 26.7 and later)

…acles)

Bump the SQLancer provider to ClickHouse/sqlancer `main` after PR #4
(ClickHouse/sqlancer#4): the wrong-result oracle
suite with 31 oracles, a recursive type system, and the
`com.clickhouse:client-v2` (RowBinary) transport replacing `clickhouse-jdbc`.

Docker image (`ci/docker/sqlancer-test/Dockerfile`):
- Bump the cloned commit to `a62ea509ee53862b5dd37f452e8c2edce8038951`.
- The new `pom.xml` targets Java 25, which Ubuntu 22.04 `default-jdk`/`maven`
  cannot build, so install Temurin JDK 25 (Adoptium) and Maven 3.9.9, and add
  `-Djacoco.skip=true` to the build (jacoco 0.8.12 rejects Java 25 classfiles).

Job script (`ci/jobs/sqlancer_job.sh`):
- Apply the provider's server-side config overrides from
  `.claude/clickhouse-config/` (logger to `warning`, remove `system.trace_log`,
  TTL the system-log tables, pin `async_insert` off) by starting the server
  from a directory containing `config.d/`; the embedded default `config.xml`
  still merges `config.d/*.xml` relative to the server CWD.
- Replace the per-oracle loop with a single combined run of all 25 oracles
  bounded by one wall-clock timeout, matching the upstream
  `.claude/run-sqlancer.sh` reference, and enable `--random-session-settings`.
@clickhouse-gh

clickhouse-gh Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8b11e90]

Summary: ✅


AI Review

Summary

This PR re-enables SQLancer as a dedicated scheduled Praktika workflow, updates the clickhouse/sqlancer-test image to the new ClickHouse/sqlancer client-v2 provider, and rewires the job to run the curated oracle set against an arm_asan_ubsan ClickHouse artifact. I did not find any remaining review findings in the final state; the earlier bot threads are addressed by the successful temporary SQLancer (arm_asan_ubsan) validation run and by restoring the scheduled timeout default to 18000.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jun 26, 2026
fm4v added 7 commits June 27, 2026 00:44
The SQLancer job definition (`sqlancer_master_jobs`) has been orphaned since
PR #105199 ("Remove SQLancer from CI", 2026-05-18) deleted its references from
the `master` and `pull_request` workflows, so it ran nowhere.

Add a dedicated scheduled workflow `NightlySQLancer`, mirroring `NightlyJepsen`:
it builds the `amd_debug` binary (to provide `CH_AMD_DEBUG`) and runs the
SQLancer job nightly on `master`, with its own report and CIDB. This keeps the
specialized correctness fuzzer isolated from other workflows' reports/alerts,
matching how Jepsen, Keeper-faults, and VectorSearchStress are wired.
- The `clickhouse/sqlancer-test` image is built for both arm and amd
  (`platforms=arm_amd`), but `JAVA_HOME` was hardcoded to the amd64 Temurin
  path, which would break the arm64 image build (the path is `-arm64` there,
  and `mvn package` runs during the build). Symlink the arch-specific Temurin
  dir to a stable `/usr/lib/jvm/temurin-25-jdk` and point `JAVA_HOME` at it.
- Correct the config-override comment in the job script: the merged provider
  ships `system_logs_disabled.xml` (full `remove`, not a TTL) and
  `alter_mutation_sync.xml`. Verified empirically that with the binary's
  embedded config (`users_config` == `config.xml`), `<profiles>` overrides in
  `config.d/` reach the default profile (`async_insert=0`, `alter_sync=2`,
  `mutations_sync=2`), so all overrides belong in `config.d/` -- the packaged
  server's `users.d/` split would silently drop the mutation-sync settings.
…random settings

Validated end-to-end against `clickhouse/clickhouse-server:head` with the
rebuilt image; three issues that broke the run:

- `--random-session-settings` was placed before the `clickhouse` subcommand, but
  it is a provider option (same class as `--oracle`), so JCommander rejected it
  with `MissingCommandException`. It is also rejected together with the
  `SEMR`/`SEMRMulti` oracles (which toggle settings themselves). Drop it: those
  oracles already provide setting-differential coverage.
- The hardcoded oracle list was stale (e.g. `RowPolicy` was removed upstream and
  the curated set grew to 94). Derive it from the provider's own `ALL_ORACLES`
  (`run-sqlancer.sh`, the `--oracles all` set) so it stays in sync with whatever
  commit the image pins; fail closed if it cannot be parsed.

After the fixes the full curated run executes cleanly (driver connects, configs
apply, ~5k queries across the oracle fleet in a short smoke run).
`TextIndexDirectRead` asserts that a text-index `hasToken` lookup with
`use_skip_indexes` on matches a full scan, but it currently dominates the
all-oracle run with known index-vs-scan divergences across several tokenizers
(cf. ClickHouse#107186), which would keep the nightly job perpetually red on the
same finding. Filter it out of the derived oracle list (exact-element match, so
the sibling `TextIndex*` oracles are kept) until that divergence class is
resolved upstream.
Switch the SQLancer job (and its debug-build dependency) from amd to arm: the
job now requires `CH_ARM_DEBUG` and runs on `arm-medium`, and NightlySQLancer
builds `arm_debug` (on `arm-large`) to provide it. The server binary's
architecture must match the runner, so both the build and the run move to ARM
together. The `clickhouse/sqlancer-test` image is already multi-arch
(`platforms=arm_amd`) and its arm variant builds in CI, and the SQLancer driver
(Java) is architecture-independent.
- Increase the sqlancer run to 5h (`TIMEOUT=18000` in sqlancer_job.sh) and raise
  the job timeout to 5h30m to cover server start/teardown.
- Run every 3 days instead of nightly (`cron: 13 6 */3 * *`); a 5h run does not
  need to fire daily.
- Build and test against `arm_ubsan` instead of `arm_debug`: a long fuzzing run
  is a good place to surface undefined behaviour. The job now requires
  `CH_ARM_UBSAN` and NightlySQLancer builds `arm_ubsan` (on `arm-large`) to
  provide it.
ClickHouse ships a combined ASan+UBSan build (`arm_asan_ubsan` ->
`CH_ARM_ASAN_UBSAN`) -- the standard sanitizer build used by most test jobs --
and no standalone ASan build. Use it for the SQLancer run so the long fuzzing
session surfaces memory errors in addition to undefined behaviour. The job now
requires `CH_ARM_ASAN_UBSAN` and NightlySQLancer builds `arm_asan_ubsan` (on
`arm-large`) to provide it.
Comment thread ci/workflows/nightly_sqlancer.py Resolved
fm4v added 3 commits June 27, 2026 23:21
Praktika uploads every path in the job result's `files` array to S3 as a
downloadable artifact (`_ResultS3.upload_result_files_to_s3`), and the job
attaches `clickhouse-server.log`, its `.err`, and `sqlancer.out`. Over the 5h
run `sqlancer.out` grows to several hundred MB (it logs every executed
statement), so gzip files larger than 10 MB before listing them. Smaller logs
(e.g. the ASan/UBSan sanitizer report on stderr) are left as plain text so the
report renders them inline.
Validation only, reverted before merge. Wires the SQLancer job into the PR
workflow against the real CH_ARM_ASAN_UBSAN artifact inside the
clickhouse/sqlancer-test image (deep-copied so NightlySQLancer is untouched;
allow_failure so a finding does not block the PR), with the run shortened to
600s, to prove runtime deps, sanitizer behavior, artifact download, and the
embedded-config startup path on a real arm-medium runner -- which the scheduled
NightlySQLancer workflow cannot exercise pre-merge.

Also makes TIMEOUT overridable via SQLANCER_TIMEOUT_SECONDS (default kept here
at 600 for the validation; restored to 18000 on revert).
Comment thread ci/jobs/sqlancer_job.sh Resolved
The temporary wiring served its purpose: SQLancer (arm_asan_ubsan) ran green on
a real arm-medium runner against the real CH_ARM_ASAN_UBSAN artifact inside the
clickhouse/sqlancer-test image
(https://github.com/ClickHouse/ClickHouse/actions/runs/28323944565/job/83911038744)
-- server started under ASan+UBSan, the client-v2 driver connected and executed
~60k queries (97-98% successful) with no sanitizer abort or AssertionError, and
all three logs were uploaded as artifacts (the >10MB stderr compressed).

Remove the validation job from the PR workflow and restore TIMEOUT to 18000
(5h). The SQLANCER_TIMEOUT_SECONDS override is kept for shortened manual runs.
@alexey-milovidov alexey-milovidov self-assigned this Jun 30, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jun 30, 2026
Merged via the queue into master with commit ee2f568 Jun 30, 2026
169 checks passed
@alexey-milovidov
alexey-milovidov deleted the sqlancer-update-pr4-driver-oracles branch June 30, 2026 23:59
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 1, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…pr4-driver-oracles

Update SQLancer to ClickHouse/sqlancer PR #4 (client-v2 driver, 25 oracles)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants