mz-run

Compile, run, format, and lint the Materialize codebase locally.

6.4k|512|Updated Feb 22, 2019
One-click install
npx skills add https://github.com/MaterializeInc/materialize --skill mz-run
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mz-run
Source: https://github.com/MaterializeInc/materialize/tree/main/.agents/skills/mz-run
Command: npx skills add https://github.com/MaterializeInc/materialize --skill mz-run

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers working on Materialize need to know the correct commands and pitfalls for compiling, running, formatting, and linting the codebase, including non-obvious issues like shared CockroachDB state and multi-crate constructor updates.

Core Features & Use Cases

  • Compilation checks: Use cargo check and bin/environmentd --build-only instead of cargo build or cargo run, and verify mz-sqllogictest compiles when changing mz_environmentd::Config.
  • Local execution: Start Materialize with bin/environmentd --optimized, connect via psql on ports 6875 or 6877, and safely handle --reset against the shared CockroachDB metadata backend.
  • Formatting and linting: Run bin/fmt, bin/lint, and cargo clippy --all-targets -- -D warnings to keep the tree clean.
  • Use Case: You added a field to mz_environmentd::Config and CI fails mysteriously. The skill explains that cargo check -p mz-environmentd misses the sqllogictest constructor, so you must run cargo check -p mz-sqllogictest --all-targets.

Quick Start

Ask the assistant to start Materialize locally and check that my changes compile across all affected crates.

Frequently Asked Questions about mz-run

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run Materialize locally for development?

Start Materialize with `bin/environmentd --optimized`, then connect using `psql -p 6875 -h localhost -U materialize` for regular access or port 6877 with user mz_system for system access. CockroachDB must be running first, typically via a Docker container.

How do I check that Materialize code compiles?

Use `cargo check` rather than `cargo build` or `cargo run`. To build without running, use `bin/environmentd --build-only`. When changing mz_environmentd::Config, also verify with `cargo check -p mz-sqllogictest --all-targets`.

Why does cargo check pass but CI fails on sqllogictest?

mz_environmentd::Config is constructed in three places, including the separate mz-sqllogictest crate. `cargo check -p mz-environmentd` does not cover the sqllogictest constructor, so a missing field breaks mz-sqllogictest and cascades into clippy, doc-tests, and mzcompose jobs.

Is it safe to use --reset when starting environmentd?

Not always. `--reset` drops schemas in the shared CockroachDB at localhost:26257, which is global across all worktrees and wipes state for any other running instance. Check for other instances with `ss -ltnp | grep 6875` first, or use a different metadata backend via `--postgres`.

How do I format and lint the Materialize codebase?

Run `bin/fmt` to format Rust, Python, and Protobuf files across the whole tree, `bin/lint` for lint errors, and `cargo clippy --all-targets -- -D warnings` for Rust-specific warnings.

How do I enable debug logging for a specific Materialize module?

Set the MZ_LOG_FILTER environment variable to a tracing-compatible filter expression. For example, `mz_adapter::catalog::apply=trace,warn` enables trace logging for that module and warn level for everything else.