Skip to content

Commit

Permalink
add sql_hash field to a few log entries
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegn committed Aug 30, 2024
1 parent 000a6da commit 78018b9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions crates/corro-types/src/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,9 @@ impl Matcher {
sql: &str,
) -> Result<(Matcher, MatcherHandle), MatcherError> {
let sub_path = Self::sub_path(subs_path.as_path(), id);
let sql_hash = hex::encode(seahash::hash(sql.as_bytes()).to_be_bytes());

info!("Initializing subscription at {sub_path}");
info!(%sql_hash, sub_id = %id, "Initializing subscription at {sub_path}");

std::fs::create_dir_all(&sub_path)?;

Expand Down Expand Up @@ -783,7 +784,7 @@ impl Matcher {
.join(","),
);

info!(sub_id = %id, "modified query for table '{tbl_name}': {new_query}");
info!(%sql_hash, sub_id = %id, "modified query for table '{tbl_name}': {new_query}");

statements.insert(
tbl_name.clone(),
Expand All @@ -803,10 +804,6 @@ impl Matcher {
// big channel to not miss anything
let (changes_tx, changes_rx) = mpsc::channel(20480);

let sql_hash = hex::encode(seahash::hash(sql.as_bytes()).to_be_bytes());

trace!("PARSED: {parsed:?}");

let handle = MatcherHandle {
inner: Arc::new(InnerMatcherHandle {
id,
Expand Down Expand Up @@ -1109,7 +1106,7 @@ impl Matcher {
tbl_name,
pks,
) {
info!(sub_id = %self.id, "query plan for table '{tbl_name}':\n{plan}");
info!(sub_id = %self.id, sql_hash = %self.hash, "query plan for table '{tbl_name}':\n{plan}");
}
}

Expand Down

0 comments on commit 78018b9

Please sign in to comment.