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

WIP: lmdb support #46

Closed
wants to merge 17 commits into from
Closed

WIP: lmdb support #46

wants to merge 17 commits into from

Conversation

uhliarik
Copy link

There is still WIP.

@minfrin
Copy link
Contributor

minfrin commented Sep 27, 2023

Not had a chance to review, but definite +1 in principle.

@uhliarik
Copy link
Author

uhliarik commented Sep 27, 2023

Since I had to rebase this code to the trunk, I'm no longer able to run tests. If anyone can see where I'm missing linking the library, feel free to review the commit.

$ make test
cd test && make all check
make[1]: Entering directory '/home/luhliari/playground/UPSTREAM/APR/apr_lmdb/test'
make[2]: Entering directory '/home/luhliari/playground/UPSTREAM/APR/apr_lmdb/test'
/bin/sh /home/luhliari/playground/UPSTREAM/APR/apr_lmdb/libtool --silent --mode=compile --tag=CC gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I../include -I./../include  -o globalmutexchild.lo -c globalmutexchild.c && touch globalmutexchild.lo
/bin/sh /home/luhliari/playground/UPSTREAM/APR/apr_lmdb/libtool --silent --mode=link --tag=CC gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I../include -I./../include   -no-install    -o globalmutexchild globalmutexchild.lo ../libapr-2.la   -lcrypt -lrt -lcrypt  -lpthread -ldl -lexpat
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_drop'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_env_close'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_cursor_get'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_del'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_env_open'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_strerror'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_cursor_open'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_txn_commit'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_dbi_close'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_dbi_open'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_cursor_close'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_env_create'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_txn_begin'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_env_set_mapsize'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_put'
/usr/bin/ld: ../.libs/libapr-2.so: undefined reference to `mdb_get'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:125: globalmutexchild] Error 1
make[2]: Leaving directory '/home/luhliari/playground/UPSTREAM/APR/apr_lmdb/test'
make[1]: *** [/home/luhliari/playground/UPSTREAM/APR/apr_lmdb/build/apr_rules.mk:118: all-recursive] Error 1
make[1]: Leaving directory '/home/luhliari/playground/UPSTREAM/APR/apr_lmdb/test'

Add -llmdb to test/Makefile.in so test can be compiled without
any error.
build.conf Outdated
@@ -22,6 +22,7 @@ paths =
crypto/crypt_blowfish.c
dbm/apr_dbm_sdbm.c
dbm/apr_dbm.c
dbm/apr_dbm_lmdb.c
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed, the DBM drivers which can be built as DSOs should not be listed here otherwise it will get linked twice.

@notroj
Copy link
Contributor

notroj commented Sep 28, 2023

With the line marked in my review above removed, and e147886 reverted, I can build with:

"./configure" \
"--with-lmdb" \
"--with-berkeley-db" \
"--with-dbm=db5" \
"--disable-modular-dso"

and this passes the tests. Thanks @uhliarik!

@notroj
Copy link
Contributor

notroj commented Sep 28, 2023

I've tested this with mod_dav and it seems to work well. As well as the changes described above I changed the _usednames implementation to pass back the "-lock" file as well:

notroj@26afe6b

- Remove lmdb driver from build.conf so it won't get linked twice!
- Revert e147886
@uhliarik
Copy link
Author

Thanks Joe for reviewing my changes. Previously, I was configurating the lmdb driver with:

./configure --with-lmdb --with-dbm=lmdb

And I was having troubles with loading lmdb driver as DSO. It was failing during DSO loading phase. I hope there is no issue with this and it is just some configuration thing.

uhliarik and others added 14 commits September 28, 2023 12:46
- Removed wrong lines from build.conf in ad34f18. Revering and
  removing correct line
(just like apr_status_t) map those values directly; map all
other errors as APR_EGENERAL.

APR-internal APIs should not use error codes within the
APR_OS_START_USEERR number region (mistake common to dbm/*.c.)
overhead of per-transaction fdatasync() calls, bringing comparable
behaviour/performance to BDB etc.

Arguably this behaviour could be controlled by a new flag passed
in the mode parameter of apr_dbm_open*.
which was originally used for dynamic database resizing in case the
database was full.

This function is no longer used and the size of the database is set
to UINT32_MAX in vt_lmdb_open() function.
@asfgit asfgit closed this in 4e6f06b Sep 29, 2023
@notroj
Copy link
Contributor

notroj commented Sep 29, 2023

Thanks a lot for the contribution, @uhliarik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants