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

Fix build on Plan 9 #1451

Merged
merged 9 commits into from
Aug 20, 2020
Merged

Fix build on Plan 9 #1451

merged 9 commits into from
Aug 20, 2020

Conversation

fhs
Copy link
Contributor

@fhs fhs commented Aug 4, 2020

Plan 9 doesn't have mmap, so we just return an error.

File locking is implemented using the exclusive mode bit.
From http://man.cat-v.org/plan_9/5/open:

If the file is marked for exclusive use (see stat(5)), only
one client can have the file open at any time. That is,
after such a file has been opened, further opens will fail
until fid has been clunked.

Initial attempt at implementing directory locking using this method was
not successful because badger seems to be opening the directory multiple
times (at least while running the test suite). As a workaround, we lock
the pid lock file instead of the directory itself, same as the windows
implementation.


This change is Reviewable

Plan 9 doesn't have mmap, so we just return an error.

File locking is implemented using the exclusive mode bit.
From http://man.cat-v.org/plan_9/5/open:

  If the file is marked for exclusive use (see stat(5)), only
  one client can have the file open at any time.  That is,
  after such a file has been opened, further opens will fail
  until fid has been clunked.

Initial attempt at implementing directory locking using this method was
not successful because badger seems to be opening the directory multiple
times (at least while running the test suite). As a workaround, we lock
the pid lock file instead of the directory itself, same as the windows
implementation.
@CLAassistant
Copy link

CLAassistant commented Aug 4, 2020

CLA assistant check
All committers have signed the CLA.

@fhs fhs mentioned this pull request Aug 5, 2020
5 tasks
Copy link
Contributor

@jarifibrahim jarifibrahim left a comment

Choose a reason for hiding this comment

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

This is awesome work @fhs 🎉. Thank you for fixing this. I have some comments.

I'm wondering how do we test this PR. Can you also add a GOOS=plan9 build to travis CI?

dir_plan9.go Show resolved Hide resolved
dir_plan9.go Outdated Show resolved Hide resolved
dir_plan9.go Outdated Show resolved Hide resolved
dir_plan9.go Outdated Show resolved Hide resolved
dir_plan9.go Outdated Show resolved Hide resolved
@fhs
Copy link
Contributor Author

fhs commented Aug 5, 2020

I've added GOOS=plan9 build to travis CI.

Copy link
Contributor

@jarifibrahim jarifibrahim left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the PR @fhs 🎉 . I made one small line length change on this PR.

I'll merge this PR once CI finishes.

@jarifibrahim jarifibrahim merged commit 07fa3eb into hypermodeinc:master Aug 20, 2020
@fhs fhs deleted the plan9-pr branch September 5, 2020 22:41
@fhs
Copy link
Contributor Author

fhs commented Sep 5, 2020

When can I expect this to be included in a release? I need this in a v1.6.x release to get ipfs working, but I can also wait for v1.7.0. IPFS tracking issue for Plan 9 support: ipfs/kubo#7575

@jarifibrahim
Copy link
Contributor

We will be doing a badger 1.x release this week. This patch would be in that release.

@NamanJain8 This needs to go in 1.x release.

NamanJain8 pushed a commit that referenced this pull request Sep 8, 2020
Plan 9 doesn't have mmap, so we just return an error.

File locking is implemented using the exclusive mode bit.
From http://man.cat-v.org/plan_9/5/open:

  If the file is marked for exclusive use (see stat(5)), only
  one client can have the file open at any time.  That is,
  after such a file has been opened, further opens will fail
  until fid has been clunked.

Initial attempt at implementing directory locking using this method was
not successful because badger seems to be opening the directory multiple
times (at least while running the test suite). As a workaround, we lock
the pid lock file instead of the directory itself, same as the windows
implementation.

Co-authored-by: Ibrahim Jarif <[email protected]>
(cherry picked from commit 07fa3eb)
NamanJain8 added a commit that referenced this pull request Sep 9, 2020
Plan 9 doesn't have mmap, so we just return an error.

File locking is implemented using the exclusive mode bit.
From http://man.cat-v.org/plan_9/5/open:

  If the file is marked for exclusive use (see stat(5)), only
  one client can have the file open at any time.  That is,
  after such a file has been opened, further opens will fail
  until fid has been clunked.

Initial attempt at implementing directory locking using this method was
not successful because badger seems to be opening the directory multiple
times (at least while running the test suite). As a workaround, we lock
the pid lock file instead of the directory itself, same as the windows
implementation.

Co-authored-by: Ibrahim Jarif <[email protected]>
(cherry picked from commit 07fa3eb)

Co-authored-by: Fazlul Shahriar <[email protected]>
jarifibrahim pushed a commit that referenced this pull request Oct 2, 2020
Plan 9 doesn't have mmap, so we just return an error.

File locking is implemented using the exclusive mode bit.
From http://man.cat-v.org/plan_9/5/open:

  If the file is marked for exclusive use (see stat(5)), only
  one client can have the file open at any time.  That is,
  after such a file has been opened, further opens will fail
  until fid has been clunked.

Initial attempt at implementing directory locking using this method was
not successful because badger seems to be opening the directory multiple
times (at least while running the test suite). As a workaround, we lock
the pid lock file instead of the directory itself, same as the windows
implementation.

Co-authored-by: Ibrahim Jarif <[email protected]>
@francislavoie
Copy link

Looks like this was never backported to badger v2. Could we make that happen?

Building against v2.2007.3 which is the version Caddy is currently depending on (via smallstep) yields these errors:

# github.com/dgraph-io/badger/v2/y
..\..\..\..\go\pkg\mod\github.com\dgraph-io\badger\[email protected]\y\file_dsync.go:24:21: undefined: unix.O_DSYNC
..\..\..\..\go\pkg\mod\github.com\dgraph-io\badger\[email protected]\y\mmap_unix.go:30:11: undefined: unix.PROT_READ
..\..\..\..\go\pkg\mod\github.com\dgraph-io\badger\[email protected]\y\mmap_unix.go:32:12: undefined: unix.PROT_WRITE
..\..\..\..\go\pkg\mod\github.com\dgraph-io\badger\[email protected]\y\mmap_unix.go:34:9: undefined: unix.Mmap
..\..\..\..\go\pkg\mod\github.com\dgraph-io\badger\[email protected]\y\mmap_unix.go:34:54: undefined: unix.MAP_SHARED
..\..\..\..\go\pkg\mod\github.com\dgraph-io\badger\[email protected]\y\mmap_unix.go:39:9: undefined: unix.Munmap
..\..\..\..\go\pkg\mod\github.com\dgraph-io\badger\[email protected]\y\mmap_unix.go:46:11: undefined: unix.MADV_NORMAL
..\..\..\..\go\pkg\mod\github.com\dgraph-io\badger\[email protected]\y\mmap_unix.go:48:11: undefined: unix.MADV_RANDOM
..\..\..\..\go\pkg\mod\github.com\dgraph-io\badger\[email protected]\y\mmap_unix.go:50:9: undefined: unix.Madvise

francislavoie added a commit to francislavoie/badger that referenced this pull request Aug 23, 2021
Plan 9 doesn't have mmap, so we just return an error.

File locking is implemented using the exclusive mode bit.
From http://man.cat-v.org/plan_9/5/open:

  If the file is marked for exclusive use (see stat(5)), only
  one client can have the file open at any time.  That is,
  after such a file has been opened, further opens will fail
  until fid has been clunked.

Initial attempt at implementing directory locking using this method was
not successful because badger seems to be opening the directory multiple
times (at least while running the test suite). As a workaround, we lock
the pid lock file instead of the directory itself, same as the windows
implementation.

Co-authored-by: Ibrahim Jarif <[email protected]>
(cherry picked from commit 07fa3eb)

Co-authored-by: Fazlul Shahriar <[email protected]>
danielmai pushed a commit that referenced this pull request Aug 24, 2021
Plan 9 doesn't have mmap, so we just return an error.

File locking is implemented using the exclusive mode bit.
From http://man.cat-v.org/plan_9/5/open:

  If the file is marked for exclusive use (see stat(5)), only
  one client can have the file open at any time.  That is,
  after such a file has been opened, further opens will fail
  until fid has been clunked.

Initial attempt at implementing directory locking using this method was
not successful because badger seems to be opening the directory multiple
times (at least while running the test suite). As a workaround, we lock
the pid lock file instead of the directory itself, same as the windows
implementation.

Co-authored-by: Ibrahim Jarif <[email protected]>
(cherry picked from commit 07fa3eb)

Co-authored-by: Fazlul Shahriar <[email protected]>

Co-authored-by: Fazlul Shahriar <[email protected]>
mYmNeo pushed a commit to mYmNeo/badger that referenced this pull request Jan 16, 2023
Plan 9 doesn't have mmap, so we just return an error.

File locking is implemented using the exclusive mode bit.
From http://man.cat-v.org/plan_9/5/open:

  If the file is marked for exclusive use (see stat(5)), only
  one client can have the file open at any time.  That is,
  after such a file has been opened, further opens will fail
  until fid has been clunked.

Initial attempt at implementing directory locking using this method was
not successful because badger seems to be opening the directory multiple
times (at least while running the test suite). As a workaround, we lock
the pid lock file instead of the directory itself, same as the windows
implementation.

Co-authored-by: Ibrahim Jarif <[email protected]>
(cherry picked from commit 07fa3eb)

Co-authored-by: Fazlul Shahriar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants