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

Ignore compaction group with only 1 block #4789

Merged
merged 3 commits into from
Oct 20, 2021

Conversation

yeya24
Copy link
Contributor

@yeya24 yeya24 commented Oct 17, 2021

Signed-off-by: Ben Ye [email protected]

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

If the compaction group only contains 1 block metadata, then there is nothing to plan and compact. In this case, we can safely ignore the group.

Changes

Verification

Ben Ye and others added 2 commits October 17, 2021 12:21
GiedriusS
GiedriusS previously approved these changes Oct 18, 2021
Copy link
Member

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

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

Not a blocker but rather a question: how is this situation possible with the "proper" grouper?

@yeya24
Copy link
Contributor Author

yeya24 commented Oct 18, 2021

Not a blocker but rather a question: how is this situation possible with the "proper" grouper?

Not sure what's exactly a proper grouper. But grouper itself doesn't have to consider how many metadatas are there in a group. Because we have two use cases that needs groups:

  1. Compaction. This only makes sense when blocks num > 1
  2. Downsampling. This can work with blocks num == 1

So now the group logic is correct and we don't need to check metadata num in group itself. Just handle it in the case of compaction is good enough.

@GiedriusS
Copy link
Member

Oops, sorry, brain fart. I meant that I thought the planners were taking care of this - they check whether there is any work to perform. So, this won't bring any visible change to users, right? Except for those metrics and not creating/removing dirs unnecessarily

@@ -333,14 +333,12 @@ func testGroupCompactE2e(t *testing.T, mergeFunc storage.VerticalChunkSeriesMerg
testutil.Equals(t, 3.0, promtest.ToFloat64(grouper.compactionRunsStarted.WithLabelValues(DefaultGroupKey(metas[0].Thanos))))
testutil.Equals(t, 3.0, promtest.ToFloat64(grouper.compactionRunsStarted.WithLabelValues(DefaultGroupKey(metas[7].Thanos))))
// TODO(bwplotka): Looks like we do some unnecessary loops. Not a major problem but investigate.
Copy link
Member

Choose a reason for hiding this comment

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

We can probably remove these too 😄

@yeya24
Copy link
Contributor Author

yeya24 commented Oct 19, 2021

So, this won't bring any visible change to users, right? Except for those metrics and not creating/removing dirs unnecessarily

Yeah, that's correct. There is no difference except the metrics I would say. Maybe some CPU time can be saved because we skip the planning phase.
But overall it is a tiny thing so this pr is mainly a cleanup.

@GiedriusS
Copy link
Member

So, this won't bring any visible change to users, right? Except for those metrics and not creating/removing dirs unnecessarily

Yeah, that's correct. There is no difference except the metrics I would say. Maybe some CPU time can be saved because we skip the planning phase. But overall it is a tiny thing so this pr is mainly a cleanup.

👍 let's remove those old comments in the test and merge this

Signed-off-by: Ben Ye <[email protected]>
@yeya24
Copy link
Contributor Author

yeya24 commented Oct 20, 2021

👍 let's remove those old comments in the test and merge this

Just pushed a commit for this. Please let me know if it is good to go now.

Copy link
Member

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

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

💪

@GiedriusS GiedriusS merged commit 6723c86 into thanos-io:main Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants