-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vtorc
: fetch shard names only every --topo-information-refresh-duration
#17319
base: main
Are you sure you want to change the base?
vtorc
: fetch shard names only every --topo-information-refresh-duration
#17319
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
defer keyspaceShardNamesMu.Unlock() | ||
return keyspaceShardNames[keyspaceName] | ||
} | ||
|
||
// RefreshAllKeyspacesAndShards reloads the keyspace and shard information for the keyspaces that vtorc is concerned with. | ||
func RefreshAllKeyspacesAndShards() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This func is called by a ticker-loop in vtorc.go
with a duration == to --topo-information-refresh-duration
It is also called before the ticker loop begins
You might want to create a blanket "vtorc performance improvements" issue so that you can link multiple PRs to that same issue. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17319 +/- ##
=======================================
Coverage 67.52% 67.53%
=======================================
Files 1581 1581
Lines 253948 253991 +43
=======================================
+ Hits 171480 171522 +42
- Misses 82468 82469 +1 ☔ View full report in Codecov by Sentry. |
…ation` Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
22482c3
to
d5456a2
Compare
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
I like the change, but I would implement it slightly differently. VTOrc maintains its state in a database, and this change feels like an anti-pattern. I would rather store this new information about shards to watch in a database table too. What do you think @timvaillancourt @deepthi? |
That's a good point. @timvaillancourt can you make that change? |
@GuptaManan100 / @deepthi i see your point, yes I can make this a query to a sqlite3 table 👍 |
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
return err | ||
} | ||
} | ||
lastAllKeyspaceShardsRefreshTime = time.Now() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated without mutex because this isn't called concurrently
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Description
This PR causes VTOrc to fetch+cache the list of shard names it is watching when
--clusters_to_watch
is defined, at an interval of--topo-information-refresh-duration
(default15s
). When--clusters_to_watch
is undef this change has no impact. The goal of this is to reduce calls to the topo and to respect the topo refresh duration flagThis was achieved by storing the shard names when they're already fetched at the desired interval by the existent
RefreshAllKeyspacesAndShards(...)
func, and allowing it to be read under lock. While I was there I added a gauge for the keyspace/shard combos watched by VTOrc, as previously discussed in#feat-vtorc
in the Vitess SlackToday a list of shard names is fetched for every "refresh" action in
go/vt/vtorc/logic/tablet_discovery.go
, which is potentially called concurrently and more frequently than the--topo-information-refresh-duration
Related Issue(s)
Tracking issue: #17330
Checklist
Deployment Notes