Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable unordered_writes by default #4594

Merged
merged 3 commits into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
14 changes: 7 additions & 7 deletions docs/sources/configuration/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2019,7 +2019,7 @@ logs in Loki.

# When true, out-of-order writes are accepted.
# CLI flag: -ingester.unordered-writes
[unordered_writes: <bool> | default = false]
[unordered_writes: <bool> | default = true]

# Maximum number of chunks that can be fetched by a single query.
# CLI flag: -store.query-chunk-limit
Expand Down Expand Up @@ -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:

```
Expand All @@ -2403,7 +2403,7 @@ configure a runtime configuration file:
```
overrides:
"tenantA":
unordered_writes: true
unordered_writes: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: what happens if global config unordered_writes is false (disabled), but per-tenant config unordered_writes is true (enabled).

this should still means disabled for that tenant?

Should we cover that case in the config doc somewere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tenant configs override globally set defaults. Yes this should be covered somewhere if it's not already 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarification! :)

```

How far into the past accepted out-of-order log entries may be
Expand Down
20 changes: 1 addition & 19 deletions pkg/ingester/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/validation/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).")
Expand Down