mirror of
https://github.com/minio/minio.git
synced 2025-11-09 21:49:46 -05:00
set max versions to be IntMax to avoid premature failures (#19360)
let users/customers set relevant values make default value to be non-applicable.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"math"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
@@ -55,7 +56,7 @@ type apiConfig struct {
|
||||
gzipObjects bool
|
||||
rootAccess bool
|
||||
syncEvents bool
|
||||
objectMaxVersions int
|
||||
objectMaxVersions int64
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -393,13 +394,13 @@ func (t *apiConfig) isSyncEventsEnabled() bool {
|
||||
return t.syncEvents
|
||||
}
|
||||
|
||||
func (t *apiConfig) getObjectMaxVersions() int {
|
||||
func (t *apiConfig) getObjectMaxVersions() int64 {
|
||||
t.mu.RLock()
|
||||
defer t.mu.RUnlock()
|
||||
|
||||
if t.objectMaxVersions <= 0 {
|
||||
// defaults to 'maxObjectVersions' when unset.
|
||||
return maxObjectVersions
|
||||
// defaults to 'IntMax' when unset.
|
||||
return math.MaxInt64
|
||||
}
|
||||
|
||||
return t.objectMaxVersions
|
||||
|
||||
@@ -40,9 +40,6 @@ import (
|
||||
"github.com/tinylib/msgp/msgp"
|
||||
)
|
||||
|
||||
// Reject creating new versions when a single object is cross maxObjectVersions
|
||||
var maxObjectVersions = 10000
|
||||
|
||||
var (
|
||||
// XL header specifies the format
|
||||
xlHeader = [4]byte{'X', 'L', '2', ' '}
|
||||
@@ -1091,8 +1088,8 @@ func (x *xlMetaV2) addVersion(ver xlMetaV2Version) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// returns error if we have exceeded maxObjectVersions
|
||||
if len(x.versions)+1 > globalAPIConfig.getObjectMaxVersions() {
|
||||
// returns error if we have exceeded configured object max versions
|
||||
if int64(len(x.versions)+1) > globalAPIConfig.getObjectMaxVersions() {
|
||||
return errMaxVersionsExceeded
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user