diff --git a/src/hosts.rs b/src/hosts.rs index 12ed77a..5874f5f 100644 --- a/src/hosts.rs +++ b/src/hosts.rs @@ -222,6 +222,7 @@ impl Host { ))) } Some(conn) => { + conn.query_drop(format!("USE {}", query.get_schema()))?; conn.query_drop(format!( "CREATE CACHE d_{} FROM {}", query.get_digest(), diff --git a/src/queries.rs b/src/queries.rs index 359f565..d7c3312 100644 --- a/src/queries.rs +++ b/src/queries.rs @@ -195,8 +195,13 @@ impl QueryDiscovery { queries_added_or_change = true; if !proxysql.dry_run() { proxysql.get_online_hosts().iter_mut().for_each(|host| { - host.cache_query(query) - .expect("Failed to create readyset cache"); + host.cache_query(query).unwrap_or_else(|_| { + panic!( + "Failed to create readyset cache on host {}:{}", + host.get_hostname(), + host.get_port() + ) + }); }); proxysql .add_as_query_rule(query)