fix: index attr caches wrong result variable (#30960)

See also #30757 #30756

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/30777/head
congqixia 2024-03-01 13:17:00 +08:00 committed by GitHub
parent 2180e2cfae
commit 385dec3b69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -59,7 +59,7 @@ func (c *IndexAttrCache) GetIndexResourceUsage(indexInfo *querypb.FieldIndexInfo
} }
engineVersion := indexInfo.GetCurrentIndexVersion() engineVersion := indexInfo.GetCurrentIndexVersion()
isLoadWithDisk, has := c.loadWithDisk.Get(typeutil.NewPair[string, int32](indexType, engineVersion)) isLoadWithDisk, has := c.loadWithDisk.Get(typeutil.NewPair(indexType, engineVersion))
if !has { if !has {
isLoadWithDisk, _, _ = c.sf.Do(fmt.Sprintf("%s_%d", indexType, engineVersion), func() (bool, error) { isLoadWithDisk, _, _ = c.sf.Do(fmt.Sprintf("%s_%d", indexType, engineVersion), func() (bool, error) {
var result bool var result bool
@ -67,10 +67,10 @@ func (c *IndexAttrCache) GetIndexResourceUsage(indexInfo *querypb.FieldIndexInfo
cIndexType := C.CString(indexType) cIndexType := C.CString(indexType)
defer C.free(unsafe.Pointer(cIndexType)) defer C.free(unsafe.Pointer(cIndexType))
cEngineVersion := C.int32_t(indexInfo.GetCurrentIndexVersion()) cEngineVersion := C.int32_t(indexInfo.GetCurrentIndexVersion())
isLoadWithDisk = bool(C.IsLoadWithDisk(cIndexType, cEngineVersion)) result = bool(C.IsLoadWithDisk(cIndexType, cEngineVersion))
return nil, nil return nil, nil
}).Await() }).Await()
c.loadWithDisk.Insert(typeutil.NewPair[string, int32](indexType, engineVersion), result) c.loadWithDisk.Insert(typeutil.NewPair(indexType, engineVersion), result)
return result, nil return result, nil
}) })
} }