Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add schema for report upload counters (release/0.6 backport) #2553

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aggregator_core/src/datastore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ macro_rules! supported_schema_versions {
// version is seen, [`Datastore::new`] fails.
//
// Note that the latest supported version must be first in the list.
supported_schema_versions!(1);
supported_schema_versions!(2, 1);

/// Datastore represents a datastore for Janus, with support for transactional reads and writes.
/// In practice, Datastore instances are currently backed by a PostgreSQL database.
Expand Down
1 change: 1 addition & 0 deletions db/00000000000002_task_upload_counters.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE task_upload_counters;
19 changes: 19 additions & 0 deletions db/00000000000002_task_upload_counters.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- Per task report upload counters.
CREATE TABLE task_upload_counters(
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, -- artificial ID, internal-only
task_id BIGINT NOT NULL,

interval_collected BIGINT NOT NULL DEFAULT 0, -- Reports submitted for an interval that was already collected.
report_decode_failure BIGINT NOT NULL DEFAULT 0, -- Reports which failed to decode.
report_decrypt_failure BIGINT NOT NULL DEFAULT 0, -- Reports which failed to decrypt.
report_expired BIGINT NOT NULL DEFAULT 0, -- Reports that were older than the task's report_expiry_age.
report_outdated_key BIGINT NOT NULL DEFAULT 0, -- Reports that were encrypted with an unknown or outdated HPKE key.
report_success BIGINT NOT NULL DEFAULT 0, -- Reports that were successfully uploaded.
report_too_early BIGINT NOT NULL DEFAULT 0, -- Reports whose timestamp is too far in the future.
task_expired BIGINT NOT NULL DEFAULT 0, -- Reports sent to the task while it is expired.

ord BIGINT NOT NULL, -- Index of this task_upload_counters shard.

CONSTRAINT fk_task_id FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,
CONSTRAINT task_upload_counters_unique UNIQUE(task_id, ord)
);
Loading