From: jbj Date: Sat, 14 Jul 2001 20:09:56 +0000 (+0000) Subject: - isolate cdb access configuration (experimental, use at your own risk). X-Git-Tag: rpm-4.4-release~1490 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=77d49ea5a28862a3c9a014b7636b0c57a2c439e5;p=platform%2Fupstream%2Frpm.git - isolate cdb access configuration (experimental, use at your own risk). - fix: hard fail on locked dbopen if CDB locking not in use. - fix: dbconfig with mp_mmapsize=16Mb/mp_size=1Mb for "everything ENOSPC" failure check. CVS patchset: 4942 CVS date: 2001/07/14 20:09:56 --- diff --git a/CHANGES b/CHANGES index 334f991..75b8adf 100644 --- a/CHANGES +++ b/CHANGES @@ -165,6 +165,10 @@ - document more popt aliases for --help usage. - remove --tarbuild from man page(s), use -t[abpcils] instead (#48666). - fix: scope multi-mode options like --nodeps correctly (#48825). + - isolate cdb access configuration (experimental, use at your own risk). + - fix: hard fail on locked dbopen if CDB locking not in use. + - fix: dbconfig with mp_mmapsize=16Mb/mp_size=1Mb for + "everything ENOSPC" failure check. 4.0 -> 4.0.[12] - add doxygen and lclint annotations most everywhere. diff --git a/configure.in b/configure.in index a7e8b16..f3c77fb 100644 --- a/configure.in +++ b/configure.in @@ -15,7 +15,7 @@ AC_PREREQ(2.12) dnl Minimum Autoconf version required. dnl XXX AM_MAINTAINER_MODE dnl Set of available languages. -ALL_LINGUAS="cs da de en_RN es eu_ES fi fr gl hu id is it ja ko no pl pt pt_BR ro ru sk sl sr sv tr uk wa zh zh_CN.GB2312" +ALL_LINGUAS="cs da de en_RN es eu_ES fi fr gl.old hu id is it ja ko no pl pt pt_BR ro ru sk sl sr sv tr uk wa zh zh_CN.GB2312" LIBOBJS= diff --git a/macros.in b/macros.in index 4bad856..e9d8470 100644 --- a/macros.in +++ b/macros.in @@ -1,7 +1,7 @@ #/*! \page config_macros Default configuration: /usr/lib/rpm/macros # \verbatim # -# $Id: macros.in,v 1.84 2001/07/10 17:59:11 jbj Exp $ +# $Id: macros.in,v 1.85 2001/07/14 20:09:56 jbj Exp $ # # This is a global RPM configuration file. All changes made here will # be lost when the rpm package is upgraded. Any per-system configuration @@ -385,8 +385,11 @@ #%__dbi_other usedbenv create joinenv mpool txn log \ # mp_mmapsize=8Mb mp_size=512Kb verify usecursors +# XXX enable at your own risk, CDB access to rpmdb isn't cooked yet. +#%__dbi_cdb create joinenv cdb mpool + # XXX The "traditional" rpmdb shared/exclusive fcntl(2) lock on Packages model: -%__dbi_other verify usecursors +%__dbi_other verify usecursors %{?__dbi_cdb} # Note: adding nofsync here speeds up --rebuilddb a lot. %__dbi_rebuild nofsync !log !txn !cdb diff --git a/rpm.spec.in b/rpm.spec.in index c50ca23..5f98d6c 100644 --- a/rpm.spec.in +++ b/rpm.spec.in @@ -4,6 +4,9 @@ %define with_internal_db @WITH_INTERNAL_DB@ %{nil} %define strip_binaries 1 +# XXX enable at your own risk, CDB access to rpmdb isn't cooked yet. +%define enable_cdb create cdb + # XXX legacy requires './' payload prefix to be omitted from rpm packages. %define _noPayloadPrefix 1 @@ -147,12 +150,16 @@ mkdir -p $RPM_BUILD_ROOT/etc/rpm cat << E_O_F > $RPM_BUILD_ROOT/etc/rpm/macros.db1 %%_dbapi 1 E_O_F +cat << E_O_F > $RPM_BUILD_ROOT/etc/rpm/macros.cdb +%{?enable_cdb:#%%__dbi_cdb %{enable_cdb}} +E_O_F mkdir -p $RPM_BUILD_ROOT/var/lib/rpm for dbi in \ Basenames Conflictname Dirnames Group Installtid Name Providename \ Provideversion Removetid Requirename Requireversion Triggername \ - Packages __db.001 __db.002 __db.003 __db.004 + Packages __db.001 __db.002 __db.003 __db.004 __db.005 __db.006 __db.007 \ + __db.008 __db.009 do touch $RPM_BUILD_ROOT/var/lib/rpm/$dbi done @@ -238,14 +245,13 @@ fi %config(noreplace,missingok) /etc/cron.daily/rpm %config(noreplace,missingok) /etc/logrotate.d/rpm %dir /etc/rpm -%config(noreplace,missingok) /etc/rpm/macros.db1 +%config(noreplace,missingok) /etc/rpm/macros.* %attr(0755, @RPMUSER@, @RPMGROUP@) %dir /var/lib/rpm %define rpmdbattr %attr(0644, @RPMUSER@, @RPMGROUP@) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) %rpmdbattr /var/lib/rpm/Basenames %rpmdbattr /var/lib/rpm/Conflictname -%rpmdbattr /var/lib/rpm/__db.001 -%rpmdbattr /var/lib/rpm/__db.002 +%rpmdbattr /var/lib/rpm/__db.0* %rpmdbattr /var/lib/rpm/Dirnames %rpmdbattr /var/lib/rpm/Group %rpmdbattr /var/lib/rpm/Installtid diff --git a/rpmdb/db3.c b/rpmdb/db3.c index 0090a17..3e62926 100644 --- a/rpmdb/db3.c +++ b/rpmdb/db3.c @@ -1050,13 +1050,15 @@ static int db3open(/*@keep@*/ rpmdb rpmdb, int rpmtag, dbiIndex * dbip) rc = fcntl(fdno, F_SETLK, (void *) &l); if (rc) { - rpmError( - (!dbi->dbi_use_dbenv ? RPMERR_FLOCK : RPMWARN_FLOCK), + /* Warning only if using CDB locking. */ + rc = ((dbi->dbi_use_dbenv && + (dbi->dbi_eflags & DB_INIT_CDB)) + ? 0 : 1); + rpmError( (rc ? RPMERR_FLOCK : RPMWARN_FLOCK), _("cannot get %s lock on %s/%s\n"), ((dbi->dbi_mode & (O_RDWR|O_WRONLY)) ? _("exclusive") : _("shared")), dbhome, (dbfile ? dbfile : "")); - rc = (!dbi->dbi_use_dbenv ? 1 : 0); } else if (dbfile) { rpmMessage(RPMMESS_DEBUG, _("locked db index %s/%s\n"), diff --git a/rpmdb/dbconfig.c b/rpmdb/dbconfig.c index cd1cdad..7540c89 100644 --- a/rpmdb/dbconfig.c +++ b/rpmdb/dbconfig.c @@ -487,8 +487,8 @@ dbiIndex db3New(rpmdb rpmdb, int rpmtag) if (!dbi->dbi_use_dbenv) { /* db3 dbenv is always used now. */ dbi->dbi_use_dbenv = 1; dbi->dbi_eflags |= (DB_INIT_MPOOL|DB_JOINENV); - dbi->dbi_mp_mmapsize = 8 * 1024 * 1024; - dbi->dbi_mp_size = 512 * 1024; + dbi->dbi_mp_mmapsize = 16 * 1024 * 1024; + dbi->dbi_mp_size = 1 * 1024 * 1024; dbi->dbi_tear_down = 1; } diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index 5903d1d..791171f 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -869,19 +869,30 @@ static int openDatabase(/*@null@*/ const char * prefix, int minimal = flags & RPMDB_FLAG_MINIMAL; if (!_initialized || dbiTagsMax == 0) { - char * filename; - int i; - i = sizeof("//__db.000"); - if (prefix) i += strlen(prefix); - if (dbpath) i += strlen(dbpath); - filename = alloca(i); - for (i = 0; i < 16; i++) { - sprintf(filename, "%s/%s/__db.%03d", - (prefix ? prefix : ""), (dbpath ? dbpath : ""), i); - (void) rpmCleanPath(filename); - (void) unlink(filename); +#if 0 + static int _enable_cdb = -1; + + /* XXX hack in suoport for CDB, otherwise nuke the state. */ + if (_enable_cdb < 0) + _enable_cdb = rpmExpandNumeric("%{?__dbi_cdb:1}"); + + if (!_enable_cdb) { + char * filename; + int i; + + i = sizeof("//__db.000"); + if (prefix) i += strlen(prefix); + if (dbpath) i += strlen(dbpath); + filename = alloca(i); + for (i = 0; i < 16; i++) { + sprintf(filename, "%s/%s/__db.%03d", + (prefix ? prefix : ""), (dbpath ? dbpath : ""), i); + (void) rpmCleanPath(filename); + (void) unlink(filename); + } } +#endif dbiTagsInit(); _initialized++; } diff --git a/rpmrc.in b/rpmrc.in index 5a65e61..23bdbe8 100644 --- a/rpmrc.in +++ b/rpmrc.in @@ -1,7 +1,7 @@ #/*! \page config_rpmrc Default configuration: /usr/lib/rpm/rpmrc # \verbatim # -# $Id: rpmrc.in,v 2.38 2001/06/19 11:38:51 jbj Exp $ +# $Id: rpmrc.in,v 2.39 2001/07/14 20:09:56 jbj Exp $ # # This is a global RPM configuration file. All changes made here will # be lost when the rpm package is upgraded. Any per-system configuration @@ -310,7 +310,7 @@ buildarch_compat: ia64: noarch buildarch_compat: s390: noarch buildarch_compat: s390x: noarch -macrofiles: @RPMCONFIGDIR@/macros:@RPMCONFIGDIR@/%{_target}/macros:@SYSCONFIGDIR@/macros.specspo:@SYSCONFIGDIR@/macros.db1:@SYSCONFIGDIR@/macros:@SYSCONFIGDIR@/%{_target}/macros:~/.rpmmacros +macrofiles: @RPMCONFIGDIR@/macros:@RPMCONFIGDIR@/%{_target}/macros:@SYSCONFIGDIR@/macros.specspo:@SYSCONFIGDIR@/macros.db1:@SYSCONFIGDIR@/macros.cdb:@SYSCONFIGDIR@/macros:@SYSCONFIGDIR@/%{_target}/macros:~/.rpmmacros # \endverbatim #*/