-
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
vtexplain: Ensure memory topo is set up for throttler #15279
vtexplain: Ensure memory topo is set up for throttler #15279
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
|
_, err = conn.Update(ctx, srvPath, data, nil) | ||
if err != nil { | ||
return err | ||
} |
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.
@shlomi-noach In order to not have the throttler log errors inside vtexplain
, I had to set up the above minimum stuff in the memory topo for SrvKeyspace
.
I wonder if there's a better way for this and if this could be refactored in a better way? Should we have some option to disable more parts of the throttler when we're inside vtexplain
?
I guess alternatively, we could make the throttler a parameter in NewTabletServer
instead to inject it (which is called inside vtexplain
), so we could inject a no-op throttler? Any other ideas?
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.
@dbussink could you please clarify what errors did the throttler log inside vtexplain
?
047c167
to
e35d1a7
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #15279 +/- ##
==========================================
+ Coverage 67.41% 67.48% +0.06%
==========================================
Files 1560 1561 +1
Lines 192752 193330 +578
==========================================
+ Hits 129952 130469 +517
- Misses 62800 62861 +61 ☔ View full report in Codecov by Sentry. |
e35d1a7
to
116a27e
Compare
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.
Other than the obvious change in throttler.go
where we do not log interrupted/cancelled errors, I'm not sure I follow the intent of this PR and what issues are there with the throttler
using memorytopo
.
@@ -358,7 +358,9 @@ func (throttler *Throttler) normalizeThrottlerConfig(throttlerConfig *topodatapb | |||
|
|||
func (throttler *Throttler) WatchSrvKeyspaceCallback(srvks *topodatapb.SrvKeyspace, err error) bool { | |||
if err != nil { | |||
log.Errorf("WatchSrvKeyspaceCallback error: %v", err) | |||
if !topo.IsErrType(err, topo.Interrupted) && !errors.Is(err, context.Canceled) { |
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.
👍
_, err = conn.Update(ctx, srvPath, data, nil) | ||
if err != nil { | ||
return err | ||
} |
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.
@dbussink could you please clarify what errors did the throttler log inside vtexplain
?
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.
For now, this is a good workaround. We need to review how we run tabletserver
within the context of vtexplain
. We are not interested in the throttler at all running in such context, and possibly other components (heartbeat writer, etc.). We'll take that into a separate discussion/change.
To be backported to all supported versions as the throttler will produce the same kind of logging on all versions since |
116a27e
to
bd20ce3
Compare
@@ -40,7 +40,7 @@ func (k *srvKeyspaceKey) String() string { | |||
func NewSrvKeyspaceWatcher(ctx context.Context, topoServer *topo.Server, counts *stats.CountersWithSingleLabel, cacheRefresh, cacheTTL time.Duration) *SrvKeyspaceWatcher { | |||
watch := func(entry *watchEntry) { | |||
key := entry.key.(*srvKeyspaceKey) | |||
requestCtx, requestCancel := context.WithCancel(context.Background()) | |||
requestCtx, requestCancel := context.WithCancel(ctx) |
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 was incorrectly using context.Background()
. I also audited the paths into this function and from things like the CLI invocation, we do pass in the background context correctly.
See also watch_srvvschema
where we do have the logic correct.
No more stray logging after this change (together with #15275). Before
After
No more noise and also a lot faster test runtime. |
This logic ensures the memorytopo is set up for the throttler logic so that it doesn't log any errors. Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
bd20ce3
to
42e2746
Compare
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
…itessio#15279) (vitessio#15284) (vitessio#4466) Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
…itessio#15279) (vitessio#15284) (vitessio#4467) Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
This logic ensures the memorytopo is set up for the throttler logic so that it doesn't log any errors.
Needs to be backported to all supported versions, since the throttler is part of all of those.
Related Issue(s)
Part of #15242
Checklist