Skip to content

Commit

Permalink
ttl: fix data race in TTL manager and test (#40976)
Browse files Browse the repository at this point in the history
close #40944
  • Loading branch information
YangKeao authored Feb 2, 2023
1 parent 72ee345 commit 3412b5d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ type Domain struct {
expiredTimeStamp4PC types.Time
logBackupAdvancer *daemon.OwnerDaemon
historicalStatsWorker *HistoricalStatsWorker
ttlJobManager *ttlworker.JobManager
ttlJobManager atomic.Pointer[ttlworker.JobManager]

serverID uint64
serverIDSession *concurrency.Session
Expand Down Expand Up @@ -2513,7 +2513,7 @@ func (do *Domain) StartTTLJobManager() {
}()

ttlJobManager := ttlworker.NewJobManager(do.ddl.GetID(), do.sysSessionPool, do.store, do.etcdClient)
do.ttlJobManager = ttlJobManager
do.ttlJobManager.Store(ttlJobManager)
ttlJobManager.Start()

<-do.exit
Expand All @@ -2528,7 +2528,7 @@ func (do *Domain) StartTTLJobManager() {

// TTLJobManager returns the ttl job manager on this domain
func (do *Domain) TTLJobManager() *ttlworker.JobManager {
return do.ttlJobManager
return do.ttlJobManager.Load()
}

func init() {
Expand Down

0 comments on commit 3412b5d

Please sign in to comment.