Skip to content

Commit 670e6ef

Browse files
Force cache creation to set default schema
Force connection to set the default schema before attempting to create a cache. We use one single connection per host. During cache creation dry-run we enforce the default schema to be set, but During actual cache creation we do not. In case a client has more than one Readyset server, we will not execute the dry-run on the second server onwards. This will cause the cache creation to fail as the default schema is not set. This commit forces the default schema to be set before attempting to create a cache. Fixes: #31
1 parent c58e79e commit 670e6ef

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/queries.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,13 @@ impl QueryDiscovery {
195195
queries_added_or_change = true;
196196
if !proxysql.dry_run() {
197197
proxysql.get_online_hosts().iter_mut().for_each(|host| {
198-
host.cache_query(query).expect(
199-
format!(
198+
host.cache_query(query).unwrap_or_else(|_| {
199+
panic!(
200200
"Failed to create readyset cache on host {}:{}",
201201
host.get_hostname(),
202202
host.get_port()
203203
)
204-
.as_str(),
205-
);
204+
});
206205
});
207206
proxysql
208207
.add_as_query_rule(query)

0 commit comments

Comments
 (0)