Skip to content

Commit

Permalink
Merge pull request #15 from readysettech/issue-12
Browse files Browse the repository at this point in the history
Add digest to cache name
  • Loading branch information
altmannmarcelo authored Aug 14, 2024
2 parents 57ff6b0 + 64ec697 commit a952381
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ 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 +181,8 @@ 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 a952381

Please sign in to comment.