golang/leveldb

osx support fcntl?

GoogleCodeExporter opened this issue · 7 comments

What steps will reproduce the problem?
1. try to run leveldb-go on osx

What is the expected output? 

N/A

What do you see instead?

leveldb/db: file locking is not implemented on darwin/amd64

What version of the product are you using?

head (i think this is what 'go get' fetches)

On what operating system?

osx 10.7.4 (darwin)


It seems (based on my reading of the build flags in file_lock_generic.go) that 
any system that is is not linux and not amd64 gets the above message.

Is leveldb-go just untested on anything else, or is it known to not work? (I 
thought fcntl was supported on darwin -- no clue how *well* supported though).

thanks.

Original issue reported on code.google.com by elij...@gmail.com on 18 Jun 2012 at 5:20

Looks like darwin 64 has slight differences in sizes of the elements in the 
syscall struct.


    k := struct {
        Start  uint64
        Len    uint64
        Pid    uint32
        Type   uint16
        Whence uint16
    }{
        Start:  0,
        Len:    0, // 0 means to lock the entire file.
        Pid:    uint32(os.Getpid()),
        Type:   syscall.F_WRLCK,
        Whence: uint16(os.SEEK_SET),
    }

The above seems to get me a lock file, but then open fails with:

leveldb: could not open CURRENT file for DB "/db/path": open /db/path/CURRENT: 
no such file or directory

Original comment by elij...@gmail.com on 19 Jun 2012 at 3:18

It's simply not tested on anything else. All my computers are linux/amd64.

Sorry for the late response, but I had a typo in my mail setup and wasn't 
getting leveldb-go bug mail.

Original comment by nigel...@golang.org on 2 Aug 2012 at 1:48

  • Changed state: Accepted
I have a patch for this and will contribute the CL soon.

Original comment by yves.jun...@gmail.com on 4 Aug 2012 at 5:42

http://codereview.appspot.com/6446087/

Original comment by yves.jun...@gmail.com on 4 Aug 2012 at 8:34

Aha!
Thanks.

Original comment by elij...@gmail.com on 4 Aug 2012 at 9:52

Original comment by nigel...@golang.org on 8 Aug 2012 at 6:05

  • Changed state: Fixed
elij.mx, note that the other error you see is because leveldb-go currently 
doesn't create a database if it's missing, which is a separate issue.

Original comment by yves.jun...@gmail.com on 4 Aug 2012 at 8:36