Skip to content

Commit

Permalink
enhance: Ignore db not found error in quota center (#36821)
Browse files Browse the repository at this point in the history
In quota center, ignore the "DB not found error" to prevent it from
affecting the rate limiting of other databases.

/kind improvement

---------

Signed-off-by: bigsheeper <[email protected]>
  • Loading branch information
bigsheeper authored Oct 15, 2024
1 parent b0d5866 commit 1bd3228
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions internal/rootcoord/quota_center.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,8 @@ func (q *QuotaCenter) forceDenyWriting(errorCode commonpb.ErrorCode, cluster boo
for _, collectionID := range collectionIDs {
dbID, ok := q.collectionIDToDBID.Get(collectionID)
if !ok {
return fmt.Errorf("db ID not found of collection ID: %d", collectionID)
log.Warn("cannot find db for collection", zap.Int64("collection", collectionID))
continue
}
collectionLimiter := q.rateLimiter.GetCollectionLimiters(dbID, collectionID)
if collectionLimiter == nil {
Expand All @@ -588,7 +589,8 @@ func (q *QuotaCenter) forceDenyWriting(errorCode commonpb.ErrorCode, cluster boo
for _, partitionID := range partitionIDs {
dbID, ok := q.collectionIDToDBID.Get(collectionID)
if !ok {
return fmt.Errorf("db ID not found of collection ID: %d", collectionID)
log.Warn("cannot find db for collection", zap.Int64("collection", collectionID))
continue
}
partitionLimiter := q.rateLimiter.GetPartitionLimiters(dbID, collectionID, partitionID)
if partitionLimiter == nil {
Expand Down Expand Up @@ -778,7 +780,8 @@ func (q *QuotaCenter) calculateWriteRates() error {

dbID, ok := q.collectionIDToDBID.Get(collection)
if !ok {
return fmt.Errorf("db ID not found of collection ID: %d", collection)
log.Warn("cannot find db for collection", zap.Int64("collection", collection))
continue
}
collectionLimiter := q.rateLimiter.GetCollectionLimiters(dbID, collection)
if collectionLimiter == nil {
Expand Down Expand Up @@ -1230,7 +1233,7 @@ func (q *QuotaCenter) checkDiskQuota(denyWritingDBs map[int64]struct{}) error {
}
dbID, ok := q.collectionIDToDBID.Get(collection)
if !ok {
log.Warn("cannot find db id for collection", zap.Int64("collection", collection))
log.Warn("cannot find db for collection", zap.Int64("collection", collection))
continue
}

Expand Down
2 changes: 1 addition & 1 deletion internal/rootcoord/quota_center_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func TestQuotaCenter(t *testing.T) {
assert.NoError(t, err)

err = quotaCenter.forceDenyWriting(commonpb.ErrorCode_ForceDeny, false, nil, []int64{4}, nil)
assert.Error(t, err)
assert.NoError(t, err)

err = quotaCenter.forceDenyWriting(commonpb.ErrorCode_ForceDeny, false, nil, []int64{1, 2, 3}, map[int64][]int64{
1: {1000},
Expand Down

0 comments on commit 1bd3228

Please sign in to comment.