- sparc: make dbenv per-rpmdb, not per-dbi.

CVS patchset: 5237
CVS date: 2002/01/06 02:23:33
This commit is contained in:
jbj 2002-01-06 02:23:33 +00:00
parent cd622ba0de
commit 350d7592de
11 changed files with 111 additions and 76 deletions

View File

@ -85,6 +85,7 @@
- fix: typo in find-requires. - fix: typo in find-requires.
- tru64 compiler message cleanup. - tru64 compiler message cleanup.
- add buildarch lines for hppa (#57728). - add buildarch lines for hppa (#57728).
- sparc: make dbenv per-rpmdb, not per-dbi.
4.0.2 -> 4.0.3: 4.0.2 -> 4.0.3:
- update per-interpreter dependency scripts, add sql/tcl (#20295). - update per-interpreter dependency scripts, add sql/tcl (#20295).

View File

@ -1698,7 +1698,7 @@ assert(newOrderCount == ts->orderCount);
ts->orderAlloced = ts->orderCount; ts->orderAlloced = ts->orderCount;
orderList = _free(orderList); orderList = _free(orderList);
#ifdef HACK #if defined(__LCLINT__) /* XXX HACK rpmsort needs for graphviz */
/* Clean up after dependency checks */ /* Clean up after dependency checks */
pi = teInitIterator(ts); pi = teInitIterator(ts);
while ((p = teNextIterator(pi)) != NULL) { while ((p = teNextIterator(pi)) != NULL) {

View File

@ -267,10 +267,14 @@ transactionElement teGetParent(transactionElement te)
transactionElement teSetParent(transactionElement te, transactionElement pte) transactionElement teSetParent(transactionElement te, transactionElement pte)
{ {
transactionElement opte = NULL; transactionElement opte = NULL;
/*@-branchstate@*/
if (te != NULL) { if (te != NULL) {
opte = te->parent; opte = te->parent;
/*@-assignexpose -temptrans@*/
te->parent = pte; te->parent = pte;
/*@=assignexpose =temptrans@*/
} }
/*@=branchstate@*/
return opte; return opte;
} }

View File

@ -290,6 +290,7 @@ int teSetTree(transactionElement te, int ntree)
* @param te transaction element * @param te transaction element
* @return parent transaction element * @return parent transaction element
*/ */
/*@observer@*/ /*@unused@*/
transactionElement teGetParent(transactionElement te) transactionElement teGetParent(transactionElement te)
/*@*/; /*@*/;
@ -313,10 +314,10 @@ int teGetDegree(transactionElement te)
/** /**
* Set number of children of transaction element. * Set number of children of transaction element.
* @param te transaction element * @param te transaction element
* @param ntree new number of children * @param ndegree new number of children
* @return previous number of children * @return previous number of children
*/ */
int teSetDegree(transactionElement te, int ntree) int teSetDegree(transactionElement te, int ndegree)
/*@modifies te @*/; /*@modifies te @*/;
/** /**
@ -345,6 +346,7 @@ void teNewTSI(transactionElement te)
* Destroy dependency set info of transaction element. * Destroy dependency set info of transaction element.
* @param te transaction element * @param te transaction element
*/ */
/*@unused@*/
void teCleanDS(transactionElement te) void teCleanDS(transactionElement te)
/*@modifies te @*/; /*@modifies te @*/;

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2002-01-04 21:38-0500\n" "POT-Creation-Date: 2002-01-05 21:18-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -883,7 +883,7 @@ msgstr ""
#: build/parseChangelog.c:155 #: build/parseChangelog.c:155
#, c-format #, c-format
msgid "%%changelog not in decending chronological order\n" msgid "%%changelog not in descending chronological order\n"
msgstr "" msgstr ""
#: build/parseChangelog.c:163 build/parseChangelog.c:174 #: build/parseChangelog.c:163 build/parseChangelog.c:174
@ -2783,11 +2783,11 @@ msgstr ""
msgid "cannot get %s lock on database\n" msgid "cannot get %s lock on database\n"
msgstr "" msgstr ""
#: rpmdb/db1.c:573 rpmdb/db3.c:1213 #: rpmdb/db1.c:573 rpmdb/db3.c:1230
msgid "exclusive" msgid "exclusive"
msgstr "" msgstr ""
#: rpmdb/db1.c:573 rpmdb/db3.c:1213 #: rpmdb/db1.c:573 rpmdb/db3.c:1230
msgid "shared" msgid "shared"
msgstr "" msgstr ""
@ -2811,22 +2811,22 @@ msgstr ""
msgid "closed db index %s/%s\n" msgid "closed db index %s/%s\n"
msgstr "" msgstr ""
#: rpmdb/db3.c:777 #: rpmdb/db3.c:782
#, c-format #, c-format
msgid "verified db index %s/%s\n" msgid "verified db index %s/%s\n"
msgstr "" msgstr ""
#: rpmdb/db3.c:990 #: rpmdb/db3.c:1007
#, c-format #, c-format
msgid "opening db index %s/%s %s mode=0x%x\n" msgid "opening db index %s/%s %s mode=0x%x\n"
msgstr "" msgstr ""
#: rpmdb/db3.c:1211 #: rpmdb/db3.c:1228
#, c-format #, c-format
msgid "cannot get %s lock on %s/%s\n" msgid "cannot get %s lock on %s/%s\n"
msgstr "" msgstr ""
#: rpmdb/db3.c:1217 #: rpmdb/db3.c:1234
#, c-format #, c-format
msgid "locked db index %s/%s\n" msgid "locked db index %s/%s\n"
msgstr "" msgstr ""
@ -2993,121 +2993,121 @@ msgstr ""
msgid "no dbpath has been set\n" msgid "no dbpath has been set\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:1050 #: rpmdb/rpmdb.c:1054
msgid "" msgid ""
"old format database is present; use --rebuilddb to generate a new format " "old format database is present; use --rebuilddb to generate a new format "
"database\n" "database\n"
msgstr "" msgstr ""
#. error #. error
#: rpmdb/rpmdb.c:1315 #: rpmdb/rpmdb.c:1319
#, c-format #, c-format
msgid "error(%d) counting packages\n" msgid "error(%d) counting packages\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:2092 rpmdb/rpmdb.c:3345 #: rpmdb/rpmdb.c:2096 rpmdb/rpmdb.c:3349
#, c-format #, c-format
msgid "record number %u in database is bad -- skipping.\n" msgid "record number %u in database is bad -- skipping.\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:2145 #: rpmdb/rpmdb.c:2149
#, c-format #, c-format
msgid "rpmdb: damaged header instance #%u retrieved, skipping.\n" msgid "rpmdb: damaged header instance #%u retrieved, skipping.\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:2415 #: rpmdb/rpmdb.c:2419
#, c-format #, c-format
msgid "%s: cannot read header at 0x%x\n" msgid "%s: cannot read header at 0x%x\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:2487 #: rpmdb/rpmdb.c:2491
#, c-format #, c-format
msgid "removing \"%s\" from %s index.\n" msgid "removing \"%s\" from %s index.\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:2496 #: rpmdb/rpmdb.c:2500
#, c-format #, c-format
msgid "removing %d entries from %s index.\n" msgid "removing %d entries from %s index.\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:2697 #: rpmdb/rpmdb.c:2701
#, c-format #, c-format
msgid "error(%d) allocating new package instance\n" msgid "error(%d) allocating new package instance\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:2778 #: rpmdb/rpmdb.c:2782
#, c-format #, c-format
msgid "adding \"%s\" to %s index.\n" msgid "adding \"%s\" to %s index.\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:2789 #: rpmdb/rpmdb.c:2793
#, c-format #, c-format
msgid "adding %d entries to %s index.\n" msgid "adding %d entries to %s index.\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:3231 #: rpmdb/rpmdb.c:3235
#, c-format #, c-format
msgid "removing %s after successful db3 rebuild.\n" msgid "removing %s after successful db3 rebuild.\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:3264 #: rpmdb/rpmdb.c:3268
msgid "no dbpath has been set" msgid "no dbpath has been set"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:3291
#, c-format
msgid "rebuilding database %s into %s\n"
msgstr ""
#: rpmdb/rpmdb.c:3295 #: rpmdb/rpmdb.c:3295
#, c-format #, c-format
msgid "rebuilding database %s into %s\n"
msgstr ""
#: rpmdb/rpmdb.c:3299
#, c-format
msgid "temporary database %s already exists\n" msgid "temporary database %s already exists\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:3301 #: rpmdb/rpmdb.c:3305
#, c-format #, c-format
msgid "creating directory %s\n" msgid "creating directory %s\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:3303 #: rpmdb/rpmdb.c:3307
#, c-format #, c-format
msgid "creating directory %s: %s\n" msgid "creating directory %s: %s\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:3310 #: rpmdb/rpmdb.c:3314
#, c-format #, c-format
msgid "opening old database with dbapi %d\n" msgid "opening old database with dbapi %d\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:3321 #: rpmdb/rpmdb.c:3325
#, c-format #, c-format
msgid "opening new database with dbapi %d\n" msgid "opening new database with dbapi %d\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:3385 #: rpmdb/rpmdb.c:3389
#, c-format #, c-format
msgid "cannot add record originally at %u\n" msgid "cannot add record originally at %u\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:3403 #: rpmdb/rpmdb.c:3407
msgid "failed to rebuild database: original database remains in place\n" msgid "failed to rebuild database: original database remains in place\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:3411 #: rpmdb/rpmdb.c:3415
msgid "failed to replace old database with new database!\n" msgid "failed to replace old database with new database!\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:3413 #: rpmdb/rpmdb.c:3417
#, c-format #, c-format
msgid "replace files in %s with files from %s to recover" msgid "replace files in %s with files from %s to recover"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:3423 #: rpmdb/rpmdb.c:3427
#, c-format #, c-format
msgid "removing directory %s\n" msgid "removing directory %s\n"
msgstr "" msgstr ""
#: rpmdb/rpmdb.c:3425 #: rpmdb/rpmdb.c:3429
#, c-format #, c-format
msgid "failed to remove directory %s: %s\n" msgid "failed to remove directory %s: %s\n"
msgstr "" msgstr ""

View File

@ -717,9 +717,14 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
dbi->dbi_dbinfo = _free(dbi->dbi_dbinfo); dbi->dbi_dbinfo = _free(dbi->dbi_dbinfo);
if (dbi->dbi_use_dbenv) { if (dbi->dbi_use_dbenv) {
if (dbi->dbi_dbenv == rpmdb->db_dbenv && rpmdb->db_opens == 1) {
/*@-nullstate@*/ /*@-nullstate@*/
xx = db_fini(dbi, (dbhome ? dbhome : ""), dbfile, dbsubfile); xx = db_fini(dbi, (dbhome ? dbhome : ""), dbfile, dbsubfile);
/*@=nullstate@*/ /*@=nullstate@*/
rpmdb->db_dbenv = NULL;
}
dbi->dbi_dbenv = NULL;
rpmdb->db_opens--;
} }
if (dbi->dbi_verify_on_close && !dbi->dbi_temporary) { if (dbi->dbi_verify_on_close && !dbi->dbi_temporary) {
@ -984,8 +989,20 @@ static int db3open(rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
dbi->dbi_dbinfo = NULL; dbi->dbi_dbinfo = NULL;
if (dbi->dbi_use_dbenv) if (dbi->dbi_use_dbenv) {
/*@-mods@*/
if (rpmdb->db_dbenv == NULL) {
rc = db_init(dbi, dbhome, dbfile, dbsubfile, &dbenv); rc = db_init(dbi, dbhome, dbfile, dbsubfile, &dbenv);
if (rc == 0) {
rpmdb->db_dbenv = dbenv;
rpmdb->db_opens = 1;
}
} else {
dbenv = rpmdb->db_dbenv;
rpmdb->db_opens++;
}
/*@=mods@*/
}
rpmMessage(RPMMESS_DEBUG, _("opening db index %s/%s %s mode=0x%x\n"), rpmMessage(RPMMESS_DEBUG, _("opening db index %s/%s %s mode=0x%x\n"),
dbhome, (dbfile ? dbfile : tagName(dbi->dbi_rpmtag)), dbhome, (dbfile ? dbfile : tagName(dbi->dbi_rpmtag)),
@ -1223,7 +1240,9 @@ static int db3open(rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
} }
dbi->dbi_db = db; dbi->dbi_db = db;
/*@-kepttrans@*/
dbi->dbi_dbenv = dbenv; dbi->dbi_dbenv = dbenv;
/*@=kepttrans@*/
if (rc == 0 && dbi->dbi_db != NULL && dbip != NULL) { if (rc == 0 && dbi->dbi_db != NULL && dbip != NULL) {
dbi->dbi_vec = &db3vec; dbi->dbi_vec = &db3vec;
@ -1235,9 +1254,9 @@ static int db3open(rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
urlfn = _free(urlfn); urlfn = _free(urlfn);
/*@-nullstate@*/ /*@-nullstate -compmempass@*/
return rc; return rc;
/*@=nullstate@*/ /*@=nullstate =compmempass@*/
} }
/** \ingroup db3 /** \ingroup db3

View File

@ -118,7 +118,7 @@ fprintf(stderr, "--> h %p ++ %d %s at %s:%u\n", h, (h != NULL ? h->nrefs : 0),
* @param h header * @param h header
* @return NULL always * @return NULL always
*/ */
HSTATIC HSTATIC /*@null@*/
Header XheaderUnlink(/*@killref@*/ /*@null@*/ Header h, Header XheaderUnlink(/*@killref@*/ /*@null@*/ Header h,
/*@null@*/ const char * msg, const char * fn, unsigned ln) /*@null@*/ const char * msg, const char * fn, unsigned ln)
/*@modifies h @*/ /*@modifies h @*/
@ -2889,7 +2889,7 @@ freeExtensionCache(const headerSprintfExtension extensions,
* @retval errmsg error message (if any) * @retval errmsg error message (if any)
* @return formatted output string (malloc'ed) * @return formatted output string (malloc'ed)
*/ */
HSTATIC /*@only@*/ HSTATIC /*@only@*/ /*@null@*/
char * headerSprintf(Header h, const char * fmt, char * headerSprintf(Header h, const char * fmt,
const struct headerTagTableEntry_s * tbltags, const struct headerTagTableEntry_s * tbltags,
const struct headerSprintfExtension_s * extensions, const struct headerSprintfExtension_s * extensions,

View File

@ -682,7 +682,9 @@ struct HV_s {
HDRfreeiter hdrfreeiter; HDRfreeiter hdrfreeiter;
HDRinititer hdrinititer; HDRinititer hdrinititer;
HDRnextiter hdrnextiter; HDRnextiter hdrnextiter;
/*@null@*/
void * hdrvecs; void * hdrvecs;
/*@null@*/
void * hdrdata; void * hdrdata;
int hdrversion; int hdrversion;
}; };

View File

@ -53,6 +53,7 @@ struct indexEntry {
*/ */
struct headerToken { struct headerToken {
/*@unused@*/ struct HV_s hv; /*!< Header public methods. */ /*@unused@*/ struct HV_s hv; /*!< Header public methods. */
/*@only@*/ /*@null@*/
void * blob; /*!< Header region blob. */ void * blob; /*!< Header region blob. */
/*@owned@*/ indexEntry index; /*!< Array of tags. */ /*@owned@*/ indexEntry index; /*!< Array of tags. */
int indexUsed; /*!< Current size of tag array. */ int indexUsed; /*!< Current size of tag array. */

View File

@ -934,41 +934,16 @@ static int openDatabase(/*@null@*/ const char * prefix,
rpmdb db; rpmdb db;
int rc, xx; int rc, xx;
unsigned int gflags = 0; /* dbiGet() flags */ unsigned int gflags = 0; /* dbiGet() flags */
static int _initialized = 0; static int _tags_initialized = 0;
static int _dbenv_removed = 0;
int justCheck = flags & RPMDB_FLAG_JUSTCHECK; int justCheck = flags & RPMDB_FLAG_JUSTCHECK;
int minimal = flags & RPMDB_FLAG_MINIMAL; int minimal = flags & RPMDB_FLAG_MINIMAL;
if (!_initialized || dbiTagsMax == 0) { if (!_tags_initialized || dbiTagsMax == 0) {
#if 1
static int _enable_cdb = -1;
/* XXX hack in suoport for CDB, otherwise nuke the state. */
/*@-mods@*/
if (_enable_cdb < 0)
_enable_cdb = rpmExpandNumeric("%{?__dbi_cdb:1}");
/*@=mods@*/
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);
xx = unlink(filename);
}
}
#endif
/*@-mods@*/ /*@-mods@*/
dbiTagsInit(); dbiTagsInit();
/*@=mods@*/ /*@=mods@*/
_initialized++; _tags_initialized++;
} }
/* Insure that _dbapi has one of -1, 1, 2, or 3 */ /* Insure that _dbapi has one of -1, 1, 2, or 3 */
@ -987,6 +962,35 @@ static int openDatabase(/*@null@*/ const char * prefix,
/*@=mods@*/ /*@=mods@*/
if (db == NULL) if (db == NULL)
return 1; return 1;
if (!_dbenv_removed) {
static int _enable_cdb = -1;
/* XXX hack in suoport for CDB, otherwise nuke the state. */
/*@-mods@*/
if (_enable_cdb < 0)
_enable_cdb = rpmExpandNumeric("%{?__dbi_cdb:1}");
/*@=mods@*/
if (!_enable_cdb) {
char * fn;
int i;
i = sizeof("//__db.000");
if (db->db_root) i += strlen(db->db_root);
if (db->db_home) i += strlen(db->db_home);
fn = alloca(i);
for (i = 0; i < 16; i++) {
sprintf(fn, "%s/%s/__db.%03d",
(db->db_root ? db->db_root : ""),
(db->db_home ? db->db_home : ""), i);
(void) rpmCleanPath(fn);
(void) unlink(fn);
}
}
_dbenv_removed++;
}
db->db_api = _dbapi; db->db_api = _dbapi;
{ int dbix; { int dbix;

View File

@ -327,6 +327,8 @@ struct rpmdb_s {
/*@*/; /*@*/;
void (*db_free) (/*@only@*/ void * ptr) void (*db_free) (/*@only@*/ void * ptr)
/*@modifies *ptr @*/; /*@modifies *ptr @*/;
int db_opens;
/*@only@*//*@null@*/ void * db_dbenv; /*!< Berkeley DB_ENV handle */
int db_ndbi; /*!< No. of tag indices. */ int db_ndbi; /*!< No. of tag indices. */
dbiIndex * _dbi; /*!< Tag indices. */ dbiIndex * _dbi; /*!< Tag indices. */