diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b6d96a8e93c3..ce185695c8642 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * [4498](https://github.com/grafana/loki/pull/4498) **trevorwhitney**: Feature: add virtual read and write targets * [4543](https://github.com/grafana/loki/pull/4543) **trevorwhitney**: Change more default values and improve application of common storage config * [4570](https://github.com/grafana/loki/pull/4570) **DylanGuedes**: Loki: Append loopback to ingester net interface default list +* [4594](https://github.com/grafana/loki/pull/4594) **owen-d**: Configures unordered_writes=true by default # 2.3.0 (2021/08/06) diff --git a/docs/sources/configuration/_index.md b/docs/sources/configuration/_index.md index ef34a76ec0c48..6c142d77a2f18 100644 --- a/docs/sources/configuration/_index.md +++ b/docs/sources/configuration/_index.md @@ -2019,7 +2019,7 @@ logs in Loki. # When true, out-of-order writes are accepted. # CLI flag: -ingester.unordered-writes -[unordered_writes: | default = false] +[unordered_writes: | default = true] # Maximum number of chunks that can be fetched by a single query. # CLI flag: -store.query-chunk-limit @@ -2379,18 +2379,18 @@ multi_kv_config: Since the beginning of Loki, log entries had to be written to Loki in order by time. This limitation has been lifted. -Out-of-order writes may be enabled globally for a Loki cluster -or enabled on a per-tenant basis. +Out-of-order writes are enabled globally by default, but can be disabled/enabled +on a cluster or per-tenant basis. -- To enable out-of-order writes for all tenants, +- To disable out-of-order writes for all tenants, place in the `limits_config` section: ``` limits_config: - unordered_writes: true + unordered_writes: false ``` -- To enable out-of-order writes for specific tenants, +- To disable out-of-order writes for specific tenants, configure a runtime configuration file: ``` @@ -2403,7 +2403,7 @@ configure a runtime configuration file: ``` overrides: "tenantA": - unordered_writes: true + unordered_writes: false ``` How far into the past accepted out-of-order log entries may be diff --git a/pkg/ingester/transfer_test.go b/pkg/ingester/transfer_test.go index 384716482f274..e5feb2ed9d028 100644 --- a/pkg/ingester/transfer_test.go +++ b/pkg/ingester/transfer_test.go @@ -58,24 +58,6 @@ func TestTransferOut(t *testing.T) { assert.Len(t, ing.instances["test"].streams, 2) } - // verify we get out of order exception on adding an entry with older timestamps - _, err2 := ing.Push(ctx, &logproto.PushRequest{ - Streams: []logproto.Stream{ - { - Entries: []logproto.Entry{ - {Line: "line 4", Timestamp: time.Unix(2, 0)}, - {Line: "ooo", Timestamp: time.Unix(0, 0)}, - {Line: "line 5", Timestamp: time.Unix(3, 0)}, - }, - Labels: `{foo="bar",bar="baz1"}`, - }, - }, - }) - - require.Error(t, err2) - require.Contains(t, err2.Error(), "out of order") - require.Contains(t, err2.Error(), "total ignored: 1 out of 3") - // Create a new ingester and transfer data to it ing2 := f.getIngester(time.Second*60, t) defer services.StopAndAwaitTerminated(context.Background(), ing2) //nolint:errcheck @@ -112,7 +94,7 @@ func TestTransferOut(t *testing.T) { assert.Equal( t, - []string{"line 0", "line 1", "line 2", "line 3", "line 4", "line 5"}, + []string{"line 0", "line 1", "line 2", "line 3"}, lines, ) } diff --git a/pkg/validation/limits.go b/pkg/validation/limits.go index b5817c3f39294..3e9798e1052e3 100644 --- a/pkg/validation/limits.go +++ b/pkg/validation/limits.go @@ -135,7 +135,7 @@ func (l *Limits) RegisterFlags(f *flag.FlagSet) { f.IntVar(&l.MaxLocalStreamsPerUser, "ingester.max-streams-per-user", 0, "Maximum number of active streams per user, per ingester. 0 to disable.") f.IntVar(&l.MaxGlobalStreamsPerUser, "ingester.max-global-streams-per-user", 5000, "Maximum number of active streams per user, across the cluster. 0 to disable.") - f.BoolVar(&l.UnorderedWrites, "ingester.unordered-writes", false, "(Experimental) Allow out of order writes.") + f.BoolVar(&l.UnorderedWrites, "ingester.unordered-writes", true, "Allow out of order writes.") _ = l.PerStreamRateLimit.Set(strconv.Itoa(defaultPerStreamRateLimit)) f.Var(&l.PerStreamRateLimit, "ingester.per-stream-rate-limit", "Maximum byte rate per second per stream, also expressible in human readable forms (1MB, 256KB, etc).")