-
Notifications
You must be signed in to change notification settings - Fork 317
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
chore: remove multiGzipWriter #5016
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
looking at the underlaying gzWriter implementation I've noticed a few issues as well:
- We open a file with append flag
file, err := os.OpenFile(s, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0o660)
, not sure what the original intention, but the expected behaviour if we fail to write on existing file should result in an error rather appending to the end. - No error is returned
gzWriter.Write
- In terms of naming, I would get rid of the GZ suffix in its method
processor/stash/stash.go
Outdated
@@ -184,60 +186,66 @@ func (st *HandleT) storeErrorsToObjectStorage(jobs []*jobsdb.JobT) (errorJob []E | |||
continue | |||
} | |||
path := fmt.Sprintf("%v%v.json.gz", tmpDirPath+localTmpDirName, fmt.Sprintf("%v.%v.%v.%v.%v", time.Now().Unix(), config.GetString("INSTANCE_ID", "1"), fmt.Sprintf("%v-%v", jobs[0].JobID, jobs[len(jobs)-1].JobID), uuid, workspaceID)) |
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.
We can use https://pkg.go.dev/path/filepath#Join
processor/stash/stash.go
Outdated
if err != nil { | ||
panic(err) | ||
} | ||
writerMap[workspaceID] = writer |
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.
We only need to store the writer to get the filename, so does it make sense to keep a list of filenames instead?
Co-authored-by: Leonidas Vrachnis <leo.al.vra@gmail.com>
An error is returned on failing to write in any case right?
It is returned..?
We're creating a writer to a compressed file( |
53a6d74
to
8f94a6f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5016 +/- ##
==========================================
+ Coverage 74.65% 74.68% +0.02%
==========================================
Files 431 435 +4
Lines 50127 50495 +368
==========================================
+ Hits 37423 37712 +289
- Misses 10257 10288 +31
- Partials 2447 2495 +48 ☔ View full report in Codecov by Sentry. |
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.
Approved with minor changes
Co-authored-by: Rohith BCS <rohith.bcs@gmail.com>
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.
https://jothiprasath.com/blog/gzip-vs-zstd/
zstd ftw 😝
} | ||
}() | ||
|
||
g, ctx := errgroup.WithContext(ctx) | ||
g.SetLimit(config.GetInt("Processor.errorBackupWorkers", 100)) | ||
g, ctx := kitsync.NewEagerGroup(ctx, config.GetInt("Processor.errorBackupWorkers", 100)) |
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.
❤️
Co-authored-by: Francesco Casula <fracasula@users.noreply.github.com>
Description
Use misc.GZipWriter in archiver since there's no need of a multi-file writer there.
Linear Ticket
Slack
Resolves PIPE-1440
Security