[Rpm-maint] [rpm-software-management/rpm] Adding an LMDB backend to RPM (#281)

Jeff Johnson notifications at github.com
Fri Jul 28 20:07:12 UTC 2017


In order to run queries as non-root, there are three minor changes:

1) lock.mdb (an 8Kb file) needs to be 0666, other perms as expected.

2) don't bother retrying mdb_env_open(): I added this line to display errors as well:
```
rpmlog(RPMLOG_ERR, "lmdb: %s(%s/lock.mdb): %s\n", __FUNCTION__, dbhome, mdb_strerror(rc));
```

3) this 1-liner needs to be added in mdb_dbi_open() to create a RDONLY txn:
```
    unsigned tflags = access(dbhome, W_OK) ? MDB_RDONLY : 0;
```

With those changes (and an /etc/popt alias to hide the goopy cmdline)
```
rpm	alias	--lmdb -D '_db_backend lmdb' --dbpath=/var/lib/lmdb
```

I see the following timings on whatever I happen to have installed on CentOS7:

```
$ /usr/bin/time ./rpm -qa > /dev/null
3.25user 0.13system 0:03.38elapsed 100%CPU (0avgtext+0avgdata 22820maxresident)k
0inputs+0outputs (0major+9477minor)pagefuls 0swaps

$ /usr/bin/time ./rpm --lmdb -qa > /dev/null
2.19user 0.07system 0:02.26elapsed 100%CPU (0avgtext+0avgdata 166940maxresident)k
0inputs+8outputs (0major+47059minor)pagefuls 0swaps

```

Much simpler (and more reliable) than what BDB does to read as non-root.

However, I expect that something similar could be done with BDB and permissions on the environment if anyone really cared.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/281#issuecomment-318749846
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20170728/344034b3/attachment.html>


More information about the Rpm-maint mailing list