-
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
: add context.Context
to more logic, general cleanup
#17903
base: main
Are you sure you want to change the base?
vtorc
: add context.Context
to more logic, general cleanup
#17903
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
|
ts = topo.Open() | ||
tmc = inst.InitializeTMC() | ||
// Clear existing cache and perform a new refresh. | ||
if _, err := db.ExecVTOrc("DELETE FROM vitess_tablet"); err != nil { | ||
if err := inst.DeleteAllTablets(); err != nil { |
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.
DELETE FROM
should be in inst
DAO code
) | ||
|
||
// ErrTabletAliasNil is a fixed error message. | ||
var ErrTabletAliasNil = errors.New("tablet alias is nil") | ||
var tmc tmclient.TabletManagerClient |
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.
TMClient stuff isn't really DAO code
@@ -711,38 +692,17 @@ func ReadInstancesWithErrantGTIds(keyspace string, shard string) ([]*Instance, e | |||
return readInstancesByCondition(condition, args, "") | |||
} | |||
|
|||
// GetKeyspaceShardName gets the keyspace shard name for the given instance key | |||
func GetKeyspaceShardName(tabletAlias string) (keyspace string, shard string, err error) { |
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.
inst.ReadTablet
(vs .GetKeyspaceShardName
) will get you keyspace
/shard
from the same table, so let's just use that 🤷
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
5c86191
to
750567b
Compare
@@ -36,7 +36,7 @@ const ( | |||
DiscoveryQueueCapacity = 100000 | |||
DiscoveryQueueMaxStatisticsSize = 120 | |||
DiscoveryCollectionRetentionSeconds = 120 | |||
UnseenInstanceForgetHours = 240 // Number of hours after which an unseen instance is forgotten | |||
UnseenInstanceForgetHours = 12 // Number of hours after which an unseen instance is forgotten |
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.
1/2 a day unseen feels like long enough
defer func() { | ||
if r := recover(); r != nil { | ||
err = logReadTopologyInstanceError(tabletAlias, "Unexpected, aborting", tb.Errorf("%+v", r)) | ||
} | ||
}() | ||
|
||
var waitGroup sync.WaitGroup |
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 waitGroup
is never used aside from a waitGroup.Wait()
call
There is never a waitGroup.Add(n)
or .Done()
🤷
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17903 +/- ##
==========================================
- Coverage 67.52% 67.51% -0.01%
==========================================
Files 1594 1596 +2
Lines 259564 259660 +96
==========================================
+ Hits 175266 175317 +51
- Misses 84298 84343 +45 ☔ View full report in Codecov by Sentry. |
Will 👀 into the |
Description
This PR:
context.Context
to morego/vt/vtorc/inst
andlogic
packages and passes a cancelable context fromcli.go
downUnseenInstanceForgetHours
from240
->12
- 12 hours is a long time to be unseeninst.GetKeyspaceShardName
withinst.ReadTablet
(deletes former)inst.ReadOutdatedInstanceKeys
->inst.ReadOutdatedInstances
and acceptfunc
vs return slice*_dao.go
-> new/existing filesRelated Issue(s)
#17330
Checklist
Deployment Notes