mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 17:48:29 +08:00
fix: pass the ttl duration in the search request for ttl filter (#42122)
fix: pass the TTL duration in the search request for TTL filter issue:https://github.com/milvus-io/milvus/issues/41959 Signed-off-by: Xianhui.Lin <xianhui.lin@zilliz.com>
This commit is contained in:
parent
7243c1d0ce
commit
da30e1e4df
@ -224,33 +224,34 @@ func (sd *shardDelegator) GetPartitionStatsVersions(ctx context.Context) map[int
|
|||||||
func (sd *shardDelegator) shallowCopySearchRequest(req *internalpb.SearchRequest, targetID int64) *internalpb.SearchRequest {
|
func (sd *shardDelegator) shallowCopySearchRequest(req *internalpb.SearchRequest, targetID int64) *internalpb.SearchRequest {
|
||||||
// Create a new SearchRequest with the same fields
|
// Create a new SearchRequest with the same fields
|
||||||
nodeReq := &internalpb.SearchRequest{
|
nodeReq := &internalpb.SearchRequest{
|
||||||
Base: &commonpb.MsgBase{TargetID: targetID},
|
Base: &commonpb.MsgBase{TargetID: targetID},
|
||||||
ReqID: req.ReqID,
|
ReqID: req.ReqID,
|
||||||
DbID: req.DbID,
|
DbID: req.DbID,
|
||||||
CollectionID: req.CollectionID,
|
CollectionID: req.CollectionID,
|
||||||
PartitionIDs: req.PartitionIDs, // Shallow copy: Same underlying slice
|
PartitionIDs: req.PartitionIDs, // Shallow copy: Same underlying slice
|
||||||
Dsl: req.Dsl,
|
Dsl: req.Dsl,
|
||||||
PlaceholderGroup: req.PlaceholderGroup, // Shallow copy: Same underlying byte slice
|
PlaceholderGroup: req.PlaceholderGroup, // Shallow copy: Same underlying byte slice
|
||||||
DslType: req.DslType,
|
DslType: req.DslType,
|
||||||
SerializedExprPlan: req.SerializedExprPlan, // Shallow copy: Same underlying byte slice
|
SerializedExprPlan: req.SerializedExprPlan, // Shallow copy: Same underlying byte slice
|
||||||
OutputFieldsId: req.OutputFieldsId, // Shallow copy: Same underlying slice
|
OutputFieldsId: req.OutputFieldsId, // Shallow copy: Same underlying slice
|
||||||
MvccTimestamp: req.MvccTimestamp,
|
MvccTimestamp: req.MvccTimestamp,
|
||||||
GuaranteeTimestamp: req.GuaranteeTimestamp,
|
GuaranteeTimestamp: req.GuaranteeTimestamp,
|
||||||
TimeoutTimestamp: req.TimeoutTimestamp,
|
TimeoutTimestamp: req.TimeoutTimestamp,
|
||||||
Nq: req.Nq,
|
Nq: req.Nq,
|
||||||
Topk: req.Topk,
|
Topk: req.Topk,
|
||||||
MetricType: req.MetricType,
|
MetricType: req.MetricType,
|
||||||
IgnoreGrowing: req.IgnoreGrowing,
|
IgnoreGrowing: req.IgnoreGrowing,
|
||||||
Username: req.Username,
|
Username: req.Username,
|
||||||
SubReqs: req.SubReqs, // Shallow copy: Same underlying slice of pointers
|
SubReqs: req.SubReqs, // Shallow copy: Same underlying slice of pointers
|
||||||
IsAdvanced: req.IsAdvanced,
|
IsAdvanced: req.IsAdvanced,
|
||||||
Offset: req.Offset,
|
Offset: req.Offset,
|
||||||
ConsistencyLevel: req.ConsistencyLevel,
|
ConsistencyLevel: req.ConsistencyLevel,
|
||||||
GroupByFieldId: req.GroupByFieldId,
|
GroupByFieldId: req.GroupByFieldId,
|
||||||
GroupSize: req.GroupSize,
|
GroupSize: req.GroupSize,
|
||||||
FieldId: req.FieldId,
|
FieldId: req.FieldId,
|
||||||
IsTopkReduce: req.IsTopkReduce,
|
IsTopkReduce: req.IsTopkReduce,
|
||||||
IsRecallEvaluation: req.IsRecallEvaluation,
|
IsRecallEvaluation: req.IsRecallEvaluation,
|
||||||
|
CollectionTtlTimestamps: req.CollectionTtlTimestamps,
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodeReq
|
return nodeReq
|
||||||
@ -405,30 +406,31 @@ func (sd *shardDelegator) Search(ctx context.Context, req *querypb.SearchRequest
|
|||||||
futures := make([]*conc.Future[*internalpb.SearchResults], len(req.GetReq().GetSubReqs()))
|
futures := make([]*conc.Future[*internalpb.SearchResults], len(req.GetReq().GetSubReqs()))
|
||||||
for index, subReq := range req.GetReq().GetSubReqs() {
|
for index, subReq := range req.GetReq().GetSubReqs() {
|
||||||
newRequest := &internalpb.SearchRequest{
|
newRequest := &internalpb.SearchRequest{
|
||||||
Base: req.GetReq().GetBase(),
|
Base: req.GetReq().GetBase(),
|
||||||
ReqID: req.GetReq().GetReqID(),
|
ReqID: req.GetReq().GetReqID(),
|
||||||
DbID: req.GetReq().GetDbID(),
|
DbID: req.GetReq().GetDbID(),
|
||||||
CollectionID: req.GetReq().GetCollectionID(),
|
CollectionID: req.GetReq().GetCollectionID(),
|
||||||
PartitionIDs: subReq.GetPartitionIDs(),
|
PartitionIDs: subReq.GetPartitionIDs(),
|
||||||
Dsl: subReq.GetDsl(),
|
Dsl: subReq.GetDsl(),
|
||||||
PlaceholderGroup: subReq.GetPlaceholderGroup(),
|
PlaceholderGroup: subReq.GetPlaceholderGroup(),
|
||||||
DslType: subReq.GetDslType(),
|
DslType: subReq.GetDslType(),
|
||||||
SerializedExprPlan: subReq.GetSerializedExprPlan(),
|
SerializedExprPlan: subReq.GetSerializedExprPlan(),
|
||||||
OutputFieldsId: req.GetReq().GetOutputFieldsId(),
|
OutputFieldsId: req.GetReq().GetOutputFieldsId(),
|
||||||
MvccTimestamp: req.GetReq().GetMvccTimestamp(),
|
MvccTimestamp: req.GetReq().GetMvccTimestamp(),
|
||||||
GuaranteeTimestamp: req.GetReq().GetGuaranteeTimestamp(),
|
GuaranteeTimestamp: req.GetReq().GetGuaranteeTimestamp(),
|
||||||
TimeoutTimestamp: req.GetReq().GetTimeoutTimestamp(),
|
TimeoutTimestamp: req.GetReq().GetTimeoutTimestamp(),
|
||||||
Nq: subReq.GetNq(),
|
Nq: subReq.GetNq(),
|
||||||
Topk: subReq.GetTopk(),
|
Topk: subReq.GetTopk(),
|
||||||
MetricType: subReq.GetMetricType(),
|
MetricType: subReq.GetMetricType(),
|
||||||
IgnoreGrowing: subReq.GetIgnoreGrowing(),
|
IgnoreGrowing: subReq.GetIgnoreGrowing(),
|
||||||
Username: req.GetReq().GetUsername(),
|
Username: req.GetReq().GetUsername(),
|
||||||
IsAdvanced: false,
|
IsAdvanced: false,
|
||||||
GroupByFieldId: subReq.GetGroupByFieldId(),
|
GroupByFieldId: subReq.GetGroupByFieldId(),
|
||||||
GroupSize: subReq.GetGroupSize(),
|
GroupSize: subReq.GetGroupSize(),
|
||||||
FieldId: subReq.GetFieldId(),
|
FieldId: subReq.GetFieldId(),
|
||||||
IsTopkReduce: req.GetReq().GetIsTopkReduce(),
|
IsTopkReduce: req.GetReq().GetIsTopkReduce(),
|
||||||
IsIterator: req.GetReq().GetIsIterator(),
|
IsIterator: req.GetReq().GetIsIterator(),
|
||||||
|
CollectionTtlTimestamps: req.GetReq().GetCollectionTtlTimestamps(),
|
||||||
}
|
}
|
||||||
future := conc.Go(func() (*internalpb.SearchResults, error) {
|
future := conc.Go(func() (*internalpb.SearchResults, error) {
|
||||||
searchReq := &querypb.SearchRequest{
|
searchReq := &querypb.SearchRequest{
|
||||||
@ -441,7 +443,7 @@ func (sd *shardDelegator) Search(ctx context.Context, req *querypb.SearchRequest
|
|||||||
if searchReq.GetReq().GetMvccTimestamp() == 0 {
|
if searchReq.GetReq().GetMvccTimestamp() == 0 {
|
||||||
searchReq.GetReq().MvccTimestamp = tSafe
|
searchReq.GetReq().MvccTimestamp = tSafe
|
||||||
}
|
}
|
||||||
|
searchReq.Req.CollectionTtlTimestamps = req.GetReq().GetCollectionTtlTimestamps()
|
||||||
results, err := sd.search(ctx, searchReq, sealed, growing)
|
results, err := sd.search(ctx, searchReq, sealed, growing)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user