Skip to content

Commit

Permalink
Added option to disable extended writes (#677)
Browse files Browse the repository at this point in the history
* Added option to disable extended writes

Signed-off-by: Joe Elliott <[email protected]>

* Added changelog/docs

Signed-off-by: Joe Elliott <[email protected]>

* docs

Signed-off-by: Joe Elliott <[email protected]>

* Added more comments

Signed-off-by: Joe Elliott <[email protected]>
  • Loading branch information
joe-elliott authored Apr 27, 2021
1 parent f048eb3 commit 341c01b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## main / unreleased

* [ENHANCEMENT] Improve WAL Replay by not rebuilding the WAL. [#668](https://github.com/grafana/tempo/pull/668)
* [ENHANCEMENT] Add config option to disable write extension to the ingesters. [#677](https://github.com/grafana/tempo/pull/677)

## v0.7.0

Expand Down
1 change: 1 addition & 0 deletions docs/tempo/website/configuration/manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ distributor:
instance_addr: ""
receivers: {}
override_ring_key: distributor
extend_writes: true
ingester_client:
pool_config:
checkinterval: 15s
Expand Down
5 changes: 5 additions & 0 deletions modules/distributor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ type Config struct {
Receivers map[string]interface{} `yaml:"receivers"`
OverrideRingKey string `yaml:"override_ring_key"`

// disables write extension with inactive ingesters. Use this along with ingester.lifecycler.unregister_on_shutdown = true
// note that setting these two config values reduces tolerance to failures on rollout b/c there is always one guaranteed to be failing replica
ExtendWrites bool `yaml:"extend_writes"`

// For testing.
factory func(addr string) (ring_client.PoolClient, error) `yaml:"-"`
}
Expand All @@ -45,4 +49,5 @@ func (cfg *Config) RegisterFlagsAndApplyDefaults(prefix string, f *flag.FlagSet)
cfg.DistributorRing.HeartbeatTimeout = 5 * time.Minute

cfg.OverrideRingKey = ring.DistributorRingKey
cfg.ExtendWrites = true
}
7 changes: 6 additions & 1 deletion modules/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,12 @@ func (d *Distributor) sendToIngestersViaBytes(ctx context.Context, userID string
rawRequests[i] = b
}

err := ring.DoBatch(ctx, ring.Write, d.ingestersRing, keys, func(ingester ring.InstanceDesc, indexes []int) error {
op := ring.WriteNoExtend
if d.cfg.ExtendWrites {
op = ring.Write
}

err := ring.DoBatch(ctx, op, d.ingestersRing, keys, func(ingester ring.InstanceDesc, indexes []int) error {

localCtx, cancel := context.WithTimeout(context.Background(), d.clientCfg.RemoteTimeout)
defer cancel()
Expand Down

0 comments on commit 341c01b

Please sign in to comment.