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

storage: reset compaction window start offset when offset map isn't built #24323

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

WillemKauf
Copy link
Contributor

@WillemKauf WillemKauf commented Nov 26, 2024

The behavior of the sliding window considered for compaction was changed in this PR: #23380.

Newly added/closed segments are ignored until the current "round" of sliding window compaction cleanly compacts all segments down to the start of the log. This allows for sliding window compaction to continually produce clean segments, and avoid a situation where clean segments are not being produced due to a high ingress rate or key cardinality (this situation would prevent timely tombstone removal). _last_compaction_window_offset must reach the base offset of the first segment in the log before new segments will be considered in the compaction window.

However, consider the following situation:

[0] [1] [2] [3] [4] [5]
            ^
            |----- _last_compaction_window_start_offset

In the event that segment [2] cannot have its keys completely added to the offset map due to memory constraints, if we do not reset the window start offset, compaction will become somewhat stuck as it repeatedly tries to index segment [2] in future compaction rounds.

By resetting the window's value in this situation, we can allow compaction to continue to make forward progression.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v24.3.x
  • v24.2.x
  • v24.1.x

Release Notes

  • none

… built

Consider the following situation:

[0] [1] [2] [3] [4] [5]
            ^
	    |----- _last_compaction_window_start_offset

In the event that segment [2] cannot have its keys completely added
to the offset map due to memory constraints, if we do not reset
the window start offset, compaction will become somewhat stuck as it
repeatedly tries to index segment [2] in future compaction rounds.

By resetting the window's value in this situation, we can allow
compaction to continue to make forward progression.
@vbotbuildovich
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants