aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarkady-e1ppa <arkady-e1ppa@yandex-team.com>2023-09-19 09:44:22 +0300
committerarkady-e1ppa <arkady-e1ppa@yandex-team.com>2023-09-19 10:04:34 +0300
commit17a06defa7ddf179308a1b1820655a2e5f53f86b (patch)
tree6a94eab777a6e3cd9dd4039753a81376d16bf167
parenta2668d31f6f18029eb3c9c525d3b38a7fb7f6859 (diff)
downloadydb-17a06defa7ddf179308a1b1820655a2e5f53f86b.tar.gz
Backoff methods renamed
-rw-r--r--yt/yt/client/api/config.cpp2
-rw-r--r--yt/yt/core/misc/backoff_strategy.cpp16
-rw-r--r--yt/yt/core/misc/backoff_strategy.h14
-rw-r--r--yt/yt/core/misc/backoff_strategy_config.cpp10
4 files changed, 22 insertions, 20 deletions
diff --git a/yt/yt/client/api/config.cpp b/yt/yt/client/api/config.cpp
index d8cdabecd3..b7be5e935d 100644
--- a/yt/yt/client/api/config.cpp
+++ b/yt/yt/client/api/config.cpp
@@ -42,7 +42,7 @@ void TConnectionDynamicConfig::Register(TRegistrar registrar)
registrar.Preprocessor([] (TThis* config) {
// TODO(gritukan): Enable tablet retries by default one day.
config->TabletWriteBackoff = New<TSerializableExponentialBackoffOptions>();
- config->TabletWriteBackoff->RetryCount = 1;
+ config->TabletWriteBackoff->InvocationCount = 1;
});
}
diff --git a/yt/yt/core/misc/backoff_strategy.cpp b/yt/yt/core/misc/backoff_strategy.cpp
index 76a1a80c94..c902ca5b5d 100644
--- a/yt/yt/core/misc/backoff_strategy.cpp
+++ b/yt/yt/core/misc/backoff_strategy.cpp
@@ -9,7 +9,7 @@ namespace NYT {
TConstantBackoffOptions::operator TExponentialBackoffOptions() const
{
return TExponentialBackoffOptions{
- .RetryCount = RetryCount,
+ .InvocationCount = InvocationCount,
.MinBackoff = Backoff,
.MaxBackoff = Backoff,
.BackoffMultiplier = 1.0,
@@ -27,28 +27,28 @@ TBackoffStrategy::TBackoffStrategy(const TExponentialBackoffOptions& options)
void TBackoffStrategy::Restart()
{
- RetryIndex_ = 0;
+ InvocationIndex_ = 0;
Backoff_ = Options_.MinBackoff;
ApplyJitter();
}
bool TBackoffStrategy::Next()
{
- if (RetryIndex_ > 0) {
+ if (InvocationIndex_ > 0) {
Backoff_ = std::min(Backoff_ * Options_.BackoffMultiplier, Options_.MaxBackoff);
ApplyJitter();
}
- return ++RetryIndex_ < Options_.RetryCount;
+ return ++InvocationIndex_ < Options_.InvocationCount;
}
-int TBackoffStrategy::GetRetryIndex() const
+int TBackoffStrategy::GetInvocationIndex() const
{
- return RetryIndex_;
+ return InvocationIndex_;
}
-int TBackoffStrategy::GetRetryCount() const
+int TBackoffStrategy::GetInvocationCount() const
{
- return Options_.RetryCount;
+ return Options_.InvocationCount;
}
TDuration TBackoffStrategy::GetBackoff() const
diff --git a/yt/yt/core/misc/backoff_strategy.h b/yt/yt/core/misc/backoff_strategy.h
index 4da3aebd44..82b3e8029c 100644
--- a/yt/yt/core/misc/backoff_strategy.h
+++ b/yt/yt/core/misc/backoff_strategy.h
@@ -8,13 +8,13 @@ namespace NYT {
struct TExponentialBackoffOptions
{
- static constexpr int DefaultRetryCount = 10;
+ static constexpr int DefaultInvocationCount = 10;
static constexpr auto DefaultMinBackoff = TDuration::Seconds(1);
static constexpr auto DefaultMaxBackoff = TDuration::Seconds(5);
static constexpr double DefaultBackoffMultiplier = 1.5;
static constexpr double DefaultBackoffJitter = 0.1;
- int RetryCount = DefaultRetryCount;
+ int InvocationCount = DefaultInvocationCount;
TDuration MinBackoff = DefaultMinBackoff;
TDuration MaxBackoff = DefaultMaxBackoff;
double BackoffMultiplier = DefaultBackoffMultiplier;
@@ -25,11 +25,11 @@ struct TExponentialBackoffOptions
struct TConstantBackoffOptions
{
- static constexpr int DefaultRetryCount = 10;
+ static constexpr int DefaultInvocationCount = 10;
static constexpr auto DefaultBackoff = TDuration::Seconds(3);
static constexpr double DefaultBackoffJitter = 0.1;
- int RetryCount = DefaultRetryCount;
+ int InvocationCount = DefaultInvocationCount;
TDuration Backoff = DefaultBackoff;
double BackoffJitter = DefaultBackoffJitter;
@@ -47,8 +47,8 @@ public:
void Restart();
bool Next();
- int GetRetryIndex() const;
- int GetRetryCount() const;
+ int GetInvocationIndex() const;
+ int GetInvocationCount() const;
TDuration GetBackoff() const;
@@ -57,7 +57,7 @@ public:
private:
TExponentialBackoffOptions Options_;
- int RetryIndex_;
+ int InvocationIndex_;
TDuration Backoff_;
TDuration BackoffWithJitter_;
diff --git a/yt/yt/core/misc/backoff_strategy_config.cpp b/yt/yt/core/misc/backoff_strategy_config.cpp
index f4f0e69dd8..848c25863d 100644
--- a/yt/yt/core/misc/backoff_strategy_config.cpp
+++ b/yt/yt/core/misc/backoff_strategy_config.cpp
@@ -6,8 +6,9 @@ namespace NYT {
void TSerializableExponentialBackoffOptions::Register(TRegistrar registrar)
{
- registrar.BaseClassParameter("retry_count", &TThis::RetryCount)
- .Default(DefaultRetryCount);
+ registrar.BaseClassParameter("invocation_count", &TThis::InvocationCount)
+ .Alias("retry_count")
+ .Default(DefaultInvocationCount);
registrar.BaseClassParameter("min_backoff", &TThis::MinBackoff)
.Default(DefaultMinBackoff);
registrar.BaseClassParameter("max_backoff", &TThis::MaxBackoff)
@@ -22,8 +23,9 @@ void TSerializableExponentialBackoffOptions::Register(TRegistrar registrar)
void TSerializableConstantBackoffOptions::Register(TRegistrar registrar)
{
- registrar.BaseClassParameter("retry_count", &TThis::RetryCount)
- .Default(DefaultRetryCount);
+ registrar.BaseClassParameter("invocation_count", &TThis::InvocationCount)
+ .Alias("retry_count")
+ .Default(DefaultInvocationCount);
registrar.BaseClassParameter("backoff", &TThis::Backoff)
.Default(DefaultBackoff);
registrar.BaseClassParameter("backoff_jitter", &TThis::BackoffJitter)