mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
fix: inconsistent meta view causes rate limit invalid (#35665)
issue: #35663 Signed-off-by: jaime <yun.zhang@zilliz.com>
This commit is contained in:
parent
b7ea1defd3
commit
d8aa01bc1a
@ -406,7 +406,7 @@ func (q *QuotaCenter) collectMetrics() error {
|
||||
collections.Range(func(collectionID int64) bool {
|
||||
coll, getErr := q.meta.GetCollectionByIDWithMaxTs(context.TODO(), collectionID)
|
||||
if getErr != nil {
|
||||
rangeErr = getErr
|
||||
// skip limit check if the collection meta has been removed from rootcoord meta
|
||||
return false
|
||||
}
|
||||
collIDToPartIDs, ok := q.readableCollections[coll.DBID]
|
||||
@ -458,11 +458,11 @@ func (q *QuotaCenter) collectMetrics() error {
|
||||
if cm != nil {
|
||||
collectionMetrics = cm.Collections
|
||||
}
|
||||
var rangeErr error
|
||||
|
||||
collections.Range(func(collectionID int64) bool {
|
||||
coll, getErr := q.meta.GetCollectionByIDWithMaxTs(context.TODO(), collectionID)
|
||||
if getErr != nil {
|
||||
rangeErr = getErr
|
||||
// skip limit check if the collection meta has been removed from rootcoord meta
|
||||
return false
|
||||
}
|
||||
|
||||
@ -494,9 +494,7 @@ func (q *QuotaCenter) collectMetrics() error {
|
||||
}
|
||||
return true
|
||||
})
|
||||
if rangeErr != nil {
|
||||
return rangeErr
|
||||
}
|
||||
|
||||
for _, collectionID := range datacoordQuotaCollections {
|
||||
_, ok := q.collectionIDToDBID.Get(collectionID)
|
||||
if ok {
|
||||
@ -504,7 +502,8 @@ func (q *QuotaCenter) collectMetrics() error {
|
||||
}
|
||||
coll, getErr := q.meta.GetCollectionByIDWithMaxTs(context.TODO(), collectionID)
|
||||
if getErr != nil {
|
||||
return getErr
|
||||
// skip limit check if the collection meta has been removed from rootcoord meta
|
||||
continue
|
||||
}
|
||||
q.collectionIDToDBID.Insert(collectionID, coll.DBID)
|
||||
q.collections.Insert(FormatCollectionKey(coll.DBID, coll.Name), collectionID)
|
||||
|
@ -245,7 +245,7 @@ func TestQuotaCenter(t *testing.T) {
|
||||
|
||||
quotaCenter := NewQuotaCenter(pcm2, qc, dc2, core.tsoAllocator, meta)
|
||||
err = quotaCenter.collectMetrics()
|
||||
assert.Error(t, err)
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("get collection by id fail, datanode", func(t *testing.T) {
|
||||
@ -289,7 +289,7 @@ func TestQuotaCenter(t *testing.T) {
|
||||
|
||||
quotaCenter := NewQuotaCenter(pcm2, qc, dc2, core.tsoAllocator, meta)
|
||||
err = quotaCenter.collectMetrics()
|
||||
assert.Error(t, err)
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("test force deny reading collection", func(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user