Skip to content

Commit

Permalink
ttl: fix data race in TTL manager and test (pingcap#40976)
Browse files Browse the repository at this point in the history
  • Loading branch information
YangKeao authored and ghazalfamilyusa committed Feb 6, 2023
1 parent 403d277 commit 18706f6
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 18706f6

Please sign in to comment.