From 4286f7945b582548614cb6e1c493394ea011c9da Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Mon, 23 Oct 2023 17:06:42 +0300 Subject: [PATCH] [#262] Support configuring max tree request attempts Signed-off-by: Denis Kirillov --- cmd/s3-gw/app.go | 2 ++ cmd/s3-gw/app_settings.go | 2 ++ config/config.env | 3 +++ config/config.yaml | 3 +++ docs/configuration.md | 10 ++++++---- go.mod | 2 +- go.sum | 4 ++-- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/cmd/s3-gw/app.go b/cmd/s3-gw/app.go index 94006eb..958fa8b 100644 --- a/cmd/s3-gw/app.go +++ b/cmd/s3-gw/app.go @@ -325,6 +325,8 @@ func getPools(ctx context.Context, logger *zap.Logger, cfg *viper.Viper) (*pool. prm.SetLogger(logger) prmTree.SetLogger(logger) + prmTree.SetMaxRequestAttempts(cfg.GetInt(cfgTreePoolMaxAttempts)) + var apiGRPCDialOpts []grpc.DialOption var treeGRPCDialOpts []grpc.DialOption if cfg.GetBool(cfgTracingEnabled) { diff --git a/cmd/s3-gw/app_settings.go b/cmd/s3-gw/app_settings.go index 6ec9f55..156a185 100644 --- a/cmd/s3-gw/app_settings.go +++ b/cmd/s3-gw/app_settings.go @@ -149,6 +149,8 @@ const ( // Settings. cfgSetCopiesNumber = "frostfs.set_copies_number" // Enabling client side object preparing for PUT operations. cfgClientCut = "frostfs.client_cut" + // Sets max attempt to make successful tree request. + cfgTreePoolMaxAttempts = "frostfs.tree_pool_max_attempts" // List of allowed AccessKeyID prefixes. cfgAllowedAccessKeyIDPrefixes = "allowed_access_key_id_prefixes" diff --git a/config/config.env b/config/config.env index 518cd8a..8b79c79 100644 --- a/config/config.env +++ b/config/config.env @@ -127,6 +127,9 @@ S3_GW_CORS_DEFAULT_MAX_AGE=600 S3_GW_FROSTFS_SET_COPIES_NUMBER=0 # This flag enables client side object preparing. S3_GW_FROSTFS_CLIENT_CUT=false +# max attempt to make successful tree request. +# default value is 0 that means the number of attempts equals to number of nodes in pool. +S3_GW_FROSTFS_TREE_POOL_MAX_ATTEMPTS=0 # List of allowed AccessKeyID prefixes # If not set, S3 GW will accept all AccessKeyIDs diff --git a/config/config.yaml b/config/config.yaml index f266db9..05e90be 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -152,6 +152,9 @@ frostfs: set_copies_number: [0] # This flag enables client side object preparing. client_cut: false + # max attempt to make successful tree request. + # default value is 0 that means the number of attempts equals to number of nodes in pool. + tree_pool_max_attempts: 0 # List of allowed AccessKeyID prefixes # If the parameter is omitted, S3 GW will accept all AccessKeyIDs diff --git a/docs/configuration.md b/docs/configuration.md index e9e09f2..4641d69 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -510,12 +510,14 @@ header for `PutObject`, `CopyObject`, `CreateMultipartUpload`. frostfs: set_copies_number: [0] client_cut: false + tree_pool_max_attempts: 0 ``` -| Parameter | Type | SIGHUP reload | Default value | Description | -|---------------------|------------|---------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `set_copies_number` | `[]uint32` | yes | `[0]` | Numbers of the object copies (for each replica) to consider PUT to FrostFS successful.
Default value `[0]` or empty list means that object will be processed according to the container's placement policy | -| `client_cut` | `bool` | yes | `false` | This flag enables client side object preparing. | +| Parameter | Type | SIGHUP reload | Default value | Description | +|---------------------------|------------|---------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `set_copies_number` | `[]uint32` | yes | `[0]` | Numbers of the object copies (for each replica) to consider PUT to FrostFS successful.
Default value `[0]` or empty list means that object will be processed according to the container's placement policy | +| `client_cut` | `bool` | yes | `false` | This flag enables client side object preparing. | +| `tree_pool_max_attempts` | `uint32` | no | `0` | Sets max attempt to make successful tree request. Value 0 means the number of attempts equals to number of nodes in pool. | # `resolve_bucket` section diff --git a/go.mod b/go.mod index 96d8ed1..16a2e95 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20231121085847-241a9f1ad0a4 git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6 - git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20231011090034-fc4551b84341 + git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20231107114540-ab75edd70939 github.com/aws/aws-sdk-go v1.44.6 github.com/bluele/gcache v0.0.2 github.com/go-chi/chi/v5 v5.0.8 diff --git a/go.sum b/go.sum index 59812c1..f1aec08 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,8 @@ git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSV git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU= git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6 h1:aGQ6QaAnTerQ5Dq5b2/f9DUQtSqPkZZ/bkMx/HKuLCo= git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6/go.mod h1:W8Nn08/l6aQ7UlIbpF7FsQou7TVpcRD1ZT1KG4TrFhE= -git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20231011090034-fc4551b84341 h1:n7xFjtArW750gKZmsp4u+NoYplKnXwf5Vuox2OWDMmM= -git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20231011090034-fc4551b84341/go.mod h1:t1akKcUH7iBrFHX8rSXScYMP17k2kYQXMbZooiL5Juw= +git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20231107114540-ab75edd70939 h1:jZEepi9yWmqrWgLRQcHQu4YPJaudmd7d2AEhpmM3m4U= +git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20231107114540-ab75edd70939/go.mod h1:t1akKcUH7iBrFHX8rSXScYMP17k2kYQXMbZooiL5Juw= git.frostfs.info/TrueCloudLab/hrw v1.2.1 h1:ccBRK21rFvY5R1WotI6LNoPlizk7qSvdfD8lNIRudVc= git.frostfs.info/TrueCloudLab/hrw v1.2.1/go.mod h1:C1Ygde2n843yTZEQ0FP69jYiuaYV0kriLvP4zm8JuvM= git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA=