Skip to content

Commit bf84e5a

Browse files
Warn users if they attempt to use rustc-timing as a database
1 parent 1545886 commit bf84e5a

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

site/src/bin/ingest.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ fn deserialize_path(path: &Path) -> Res {
4343
}
4444

4545
fn main() -> Result<(), Box<dyn std::error::Error>> {
46-
let db = site::db::open("data", true);
46+
let dir = std::env::args().nth(1).expect("database as first arg");
47+
let db = site::db::open(&dir, true);
4748
let mut index = site::db::Index::load(&db);
4849

49-
let paths = std::env::args().skip(1).collect::<Vec<_>>();
50+
let paths = std::env::args().skip(2).collect::<Vec<_>>();
5051
let paths_count = paths.len();
5152
let mut last = std::time::Instant::now();
5253
for (idx, path) in paths.into_iter().enumerate() {

site/src/load.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,26 @@ impl InputData {
151151

152152
/// Initialize `InputData from the file system.
153153
pub fn from_fs(db: &str) -> anyhow::Result<InputData> {
154+
if std::path::Path::new(db).join("times").exists() {
155+
eprintln!("It looks like you're running the site off of the old data format");
156+
eprintln!(
157+
"Please run the ingestion script pointing at a different directory, like so:"
158+
);
159+
eprintln!(
160+
" find rustc-timing/times/ -type f | xargs ./target/release/ingest database"
161+
);
162+
eprintln!();
163+
eprintln!("And optionally follow up by shrinking the database:");
164+
eprintln!(" ./target/release/compact database");
165+
eprintln!("");
166+
eprintln!("You can run the ingestion script repeatedly over all the files,");
167+
eprintln!("or you can run it on just some newly collected data.");
168+
eprintln!(
169+
"The ingestion script must not be run in parallel with the site (it should error)."
170+
);
171+
std::process::exit(1);
172+
}
173+
154174
let config = if let Ok(s) = fs::read_to_string("site-config.toml") {
155175
toml::from_str(&s)?
156176
} else {

0 commit comments

Comments
 (0)