Skip to content

Commit

Permalink
chore: Be more verbose about init of db (#391)
Browse files Browse the repository at this point in the history
* chore: Provide more insight into the DB init

* bump version in stage
  • Loading branch information
wojciechsromek authored Sep 17, 2024
1 parent de6b4ab commit dc6a957
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion deploy/stage/common-values-iris-mpc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: "ghcr.io/worldcoin/iris-mpc:v0.6.5"
image: "ghcr.io/worldcoin/iris-mpc:v0.6.6"

environment: stage
replicaCount: 1
Expand Down
5 changes: 5 additions & 0 deletions iris-mpc-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,17 @@ DO UPDATE SET right_code = EXCLUDED.right_code, right_mask = EXCLUDED.right_mask
let mut rng = StdRng::seed_from_u64(rng_seed);

if clear_db_before_init {
tracing::info!("Cleaning up the db before initializing irises");
// Cleaning up the db before inserting newly generated irises
self.rollback(0).await?;
}

let mut tx = self.tx().await?;

tracing::info!(
"DB size before initialization: {}",
self.count_irises().await?
);
for i in 0..db_size {
if (i % 1000) == 0 {
tracing::info!("Initializing iris db: Generated {} entries", i);
Expand Down
11 changes: 10 additions & 1 deletion iris-mpc/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,19 @@ async fn server_main(config: Config) -> eyre::Result<()> {

let store_len = store.count_irises().await?;

tracing::info!(format!(

Check failure on line 543 in iris-mpc/src/bin/server.rs

View workflow job for this annotation

GitHub Actions / doc

format argument must be a string literal

Check failure on line 543 in iris-mpc/src/bin/server.rs

View workflow job for this annotation

GitHub Actions / doc

format argument must be a string literal
"Size of the database during startup: {}",
store_len
));

// Seed the persistent storage with random shares if configured and db is still
// empty.
if store_len == 0 && config.init_db_size > 0 {
tracing::info!("Initialize persistent iris db with randomly generated shares");
tracing::info!(format!(

Check failure on line 551 in iris-mpc/src/bin/server.rs

View workflow job for this annotation

GitHub Actions / doc

format argument must be a string literal

Check failure on line 551 in iris-mpc/src/bin/server.rs

View workflow job for this annotation

GitHub Actions / doc

format argument must be a string literal
"Initialize persistent iris DB with {} randomly generated shares",
config.init_db_size
));
tracing::info!(format!("Resetting the db: {}", config.clear_db_before_init));

Check failure on line 555 in iris-mpc/src/bin/server.rs

View workflow job for this annotation

GitHub Actions / doc

format argument must be a string literal

Check failure on line 555 in iris-mpc/src/bin/server.rs

View workflow job for this annotation

GitHub Actions / doc

format argument must be a string literal
store
.init_db_with_random_shares(
RNG_SEED_INIT_DB,
Expand Down

0 comments on commit dc6a957

Please sign in to comment.