From 9b92b97fd77490da3ec3c28fb80c25b37de52cea Mon Sep 17 00:00:00 2001 From: GuokeCui Date: Wed, 11 May 2022 11:46:48 +0800 Subject: [PATCH] Fix race condition for `dynamicShardsPool`; --- raftstore/store_shards_pool.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/raftstore/store_shards_pool.go b/raftstore/store_shards_pool.go index 29cd55f5..3c142504 100644 --- a/raftstore/store_shards_pool.go +++ b/raftstore/store_shards_pool.go @@ -74,7 +74,7 @@ type dynamicShardsPool struct { } func newDynamicShardsPool(cfg *config.Config, logger *zap.Logger) *dynamicShardsPool { - p := &dynamicShardsPool{pdC: make(chan struct{}, 1), cfg: cfg, logger: log.Adjust(logger).Named("shard-pool")} + p := &dynamicShardsPool{pdC: make(chan struct{}), cfg: cfg, logger: log.Adjust(logger).Named("shard-pool")} p.factory = p.shardFactory p.stopper = stop.NewStopper("shards-pool", stop.WithLogger(p.logger)) if cfg.Customize.CustomShardPoolShardFactory != nil { @@ -91,9 +91,6 @@ func (dsp *dynamicShardsPool) setProphetClient(pd prophet.Client) { } func (dsp *dynamicShardsPool) waitProphetClientSetted() { - if dsp.pd != nil { - return - } <-dsp.pdC }