From 627294bf704c5e3ca2e0ac0b23ff0a8e4b92a935 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 7 Nov 2023 11:07:27 +0300 Subject: [PATCH] [#92] Support configuring max tree request attempts Signed-off-by: Denis Kirillov --- cmd/http-gw/settings.go | 5 +++++ config/config.env | 4 ++++ config/config.yaml | 3 +++ docs/gate-configuration.md | 10 ++++++---- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/cmd/http-gw/settings.go b/cmd/http-gw/settings.go index 24e4f37..789dd2f 100644 --- a/cmd/http-gw/settings.go +++ b/cmd/http-gw/settings.go @@ -113,6 +113,9 @@ const ( cfgClientCut = "frostfs.client_cut" // Sets max buffer size for read payload in put operations. cfgBufferMaxSizeForPut = "frostfs.buffer_max_size_for_put" + // Configuration of parameters of requests to FrostFS. + // Sets max attempt to make successful tree request. + cfgTreePoolMaxAttempts = "frostfs.tree_pool_max_attempts" // Caching. cfgBucketsCacheLifetime = "cache.buckets.lifetime" @@ -527,6 +530,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/config/config.env b/config/config.env index be42af9..12f1ba4 100644 --- a/config/config.env +++ b/config/config.env @@ -114,3 +114,7 @@ HTTP_GW_CACHE_BUCKETS_SIZE=1000 HTTP_GW_RESOLVE_BUCKET_NAMESPACE_HEADER=X-Frostfs-Namespace # Namespaces that should be handled as default HTTP_GW_RESOLVE_BUCKET_DEFAULT_NAMESPACES="" "root" + +# Max attempt to make successful tree request. +# default value is 0 that means the number of attempts equals to number of nodes in pool. +HTTP_GW_FROSTFS_TREE_POOL_MAX_ATTEMPTS=0 diff --git a/config/config.yaml b/config/config.yaml index 020b0dd..7ea2748 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -112,6 +112,9 @@ frostfs: client_cut: false # Sets max buffer size for read payload in put operations. 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. + tree_pool_max_attempts: 0 # Caching cache: diff --git a/docs/gate-configuration.md b/docs/gate-configuration.md index fe4b50f..bf792b7 100644 --- a/docs/gate-configuration.md +++ b/docs/gate-configuration.md @@ -282,12 +282,14 @@ Contains parameters of requests to FrostFS. frostfs: client_cut: false buffer_max_size_for_put: 1048576 # 1mb + tree_pool_max_attempts: 0 ``` -| Parameter | Type | SIGHUP reload | Default value | Description | -|---------------------------|----------|---------------|---------------|----------------------------------------------------------| -| `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. | +| Parameter | Type | SIGHUP reload | Default value | Description | +|---------------------------|----------|---------------|---------------|---------------------------------------------------------------------------------------------------------------------------| +| `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. | ### `cache` section