Disallow writeback caching with cache_after (#11002)

fixes #10974
This commit is contained in:
Poorna Krishnamoorthy 2020-11-30 20:53:27 -08:00 committed by GitHub
parent ae4ded7fd1
commit 2f564437ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -222,6 +222,10 @@ func LookupConfig(kvs config.KVS) (Config, error) {
if err != nil { if err != nil {
return cfg, err return cfg, err
} }
if cfg.After > 0 && cfg.CommitWriteback {
err := errors.New("cache after cannot be used with commit writeback")
return cfg, config.ErrInvalidCacheSetting(err)
}
} }
return cfg, nil return cfg, nil

View File

@ -108,6 +108,11 @@ var (
"MINIO_CACHE_COMMIT: Valid expected value is `writeback` or `writethrough`", "MINIO_CACHE_COMMIT: Valid expected value is `writeback` or `writethrough`",
) )
ErrInvalidCacheSetting = newErrFn(
"Incompatible cache setting",
"Please check the passed value",
"MINIO_CACHE_AFTER cannot be used with MINIO_CACHE_COMMIT setting",
)
ErrInvalidRotatingCredentialsBackendEncrypted = newErrFn( ErrInvalidRotatingCredentialsBackendEncrypted = newErrFn(
"Invalid rotating credentials", "Invalid rotating credentials",
"Please set correct rotating credentials in the environment for decryption", "Please set correct rotating credentials in the environment for decryption",