Skip to content

Commit a519420

Browse files
more placeholder adjustments
Add more rules to replace_placeholders to remove "..." from digest coming from proxysql. Fixed warmup_time config in .cnf file.
1 parent c92a27a commit a519420

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ This scheduler executes the following steps:
99
2. If `mode=(All|HealthCheck)` - Query `mysql_servers` and check all servers that have `comment='Readyset` (case insensitive) and `hostgroup=readyset_hostgroup`. For each server it checks if it can connect to Readyset and validate if `Snapshot Status` is `Completed`. In case it cannot connect or Readyset is still performing snapshot it adjust the server status to `SHUNNED` in ProxySQL.
1010
3. If `mode=(All|QueryDiscovery)` Query the table `stats_mysql_query_digest` finding queries executed at `source_hostgroup` by `readyset_user` and validates if each query is supported by Readyset. The rules to order queries are configured by [Query Discovery](#query-discovery) configurations.
1111
3. If the query is supported it adds a cache in Readyset by executing `CREATE CACHE FROM __query__`.
12-
4. If `warmup_time` is NOT configure, a new query rule will be added redirecting this query to Readyset
13-
5. If `warmup_time` is configured, a new query rule will be added to mirror this query to Readyset. The query will still be redirected to the original hostgroup
14-
6. Once `warmup_time` seconds has elapsed since the query was mirrored, the query rule will be updated to redirect the query to Readyset instead of mirroring.
12+
4. If `warmup_time_s` is NOT configure, a new query rule will be added redirecting this query to Readyset
13+
5. If `warmup_time_s` is configured, a new query rule will be added to mirror this query to Readyset. The query will still be redirected to the original hostgroup
14+
6. Once `warmup_time_s` seconds has elapsed since the query was mirrored, the query rule will be updated to redirect the query to Readyset instead of mirroring.
1515

1616

1717

@@ -44,7 +44,7 @@ Configure `/etc/readyset_proxysql_scheduler.cnf` as follow:
4444
* `readyset_password` - (Required) - Readyset application password
4545
* `source_hostgroup` - (Required) - Hostgroup running your Read workload
4646
* `readyset_hostgroup` - (Required) - Hostgroup where Readyset is configure
47-
* `warmup_time` - (Optional) - Time in seconds to mirror a query supported before redirecting the query to Readyset (Default 0 - no mirror)
47+
* `warmup_time_s` - (Optional) - Time in seconds to mirror a query supported before redirecting the query to Readyset (Default 0 - no mirror)
4848
* `lock_file` - (Optional) - Lock file to prevent two instances of the scheduler to run at the same time (Default '/etc/readyset_scheduler.lock')
4949
* `operation_mode` - (Optional) - Operation mode to run the scheduler. The options are described in [Operation Mode](#operation-mode) (Default All).
5050
* `number_of_queries` - (Optional) - Number of queries to cache in Readyset (Default 10).

readyset_proxysql_scheduler.cnf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ readyset_user = 'root'
66
readyset_password = 'root'
77
source_hostgroup = 11
88
readyset_hostgroup = 99
9-
warmup_time = 60
9+
warmup_time_s = 60
1010
lock_file = '/tmp/readyset_scheduler.lock'
1111
operation_mode="All"
1212
number_of_queries=10

src/queries.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl QueryDiscovery {
244244
rows.iter()
245245
.map(|(digest_text, digest, schema)| {
246246
Query::new(
247-
digest_text.to_string(),
247+
self.replace_placeholders(digest_text),
248248
digest.to_string(),
249249
schema.to_string(),
250250
self.readyset_user.clone(),
@@ -257,6 +257,7 @@ impl QueryDiscovery {
257257

258258
fn replace_placeholders(&self, query: &str) -> String {
259259
// date placeholder
260-
query.replace("?-?-?", "?")
260+
// multiple placeholders
261+
query.replace("?,?,?,...", "?,?,?").replace("?-?-?", "?")
261262
}
262263
}

0 commit comments

Comments
 (0)