Skip to content

Commit c2fbb00

Browse files
committed
chore: sqlite v1 to v2 data migration
1 parent 710f2df commit c2fbb00

37 files changed

Lines changed: 6123 additions & 7721 deletions

File tree

Cargo.lock

Lines changed: 41 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ members = [
119119
rand = "0.8"
120120
regex = "1.4"
121121
rstest = "0.26.1"
122+
rusqlite = { version = "0.32.1", features = [ "bundled" ] }
122123
rustls-pemfile = "2.2.0"
123124
rustyline = "15.0.0"
124125
scc = "3.6.12"

engine/packages/pegboard-envoy/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ serde_bare.workspace = true
3232
serde_json.workspace = true
3333
serde.workspace = true
3434
sqlite-storage.workspace = true
35+
tempfile.workspace = true
3536
tokio-tungstenite.workspace = true
3637
tokio.workspace = true
3738
tracing.workspace = true
3839
universaldb.workspace = true
3940
universalpubsub.workspace = true
4041
url.workspace = true
4142
vbare.workspace = true
43+
rusqlite.workspace = true
4244

4345
pegboard.workspace = true
4446
namespace.workspace = true

engine/packages/pegboard-envoy/src/metrics.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,37 @@ lazy_static::lazy_static! {
5555
BUCKETS.to_vec(),
5656
*REGISTRY
5757
).unwrap();
58+
59+
pub static ref SQLITE_MIGRATION_ATTEMPTS_TOTAL: IntCounter = register_int_counter_with_registry!(
60+
"pegboard_envoy_sqlite_migration_attempts_total",
61+
"Total number of sqlite v1 to v2 migration attempts.",
62+
*REGISTRY
63+
).unwrap();
64+
65+
pub static ref SQLITE_MIGRATION_SUCCESSES_TOTAL: IntCounter = register_int_counter_with_registry!(
66+
"pegboard_envoy_sqlite_migration_successes_total",
67+
"Total number of sqlite v1 to v2 migrations that completed successfully.",
68+
*REGISTRY
69+
).unwrap();
70+
71+
pub static ref SQLITE_MIGRATION_FAILURES_TOTAL: IntCounterVec = register_int_counter_vec_with_registry!(
72+
"pegboard_envoy_sqlite_migration_failures_total",
73+
"Total number of sqlite v1 to v2 migration failures by phase.",
74+
&["phase"],
75+
*REGISTRY
76+
).unwrap();
77+
78+
pub static ref SQLITE_MIGRATION_DURATION: Histogram = register_histogram_with_registry!(
79+
"pegboard_envoy_sqlite_migration_duration_seconds",
80+
"Duration of sqlite v1 to v2 migrations.",
81+
BUCKETS.to_vec(),
82+
*REGISTRY
83+
).unwrap();
84+
85+
pub static ref SQLITE_MIGRATION_PAGES: Histogram = register_histogram_with_registry!(
86+
"pegboard_envoy_sqlite_migration_pages",
87+
"Number of pages imported during sqlite v1 to v2 migration.",
88+
BUCKETS.to_vec(),
89+
*REGISTRY
90+
).unwrap();
5891
}

0 commit comments

Comments
 (0)