mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 01:58:34 +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 {
|
collections.Range(func(collectionID int64) bool {
|
||||||
coll, getErr := q.meta.GetCollectionByIDWithMaxTs(context.TODO(), collectionID)
|
coll, getErr := q.meta.GetCollectionByIDWithMaxTs(context.TODO(), collectionID)
|
||||||
if getErr != nil {
|
if getErr != nil {
|
||||||
rangeErr = getErr
|
// skip limit check if the collection meta has been removed from rootcoord meta
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
collIDToPartIDs, ok := q.readableCollections[coll.DBID]
|
collIDToPartIDs, ok := q.readableCollections[coll.DBID]
|
||||||
@ -458,11 +458,11 @@ func (q *QuotaCenter) collectMetrics() error {
|
|||||||
if cm != nil {
|
if cm != nil {
|
||||||
collectionMetrics = cm.Collections
|
collectionMetrics = cm.Collections
|
||||||
}
|
}
|
||||||
var rangeErr error
|
|
||||||
collections.Range(func(collectionID int64) bool {
|
collections.Range(func(collectionID int64) bool {
|
||||||
coll, getErr := q.meta.GetCollectionByIDWithMaxTs(context.TODO(), collectionID)
|
coll, getErr := q.meta.GetCollectionByIDWithMaxTs(context.TODO(), collectionID)
|
||||||
if getErr != nil {
|
if getErr != nil {
|
||||||
rangeErr = getErr
|
// skip limit check if the collection meta has been removed from rootcoord meta
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,9 +494,7 @@ func (q *QuotaCenter) collectMetrics() error {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
if rangeErr != nil {
|
|
||||||
return rangeErr
|
|
||||||
}
|
|
||||||
for _, collectionID := range datacoordQuotaCollections {
|
for _, collectionID := range datacoordQuotaCollections {
|
||||||
_, ok := q.collectionIDToDBID.Get(collectionID)
|
_, ok := q.collectionIDToDBID.Get(collectionID)
|
||||||
if ok {
|
if ok {
|
||||||
@ -504,7 +502,8 @@ func (q *QuotaCenter) collectMetrics() error {
|
|||||||
}
|
}
|
||||||
coll, getErr := q.meta.GetCollectionByIDWithMaxTs(context.TODO(), collectionID)
|
coll, getErr := q.meta.GetCollectionByIDWithMaxTs(context.TODO(), collectionID)
|
||||||
if getErr != nil {
|
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.collectionIDToDBID.Insert(collectionID, coll.DBID)
|
||||||
q.collections.Insert(FormatCollectionKey(coll.DBID, coll.Name), collectionID)
|
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)
|
quotaCenter := NewQuotaCenter(pcm2, qc, dc2, core.tsoAllocator, meta)
|
||||||
err = quotaCenter.collectMetrics()
|
err = quotaCenter.collectMetrics()
|
||||||
assert.Error(t, err)
|
assert.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("get collection by id fail, datanode", func(t *testing.T) {
|
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)
|
quotaCenter := NewQuotaCenter(pcm2, qc, dc2, core.tsoAllocator, meta)
|
||||||
err = quotaCenter.collectMetrics()
|
err = quotaCenter.collectMetrics()
|
||||||
assert.Error(t, err)
|
assert.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("test force deny reading collection", func(t *testing.T) {
|
t.Run("test force deny reading collection", func(t *testing.T) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user