Skip to content

Commit

Permalink
sqlliveness: remove started field
Browse files Browse the repository at this point in the history
This field was used to protect against doubly-starting
sqlliveness.Instance, and against requesting a session before the
Instance was started. Neither of these are real risks. This patch
removes such protection and the field backing it.

Release note: None
  • Loading branch information
andreimatei committed Oct 31, 2022
1 parent f135bf0 commit e1d5835
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions pkg/sql/sqlliveness/slinstance/slinstance.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ type Instance struct {
testKnobs sqlliveness.TestingKnobs
mu struct {
syncutil.Mutex
started bool
startErr error
blockCh chan struct{}
s *session
Expand Down Expand Up @@ -334,10 +333,6 @@ func NewSQLInstance(
func (l *Instance) Start(ctx context.Context) {
l.mu.Lock()
defer l.mu.Unlock()
if l.mu.started {
return
}
l.mu.started = true
log.Infof(ctx, "starting SQL liveness instance")
// Detach from ctx's cancelation.
taskCtx := logtags.WithTags(context.Background(), logtags.FromContext(ctx))
Expand All @@ -353,12 +348,6 @@ func (l *Instance) Session(ctx context.Context) (sqlliveness.Session, error) {
return s, err
}
}
l.mu.Lock()
if !l.mu.started {
l.mu.Unlock()
return nil, sqlliveness.NotStartedError
}
l.mu.Unlock()

for {
s, ch := l.getSessionOrBlockCh()
Expand Down

0 comments on commit e1d5835

Please sign in to comment.