Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 8 min read Case study mediumAdept

BuzzHouse: Bridging the database fuzzing gap for testing ClickHouse

BuzzHouse is a new ClickHouse fuzzer that generates complex but mostly semantically valid SQL backed by a tracked catalog of tables, filling a gap left by SQLsmith, SQLancer, the AST fuzzer and WINGFUZZ. It has found about 100 new issues. Correctness is checked by dumping and re-reading tables, comparing equivalent queries via SQLancer-style oracles, re-running queries under different settings, and comparing results against another relational database. The design tradeoffs covered include valid versus random identifiers, why coverage-guided fuzzing was skipped, and how statement probabilities (e.g. DROP frequency) shape what the fuzzer can reach.

Related posts

  • Fuzzing collaboration with WINGFUZZ - Part 1

    ClickHouse easyNovice

    WINGFUZZ, a DBMS fuzzing engine, found eight new bugs in ClickHouse, some introduced only four months earlier, using two techniques. Grammar-free mutation builds a metadata graph from built-in SQL tests, reshuffles statements, and fixes semantic errors by metadata-guided substitution (Griffin). Type-affinity sequence generation uses coverage feedback to learn which SQL statement-type pairs matter and builds new sequences around them. ClickHouse is now integrating WINGFUZZ into its daily testing.

  • Fuzzing ClickHouse

    ClickHouse mediumAdept

    ClickHouse's AST-based query fuzzer takes SQL queries from the regression test suite, parses them, and randomly mutates the AST. It swaps in bad numeric values such as NaN and integer limits, perturbs strings and arrays, and splices function arguments, expressions and tables from other test queries. The core is about 700 lines of C++ and has found more than 200 bugs, including segfaults and logic errors. Much of that comes from pairing it with assertions, a distinct LOGICAL_ERROR exception for internal bugs, and clang sanitizers. In CI it weights permutations toward new tests in pull requests and needs settings constraints, since it once disabled its own execution-time limit.

  • Decorating a Christmas Tree With the Help Of Flaky Tests

    ClickHouse mediumAdept

    ClickHouse treats flaky tests as bugs to investigate rather than noise to mute or retry, and deliberately makes tests flakier to surface hidden issues. Its practices include randomizing the environment on every run, running new tests 100 times before merge, using new tests as a fuzzing corpus, injecting random sleeps and core switches around mutex operations, and running in parallel on slow machines. Results of all test runs, nearly 1.8 billion records and 5–9 million runs per day, are stored in ClickHouse itself. A 561-day by 3772-test pass/fail pixel map of the stateless functional tests, rendered by JavaScript querying ClickHouse directly, forms a 'Christmas tree' where horizontal red lines mark flaky tests and vertical red lines mark days master was broken.

  • Fuzzer Blind Spots (Meet Jepsen!)

    TigerBeetle hardMaster

    Jepsen found a missing-results bug in TigerBeetle's query engine despite four fuzzers covering it, because the VOPR and LSM query fuzzer pre-registered disjoint queries whose matching objects were always consecutive in every secondary index, so zig-zag merge join probing was never exercised. The bug was in ScanTreeLevel: after a probe shrank the scan's key range, the key_exclusive_next check could misfire from the wrong end and mark the level finished, returning truncated results. Rewriting the fuzzer to generate random objects and random queries against a full model reproduced the bug trivially, and the fix splits the termination condition. The broader lesson is that biased fuzzer workloads can silently project away reachable states, so targeted fuzzers should be complemented with broader, less-structured sampling and precise output checking.

  • ClickHouse Newsletter November 2022: The purifying effects of obfuscation

    ClickHouse mediumAdept

    ClickHouse Cloud pricing now charges only for compute and storage, and ClickHouse 22.10 adds S3 backups (full and incremental), `SET setting = DEFAULT`, forced merging of old parts via `min_age_to_force_merge_seconds`, a relaxed too-many-parts check for large partitions, new random-distribution functions and a preview Kafka Connect sink with exactly-once semantics. The featured query shows how `clickhouse-obfuscator` turns a real dataset, demonstrated on 26.7M UK property sales in Parquet, into synthetic data that keeps row count, cardinality and value distributions close to the original. That matters for realistic GROUP BY memory and performance testing, but the output is neither encrypted nor hashed and is not automatically safe to share. Also covered: upcoming meetups and webinars, plus links to migration stories and tuning posts.

The quest for software engineering knowledge.

Look:
Layout: