Skip to content

Commit 827ec67

Browse files
committed
Add a purge_artifact command to manually remove all data of an artifact
1 parent 9890827 commit 827ec67

File tree

3 files changed

+40
-21
lines changed

3 files changed

+40
-21
lines changed

collector/src/bin/collector.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,15 @@ enum Commands {
571571

572572
/// Download a crate into collector/benchmarks.
573573
Download(DownloadCommand),
574+
575+
/// Removes all data associated with artifact(s) with the given name.
576+
PurgeArtifact {
577+
/// Name of the artifact.
578+
name: String,
579+
580+
#[command(flatten)]
581+
db: DbOption,
582+
},
574583
}
575584

576585
#[derive(Debug, clap::Parser)]
@@ -967,6 +976,14 @@ Make sure to modify `{dir}/perf-config.json` if the category/artifact don't matc
967976
);
968977
Ok(0)
969978
}
979+
Commands::PurgeArtifact { name, db } => {
980+
let pool = Pool::open(&db.db);
981+
let conn = rt.block_on(pool.connection());
982+
rt.block_on(conn.purge_artifact(&ArtifactId::Tag(name.clone())));
983+
984+
println!("Data of artifact {name} were removed");
985+
Ok(0)
986+
}
970987
}
971988
}
972989

database/manual-modifications.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Useful queries and commands
2+
This document contains useful queries and commands that should be performed manually in exceptional
3+
situations.
4+
5+
## Remove data for an artifact from the DB
6+
This is important for situations where there is some compilation error for a stable benchmark,
7+
with a stable release of the compiler. While this should be rare, it happens sometimes e.g. because
8+
of future incompatibility lints turning into errors.
9+
10+
First, the benchmark should be fixed, and then any data for (published) artifacts that were
11+
benchmarked with the broken benchmark should be removed.
12+
13+
All data associated with an artifact can be removed using the following command:
14+
```bash
15+
$ cargo run --bin collector purge_artifact <artifact-name>
16+
```
17+
18+
Here is an example to remove the data of the `1.70.0` stable release artifact:
19+
```bash
20+
$ cargo run --bin collector purge_artifact 1.70.0
21+
```
22+
23+
After executing this command, the server should automatically re-benchmark the affected artifacts again.

database/queries.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)