Skip to content

Commit 64ed235

Browse files
committed
Create new table for collector_config, configuration for the collectors
1 parent d3c010b commit 64ed235

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

database/schema.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ aid benchmark error
259259
1 syn-1.0.89 Failed to compile...
260260
```
261261

262-
263262
## New benchmarking design
264263
We are currently implementing a new design for dispatching benchmarks to collector(s) and storing
265264
them in the database. It will support new use-cases, like backfilling of new benchmarks into a parent
@@ -296,3 +295,15 @@ Columns:
296295
* `completed`: Completed request.
297296
* **backends** (`text NOT NULL`): Comma-separated list of codegen backends to benchmark. If empty, the default set of codegen backends will be benchmarked.
298297
* **profiles** (`text NOT NULL`): Comma-separated list of profiles to benchmark. If empty, the default set of profiles will be benchmarked.
298+
299+
### collector_config
300+
301+
Information about the collector; it's target architecture, when it was added, whether it is active and when it last had activity denoted by `last_heartbeat_at`.
302+
303+
```
304+
sqlite> SELECT * FROM collector_config;
305+
306+
id target date_added last_heartbeat_at benchmark_set is_active
307+
--------- ------------------------- ------------- ---------------- --------- -------
308+
ea1f4e... aarch64-unknown-linux-gnu 2025-06-11... 2025-06-12 17... cea1bc... 0
309+
```

database/src/pool/postgres.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,17 @@ static MIGRATIONS: &[&str] = &[
309309
// Prevent multiple try commits without a `sha` and the same `pr` number
310310
// being added to the table
311311
r#"CREATE UNIQUE INDEX benchmark_request_pr_commit_type_idx ON benchmark_request (pr, commit_type) WHERE status != 'completed';"#,
312+
r#"CREATE EXTENSION IF NOT EXISTS "uuid-ossp";"#,
313+
r#"
314+
CREATE TABLE IF NOT EXISTS collector_config (
315+
id UUID PRIMARY KEY,
316+
target TEXT NOT NULL,
317+
date_added TIMESTAMPTZ DEFAULT NOW() NOT NULL,
318+
last_heartbeat_at TIMESTAMPTZ,
319+
benchmark_set UUID NOT NULL,
320+
is_active BOOLEAN DEFAULT FALSE NOT NULL
321+
);
322+
"#,
312323
];
313324

314325
#[async_trait::async_trait]

database/src/pool/sqlite.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,18 @@ static MIGRATIONS: &[Migration] = &[
405405
alter table pstat_series_with_target rename to pstat_series;
406406
"#,
407407
),
408+
Migration::without_foreign_key_constraints(
409+
r#"
410+
CREATE TABLE IF NOT EXISTS collector_config (
411+
id TEXT PRIMARY KEY,
412+
target TEXT NOT NULL,
413+
date_added TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
414+
last_heartbeat_at TIMESTAMP,
415+
benchmark_set TEXT NOT NULL,
416+
is_active BOOLEAN DEFAULT FALSE NOT NULL
417+
);
418+
"#,
419+
),
408420
];
409421

410422
#[async_trait::async_trait]

0 commit comments

Comments
 (0)