fix: [2.5] Release lock when return function (#38863)

issue: #38851 

master pr: #38856

Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
pull/38872/head
cai.zhang 2024-12-30 22:44:39 +08:00 committed by GitHub
parent 015e50e4de
commit 71dea30d44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 6 deletions

View File

@ -212,12 +212,6 @@ func (c *compactionPlanHandler) schedule() []CompactionTask {
slots map[int64]int64
)
c.executingGuard.Lock()
if len(c.executingTasks) >= parallelism {
return selected
}
c.executingGuard.Unlock()
l0ChannelExcludes := typeutil.NewSet[string]()
mixChannelExcludes := typeutil.NewSet[string]()
clusterChannelExcludes := typeutil.NewSet[string]()
@ -225,6 +219,11 @@ func (c *compactionPlanHandler) schedule() []CompactionTask {
clusterLabelExcludes := typeutil.NewSet[string]()
c.executingGuard.RLock()
if len(c.executingTasks) >= parallelism {
c.executingGuard.RUnlock()
return selected
}
for _, t := range c.executingTasks {
switch t.GetTaskProto().GetType() {
case datapb.CompactionType_Level0DeleteCompaction: