Skip to content

Commit

Permalink
remove debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
eaypek-tfh committed Sep 28, 2024
1 parent 3af87fb commit 6343b0f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 42 deletions.
27 changes: 12 additions & 15 deletions iris-mpc-gpu/src/server/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,22 +821,19 @@ impl ServerActor {
}
);

tracing::info!("Merged results: {:?}", merged_results);
tracing::info!("Matches: {:?}", matches);
let res = ServerJobResult {
merged_results,
request_ids: batch.request_ids,
metadata: batch.metadata,
matches,
match_ids,
store_left: query_store_left,
store_right: query_store_right,
deleted_ids: batch.deletion_requests_indices,
};
tracing::info!("Res: {:?}", res);

// Pass to internal sender thread
return_channel.send(res).unwrap();
return_channel
.send(ServerJobResult {
merged_results,
request_ids: batch.request_ids,
metadata: batch.metadata,
matches,
match_ids,
store_left: query_store_left,
store_right: query_store_right,
deleted_ids: batch.deletion_requests_indices,
})
.unwrap();

// Wait for all streams before get timings
self.device_manager.await_streams(&self.streams[0]);
Expand Down
22 changes: 9 additions & 13 deletions iris-mpc-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ impl Store {
Ok(Store { pool })
}

pub async fn tx(&self, func_name: &str) -> Result<Transaction<'_, Postgres>> {
tracing::info!("Starting transaction for {}", func_name);
pub async fn tx(&self) -> Result<Transaction<'_, Postgres>> {
Ok(self.pool.begin().await?)
}

Expand Down Expand Up @@ -319,10 +318,7 @@ DO UPDATE SET right_code = EXCLUDED.right_code, right_mask = EXCLUDED.right_mask
query.push_bind(result);
});

tracing::info!("Before insert_results execution");
query.build().execute(tx.deref_mut()).await?;
tracing::info!("After insert_results execution");

Ok(())
}

Expand Down Expand Up @@ -384,7 +380,7 @@ DO UPDATE SET right_code = EXCLUDED.right_code, right_mask = EXCLUDED.right_mask
self.rollback(0).await?;
}

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

tracing::info!(
"DB size before initialization: {}",
Expand Down Expand Up @@ -424,7 +420,7 @@ DO UPDATE SET right_code = EXCLUDED.right_code, right_mask = EXCLUDED.right_mask

if (i % 1000) == 0 {
tx.commit().await?;
tx = self.tx("init_db_with_random_shares i % 1000").await?;
tx = self.tx().await?;
}
}
tracing::info!("Completed initialization of iris db, committing...");
Expand Down Expand Up @@ -497,7 +493,7 @@ mod tests {
right_mask: &[],
},
];
let mut tx = store.tx("test").await?;
let mut tx = store.tx().await?;
store.insert_irises(&mut tx, &codes_and_masks[0..2]).await?;
store.insert_irises(&mut tx, &codes_and_masks[2..3]).await?;
tx.commit().await?;
Expand Down Expand Up @@ -529,7 +525,7 @@ mod tests {
let schema_name = temporary_name();
let store = Store::new(&test_db_url()?, &schema_name).await?;

let mut tx = store.tx("test").await?;
let mut tx = store.tx().await?;
store.insert_results(&mut tx, &[]).await?;
store.insert_irises(&mut tx, &[]).await?;
tx.commit().await?;
Expand Down Expand Up @@ -563,7 +559,7 @@ mod tests {
))?;
let result_events = vec![result_event; count];

let mut tx = store.tx("test").await?;
let mut tx = store.tx().await?;
store.insert_results(&mut tx, &result_events).await?;
store.insert_irises(&mut tx, &codes_and_masks).await?;
tx.commit().await?;
Expand Down Expand Up @@ -618,7 +614,7 @@ mod tests {
right_mask: &[101_u16; 12800],
};

let mut tx = store.tx("test").await?;
let mut tx = store.tx().await?;
store.insert_irises(&mut tx, &vec![iris; 10]).await?;
tx.commit().await?;
store.rollback(5).await?;
Expand All @@ -637,7 +633,7 @@ mod tests {
let store = Store::new(&test_db_url()?, &schema_name).await?;

let result_events = vec!["event1".to_string(), "event2".to_string()];
let mut tx = store.tx("test").await?;
let mut tx = store.tx().await?;
store.insert_results(&mut tx, &result_events).await?;
store.insert_results(&mut tx, &result_events).await?;
tx.commit().await?;
Expand Down Expand Up @@ -755,7 +751,7 @@ mod tests {
right_code: &[789_u16; 12800],
right_mask: &[101_u16; 6400],
};
let mut tx = store.tx("test").await?;
let mut tx = store.tx().await?;
store.insert_irises(&mut tx, &vec![iris.clone(); 2]).await?;
tx.commit().await?;

Expand Down
15 changes: 1 addition & 14 deletions iris-mpc/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,15 +721,12 @@ async fn server_main(config: Config) -> eyre::Result<()> {

background_tasks.check_tasks();

tracing::info!("Start thread that will be responsible for communicating back the results");

// Start thread that will be responsible for communicating back the results
let (tx, mut rx) = mpsc::channel::<ServerJobResult>(32); // TODO: pick some buffer value
let sns_client_bg = sns_client.clone();
let config_bg = config.clone();
let store_bg = store.clone();
let _result_sender_abort = background_tasks.spawn(async move {
tracing::info!("In _result_sender_abort");
while let Some(ServerJobResult {
merged_results,
request_ids,
Expand All @@ -741,7 +738,6 @@ async fn server_main(config: Config) -> eyre::Result<()> {
deleted_ids,
}) = rx.recv().await
{
tracing::info!("Received results for {} queries", request_ids.len());
// returned serial_ids are 0 indexed, but we want them to be 1 indexed
let uniqueness_results = merged_results
.iter()
Expand All @@ -760,14 +756,10 @@ async fn server_main(config: Config) -> eyre::Result<()> {
false => None,
},
);
tracing::info!("result_event: {:?}", result_event);

serde_json::to_string(&result_event).wrap_err("failed to serialize result")
})
.collect::<eyre::Result<Vec<_>>>()?;

tracing::info!("uniqueness_results: {:?}", uniqueness_results);

// Insert non-matching queries into the persistent store.
let (memory_serial_ids, codes_and_masks): (Vec<u32>, Vec<StoredIrisRef>) = matches
.iter()
Expand All @@ -787,14 +779,11 @@ async fn server_main(config: Config) -> eyre::Result<()> {
})
.unzip();

tracing::info!("Start awaiting store_bg tx");
let mut tx = store_bg.tx("server.rs").await?;
tracing::info!("End awaiting store_bg tx");
let mut tx = store_bg.tx().await?;

store_bg
.insert_results(&mut tx, &uniqueness_results)
.await?;
tracing::info!("Inserted results");

if !codes_and_masks.is_empty() {
let db_serial_ids = store_bg
Expand All @@ -820,9 +809,7 @@ async fn server_main(config: Config) -> eyre::Result<()> {
}
}

tracing::info!("Before tx.commit().await");
tx.commit().await?;
tracing::info!("After tx.commit().await");

tracing::info!("Sending {} uniqueness results", uniqueness_results.len());
send_results_to_sns(
Expand Down

0 comments on commit 6343b0f

Please sign in to comment.