harikb / lmdb-go Goto Github PK
View Code? Open in Web Editor NEWThis project forked from bmatsuo/lmdb-go
Bindings for the LMDB C library
License: BSD 3-Clause "New" or "Revised" License
This project forked from bmatsuo/lmdb-go
Bindings for the LMDB C library
License: BSD 3-Clause "New" or "Revised" License
This repo is a verbatim copy of github.com/bmatsuo/lmdb-go with two files from github.com/kellabyte/rewind rewind.c and that trimmed to a rewind.h
Only relevant commit is 44b77dc
Other commits are simply replacing the builtin self references for bmatsuo/lmdb-go
to harikb/lmdb-go
. I tried avoiding this change using go mod
's replace
feature but failed miserably. I also had to create a 1.9.0
tag so that is wouldn't automatically go fetch 1.8.0
(which didn't have my changes).
> GO111MODULE=on make bin
> bin/try_rewind -h
Usage of bin/try_rewind:
-b, --batch-count int Number of records per trasaction (default 100)
-r, --enable-rewind Enable rewind
-l, --loop-count int Number of transactions to run (default 100)
pflag: help requested
> time bin/try_rewind -b 10 -l 1000
2019/02/03 09:15:46 Updated 10000 entries
2019/02/03 09:15:46 Checked 10000 entries
real 0m1.352s
user 0m0.152s
sys 0m0.807s
harikb ~/code/src/github.com/harikb/lmdb-go [ 9:15:46]> time bin/try_rewind -b 10 -l 1000 -r
2019/02/03 09:15:55 REWIND ENABLED
2019/02/03 09:15:55 Updated 10000 entries
panic: mdb_get: MDB_NOTFOUND: No matching key/data pair found
goroutine 1 [running]:
main.main()
/Users/harikb/code/src/github.com/harikb/lmdb-go/cmd/try_rewind/main.go:145 +0x5c8
real 0m0.457s
user 0m0.083s
sys 0m0.280s
@kellabyte 's repo used a much newer version of LMDB source code. there seems to be differences from the one used by @bmatsuo 's library.
I think the issue is with mdb_dbi_open
. In the current code, I think Kelly's code opens the "main" db for the log cursor.
In my earlier attempt, when I tried dbi, err = txn.CreateDBI("example")
for this line
I got
> time bin/try_rewind -b 10 -l 1000 -r
2019/02/03 09:25:06 REWIND ENABLED
panic: mdb_dbi_open: MDB_INCOMPATIBLE: Operation and DB incompatible, or DB flags changed
goroutine 1 [running]:
main.main()
/Users/harikb/code/src/github.com/harikb/lmdb-go/cmd/try_rewind/main.go:69 +0x5e8
real 0m0.010s
user 0m0.003s
sys 0m0.004s
1.. With the current code of using OpenRoot
(is Root same as Main db?), data seems to be doing to the log
directory, and moreover, inaccessible for read later
harikb ~/code/src/github.com/harikb/lmdb-go [ 9:31:38]> ls -al /tmp/lmdb-test/
total 0
drwxr-xr-x 3 harikb wheel 96 Feb 3 09:31 .
drwxrwxrwt 26 root wheel 832 Feb 3 09:31 ..
drwx------ 4 harikb wheel 128 Feb 3 09:31 log
harikb ~/code/src/github.com/harikb/lmdb-go [ 9:31:47]> ls -al /tmp/lmdb-test/log
total 42224
drwx------ 4 harikb wheel 128 Feb 3 09:31 .
drwxr-xr-x 3 harikb wheel 96 Feb 3 09:31 ..
-rw-r--r-- 1 harikb wheel 21610496 Feb 3 09:31 data.mdb
-rw-r--r-- 1 harikb wheel 8192 Feb 3 09:31 lock.mdb
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.