Skip to content

chore!: Remove deprecated per-tenant setting unordered_writes - #21835

Merged
chaudum merged 7 commits into
mainfrom
chaudum/remove-deprecated-unordered-writes
May 13, 2026
Merged

chore!: Remove deprecated per-tenant setting unordered_writes#21835
chaudum merged 7 commits into
mainfrom
chaudum/remove-deprecated-unordered-writes

Conversation

@chaudum

@chaudum chaudum commented May 12, 2026

Copy link
Copy Markdown
Contributor

Summary

The setting unordered_writes was deprecated and defaulted to true. Now it has been removed.
Please use the deprecated-config-checker tool to validate your config.yaml.


Note

Medium Risk
Removes a previously user-configurable ingestion behavior and changes validation/metric labeling around out-of-order data, which can affect upgrade compatibility and operational alerting.

Overview
Loki no longer supports configuring unordered_writes (global or per-tenant): the limit/CLI flag and override plumbing are removed, stream creation no longer carries an unorderedWrites mode, and WAL recovery no longer includes logic to convert unordered→ordered head blocks.

Ingestion validation is simplified to always enforce the max_chunk_age/2 cutoff for old entries and to always report discards as reason=too_far_behind (removing out_of_order), with docs and troubleshooting guidance updated and the deprecated-config-checker updated to flag limits_config.unordered_writes and per-tenant override usage as removed.

Reviewed by Cursor Bugbot for commit 4722a23. Bugbot is set up for automated code reviews on this repo. Configure here.

The setting `unordered_writes` was deprecated and defaulted to `true`.
Now it has been removed.
Please use the `deprecated-config-checker` tool to validate your
`config.yaml`.
@chaudum
chaudum requested a review from a team as a code owner May 12, 2026 13:45
@github-actions

github-actions Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

💻 Deploy preview deleted (chore!: Remove deprecated per-tenant setting unordered_writes).

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Unused function headBlockType left as dead code
    • Removed the unreferenced private headBlockType helper from pkg/ingester/stream.go.

Create PR

Or push these changes by commenting:

@cursor push 775a784284
Preview (775a784284)
diff --git a/pkg/ingester/stream.go b/pkg/ingester/stream.go
--- a/pkg/ingester/stream.go
+++ b/pkg/ingester/stream.go
@@ -645,15 +645,6 @@
 	s.tailers[t.getID()] = t
 }
 
-func headBlockType(chunkfmt byte, unorderedWrites bool) chunkenc.HeadBlockFmt {
-	if unorderedWrites {
-		if chunkfmt >= chunkenc.ChunkFormatV3 {
-			return chunkenc.ChunkHeadFormatFor(chunkfmt)
-		}
-	}
-	return chunkenc.OrderedHeadBlockFmt
-}
-
 func labelsEqual(a, b pushtypes.LabelsAdapter) bool {
 	if len(a) != len(b) {
 		return false

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit 1721b6e. Configure here.

Comment thread pkg/ingester/stream.go
The `too_far_behind` validation error is returned when lines in question are older than half of `-ingester.max-chunk-age` compared to the newest line in the stream.

This validation error is returned when a stream is submitted out of order. More details can be found [here](/docs/loki/<LOKI_VERSION>/configuration/#accept-out-of-order-writes) about the Loki ordering constraints.
This problem can be solved by ensuring that log delivery is configured correctly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"is configured correctly" isn't very helpful. Can we restore the link to #accept out of order writes please?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Or explain what "configured correctly" looks like with an example?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think I need to remove the section "Accept out-of-order writes" from the configuration page, since it references the now removed setting.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, so I updated the "Accept out-of-order writes" section and keep the link on this page.

Comment thread docs/sources/setup/upgrade/_index.md Outdated
Comment thread docs/sources/setup/upgrade/_index.md Outdated
chaudum and others added 2 commits May 12, 2026 17:58
Co-authored-by: J Stickler <julie.stickler@grafana.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
salvacorts
salvacorts previously approved these changes May 13, 2026

@salvacorts salvacorts left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great!

ashwanthgoli
ashwanthgoli previously approved these changes May 13, 2026

@ashwanthgoli ashwanthgoli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

Comment thread tools/deprecated-config-checker/deleted-config.yaml Outdated
@chaudum
chaudum dismissed stale reviews from ashwanthgoli and salvacorts via ee1636b May 13, 2026 07:29
Co-authored-by: Ashwanth <iamashwanth@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
@chaudum
chaudum enabled auto-merge (squash) May 13, 2026 07:39
@chaudum
chaudum merged commit 352c7fc into main May 13, 2026
85 checks passed
@chaudum
chaudum deleted the chaudum/remove-deprecated-unordered-writes branch May 13, 2026 07:40
sophiewaldman pushed a commit that referenced this pull request May 15, 2026
The setting unordered_writes was deprecated and defaulted to true. Now it has been removed.
Please use the deprecated-config-checker tool to validate your config.yaml.


Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Co-authored-by: J Stickler <julie.stickler@grafana.com>
Co-authored-by: Ashwanth <iamashwanth@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4 participants