Make query set guarantee ts based on default consistency level (#25578)

Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
This commit is contained in:
zhenshan.cao 2023-07-17 09:58:38 +08:00 committed by GitHub
parent a7023ab3cc
commit c4f009073c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -370,9 +370,30 @@ func (t *queryTask) PreExecute(ctx context.Context) error {
if err != nil {
return err
}
collectionInfo, err2 := globalMetaCache.GetCollectionInfo(ctx, t.request.GetDbName(), collectionName)
if err2 != nil {
log.Warn("Proxy::queryTask::PreExecute failed to GetCollectionInfo from cache",
zap.String("collectionName", collectionName), zap.Error(err2))
return err2
}
guaranteeTs := t.request.GetGuaranteeTimestamp()
t.GuaranteeTimestamp = parseGuaranteeTs(guaranteeTs, t.BeginTs())
var consistencyLevel commonpb.ConsistencyLevel
useDefaultConsistency := t.request.GetUseDefaultConsistency()
if useDefaultConsistency {
consistencyLevel = collectionInfo.consistencyLevel
guaranteeTs = parseGuaranteeTsFromConsistency(guaranteeTs, t.BeginTs(), consistencyLevel)
} else {
consistencyLevel = t.request.GetConsistencyLevel()
// Compatibility logic, parse guarantee timestamp
if consistencyLevel == 0 && guaranteeTs > 0 {
guaranteeTs = parseGuaranteeTs(guaranteeTs, t.BeginTs())
} else {
// parse from guarantee timestamp and user input consistency level
guaranteeTs = parseGuaranteeTsFromConsistency(guaranteeTs, t.BeginTs(), consistencyLevel)
}
}
t.GuaranteeTimestamp = guaranteeTs
deadline, ok := t.TraceCtx().Deadline()
if ok {