-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fail fast if cgo is disabled and compression is ZSTD #1284
Conversation
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.
This PR looks good, just a minor comment. Though, I think it would be better to throw a compile time error. We can use build flags (linux, cgo) and not define the compression functions for the case when !linux or !cgo
.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @ashish-goswami, @jarifibrahim, and @manishrjain)
y/y.go, line 40 at r1 (raw file):
ErrEOF = errors.New("End of mapped region") ErrZstdCgo = errors.New("zstd compression requires building badger with cgo enabled")
comment missing, go vet will complain.
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.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @ashish-goswami, @jarifibrahim, and @manishrjain)
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 had a chat with @mangalaman93 and we agreed that the !linux
the approach wouldn't work.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @ashish-goswami, @jarifibrahim, and @manishrjain)
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.
Reviewed 2 of 3 files at r1, 1 of 1 files at r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ashish-goswami and @jarifibrahim)
As seen in issue hypermodeinc/dgraph#4995, if badger is built without CGO and compression is set to ZSTD, badger would crash when level 0 is compacted. This could take from a few seconds to a few minutes for the crash to show up.
With this PR,
badger.Open()
call will return an error if compression is set to ZSTD and badger was built without CGO.This change is