Skip to content

Commit 7e17b89

Browse files
pstibranygouthamve
authored andcommitted
If ingester.max-transfer-retries is set to 0, hand-over attempts are … (#1777)
* If ingester.max-transfer-retries is set to 0, hand-over attempts are disabled. Due to interaction with BackOffConfig.MaxRetries, zero value meant infinite number of attempts, which is hardly ever a desired behaviour (with no ingester waiting to accept a transfer, this would never end). Fixed #1771. Signed-off-by: Peter Štibraný <[email protected]> * Fixed typo Signed-off-by: Peter Štibraný <[email protected]> * Fix ingester.max-transfer-retries argument name. Signed-off-by: Peter Štibraný <[email protected]>
1 parent 548e1a3 commit 7e17b89

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* [CHANGE] The frontend component has been refactored to be easier to re-use. When upgrading the frontend, cache entries will be discarded and re-created with the new protobuf schema. #1734
66
* [CHANGE] Remove direct DB/API access from the ruler
77
* [CHANGE] Removed `Delta` encoding. Any old chunks with `Delta` encoding cannot be read anymore. If `ingester.chunk-encoding` is set to `Delta` the ingester will fail to start. #1706
8+
* [CHANGE] Setting `-ingester.max-transfer-retries` to 0 now disables hand-over when ingester is shutting down. Previously, zero meant infinite number of attempts. #1771
89
* [FEATURE] Global limit on the max series per user and metric #1760
910
* `-ingester.max-global-series-per-user`
1011
* `-ingester.max-global-series-per-metric`

docs/arguments.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,9 @@ It also talks to a KVStore and has it's own copies of the same flags used by the
228228

229229
How long to wait in PENDING state during the [hand-over process](ingester-handover.md). (default 0s)
230230

231-
- `-ingester.ingester.max-transfer-retries`
231+
- `-ingester.max-transfer-retries`
232232

233-
How many times a LEAVING ingester tries to find a PENDING ingester during the [hand-over process](ingester-handover.md). Each attempt takes a second or so. (default 10)
233+
How many times a LEAVING ingester tries to find a PENDING ingester during the [hand-over process](ingester-handover.md). Each attempt takes a second or so. Negative value or zero disables hand-over process completely. (default 10)
234234

235235
- `-ingester.normalise-tokens`
236236

pkg/ingester/ingester.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func newIngesterMetrics(r prometheus.Registerer) *ingesterMetrics {
102102
type Config struct {
103103
LifecyclerConfig ring.LifecyclerConfig `yaml:"lifecycler,omitempty"`
104104

105-
// Config for transferring chunks.
105+
// Config for transferring chunks. Zero or negative = no retries.
106106
MaxTransferRetries int `yaml:"max_transfer_retries,omitempty"`
107107

108108
// Config for chunk flushing.
@@ -134,7 +134,7 @@ type Config struct {
134134
func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
135135
cfg.LifecyclerConfig.RegisterFlags(f)
136136

137-
f.IntVar(&cfg.MaxTransferRetries, "ingester.max-transfer-retries", 10, "Number of times to try and transfer chunks before falling back to flushing.")
137+
f.IntVar(&cfg.MaxTransferRetries, "ingester.max-transfer-retries", 10, "Number of times to try and transfer chunks before falling back to flushing. Negative value or zero disables hand-over.")
138138
f.DurationVar(&cfg.FlushCheckPeriod, "ingester.flush-period", 1*time.Minute, "Period with which to attempt to flush chunks.")
139139
f.DurationVar(&cfg.RetainPeriod, "ingester.retain-period", 5*time.Minute, "Period chunks will remain in memory after flushing.")
140140
f.DurationVar(&cfg.FlushOpTimeout, "ingester.flush-op-timeout", 1*time.Minute, "Timeout for individual flush operations.")

pkg/ingester/lifecycle_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func defaultIngesterTestConfig() Config {
4444
cfg.LifecyclerConfig.Addr = "localhost"
4545
cfg.LifecyclerConfig.ID = "localhost"
4646
cfg.LifecyclerConfig.FinalSleep = 0
47-
cfg.MaxTransferRetries = -1
47+
cfg.MaxTransferRetries = 0
4848
return cfg
4949
}
5050

pkg/ingester/transfer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ func fromWireChunks(wireChunks []client.Chunk) ([]*desc, error) {
349349
// TransferOut finds an ingester in PENDING state and transfers our chunks to it.
350350
// Called as part of the ingester shutdown process.
351351
func (i *Ingester) TransferOut(ctx context.Context) error {
352-
if i.cfg.MaxTransferRetries < 0 {
352+
if i.cfg.MaxTransferRetries <= 0 {
353353
return fmt.Errorf("transfers disabled")
354354
}
355355
backoff := util.NewBackoff(ctx, util.BackoffConfig{

0 commit comments

Comments
 (0)