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

compactor for compacting boltdb files uploaded by shipper #2526

Merged

Conversation

sandeepsukhani
Copy link
Contributor

What this PR does / why we need it:
Adds compactor service for compacting boltdb files uploaded by shipper.
It would run every 4 hours and requires at least 4 files in a table to compact it since it is not a lot of overhead to query just 2 or 3 files.

I am processing multiple files concurrently and have used batch writes for boltdb which allows concurrent writes without which it was taking a lot of time to compact the files. Without concurrency and batch writes for 3 GB of data it was taking more than an hour and with the improvements, it takes close to 7 minutes on my machine.

Checklist

  • Tests updated

Copy link
Member

@owen-d owen-d left a comment

Choose a reason for hiding this comment

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

A few nits then LGTM

edit: looks like there's some go mod tinkering needed too.

// send all files to readObjectChan
go func() {
for _, object := range objects {
if tm == nil {
Copy link
Member

Choose a reason for hiding this comment

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

tm doesn't appear used at all beyond this.

pkg/storage/stores/shipper/util/util.go Show resolved Hide resolved
@sandeepsukhani
Copy link
Contributor Author

A few nits then LGTM

edit: looks like there's some go mod tinkering needed too.

Thanks for the review Owen! I have taken care of the changes and also removed the code which causes go mod to change.

@codecov-commenter
Copy link

Codecov Report

Merging #2526 into master will decrease coverage by 0.12%.
The diff coverage is 49.80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2526      +/-   ##
==========================================
- Coverage   63.56%   63.43%   -0.13%     
==========================================
  Files         163      166       +3     
  Lines       14305    14543     +238     
==========================================
+ Hits         9093     9226     +133     
- Misses       4499     4578      +79     
- Partials      713      739      +26     
Impacted Files Coverage Δ
pkg/loki/loki.go 0.00% <0.00%> (ø)
pkg/loki/modules.go 4.88% <0.00%> (-0.14%) ⬇️
pkg/storage/stores/shipper/compactor/compactor.go 0.00% <0.00%> (ø)
pkg/storage/stores/shipper/shipper_index_client.go 0.00% <0.00%> (ø)
pkg/storage/stores/shipper/util/util.go 25.92% <25.92%> (ø)
pkg/storage/stores/shipper/compactor/table.go 64.48% <64.48%> (ø)
pkg/storage/stores/shipper/downloads/table.go 68.58% <100.00%> (+1.36%) ⬆️
pkg/storage/stores/shipper/table_client.go 41.93% <100.00%> (ø)
pkg/querier/queryrange/downstreamer.go 95.87% <0.00%> (-2.07%) ⬇️
... and 4 more

@sandeepsukhani sandeepsukhani merged commit b489130 into grafana:master Aug 24, 2020
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.

3 participants