Fix `sessions` concurrency problem (#20140)

Signed-off-by: SimFG <bang.fu@zilliz.com>

Signed-off-by: SimFG <bang.fu@zilliz.com>
pull/20142/head
SimFG 2022-10-27 19:39:31 +08:00 committed by GitHub
parent d00028edba
commit a90e28cf45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -237,13 +237,11 @@ func (c *SessionManager) execReCollectSegmentStats(ctx context.Context, nodeID i
func (c *SessionManager) GetCompactionState() map[int64]*datapb.CompactionStateResult {
wg := sync.WaitGroup{}
ctx := context.Background()
c.sessions.RLock()
wg.Add(len(c.sessions.data))
c.sessions.RUnlock()
plans := sync.Map{}
c.sessions.RLock()
for nodeID, s := range c.sessions.data {
wg.Add(1)
go func(nodeID int64, s *Session) {
defer wg.Done()
cli, err := s.GetOrCreateClient(ctx)