Importing netbsd cdb

Jeremie Le Hen jlh at FreeBSD.org
Tue Nov 5 22:02:34 UTC 2013


Hi Baptiste,

On Mon, Oct 28, 2013 at 12:26:28AM +0100, Baptiste Daroussin wrote:
> 
> Here is a code that imports the cdbrw from netbsd into a new lib/libcdbrw
> library, the read part is also added to libc but not exposed.
> 
> As an example of using that library I also got the service_mkdb patches from
> netbsd that makes it by default emit a cdb database and add a switch to allow it
> to still create the old .db database format.
> 
> in the libc, getservent has been modified to first try to read the .cdb files
> and fallback on reading the old .db file. (I'm not sure if it is worth keeping
> reading the old db format.)
> 
> http://people.freebsd.org/~bapt/cdbrw.diff
> 
> The plan after that is to get pw_util(3) directly generating a cdb file for
> pwd.db and spwd.db and modifiy pwd_mkdb(8) so that by default it uses the API
> from pw_util(3) and have a switch to fallback on creating in bdb format.
> 
> I also plan to do the same for cap_mkdb(1) and getcap(3).
> 
> With cdb querying is way faster (I don't have number but I can get some it
> needed)
> the size of the db is also way smaller:
>  64K   /var/db/services.cdb
>  2,1M    /var/db/services.db
> 
> Any objection?

What are the benefits of this, beside generating a much smaller
database?  Do you know about benchmarks that compare it against the
current database engine used?  It would be unfortunate to notice a
regression afterward :).

Also, if you go ahead, do you have an idea of the migration procedure we
could offer to our users, when they will upgrade to 11.0-RELEASE?

Cheers,
-- 
Jeremie Le Hen

Scientists say the world is made up of Protons, Neutrons and Electrons.
They forgot to mention Morons.


More information about the freebsd-hackers mailing list