Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Nov 2013 11:39:48 +0100
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        Atte Peltomaki <atte.peltomaki@iki.fi>
Cc:        hackers@FreeBSD.org
Subject:   Re: Importing netbsd cdb
Message-ID:  <20131106103947.GI56315@ithaqua.etoilebsd.net>
In-Reply-To: <20131106084550.GA21489@ass.pp.htv.fi>
References:  <20131027232628.GB74512@ithaqua.etoilebsd.net> <20131105220225.GF37879@caravan.chchile.org> <20131106084550.GA21489@ass.pp.htv.fi>

next in thread | previous in thread | raw e-mail | index | archive | help

--TA4f0niHM6tHt3xR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Nov 06, 2013 at 10:45:50AM +0200, Atte Peltomaki wrote:
> On Tue, Nov 05, 2013 at 11:02:26PM +0100, Jeremie Le Hen wrote:
> > On Mon, Oct 28, 2013 at 12:26:28AM +0100, Baptiste Daroussin wrote:
> > >=20
> > > Here is a code that imports the cdbrw from netbsd into a new lib/libc=
dbrw
> > > library, the read part is also added to libc but not exposed.
> > >=20
> > > As an example of using that library I also got the service_mkdb patch=
es 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.
> > >=20
> > > in the libc, getservent has been modified to first try to read the .c=
db files
> > > and fallback on reading the old .db file. (I'm not sure if it is wort=
h keeping
> > > reading the old db format.)
> > >=20
> > > http://people.freebsd.org/~bapt/cdbrw.diff
> > >=20
> > > The plan after that is to get pw_util(3) directly generating a cdb fi=
le 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 form=
at.
> > >=20
> > > I also plan to do the same for cap_mkdb(1) and getcap(3).
> > >=20
> > > With cdb querying is way faster (I don't have number but I can get so=
me it
> > > needed)
> > > the size of the db is also way smaller:
> > >  64K   /var/db/services.cdb
> > >  2,1M    /var/db/services.db
> > >=20
> > > Any objection?
> >=20
> > 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 :).
>=20
> At least randomly googled third-party benchmarks suggest that CDB is
> vastly superior to BDB:
> http://www.dmo.ca/blog/benchmarking-hash-databases-on-large-data/
>=20

=46rom the netbsd commit log, it says that in case of services it is at lea=
st as
slow, and at best faster, from my testing it is way faster, (sorry no numbe=
rs)

Concerning the migration, the way I did it for now, is that getservent is t=
rying
to open the cdb database and fallsback on the bdb one, so migrating to
11.0-RELEASE should be ootb.

Running:
services_mkdb

Will generate the cdb version of the db

services_mkdb -V db

Will generate the old format db.

regards,
Bapt

--TA4f0niHM6tHt3xR
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iEYEARECAAYFAlJ6HHMACgkQ8kTtMUmk6Ex53wCfXkcvKJVQD2+UFNYk4TENeH3P
Z2MAnjAxndTFcClDUVPYiOFXbQQjfePf
=G0I4
-----END PGP SIGNATURE-----

--TA4f0niHM6tHt3xR--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131106103947.GI56315>