Skip to content

Commit

Permalink
Add digest to cache name
Browse files Browse the repository at this point in the history
This commit adds the original digest to the cache name. This will
allow the cache to be identified between ProxySQL and Readyset.

Fixes #12
  • Loading branch information
altmannmarcelo committed Aug 13, 2024
1 parent c7e0c44 commit 635d689
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ pub fn check_readyset_query_support(
}
}

pub fn cache_query(conn: &mut PooledConn, digest_text: &String) -> Result<bool, mysql::Error> {
conn.query_drop(format!("CREATE CACHE FROM {}", digest_text))
pub fn cache_query(conn: &mut PooledConn, digest_text: &String, digest: &String) -> Result<bool, mysql::Error> {
conn.query_drop(format!("CREATE CACHE d_{} FROM {}", digest, digest_text))
.expect("Failed to create readyset cache");
Ok(true)
}
Expand Down Expand Up @@ -177,7 +177,7 @@ pub fn query_discovery(
.as_str(),
);
queries_added_or_change = true;
cache_query(readyset_conn, &digest_text).expect("Failed to create readyset cache");
cache_query(readyset_conn, &digest_text, &digest).expect("Failed to create readyset cache");
add_query_rule(proxysql_conn, &digest, config).expect("Failed to add query rule");
current_queries_digest.push(digest);
}
Expand Down

0 comments on commit 635d689

Please sign in to comment.