From 635d6892f4b4087f5b29e6bb2ac071161af79523 Mon Sep 17 00:00:00 2001 From: Marcelo Altmann Date: Tue, 13 Aug 2024 15:52:47 -0300 Subject: [PATCH] Add digest to cache name This commit adds the original digest to the cache name. This will allow the cache to be identified between ProxySQL and Readyset. Fixes #12 --- src/queries.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/queries.rs b/src/queries.rs index 9d23b48..5013d2d 100644 --- a/src/queries.rs +++ b/src/queries.rs @@ -82,8 +82,8 @@ pub fn check_readyset_query_support( } } -pub fn cache_query(conn: &mut PooledConn, digest_text: &String) -> Result { - conn.query_drop(format!("CREATE CACHE FROM {}", digest_text)) +pub fn cache_query(conn: &mut PooledConn, digest_text: &String, digest: &String) -> Result { + conn.query_drop(format!("CREATE CACHE d_{} FROM {}", digest, digest_text)) .expect("Failed to create readyset cache"); Ok(true) } @@ -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); }