-
Notifications
You must be signed in to change notification settings - Fork 38
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
Use multi-core optimized pgzip package in tarball compressor #98
Conversation
fileutil/tarball_compressor.go
Outdated
return bosherr.WrapError(err, "Decompressing file contents") | ||
} | ||
default: | ||
return fmt.Errorf("uknown type: %v in %s for tar: %s", |
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.
Slight typo for unknown
fileutil/tarball_compressor.go
Outdated
"path/filepath" | ||
|
||
"archive/tar" | ||
gzip "github.com/klauspost/pgzip" |
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.
Maybe drop this import alias? It only hides information.
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.
Is the pgzip
library actively maintained? I was checking the activity in the repository and there were not much since two years. It could be that there was no need for any updates because it only adds parallel execution.
fileutil/tarball_compressor.go
Outdated
} | ||
|
||
if fi.Mode().IsRegular() { | ||
data, err := os.Open(f) |
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.
should this opened file be closed or is handled by the close of the tarball defer tarball.Close()
?
fileutil/tarball_compressor.go
Outdated
tarball, err := c.fs.OpenFile(tarballPath, os.O_RDONLY, 0) | ||
if err != nil { | ||
return bosherr.WrapError(err, "Opening tarball") | ||
} | ||
|
||
if options.PathInArchive != "" { | ||
args = append(args, options.PathInArchive) | ||
} | ||
_, _, _, err := c.cmdRunner.RunCommand("tar", args...) | ||
zr, err := gzip.NewReader(tarball) |
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.
Should we add defer tarball.Close()
and defer zr.Close()
? The CompressFilesInDir
function is closing the tarball stream e.g.. Or is the close handled differently here because I couldn't follow where the close is happening?
The maintainer is still active on issues (the most recent one is from February): klauspost/pgzip#56 (comment) So to me that suggests the project is feature-complete. It also has a healthy number of github stars. |
- don't use import alias - close all readers / writers - fix typo - also use bosh filesystem interface when reading file contents
Waiting for #99 |
Some early benchmarks (when using these changes in the bosh-cli):
I did make this a breaking change to the interface because we no longer need the CmdRunner in the TarballCompressor.