-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
compress boltdb files to gzip while uploading from shipper #2507
compress boltdb files to gzip while uploading from shipper #2507
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2507 +/- ##
==========================================
+ Coverage 63.45% 63.60% +0.14%
==========================================
Files 163 163
Lines 14263 14273 +10
==========================================
+ Hits 9051 9078 +27
+ Misses 4499 4481 -18
- Partials 713 714 +1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see the randomness removed from the test then LGTM.
@@ -142,7 +147,28 @@ func SetupDBTablesAtPath(t *testing.T, tableName, path string, dbs map[string]DB | |||
|
|||
for name, dbRecords := range dbs { | |||
AddRecordsToDB(t, filepath.Join(tablePath, name), boltIndexClient, dbRecords.Start, dbRecords.NumRecords) | |||
if compressRandomFiles && rand.Intn(2) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I think adding randomness like this to tests is bad practice because it creates flakey test cases. Instead, we can run the test case twice, once against compressed files and once against uncompressed files, or you can make this "randomness" deterministic by basing it off of the index like
var i int
for name, dbRecords := range dbs {
if compress && i % 2 == 0 {
// compress it
}
i++
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it. Thanks for the review!
What this PR does / why we need it:
Adds supports for compressing boltdb files before uploading which is expected to reduce file sizes by 1/3rd.
The files which are compressed would have
.gz
extension and until we build a compactor we would have both compressed and uncompressed files in the storage which is taken care of in the read path.While it is not necessary but it would be good to merge PR #2487 before merging this to avoid having some files in both compressed and uncompressed form.
It uses gzip pool that we already have built for reducing allocations while compressing/decompressing chunks.
Checklist