Skip to content

Conversation

stevesg
Copy link
Contributor

@stevesg stevesg commented Feb 22, 2021

What this PR does:
Attempt to prevent idle compaction from happening concurrently by
introducing a 25% jitter to the configured timeout. This jitter only
increases the timeout, such that the configured minimum timeout is
always adhered to.

Which issue(s) this PR fixes:
Fixes #3832

Checklist

  • Tests updated
  • Documentation added - N/A
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@stevesg
Copy link
Contributor Author

stevesg commented Feb 22, 2021

Rebase

@pracucci pracucci requested review from pracucci and pstibrany and removed request for pstibrany February 22, 2021 14:43
Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

Please updated the CLI flag description at pkg/storage/tsdb/config.go to mention a jitter is applied.

Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@pracucci pracucci marked this pull request as ready for review February 22, 2021 17:35
Attempt to prevent idle compaction from happening concurrently by
introducing a 25% jitter to the configured timeout. This jitter only
increases the timeout, such that the configured minimum timeout is
always adhered to.

Signed-off-by: Steve Simpson <[email protected]>
Signed-off-by: Steve Simpson <[email protected]>
Move the setting of TSDB.compactionIdleTimeout just after struct
creation. This avoids a race condition in the unit test because it makes
calls to compactBlocks directly.

Signed-off-by: Steve Simpson <[email protected]>
@stevesg
Copy link
Contributor Author

stevesg commented Feb 22, 2021

Rebase

# If TSDB head is idle for this duration, it is compacted. 0 means disabled.
# If TSDB head is idle for this duration, it is compacted. Note that up to
# 25% jitter is added to the value to avoid ingesters compacting
Copy link
Contributor

Choose a reason for hiding this comment

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

I am just wondering, what is the reason to leave the jitter percentage unconfigurable to the user?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We didn't have a strong opinion here, other than following how jitter has typically been added in other places.

I don't think there would be opposition to be being configurable though.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Make sense. I agree we can make it configurable when the need arises in a separate PR.

Copy link
Contributor

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@pracucci pracucci merged commit 198b55a into cortexproject:master Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make TSDB idle-flush more dynamic by compacting only time range that cannot receive any samples.

4 participants