mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
fix: [hotfix]Use task timestamp to calculating ttl timestamp (#42925)
Cherry-pick from master pr: #42920 Related to #42918 Previously the `CollectionTtlTimestamp` could be overflowed when the guarantee_ts==1, which means using `Eventually` consistency level. This patch use task timestamp, allocated by scheduler, to generate ttl timestamp ignore the potential very small timestamp being used. Also add overflow check for ttl timestamp calculated. Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
a239e76355
commit
cfc8577f76
@ -482,9 +482,13 @@ func (t *queryTask) PreExecute(ctx context.Context) error {
|
||||
t.GuaranteeTimestamp = t.request.GetGuaranteeTimestamp()
|
||||
}
|
||||
if collectionInfo.collectionTTL != 0 {
|
||||
physicalTime, _ := tsoutil.ParseTS(guaranteeTs)
|
||||
physicalTime := tsoutil.PhysicalTime(t.GetBase().GetTimestamp())
|
||||
expireTime := physicalTime.Add(-time.Duration(collectionInfo.collectionTTL))
|
||||
t.CollectionTtlTimestamps = tsoutil.ComposeTSByTime(expireTime, 0)
|
||||
// preventing overflow, abort ttl timestamp
|
||||
if t.CollectionTtlTimestamps > t.GetBase().GetTimestamp() {
|
||||
t.CollectionTtlTimestamps = 0
|
||||
}
|
||||
}
|
||||
deadline, ok := t.TraceCtx().Deadline()
|
||||
if ok {
|
||||
|
||||
@ -265,9 +265,13 @@ func (t *searchTask) PreExecute(ctx context.Context) error {
|
||||
}
|
||||
|
||||
if collectionInfo.collectionTTL != 0 {
|
||||
physicalTime, _ := tsoutil.ParseTS(guaranteeTs)
|
||||
physicalTime := tsoutil.PhysicalTime(t.GetBase().GetTimestamp())
|
||||
expireTime := physicalTime.Add(-time.Duration(collectionInfo.collectionTTL))
|
||||
t.CollectionTtlTimestamps = tsoutil.ComposeTSByTime(expireTime, 0)
|
||||
// preventing overflow, abort ttl timestamp
|
||||
if t.CollectionTtlTimestamps > t.GetBase().GetTimestamp() {
|
||||
t.CollectionTtlTimestamps = 0
|
||||
}
|
||||
}
|
||||
|
||||
t.resultBuf = typeutil.NewConcurrentSet[*internalpb.SearchResults]()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user