Useful queries and commands

中文版:manual-modifications_CN.md

Manual database operations for exceptional situations. These are safety valves — prefer the normal webhook/queue flow whenever possible.

Remove data for an artifact

When an artifact's results are bad (e.g. a transient failure during collection, or a benchmark that was later fixed), the cleanest remedy is to purge all data for that artifact from the DB and re-run it.

purge_artifact subcommand

The collector binary provides a first-class purge command (collector/src/bin/collector.rs:662):

# Remove all data for the artifact named <name> (default tag "default")
./target/release/collector purge_artifact <name> --db "postgres://user:pass@host/db"

# Purge an artifact benchmarked under a specific collector tag
./target/release/collector purge_artifact <name> --tag "Kunpeng 920B" --db "postgres://..."

# Use a local SQLite DB
./target/release/collector purge_artifact <name> --db results.db

purge_artifact removes the artifact's runtime_pstat rows (and associated collections) for the matching (name, tag) and the artifact row itself. Re-benchmark the artifact (locally via bench_runtime_local, or by re-queuing a try/master request) to repopulate it.

When to purge

  • A runtime benchmark errored partway through and left partial/missing data.
  • The artifact was benchmarked with the wrong build_cmd or extra_args.
  • You want to force a re-run but a previous completed request is blocking re-insertion (use /rust-bench try force=true from a comment first; purge only if direct DB access is needed).

Re-queue a completed request

A completed benchmark_request blocks re-insertion of a request with the same pr/commit_type/repo (the partial unique index benchmark_request_pr_commit_type_repo_idx only excludes completed rows). To re-run a completed try request without purging, use the bot command with force=true:

/rust-bench try force=true

This calls reset_benchmark_request_for_rerun(sha) before re-inserting (site/src/request_handlers/github.rs:657-676), allowing the request to be re-queued.

Deactivate a collector

If a collector is permanently offline and stalling the queue, mark it inactive in the DB (there is no CLI for this yet):

UPDATE collector_config SET is_active = false WHERE name = '<collector_tag>';

Active jobs owned by the collector will then no longer be expected, and (after their retry counter hits MAX_RETRIES) will be marked failure, unblocking the request. Reassign benchmarking capacity by adding/activating a replacement collector and listing its tag in [collectors].tags.