Skip to content

Commit

Permalink
Release lock when return function
Browse files Browse the repository at this point in the history
Signed-off-by: Cai Zhang <[email protected]>
  • Loading branch information
xiaocai2333 committed Dec 30, 2024
1 parent 015e50e commit 303b590
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions internal/datacoord/compaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,18 @@ 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]()
mixLabelExcludes := typeutil.NewSet[string]()
clusterLabelExcludes := typeutil.NewSet[string]()

c.executingGuard.RLock()
if len(c.executingTasks) >= parallelism {
c.executingGuard.RUnlock()
return selected
}

Check warning on line 225 in internal/datacoord/compaction.go

View check run for this annotation

Codecov / codecov/patch

internal/datacoord/compaction.go#L223-L225

Added lines #L223 - L225 were not covered by tests

for _, t := range c.executingTasks {
switch t.GetTaskProto().GetType() {
case datapb.CompactionType_Level0DeleteCompaction:
Expand Down

0 comments on commit 303b590

Please sign in to comment.