From be6a37ada5b4e19b23473a72c21dc9a6fabb1d93 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 Signed-off-by: Alex Vanin --- cmd/s3-gw/app.go | 2 ++ cmd/s3-gw/app_settings.go | 2 ++ config/config.env | 3 +++ docs/configuration.md | 2 ++ go.mod | 2 +- go.sum | 4 ++-- 6 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/s3-gw/app.go b/cmd/s3-gw/app.go index 5426b199..0d20be3f 100644 --- a/cmd/s3-gw/app.go +++ b/cmd/s3-gw/app.go @@ -563,6 +563,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 b5fb05a9..fa05f74b 100644 --- a/cmd/s3-gw/app_settings.go +++ b/cmd/s3-gw/app_settings.go @@ -185,6 +185,8 @@ const ( // Settings. cfgClientCut = "frostfs.client_cut" // Sets max buffer size for read payload in put operations. cfgBufferMaxSizeForPut = "frostfs.buffer_max_size_for_put" + // 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 9c52d892..bc8498ad 100644 --- a/config/config.env +++ b/config/config.env @@ -135,6 +135,9 @@ S3_GW_FROSTFS_SET_COPIES_NUMBER=0 S3_GW_FROSTFS_CLIENT_CUT=false # Sets max buffer size for read payload in put operations. S3_GW_FROSTFS_BUFFER_MAX_SIZE_FOR_PUT=1048576 +# 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/docs/configuration.md b/docs/configuration.md index 33703843..984551d3 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -535,6 +535,7 @@ frostfs: set_copies_number: [0] client_cut: false buffer_max_size_for_put: 1048576 # 1mb + tree_pool_max_attempts: 0 ``` | Parameter | Type | SIGHUP reload | Default value | Description | @@ -542,6 +543,7 @@ frostfs: | `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. | | `buffer_max_size_for_put` | `uint64` | yes | `1048576` | Sets max buffer size for read payload in put operations. | +| `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 5109cee8..1b981598 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20231121085847-241a9f1ad0a4 git.frostfs.info/TrueCloudLab/frostfs-contract v0.18.1-0.20231109143925-dd5919348da9 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 git.frostfs.info/TrueCloudLab/policy-engine v0.0.0-20231205092054-2d4a9fc6dcb3 git.frostfs.info/TrueCloudLab/zapjournald v0.0.0-20231018083019-2b6d84de9a3d github.com/aws/aws-sdk-go v1.44.6 diff --git a/go.sum b/go.sum index f2c01acf..e797cc22 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/policy-engine v0.0.0-20231205092054-2d4a9fc6dcb3 h1:d4cCtg6vgQ101Qni9FqYaGPkmSJP1ZnEyHYMI+JaTIo=