Skip to content

Commit

Permalink
enhance: Remove levelZeroMut totally (#38473)
Browse files Browse the repository at this point in the history
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 16, 2024
1 parent 40f9db4 commit 9c8c1b3
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 @@ -121,7 +121,6 @@ type shardDelegator struct {

segmentManager segments.SegmentManager
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 @@ -523,9 +523,6 @@ func (sd *shardDelegator) LoadSegments(ctx context.Context, req *querypb.LoadSeg
}

func (sd *shardDelegator) GetLevel0Deletions(partitionID int64, candidate pkoracle.Candidate) (storage.PrimaryKeys, []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))
deltaData := storage.NewDeltaData(0)
Expand Down Expand Up @@ -556,8 +553,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 @@ -183,9 +183,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 9c8c1b3

Please sign in to comment.