Skip to content

Commit

Permalink
enhance: [2.4] Remove levelZeroMut totally (#38473) (#38495)
Browse files Browse the repository at this point in the history
Cherry pick from master
pr: #38473
The level zero mutex could be remove since all operations are guarded by
segment manager mutex

---------

Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia authored Dec 17, 2024
1 parent e03d3d5 commit 6f573f6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 9 deletions.
1 change: 0 additions & 1 deletion internal/querynodev2/delegator/delegator.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ type shardDelegator struct {
segmentManager segments.SegmentManager
tsafeManager tsafe.Manager
pkOracle pkoracle.PkOracle
level0Mut sync.RWMutex
// stream delete buffer
deleteMut sync.RWMutex
deleteBuffer deletebuffer.DeleteBuffer[*deletebuffer.Item]
Expand Down
5 changes: 0 additions & 5 deletions internal/querynodev2/delegator/delegator_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,6 @@ func (sd *shardDelegator) LoadSegments(ctx context.Context, req *querypb.LoadSeg
}

func (sd *shardDelegator) GetLevel0Deletions(partitionID int64, candidate pkoracle.Candidate) ([]storage.PrimaryKey, []storage.Timestamp) {
sd.level0Mut.Lock()
defer sd.level0Mut.Unlock()

// TODO: this could be large, host all L0 delete on delegator might be a dangerous, consider mmap it on local segment and stream processing it
level0Segments := sd.segmentManager.GetBy(segments.WithLevel(datapb.SegmentLevel_L0), segments.WithChannel(sd.vchannelName))
pks := make([]storage.PrimaryKey, 0)
Expand Down Expand Up @@ -529,8 +526,6 @@ func (sd *shardDelegator) GetLevel0Deletions(partitionID int64, candidate pkorac
}

func (sd *shardDelegator) RefreshLevel0DeletionStats() {
sd.level0Mut.Lock()
defer sd.level0Mut.Unlock()
level0Segments := sd.segmentManager.GetBy(segments.WithLevel(datapb.SegmentLevel_L0), segments.WithChannel(sd.vchannelName))
totalSize := int64(0)
for _, segment := range level0Segments {
Expand Down
3 changes: 0 additions & 3 deletions internal/querynodev2/delegator/delta_forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,6 @@ func (sd *shardDelegator) forwardL0RemoteLoad(ctx context.Context,
}

func (sd *shardDelegator) getLevel0Deltalogs(partitionID int64) []*datapb.FieldBinlog {
sd.level0Mut.Lock()
defer sd.level0Mut.Unlock()

level0Segments := sd.segmentManager.GetBy(
segments.WithLevel(datapb.SegmentLevel_L0),
segments.WithChannel(sd.vchannelName))
Expand Down

0 comments on commit 6f573f6

Please sign in to comment.