limit number of buckets to 500k (#15668)

500k is a reasonable limit for any single MinIO
cluster deployment, in future we may increase this
value.

However for now we are going to keep this limit.
This commit is contained in:
Harshavardhana
2022-09-09 03:06:34 -07:00
committed by GitHub
parent 87f0c8e7e8
commit b579163802
6 changed files with 228 additions and 198 deletions

View File

@@ -769,6 +769,14 @@ func (api objectAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Req
return
}
// check if client is attempting to create more buckets than allowed maximum.
if currBuckets := globalBucketMetadataSys.Count(); currBuckets+1 > maxBuckets {
apiErr := errorCodes.ToAPIErr(ErrTooManyBuckets)
apiErr.Description = fmt.Sprintf("You have attempted to create %d buckets than allowed %d", currBuckets+1, maxBuckets)
writeErrorResponse(ctx, w, apiErr, r.URL)
return
}
opts := MakeBucketOptions{
Location: location,
LockEnabled: objectLockEnabled,