Skip to content

Commit

Permalink
enhance: Use partitionID when delete by partitionKey (#38232)
Browse files Browse the repository at this point in the history
When delete by partition_key, Milvus will generates L0 segments
globally. During L0 Compaction, those L0 segments will touch all
partitions collection wise. Due to the false-positive rate of segment
bloomfilters, L0 compactions will append false deltalogs to completed
irrelevant partitions, which causes *partition deletion amplification.

This PR uses partition_key to set targeted partitionID when producing
deleteMsgs into MsgStreams. This'll narrow down L0 segments scope to
partition level, and remove the false-positive influence
collection-wise.

However, due to DeleteMsg structure, we can only label one partition to
one deleteMsg, so this enhancement fails if user wants to delete over 2
partition_keys in one deletion.

pr: #38231 
See also: #34665

Signed-off-by: yangxuan <[email protected]>
  • Loading branch information
XuanYang-cn authored Dec 23, 2024
1 parent 592f34c commit 21d76ad
Show file tree
Hide file tree
Showing 9 changed files with 764 additions and 577 deletions.
1 change: 0 additions & 1 deletion internal/datacoord/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ func (s *Server) AssignSegmentID(ctx context.Context, req *datapb.AssignSegmentI
zap.Int64("partitionID", r.GetPartitionID()),
zap.String("channelName", r.GetChannelName()),
zap.Uint32("count", r.GetCount()),
zap.String("segment level", r.GetLevel().String()),
)

// Load the collection info from Root Coordinator, if it is not found in server meta.
Expand Down
2 changes: 1 addition & 1 deletion internal/proto/data_coord.proto
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ message SegmentIDRequest {
int64 partitionID = 4;
bool isImport = 5; // deprecated
int64 importTaskID = 6; // deprecated
SegmentLevel level = 7;
SegmentLevel level = 7; // deprecated
}

message AssignSegmentIDRequest {
Expand Down
6 changes: 2 additions & 4 deletions internal/proxy/search_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func getPartitionIDs(ctx context.Context, dbName string, collectionName string,

useRegexp := Params.ProxyCfg.PartitionNameRegexp.GetAsBool()

partitionsSet := typeutil.NewSet[int64]()
partitionsSet := typeutil.NewUniqueSet()
for _, partitionName := range partitionNames {
if useRegexp {
// Legacy feature, use partition name as regexp
Expand All @@ -259,9 +259,7 @@ func getPartitionIDs(ctx context.Context, dbName string, collectionName string,
// TODO change after testcase updated: return nil, merr.WrapErrPartitionNotFound(partitionName)
return nil, fmt.Errorf("partition name %s not found", partitionName)
}
if !partitionsSet.Contain(partitionID) {
partitionsSet.Insert(partitionID)
}
partitionsSet.Insert(partitionID)
}
}
return partitionsSet.Collect(), nil
Expand Down
Loading

0 comments on commit 21d76ad

Please sign in to comment.