1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2026-10-23 21:49:05 +03:00
Files
aleksei.bukhalov f7a86806ff feat(fuzz): add sql mutation fuzzer and shell runner
SQL fuzzer that extracts ~75k seeds from MTR .test files, applies
weighted random mutations (24 strategies), and runs queries against a
live Columnstore instance to detect crashes, hangs, and assertion errors.

Key design decisions:
- Persistent subprocess connection via `mariadb --force` with binary
  unbuffered I/O (bufsize=0) and background reader threads for
  timeout-safe reads.  Avoids Python TextIOWrapper buffering that
  makes select() miss already-buffered data.
- Marker-based query completion: each query is followed by
  SELECT <unique_marker> so the reader knows exactly when output ends.
- SET @@max_statement_time on session start to cancel ghost queries
  left in ExeMgr after client kill.
- Two-layer deduplication:
    exact hash  = normalised(error + SQL shape)  → skip identical
    coarse hash = issue_type + error_key          → cap disk artifacts
  per error pattern (--max-artifacts-per-pattern, default 5) to avoid
  flooding disk while still tracking all unique issues in memory.
  In-memory lists are bounded at max+1 per coarse pattern.
- Core dump collection restricted to known dirs + kernel.core_pattern
  instead of full-filesystem find.
- Protected table set with pre-compiled regex for O(1) destructive-DDL
  checks.
- Explicit USE fuzz_db after every reconnect / DB creation to keep
  persistent session in the correct schema.
- conn.close() in finally block for cleanup.

Shell launcher (run_sql_fuzzer.sh):
- English description of the full pipeline in the header.
- Preflight checks, password masking, usage examples.

Files: fuzz/sql_fuzzer.py, fuzz/run_sql_fuzzer.sh
2026-04-17 17:07:27 +04:00
..